Introduce IDL files for runtime-enabled UndoManager and UndoItem JavaScript API
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Jan 2019 18:28:06 +0000 (18:28 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Jan 2019 18:28:06 +0000 (18:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=193109
<rdar://problem/44807048>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Adds new IDL files and stubs for UndoManager and UndoItem. This is an experimental DOM API that (in the near
future) is intended only for use in internal WebKit text editing clients. This API allows the page to
participate in the processes of undoing and redoing by defining custom undo and redo handlers, to be executed
when undo or redo is triggered.

Tests: editing/undo-manager/undo-manager-interfaces.html
       editing/undo-manager/undo-manager-keeps-wrapper-alive.html

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* UnifiedSources-input.xcfilelist:
* WebCore.xcodeproj/project.pbxproj:

Add new source files.

* bindings/js/WebCoreBuiltinNames.h:

Add "UndoManager" and "UndoItem" names.

* dom/Document.cpp:
(WebCore::m_undoManager):

Have the document own a UndoManager.

* dom/Document.h:
(WebCore::Document::undoManager const):
* dom/Document.idl:
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setUndoManagerAPIEnabled):
(WebCore::RuntimeEnabledFeatures::undoManagerAPIEnabled const):

Guard the new bindings behind a runtime-enabled feature flag.

* page/UndoItem.h: Added.
(WebCore::UndoItem::create):
(WebCore::UndoItem::label const):
(WebCore::UndoItem::undoHandler const):
(WebCore::UndoItem::redoHandler const):
(WebCore::UndoItem::UndoItem):
* page/UndoItem.idl: Added.
* page/UndoManager.cpp: Added.
(WebCore::UndoManager::addItem):
* page/UndoManager.h: Added.
(WebCore::UndoManager::create):
(WebCore::UndoManager::document):
(WebCore::UndoManager::UndoManager):
* page/UndoManager.idl: Added.
* page/mac/WheelEventDeltaFilterMac.h:

Necessary (albeit unrelated) build fix to appease unified sources.

Source/WebKit:

Add a new SPI configuration flag to enable the UndoManager API. This is off by default.

* Shared/WebPreferences.yaml:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration _setUndoManagerAPIEnabled:]):
(-[WKWebViewConfiguration _undoManagerAPIEnabled]):
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:

Tools:

Introduce and respect a test option to enable the UndoManager API.

* WebKitTestRunner/TestController.cpp:
(WTR::updateTestOptionsFromTestHeader):
* WebKitTestRunner/TestOptions.h:
(WTR::TestOptions::hasSameInitializationOptions const):
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::platformCreateWebView):

LayoutTests:

Add UndoManager tests to exercise new bindings, and verify that the JS wrapper for Document's UndoManager
survives garbage collection.

* TestExpectations:
* editing/undo-manager/undo-manager-interfaces-expected.txt: Added.
* editing/undo-manager/undo-manager-interfaces.html: Added.
* editing/undo-manager/undo-manager-keeps-wrapper-alive-expected.txt: Added.
* editing/undo-manager/undo-manager-keeps-wrapper-alive.html: Added.
* platform/ios-wk2/TestExpectations:
* platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239864 268f45cc-cd09-0410-ab3c-d52691b4dbfc

36 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/editing/undo-manager/undo-manager-interfaces-expected.txt [new file with mode: 0644]
LayoutTests/editing/undo-manager/undo-manager-interfaces.html [new file with mode: 0644]
LayoutTests/editing/undo-manager/undo-manager-keeps-wrapper-alive-expected.txt [new file with mode: 0644]
LayoutTests/editing/undo-manager/undo-manager-keeps-wrapper-alive.html [new file with mode: 0644]
LayoutTests/platform/ios-wk2/TestExpectations
LayoutTests/platform/mac-wk2/TestExpectations
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources-input.xcfilelist
Source/WebCore/DerivedSources-output.xcfilelist
Source/WebCore/DerivedSources.make
Source/WebCore/Sources.txt
Source/WebCore/UnifiedSources-input.xcfilelist
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/WebCoreBuiltinNames.h
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/Document.idl
Source/WebCore/page/RuntimeEnabledFeatures.h
Source/WebCore/page/UndoItem.h [new file with mode: 0644]
Source/WebCore/page/UndoItem.idl [new file with mode: 0644]
Source/WebCore/page/UndoManager.cpp [new file with mode: 0644]
Source/WebCore/page/UndoManager.h [new file with mode: 0644]
Source/WebCore/page/UndoManager.idl [new file with mode: 0644]
Source/WebCore/page/mac/WheelEventDeltaFilterMac.h
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferences.yaml
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h
Tools/ChangeLog
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestOptions.h
Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm

index 97628de..9857987 100644 (file)
@@ -1,3 +1,22 @@
+2019-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Introduce IDL files for runtime-enabled UndoManager and UndoItem JavaScript API
+        https://bugs.webkit.org/show_bug.cgi?id=193109
+        <rdar://problem/44807048>
+
+        Reviewed by Ryosuke Niwa.
+
+        Add UndoManager tests to exercise new bindings, and verify that the JS wrapper for Document's UndoManager
+        survives garbage collection.
+
+        * TestExpectations:
+        * editing/undo-manager/undo-manager-interfaces-expected.txt: Added.
+        * editing/undo-manager/undo-manager-interfaces.html: Added.
+        * editing/undo-manager/undo-manager-keeps-wrapper-alive-expected.txt: Added.
+        * editing/undo-manager/undo-manager-keeps-wrapper-alive.html: Added.
+        * platform/ios-wk2/TestExpectations:
+        * platform/mac-wk2/TestExpectations:
+
 2019-01-11  Zalan Bujtas  <zalan@apple.com>
 
         [LFC][BFC][MarginCollapsing] Adjust vertical position when box margin collapses through.
 2019-01-11  Zalan Bujtas  <zalan@apple.com>
 
         [LFC][BFC][MarginCollapsing] Adjust vertical position when box margin collapses through.
index ddf324e..354e0d6 100644 (file)
@@ -19,6 +19,7 @@ editing/input/ios [ Skip ]
 editing/find [ Skip ]
 editing/pasteboard/gtk [ Skip ]
 editing/selection/ios [ Skip ]
 editing/find [ Skip ]
 editing/pasteboard/gtk [ Skip ]
 editing/selection/ios [ Skip ]
+editing/undo-manager [ Skip ]
 tiled-drawing [ Skip ]
 fast/css/watchos [ Skip ]
 fast/dom/Window/watchos [ Skip ]
 tiled-drawing [ Skip ]
 fast/css/watchos [ Skip ]
 fast/dom/Window/watchos [ Skip ]
diff --git a/LayoutTests/editing/undo-manager/undo-manager-interfaces-expected.txt b/LayoutTests/editing/undo-manager/undo-manager-interfaces-expected.txt
new file mode 100644 (file)
index 0000000..f50eba8
--- /dev/null
@@ -0,0 +1,43 @@
+Verifies that, when the UndoManager API is enabled, UndoManager and UndoItem interfaces behave as expected.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+Testing UndoManager:
+PASS UndoManager instanceof Function is true
+PASS typeof UndoManager is "function"
+PASS document.undoManager instanceof UndoManager is true
+PASS Object.getPrototypeOf(document.undoManager) === UndoManager.prototype is true
+PASS UndoManager.prototype.addItem instanceof Function is true
+PASS UndoManager() threw exception TypeError: Illegal constructor.
+PASS new UndoManager() threw exception TypeError: function is not a constructor (evaluating 'new UndoManager()').
+PASS document.undoManager.addItem() threw exception TypeError: Not enough arguments.
+PASS document.undoManager.addItem('foo') threw exception TypeError: Argument 1 ('item') to UndoManager.addItem must be an instance of UndoItem.
+PASS UndoManager.toString() is "function UndoManager() {\n    [native code]\n}"
+PASS document.undoManager.toString() is "[object UndoManager]"
+
+Testing UndoItem:
+PASS UndoItem instanceof Function is true
+PASS typeof UndoItem is "function"
+PASS UndoItem() threw exception TypeError: Constructor requires 'new' operator.
+PASS new UndoItem() threw exception TypeError: Not enough arguments.
+PASS new UndoItem('foo') threw exception TypeError: Type error.
+PASS new UndoItem({ }) threw exception TypeError: Member UndoItemInit.label is required and must be an instance of DOMString.
+PASS new UndoItem({ label: null, undo: null }) threw exception TypeError: Member UndoItemInit.redo is required and must be an instance of VoidCallback.
+PASS new UndoItem({ redo: null }) threw exception TypeError: Member UndoItemInit.label is required and must be an instance of DOMString.
+PASS new UndoItem({ label: '', undo: emptyFunction }) threw exception TypeError: Member UndoItemInit.redo is required and must be an instance of VoidCallback.
+PASS new UndoItem({ label: 'hello', redo: emptyFunction }) threw exception TypeError: Member UndoItemInit.undo is required and must be an instance of VoidCallback.
+PASS new UndoItem({ label: 3, undo: null, redo: null }) threw exception TypeError: Type error.
+PASS new UndoItem({ label: '', undo: '', redo: emptyFunction }) threw exception TypeError: Type error.
+PASS new UndoItem({ label: '', undo: emptyFunction, redo: 10 }) threw exception TypeError: Type error.
+PASS new UndoItem({ label: '', undo: emptyFunction, redo: emptyFunction, foo: 'hi' }) instanceof UndoItem is true
+PASS Object.getPrototypeOf(new UndoItem({ label: '', undo: emptyFunction, redo: emptyFunction })) === UndoItem.prototype is true
+PASS new UndoItem({ label: 'foo', undo: emptyFunction, redo: emptyFunction }).label is "foo"
+PASS UndoItem.toString() is "function UndoItem() {\n    [native code]\n}"
+PASS new UndoItem({ label: '', undo: emptyFunction, redo: emptyFunction }).toString() is "[object UndoItem]"
+PASS document.undoManager.addItem(new UndoItem({ label: '', undo: emptyFunction, redo: emptyFunction })) did not throw exception.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/editing/undo-manager/undo-manager-interfaces.html b/LayoutTests/editing/undo-manager/undo-manager-interfaces.html
new file mode 100644 (file)
index 0000000..93b2ca7
--- /dev/null
@@ -0,0 +1,49 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ enableUndoManagerAPI=true ] -->
+<html>
+    <head>
+        <script src="../../resources/js-test.js"></script>
+    </head>
+    <script>
+        function emptyFunction() { }
+
+        function runTest()
+        {
+            description("Verifies that, when the UndoManager API is enabled, UndoManager and UndoItem interfaces behave as expected.");
+
+            debug("\nTesting UndoManager:");
+            shouldBeTrue("UndoManager instanceof Function");
+            shouldBeEqualToString("typeof UndoManager", "function");
+            shouldBeTrue("document.undoManager instanceof UndoManager");
+            shouldBeTrue("Object.getPrototypeOf(document.undoManager) === UndoManager.prototype");
+            shouldBeTrue("UndoManager.prototype.addItem instanceof Function");
+            shouldThrow("UndoManager()");
+            shouldThrow("new UndoManager()");
+            shouldThrow("document.undoManager.addItem()");
+            shouldThrow("document.undoManager.addItem('foo')");
+            shouldBeEqualToString("UndoManager.toString()", "function UndoManager() {\n    [native code]\n}");
+            shouldBeEqualToString("document.undoManager.toString()", "[object UndoManager]");
+
+            debug("\nTesting UndoItem:");
+            shouldBeTrue("UndoItem instanceof Function");
+            shouldBeEqualToString("typeof UndoItem", "function");
+            shouldThrow("UndoItem()");
+            shouldThrow("new UndoItem()");
+            shouldThrow("new UndoItem('foo')");
+            shouldThrow("new UndoItem({ })");
+            shouldThrow("new UndoItem({ label: null, undo: null })");
+            shouldThrow("new UndoItem({ redo: null })");
+            shouldThrow("new UndoItem({ label: '', undo: emptyFunction })");
+            shouldThrow("new UndoItem({ label: 'hello', redo: emptyFunction })");
+            shouldThrow("new UndoItem({ label: 3, undo: null, redo: null })");
+            shouldThrow("new UndoItem({ label: '', undo: '', redo: emptyFunction })");
+            shouldThrow("new UndoItem({ label: '', undo: emptyFunction, redo: 10 })");
+            shouldBeTrue("new UndoItem({ label: '', undo: emptyFunction, redo: emptyFunction, foo: 'hi' }) instanceof UndoItem");
+            shouldBeTrue("Object.getPrototypeOf(new UndoItem({ label: '', undo: emptyFunction, redo: emptyFunction })) === UndoItem.prototype");
+            shouldBeEqualToString("new UndoItem({ label: 'foo', undo: emptyFunction, redo: emptyFunction }).label", "foo");
+            shouldBeEqualToString("UndoItem.toString()", "function UndoItem() {\n    [native code]\n}");
+            shouldBeEqualToString("new UndoItem({ label: '', undo: emptyFunction, redo: emptyFunction }).toString()", "[object UndoItem]");
+            shouldNotThrow("document.undoManager.addItem(new UndoItem({ label: '', undo: emptyFunction, redo: emptyFunction }))");
+        }
+    </script>
+    <body onload=runTest()></body>
+</html>
diff --git a/LayoutTests/editing/undo-manager/undo-manager-keeps-wrapper-alive-expected.txt b/LayoutTests/editing/undo-manager/undo-manager-keeps-wrapper-alive-expected.txt
new file mode 100644 (file)
index 0000000..b4b5e38
--- /dev/null
@@ -0,0 +1,10 @@
+Verifies that the wrapper for Document's UndoManager remains consistent across GC passes. This test must be run using WebKitTestRunner.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.undoManager.foo is "bar"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/editing/undo-manager/undo-manager-keeps-wrapper-alive.html b/LayoutTests/editing/undo-manager/undo-manager-keeps-wrapper-alive.html
new file mode 100644 (file)
index 0000000..bccce51
--- /dev/null
@@ -0,0 +1,17 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ enableUndoManagerAPI=true ] -->
+<html>
+    <head>
+        <script src="../../resources/js-test.js"></script>
+    </head>
+    <script>
+        function runTest()
+        {
+            description("Verifies that the wrapper for Document's UndoManager remains consistent across GC passes. This test must be run using WebKitTestRunner.");
+            document.undoManager.foo = "bar";
+            if (window.GCController)
+                GCController.collect();
+            shouldBeEqualToString("document.undoManager.foo", "bar");
+        }
+    </script>
+    <body onload=runTest()></body>
+</html>
index 034f122..c567c14 100644 (file)
@@ -16,6 +16,7 @@ tiled-drawing/ios [ Pass ]
 fast/web-share [ Pass ]
 editing/find [ Pass ]
 editing/input/ios [ Pass ]
 fast/web-share [ Pass ]
 editing/find [ Pass ]
 editing/input/ios [ Pass ]
+editing/undo-manager [ Pass ]
 
 editing/selection/character-granularity-rect.html [ Failure ]
 
 
 editing/selection/character-granularity-rect.html [ Failure ]
 
index 714d9e9..6f8c332 100644 (file)
@@ -11,6 +11,7 @@ fast/visual-viewport/tiled-drawing [ Pass ]
 swipe [ Pass ]
 fast/web-share [ Pass ]
 editing/find [ Pass ]
 swipe [ Pass ]
 fast/web-share [ Pass ]
 editing/find [ Pass ]
+editing/undo-manager [ Pass ]
 
 fast/events/autoscroll-when-zoomed.html [ Pass ]
 fast/events/autoscroll-main-document.html [ Pass ]
 
 fast/events/autoscroll-when-zoomed.html [ Pass ]
 fast/events/autoscroll-main-document.html [ Pass ]
index f2775eb..d019ada 100644 (file)
@@ -927,6 +927,8 @@ set(WebCore_NON_SVG_IDL_FILES
     page/ScrollLogicalPosition.idl
     page/ScrollToOptions.idl
     page/ShareData.idl
     page/ScrollLogicalPosition.idl
     page/ScrollToOptions.idl
     page/ShareData.idl
+    page/UndoItem.idl
+    page/UndoManager.idl
     page/VisualViewport.idl
     page/WebKitPoint.idl
     page/WindowEventHandlers.idl
     page/VisualViewport.idl
     page/WebKitPoint.idl
     page/WindowEventHandlers.idl
index da837e7..8e2c89e 100644 (file)
@@ -1,3 +1,65 @@
+2019-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Introduce IDL files for runtime-enabled UndoManager and UndoItem JavaScript API
+        https://bugs.webkit.org/show_bug.cgi?id=193109
+        <rdar://problem/44807048>
+
+        Reviewed by Ryosuke Niwa.
+
+        Adds new IDL files and stubs for UndoManager and UndoItem. This is an experimental DOM API that (in the near
+        future) is intended only for use in internal WebKit text editing clients. This API allows the page to
+        participate in the processes of undoing and redoing by defining custom undo and redo handlers, to be executed
+        when undo or redo is triggered.
+
+        Tests: editing/undo-manager/undo-manager-interfaces.html
+               editing/undo-manager/undo-manager-keeps-wrapper-alive.html
+
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Sources.txt:
+        * UnifiedSources-input.xcfilelist:
+        * WebCore.xcodeproj/project.pbxproj:
+
+        Add new source files.
+
+        * bindings/js/WebCoreBuiltinNames.h:
+
+        Add "UndoManager" and "UndoItem" names.
+
+        * dom/Document.cpp:
+        (WebCore::m_undoManager):
+
+        Have the document own a UndoManager.
+
+        * dom/Document.h:
+        (WebCore::Document::undoManager const):
+        * dom/Document.idl:
+        * page/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::setUndoManagerAPIEnabled):
+        (WebCore::RuntimeEnabledFeatures::undoManagerAPIEnabled const):
+
+        Guard the new bindings behind a runtime-enabled feature flag.
+
+        * page/UndoItem.h: Added.
+        (WebCore::UndoItem::create):
+        (WebCore::UndoItem::label const):
+        (WebCore::UndoItem::undoHandler const):
+        (WebCore::UndoItem::redoHandler const):
+        (WebCore::UndoItem::UndoItem):
+        * page/UndoItem.idl: Added.
+        * page/UndoManager.cpp: Added.
+        (WebCore::UndoManager::addItem):
+        * page/UndoManager.h: Added.
+        (WebCore::UndoManager::create):
+        (WebCore::UndoManager::document):
+        (WebCore::UndoManager::UndoManager):
+        * page/UndoManager.idl: Added.
+        * page/mac/WheelEventDeltaFilterMac.h:
+
+        Necessary (albeit unrelated) build fix to appease unified sources.
+
 2019-01-11  Zalan Bujtas  <zalan@apple.com>
 
         [LFC][BFC][MarginCollapsing] Adjust vertical position when box margin collapses through.
 2019-01-11  Zalan Bujtas  <zalan@apple.com>
 
         [LFC][BFC][MarginCollapsing] Adjust vertical position when box margin collapses through.
index 90b25fa..fff1d07 100644 (file)
@@ -852,6 +852,8 @@ $(PROJECT_DIR)/page/ScrollLogicalPosition.idl
 $(PROJECT_DIR)/page/ScrollToOptions.idl
 $(PROJECT_DIR)/page/Settings.yaml
 $(PROJECT_DIR)/page/ShareData.idl
 $(PROJECT_DIR)/page/ScrollToOptions.idl
 $(PROJECT_DIR)/page/Settings.yaml
 $(PROJECT_DIR)/page/ShareData.idl
+$(PROJECT_DIR)/page/UndoItem.idl
+$(PROJECT_DIR)/page/UndoManager.idl
 $(PROJECT_DIR)/page/UserMessageHandler.idl
 $(PROJECT_DIR)/page/UserMessageHandlersNamespace.idl
 $(PROJECT_DIR)/page/VisualViewport.idl
 $(PROJECT_DIR)/page/UserMessageHandler.idl
 $(PROJECT_DIR)/page/UserMessageHandlersNamespace.idl
 $(PROJECT_DIR)/page/VisualViewport.idl
index dfbb88b..8d2ac9d 100644 (file)
@@ -1702,6 +1702,10 @@ $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUIEventInit.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUIEventInit.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSURLSearchParams.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSURLSearchParams.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUIEventInit.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSURLSearchParams.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSURLSearchParams.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUndoItem.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUndoItem.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUndoManager.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUndoManager.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUserMessageHandler.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUserMessageHandler.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUserMessageHandlersNamespace.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUserMessageHandler.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUserMessageHandler.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUserMessageHandlersNamespace.cpp
index 4d51b6f..69278db 100644 (file)
@@ -876,6 +876,8 @@ JS_BINDING_IDLS = \
     $(WebCore)/page/ScrollLogicalPosition.idl \
     $(WebCore)/page/ScrollToOptions.idl \
     $(WebCore)/page/ShareData.idl \
     $(WebCore)/page/ScrollLogicalPosition.idl \
     $(WebCore)/page/ScrollToOptions.idl \
     $(WebCore)/page/ShareData.idl \
+    $(WebCore)/page/UndoItem.idl \
+    $(WebCore)/page/UndoManager.idl \
     $(WebCore)/page/UserMessageHandler.idl \
     $(WebCore)/page/UserMessageHandlersNamespace.idl \
     $(WebCore)/page/VisualViewport.idl \
     $(WebCore)/page/UserMessageHandler.idl \
     $(WebCore)/page/UserMessageHandlersNamespace.idl \
     $(WebCore)/page/VisualViewport.idl \
index 12a9244..491482a 100644 (file)
@@ -1507,6 +1507,7 @@ page/SocketProvider.cpp
 page/SpatialNavigation.cpp
 page/SuspendableTimer.cpp
 page/TextIndicator.cpp
 page/SpatialNavigation.cpp
 page/SuspendableTimer.cpp
 page/TextIndicator.cpp
+page/UndoManager.cpp
 page/UserContentProvider.cpp
 page/UserContentController.cpp
 page/UserContentURLPattern.cpp
 page/UserContentProvider.cpp
 page/UserContentController.cpp
 page/UserContentURLPattern.cpp
@@ -3224,6 +3225,8 @@ JSTextMetrics.cpp
 JSTimeRanges.cpp
 JSTransitionEvent.cpp
 JSTreeWalker.cpp
 JSTimeRanges.cpp
 JSTransitionEvent.cpp
 JSTreeWalker.cpp
+JSUndoItem.cpp
+JSUndoManager.cpp
 JSUIEvent.cpp
 JSUIEventInit.cpp
 JSURLSearchParams.cpp
 JSUIEvent.cpp
 JSUIEventInit.cpp
 JSURLSearchParams.cpp
index dfc2a3c..07ce946 100644 (file)
@@ -818,6 +818,8 @@ $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSTreeWalker.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUIEvent.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUIEventInit.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSURLSearchParams.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUIEvent.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUIEventInit.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSURLSearchParams.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUndoItem.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUndoManager.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUserMessageHandler.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUserMessageHandlersNamespace.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUserVerificationRequirement.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUserMessageHandler.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUserMessageHandlersNamespace.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSUserVerificationRequirement.cpp
index 915d544..ff35a88 100644 (file)
                2EB4BCD3121F03E300EC4885 /* BlobResourceHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EB4BCD1121F03E300EC4885 /* BlobResourceHandle.h */; };
                2EB767571DA19BDF003E23B5 /* InputEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EB767541DA19B67003E23B5 /* InputEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2EBBC3D81B65988300F5253D /* WheelEventDeltaFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EBBC3D71B65988300F5253D /* WheelEventDeltaFilter.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2EB4BCD3121F03E300EC4885 /* BlobResourceHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EB4BCD1121F03E300EC4885 /* BlobResourceHandle.h */; };
                2EB767571DA19BDF003E23B5 /* InputEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EB767541DA19B67003E23B5 /* InputEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2EBBC3D81B65988300F5253D /* WheelEventDeltaFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EBBC3D71B65988300F5253D /* WheelEventDeltaFilter.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               2ECDBAD121D8903400F00ECD /* UndoManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ECDBACE21D8903400F00ECD /* UndoManager.h */; };
+               2ECDBAD821D8906300F00ECD /* UndoItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ECDBAD521D8906300F00ECD /* UndoItem.h */; };
                2ECF7ADD10162B3800427DE7 /* JSErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ECF7ADB10162B3800427DE7 /* JSErrorEvent.h */; };
                2ECF7AE210162B5800427DE7 /* ErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ECF7ADF10162B5800427DE7 /* ErrorEvent.h */; };
                2ED609BD1145B07100C8684E /* DOMFormData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ED609BB1145B07100C8684E /* DOMFormData.h */; };
                2ECF7ADD10162B3800427DE7 /* JSErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ECF7ADB10162B3800427DE7 /* JSErrorEvent.h */; };
                2ECF7AE210162B5800427DE7 /* ErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ECF7ADF10162B5800427DE7 /* ErrorEvent.h */; };
                2ED609BD1145B07100C8684E /* DOMFormData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ED609BB1145B07100C8684E /* DOMFormData.h */; };
                2EB767551DA19B99003E23B5 /* InputEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InputEvent.cpp; sourceTree = "<group>"; };
                2EBBC3D71B65988300F5253D /* WheelEventDeltaFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WheelEventDeltaFilter.h; sourceTree = "<group>"; };
                2EC41DE21C0410A300D294FE /* RealtimeMediaSourceSupportedConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RealtimeMediaSourceSupportedConstraints.cpp; sourceTree = "<group>"; };
                2EB767551DA19B99003E23B5 /* InputEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InputEvent.cpp; sourceTree = "<group>"; };
                2EBBC3D71B65988300F5253D /* WheelEventDeltaFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WheelEventDeltaFilter.h; sourceTree = "<group>"; };
                2EC41DE21C0410A300D294FE /* RealtimeMediaSourceSupportedConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RealtimeMediaSourceSupportedConstraints.cpp; sourceTree = "<group>"; };
+               2ECDBACE21D8903400F00ECD /* UndoManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UndoManager.h; sourceTree = "<group>"; };
+               2ECDBACF21D8903400F00ECD /* UndoManager.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UndoManager.cpp; sourceTree = "<group>"; };
+               2ECDBAD021D8903400F00ECD /* UndoManager.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = UndoManager.idl; sourceTree = "<group>"; };
+               2ECDBAD521D8906300F00ECD /* UndoItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UndoItem.h; sourceTree = "<group>"; };
+               2ECDBAD721D8906300F00ECD /* UndoItem.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = UndoItem.idl; sourceTree = "<group>"; };
                2ECF7ADA10162B3800427DE7 /* JSErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSErrorEvent.cpp; sourceTree = "<group>"; };
                2ECF7ADB10162B3800427DE7 /* JSErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSErrorEvent.h; sourceTree = "<group>"; };
                2ECF7ADE10162B5800427DE7 /* ErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ErrorEvent.cpp; sourceTree = "<group>"; };
                2ECF7ADA10162B3800427DE7 /* JSErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSErrorEvent.cpp; sourceTree = "<group>"; };
                2ECF7ADB10162B3800427DE7 /* JSErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSErrorEvent.h; sourceTree = "<group>"; };
                2ECF7ADE10162B5800427DE7 /* ErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ErrorEvent.cpp; sourceTree = "<group>"; };
                656580EC09D12B20000E61D7 /* Derived Sources */ = {
                        isa = PBXGroup;
                        children = (
                656580EC09D12B20000E61D7 /* Derived Sources */ = {
                        isa = PBXGroup;
                        children = (
-                               C21BF74221CD963B00227979 /* WHLSLStandardLibrary.h */,
                                538EC7EA1F96A95B004D22A8 /* unified-sources */,
                                9908B0F31BCACFFE00ED0F65 /* ByteLengthQueuingStrategyBuiltins.cpp */,
                                9908B0F51BCAD07D00ED0F65 /* ByteLengthQueuingStrategyBuiltins.h */,
                                538EC7EA1F96A95B004D22A8 /* unified-sources */,
                                9908B0F31BCACFFE00ED0F65 /* ByteLengthQueuingStrategyBuiltins.cpp */,
                                9908B0F51BCAD07D00ED0F65 /* ByteLengthQueuingStrategyBuiltins.h */,
                                656581AF09D14EE6000E61D7 /* UserAgentStyleSheetsData.cpp */,
                                1A1414B313A0F0500019996C /* WebKitFontFamilyNames.cpp */,
                                1A1414B413A0F0500019996C /* WebKitFontFamilyNames.h */,
                                656581AF09D14EE6000E61D7 /* UserAgentStyleSheetsData.cpp */,
                                1A1414B313A0F0500019996C /* WebKitFontFamilyNames.cpp */,
                                1A1414B413A0F0500019996C /* WebKitFontFamilyNames.h */,
+                               C21BF74221CD963B00227979 /* WHLSLStandardLibrary.h */,
                                51748FA21CC6EEEB00728D84 /* WorkerGlobalScopeConstructors.idl */,
                                9908B0F91BCAD07D00ED0F75 /* WritableStreamBuiltins.cpp */,
                                9B03D8061BB3110D00B764E8 /* WritableStreamBuiltins.h */,
                                51748FA21CC6EEEB00728D84 /* WorkerGlobalScopeConstructors.idl */,
                                9908B0F91BCAD07D00ED0F75 /* WritableStreamBuiltins.cpp */,
                                9B03D8061BB3110D00B764E8 /* WritableStreamBuiltins.h */,
                                62C1217B11AB9E77003C462C /* SuspendableTimer.h */,
                                2D4F96F11A1ECC240098BF88 /* TextIndicator.cpp */,
                                2D4F96F21A1ECC240098BF88 /* TextIndicator.h */,
                                62C1217B11AB9E77003C462C /* SuspendableTimer.h */,
                                2D4F96F11A1ECC240098BF88 /* TextIndicator.cpp */,
                                2D4F96F21A1ECC240098BF88 /* TextIndicator.h */,
+                               2ECDBAD521D8906300F00ECD /* UndoItem.h */,
+                               2ECDBAD721D8906300F00ECD /* UndoItem.idl */,
+                               2ECDBACF21D8903400F00ECD /* UndoManager.cpp */,
+                               2ECDBACE21D8903400F00ECD /* UndoManager.h */,
+                               2ECDBAD021D8903400F00ECD /* UndoManager.idl */,
                                1AE79D40188DB61F002239C2 /* UserContentController.cpp */,
                                1AE79D41188DB61F002239C2 /* UserContentController.h */,
                                7C3F01BF1C8E5AB100ADD962 /* UserContentProvider.cpp */,
                                1AE79D40188DB61F002239C2 /* UserContentController.cpp */,
                                1AE79D41188DB61F002239C2 /* UserContentController.h */,
                                7C3F01BF1C8E5AB100ADD962 /* UserContentProvider.cpp */,
                C210E90D21B4BCA400B7F83D /* WHLSL */ = {
                        isa = PBXGroup;
                        children = (
                C210E90D21B4BCA400B7F83D /* WHLSL */ = {
                        isa = PBXGroup;
                        children = (
-                               C21BF74521CD969800227979 /* WHLSLStandardLibrary.txt */,
                                C21BF6F121CD898D00227979 /* AST */,
                                C210E91121B4BD1000B7F83D /* WHLSLLexer.cpp */,
                                C210E91221B4BD1000B7F83D /* WHLSLLexer.h */,
                                C21BF73721CD8A0200227979 /* WHLSLParser.cpp */,
                                C21BF73821CD8A0300227979 /* WHLSLParser.h */,
                                C21BF73A21CD8D7000227979 /* WHLSLProgram.h */,
                                C21BF6F121CD898D00227979 /* AST */,
                                C210E91121B4BD1000B7F83D /* WHLSLLexer.cpp */,
                                C210E91221B4BD1000B7F83D /* WHLSLLexer.h */,
                                C21BF73721CD8A0200227979 /* WHLSLParser.cpp */,
                                C21BF73821CD8A0300227979 /* WHLSLParser.h */,
                                C21BF73A21CD8D7000227979 /* WHLSLProgram.h */,
+                               C21BF74521CD969800227979 /* WHLSLStandardLibrary.txt */,
                        );
                        path = WHLSL;
                        sourceTree = "<group>";
                        );
                        path = WHLSL;
                        sourceTree = "<group>";
                                85031B4E0A44EFC700F992E0 /* UIEvent.h in Headers */,
                                83FE7CA71DA9F1A70037237C /* UIEventInit.h in Headers */,
                                85031B4F0A44EFC700F992E0 /* UIEventWithKeyState.h in Headers */,
                                85031B4E0A44EFC700F992E0 /* UIEvent.h in Headers */,
                                83FE7CA71DA9F1A70037237C /* UIEventInit.h in Headers */,
                                85031B4F0A44EFC700F992E0 /* UIEventWithKeyState.h in Headers */,
+                               2ECDBAD821D8906300F00ECD /* UndoItem.h in Headers */,
+                               2ECDBAD121D8903400F00ECD /* UndoManager.h in Headers */,
                                9B2D8A7914997CCF00ECEF3E /* UndoStep.h in Headers */,
                                A863E2011343412000274926 /* UnicodeBidi.h in Headers */,
                                518864E11BBAF57400E540C9 /* UniqueIDBDatabase.h in Headers */,
                                9B2D8A7914997CCF00ECEF3E /* UndoStep.h in Headers */,
                                A863E2011343412000274926 /* UnicodeBidi.h in Headers */,
                                518864E11BBAF57400E540C9 /* UniqueIDBDatabase.h in Headers */,
index 555a939..183fe8a 100644 (file)
@@ -178,6 +178,8 @@ namespace WebCore {
     macro(StaticRange) \
     macro(StylePropertyMapReadOnly) \
     macro(StylePropertyMap) \
     macro(StaticRange) \
     macro(StylePropertyMapReadOnly) \
     macro(StylePropertyMap) \
+    macro(UndoItem) \
+    macro(UndoManager) \
     macro(VRDisplay) \
     macro(VRDisplayCapabilities) \
     macro(VRDisplayEvent) \
     macro(VRDisplay) \
     macro(VRDisplayCapabilities) \
     macro(VRDisplayEvent) \
index e60a0b4..74fe607 100644 (file)
 #include "TextNodeTraversal.h"
 #include "TransformSource.h"
 #include "TreeWalker.h"
 #include "TextNodeTraversal.h"
 #include "TransformSource.h"
 #include "TreeWalker.h"
+#include "UndoManager.h"
 #include "UserGestureIndicator.h"
 #include "ValidationMessageClient.h"
 #include "VisibilityChangeClient.h"
 #include "UserGestureIndicator.h"
 #include "ValidationMessageClient.h"
 #include "VisibilityChangeClient.h"
@@ -537,6 +538,7 @@ Document::Document(Frame* frame, const URL& url, unsigned documentClasses, unsig
     , m_isNonRenderedPlaceholder(constructionFlags & NonRenderedPlaceholder)
     , m_orientationNotifier(currentOrientation(frame))
     , m_identifier(generateObjectIdentifier<DocumentIdentifierType>())
     , m_isNonRenderedPlaceholder(constructionFlags & NonRenderedPlaceholder)
     , m_orientationNotifier(currentOrientation(frame))
     , m_identifier(generateObjectIdentifier<DocumentIdentifierType>())
+    , m_undoManager(UndoManager::create(*this))
 {
     auto addResult = allDocumentsMap().add(m_identifier, this);
     ASSERT_UNUSED(addResult, addResult.isNewEntry);
 {
     auto addResult = allDocumentsMap().add(m_identifier, this);
     ASSERT_UNUSED(addResult, addResult.isNewEntry);
index 77f2dbd..1df75ec 100644 (file)
@@ -186,6 +186,7 @@ class StyleSheetList;
 class Text;
 class TextResourceDecoder;
 class TreeWalker;
 class Text;
 class TextResourceDecoder;
 class TreeWalker;
+class UndoManager;
 class VisibilityChangeClient;
 class VisitedLinkState;
 class WebAnimation;
 class VisibilityChangeClient;
 class VisitedLinkState;
 class WebAnimation;
@@ -1004,6 +1005,8 @@ public:
     WEBCORE_EXPORT bool queryCommandSupported(const String& command);
     WEBCORE_EXPORT String queryCommandValue(const String& command);
 
     WEBCORE_EXPORT bool queryCommandSupported(const String& command);
     WEBCORE_EXPORT String queryCommandValue(const String& command);
 
+    UndoManager& undoManager() const { return m_undoManager.get(); }
+
     // designMode support
     enum InheritedBool { off = false, on = true, inherit };    
     void setDesignMode(InheritedBool value);
     // designMode support
     enum InheritedBool { off = false, on = true, inherit };    
     void setDesignMode(InheritedBool value);
@@ -2086,6 +2089,8 @@ private:
     bool m_isRunningUserScripts { false };
 
     bool m_alwaysAllowLocalWebarchive { false };
     bool m_isRunningUserScripts { false };
 
     bool m_alwaysAllowLocalWebarchive { false };
+
+    Ref<UndoManager> m_undoManager;
 };
 
 Element* eventTargetElementForDocument(Document*);
 };
 
 Element* eventTargetElementForDocument(Document*);
index 1b68f24..6f6379b 100644 (file)
@@ -126,6 +126,7 @@ typedef (
     boolean queryCommandState(DOMString commandId);
     boolean queryCommandSupported(DOMString commandId);
     DOMString queryCommandValue(DOMString commandId);
     boolean queryCommandState(DOMString commandId);
     boolean queryCommandSupported(DOMString commandId);
     DOMString queryCommandValue(DOMString commandId);
+    [EnabledAtRuntime=UndoManagerAPI] readonly attribute UndoManager undoManager;
 
     // Special event handler IDL attributes that only apply to Document objects.
     [LenientThis] attribute EventHandler onreadystatechange;
 
     // Special event handler IDL attributes that only apply to Document objects.
     [LenientThis] attribute EventHandler onreadystatechange;
index 114558e..02face0 100644 (file)
@@ -315,6 +315,9 @@ public:
     bool intersectionObserverEnabled() const { return m_intersectionObserverEnabled; }
 #endif
 
     bool intersectionObserverEnabled() const { return m_intersectionObserverEnabled; }
 #endif
 
+    void setUndoManagerAPIEnabled(bool isEnabled) { m_undoManagerAPIEnabled = isEnabled; }
+    bool undoManagerAPIEnabled() const { return m_undoManagerAPIEnabled; }
+
 #if ENABLE(ENCRYPTED_MEDIA)
     void setEncryptedMediaAPIEnabled(bool isEnabled) { m_encryptedMediaAPIEnabled = isEnabled; }
     bool encryptedMediaAPIEnabled() const { return m_encryptedMediaAPIEnabled; }
 #if ENABLE(ENCRYPTED_MEDIA)
     void setEncryptedMediaAPIEnabled(bool isEnabled) { m_encryptedMediaAPIEnabled = isEnabled; }
     bool encryptedMediaAPIEnabled() const { return m_encryptedMediaAPIEnabled; }
@@ -506,6 +509,8 @@ private:
     bool m_systemPreviewEnabled { false };
 #endif
 
     bool m_systemPreviewEnabled { false };
 #endif
 
+    bool m_undoManagerAPIEnabled { false };
+
     friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>;
 };
 
     friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>;
 };
 
diff --git a/Source/WebCore/page/UndoItem.h b/Source/WebCore/page/UndoItem.h
new file mode 100644 (file)
index 0000000..019bb9a
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "VoidCallback.h"
+#include <wtf/Function.h>
+#include <wtf/IsoMallocInlines.h>
+#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class UndoItem : public RefCounted<UndoItem> {
+    WTF_MAKE_ISO_ALLOCATED_INLINE(UndoItem);
+public:
+    struct Init {
+        String label;
+        RefPtr<VoidCallback> undo;
+        RefPtr<VoidCallback> redo;
+    };
+
+    static Ref<UndoItem> create(Init&& init)
+    {
+        return adoptRef(*new UndoItem(WTFMove(init)));
+    }
+
+    const String& label() const { return m_label; }
+    VoidCallback& undoHandler() const { return m_undoHandler.get(); }
+    VoidCallback& redoHandler() const { return m_redoHandler.get(); }
+
+private:
+    UndoItem(Init&& init)
+        : m_label(WTFMove(init.label))
+        , m_undoHandler(init.undo.releaseNonNull())
+        , m_redoHandler(init.redo.releaseNonNull())
+    {
+    }
+
+    String m_label;
+    Ref<VoidCallback> m_undoHandler;
+    Ref<VoidCallback> m_redoHandler;
+};
+
+} // namespace WebCore
diff --git a/Source/WebCore/page/UndoItem.idl b/Source/WebCore/page/UndoItem.idl
new file mode 100644 (file)
index 0000000..09b97c8
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    EnabledAtRuntime=UndoManagerAPI,
+] dictionary UndoItemInit {
+    required DOMString label;
+    required VoidCallback undo;
+    required VoidCallback redo;
+};
+
+[
+    EnabledAtRuntime=UndoManagerAPI,
+    ImplementationLacksVTable,
+    Constructor(UndoItemInit initDict),
+] interface UndoItem {
+    readonly attribute DOMString label;
+};
diff --git a/Source/WebCore/page/UndoManager.cpp b/Source/WebCore/page/UndoManager.cpp
new file mode 100644 (file)
index 0000000..221bf28
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "UndoManager.h"
+
+#include "UndoItem.h"
+#include <wtf/IsoMallocInlines.h>
+
+namespace WebCore {
+
+WTF_MAKE_ISO_ALLOCATED_IMPL(UndoManager);
+
+void UndoManager::addItem(Ref<UndoItem>&& item)
+{
+    UNUSED_PARAM(item);
+    UNUSED_PARAM(m_document);
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/page/UndoManager.h b/Source/WebCore/page/UndoManager.h
new file mode 100644 (file)
index 0000000..49604f0
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/IsoMalloc.h>
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class Document;
+class UndoItem;
+
+class UndoManager : public RefCounted<UndoManager> {
+    WTF_MAKE_ISO_ALLOCATED(UndoManager);
+public:
+    static Ref<UndoManager> create(Document& document)
+    {
+        return adoptRef(*new UndoManager(document));
+    }
+
+    void addItem(Ref<UndoItem>&&);
+    Document& document() { return m_document; }
+
+private:
+    UndoManager(Document& document)
+        : m_document(document)
+    {
+    }
+
+    Document& m_document;
+};
+
+} // namespace WebCore
diff --git a/Source/WebCore/page/UndoManager.idl b/Source/WebCore/page/UndoManager.idl
new file mode 100644 (file)
index 0000000..d361276
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    EnabledAtRuntime=UndoManagerAPI,
+    ImplementationLacksVTable,
+    GenerateIsReachable=ImplDocument,
+] interface UndoManager {
+    void addItem(UndoItem item);
+};
index 310822c..2cc98bf 100644 (file)
@@ -28,6 +28,7 @@
 #if PLATFORM(MAC)
 
 #include "WheelEventDeltaFilter.h"
 #if PLATFORM(MAC)
 
 #include "WheelEventDeltaFilter.h"
+#include <wtf/MonotonicTime.h>
 #include <wtf/RetainPtr.h>
 
 OBJC_CLASS _NSScrollingPredominantAxisFilter;
 #include <wtf/RetainPtr.h>
 
 OBJC_CLASS _NSScrollingPredominantAxisFilter;
index c6d17bb..d53cc33 100644 (file)
@@ -1,3 +1,23 @@
+2019-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Introduce IDL files for runtime-enabled UndoManager and UndoItem JavaScript API
+        https://bugs.webkit.org/show_bug.cgi?id=193109
+        <rdar://problem/44807048>
+
+        Reviewed by Ryosuke Niwa.
+
+        Add a new SPI configuration flag to enable the UndoManager API. This is off by default.
+
+        * Shared/WebPreferences.yaml:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _initializeWithConfiguration:]):
+        * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+        (-[WKWebViewConfiguration init]):
+        (-[WKWebViewConfiguration copyWithZone:]):
+        (-[WKWebViewConfiguration _setUndoManagerAPIEnabled:]):
+        (-[WKWebViewConfiguration _undoManagerAPIEnabled]):
+        * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
+
 2019-01-10  Jiewen Tan  <jiewen_tan@apple.com>
 
         [WebAuthN] Change the nonce in the CTAP kInit command to weak random values
 2019-01-10  Jiewen Tan  <jiewen_tan@apple.com>
 
         [WebAuthN] Change the nonce in the CTAP kInit command to weak random values
index 00a8de8..bcfa73f 100644 (file)
@@ -1528,3 +1528,11 @@ RestrictedHTTPResponseAccess:
   humanReadableDescription: "Enable HTTP Response filtering for WebProcesses"
   category: internal
   webcoreBinding: RuntimeEnabledFeatures
   humanReadableDescription: "Enable HTTP Response filtering for WebProcesses"
   category: internal
   webcoreBinding: RuntimeEnabledFeatures
+
+UndoManagerAPIEnabled:
+  type: bool
+  defaultValue: false
+  humanReadableName: "UndoManager DOM API"
+  humanReadableDescription: "Enable the UndoManager DOM API"
+  category: internal
+  webcoreBinding: RuntimeEnabledFeatures
index cf1919c..11633c6 100644 (file)
@@ -645,6 +645,7 @@ static void validate(WKWebViewConfiguration *configuration)
     pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::colorFilterEnabledKey(), WebKit::WebPreferencesStore::Value(!![_configuration _colorFilterEnabled]));
 
     pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::editableImagesEnabledKey(), WebKit::WebPreferencesStore::Value(!![_configuration _editableImagesEnabled]));
     pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::colorFilterEnabledKey(), WebKit::WebPreferencesStore::Value(!![_configuration _colorFilterEnabled]));
 
     pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::editableImagesEnabledKey(), WebKit::WebPreferencesStore::Value(!![_configuration _editableImagesEnabled]));
+    pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::undoManagerAPIEnabledKey(), WebKit::WebPreferencesStore::Value(!![_configuration _undoManagerAPIEnabled]));
 
 #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
     pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::legacyEncryptedMediaAPIEnabledKey(), WebKit::WebPreferencesStore::Value(!![_configuration _legacyEncryptedMediaAPIEnabled]));
 
 #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
     pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::legacyEncryptedMediaAPIEnabledKey(), WebKit::WebPreferencesStore::Value(!![_configuration _legacyEncryptedMediaAPIEnabled]));
index de6f33e..4ecdce9 100644 (file)
@@ -160,6 +160,7 @@ static _WKDragLiftDelay toDragLiftDelay(NSUInteger value)
     BOOL _shouldDeferAsynchronousScriptsUntilAfterDocumentLoad;
     BOOL _drawsBackground;
     BOOL _editableImagesEnabled;
     BOOL _shouldDeferAsynchronousScriptsUntilAfterDocumentLoad;
     BOOL _drawsBackground;
     BOOL _editableImagesEnabled;
+    BOOL _undoManagerAPIEnabled;
 
     RetainPtr<NSString> _mediaContentTypesRequiringHardwareSupport;
     RetainPtr<NSArray<NSString *>> _additionalSupportedImageTypes;
 
     RetainPtr<NSString> _mediaContentTypesRequiringHardwareSupport;
     RetainPtr<NSArray<NSString *>> _additionalSupportedImageTypes;
@@ -248,6 +249,7 @@ static _WKDragLiftDelay toDragLiftDelay(NSUInteger value)
     _drawsBackground = YES;
 
     _editableImagesEnabled = NO;
     _drawsBackground = YES;
 
     _editableImagesEnabled = NO;
+    _undoManagerAPIEnabled = NO;
 
     return self;
 }
 
     return self;
 }
@@ -409,6 +411,7 @@ static _WKDragLiftDelay toDragLiftDelay(NSUInteger value)
     configuration->_drawsBackground = self->_drawsBackground;
 
     configuration->_editableImagesEnabled = self->_editableImagesEnabled;
     configuration->_drawsBackground = self->_drawsBackground;
 
     configuration->_editableImagesEnabled = self->_editableImagesEnabled;
+    configuration->_undoManagerAPIEnabled = self->_undoManagerAPIEnabled;
 
     return configuration;
 }
 
     return configuration;
 }
@@ -1037,6 +1040,16 @@ ALLOW_DEPRECATED_DECLARATIONS_END
     return _editableImagesEnabled;
 }
 
     return _editableImagesEnabled;
 }
 
+- (void)_setUndoManagerAPIEnabled:(BOOL)enabled
+{
+    _undoManagerAPIEnabled = enabled;
+}
+
+- (BOOL)_undoManagerAPIEnabled
+{
+    return _undoManagerAPIEnabled;
+}
+
 @end
 
 @implementation WKWebViewConfiguration (WKDeprecated)
 @end
 
 @implementation WKWebViewConfiguration (WKDeprecated)
index 37c430f..2abc8c1 100644 (file)
@@ -106,6 +106,7 @@ typedef NS_ENUM(NSUInteger, _WKDragLiftDelay) {
 @property (nonatomic, copy, setter=_setAdditionalSupportedImageTypes:) NSArray<NSString *> *_additionalSupportedImageTypes WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 @property (nonatomic, setter=_setEditableImagesEnabled:) BOOL _editableImagesEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 @property (nonatomic, copy, setter=_setAdditionalSupportedImageTypes:) NSArray<NSString *> *_additionalSupportedImageTypes WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 @property (nonatomic, setter=_setEditableImagesEnabled:) BOOL _editableImagesEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+@property (nonatomic, setter=_setUndoManagerAPIEnabled:) BOOL _undoManagerAPIEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 @end
 
 
 @end
 
index 4f8ca3e..e22f99f 100644 (file)
@@ -1,3 +1,20 @@
+2019-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Introduce IDL files for runtime-enabled UndoManager and UndoItem JavaScript API
+        https://bugs.webkit.org/show_bug.cgi?id=193109
+        <rdar://problem/44807048>
+
+        Reviewed by Ryosuke Niwa.
+
+        Introduce and respect a test option to enable the UndoManager API.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::updateTestOptionsFromTestHeader):
+        * WebKitTestRunner/TestOptions.h:
+        (WTR::TestOptions::hasSameInitializationOptions const):
+        * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+        (WTR::TestController::platformCreateWebView):
+
 2019-01-11  Zalan Bujtas  <zalan@apple.com>
 
         [LFC][BFC][MarginCollapsing] Adjust vertical position when box margin collapses through.
 2019-01-11  Zalan Bujtas  <zalan@apple.com>
 
         [LFC][BFC][MarginCollapsing] Adjust vertical position when box margin collapses through.
index 6d4dffb..7c88e00 100644 (file)
@@ -1264,6 +1264,8 @@ static void updateTestOptionsFromTestHeader(TestOptions& testOptions, const std:
             testOptions.enableEditableImages = parseBooleanTestHeaderValue(value);
         else if (key == "editable")
             testOptions.editable = parseBooleanTestHeaderValue(value);
             testOptions.enableEditableImages = parseBooleanTestHeaderValue(value);
         else if (key == "editable")
             testOptions.editable = parseBooleanTestHeaderValue(value);
+        else if (key == "enableUndoManagerAPI")
+            testOptions.enableUndoManagerAPI = parseBooleanTestHeaderValue(value);
         pairStart = pairEnd + 1;
     }
 }
         pairStart = pairEnd + 1;
     }
 }
index 05a4efb..10cd4e4 100644 (file)
@@ -67,6 +67,7 @@ struct TestOptions {
     bool shouldShowSpellCheckingDots { false };
     bool enableEditableImages { false };
     bool editable { false };
     bool shouldShowSpellCheckingDots { false };
     bool enableEditableImages { false };
     bool editable { false };
+    bool enableUndoManagerAPI { false };
 
     float deviceScaleFactor { 1 };
     Vector<String> overrideLanguages;
 
     float deviceScaleFactor { 1 };
     Vector<String> overrideLanguages;
@@ -111,7 +112,8 @@ struct TestOptions {
             || shouldShowSpellCheckingDots != options.shouldShowSpellCheckingDots
             || shouldIgnoreMetaViewport != options.shouldIgnoreMetaViewport
             || enableEditableImages != options.enableEditableImages
             || shouldShowSpellCheckingDots != options.shouldShowSpellCheckingDots
             || shouldIgnoreMetaViewport != options.shouldIgnoreMetaViewport
             || enableEditableImages != options.enableEditableImages
-            || editable != options.editable)
+            || editable != options.editable
+            || enableUndoManagerAPI != options.enableUndoManagerAPI)
             return false;
 
         if (experimentalFeatures != options.experimentalFeatures)
             return false;
 
         if (experimentalFeatures != options.experimentalFeatures)
index 11b0e3a..2c1f6a6 100644 (file)
@@ -161,6 +161,9 @@ void TestController::platformCreateWebView(WKPageConfigurationRef, const TestOpt
     if (options.enableEditableImages)
         [copiedConfiguration _setEditableImagesEnabled:YES];
 
     if (options.enableEditableImages)
         [copiedConfiguration _setEditableImagesEnabled:YES];
 
+    if (options.enableUndoManagerAPI)
+        [copiedConfiguration _setUndoManagerAPIEnabled:YES];
+
     if (options.applicationManifest.length()) {
         auto manifestPath = [NSString stringWithUTF8String:options.applicationManifest.c_str()];
         NSString *text = [NSString stringWithContentsOfFile:manifestPath usedEncoding:nullptr error:nullptr];
     if (options.applicationManifest.length()) {
         auto manifestPath = [NSString stringWithUTF8String:options.applicationManifest.c_str()];
         NSString *text = [NSString stringWithContentsOfFile:manifestPath usedEncoding:nullptr error:nullptr];