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)
commit6190dc93076c25b938c81a4324cecbd54c25bfe6
treecb22e0e7350bdb2a73c3d4ba889eb7a3f26857ee
parentf24cc97ea1a3718feb7efec492ec8f46fc4e5fbf
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.

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