WebKit Bugzilla
Attachment 358847 Details for
Bug 193109
: Introduce IDL files for runtime-enabled UndoManager and UndoItem JavaScript API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193109-20190110161742.patch (text/plain), 44.78 KB, created by
Wenson Hsieh
on 2019-01-10 16:17:43 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2019-01-10 16:17:43 PST
Size:
44.78 KB
patch
obsolete
>Subversion Revision: 239848 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 83645890e9929c589987122754dd7242b07a2a34..55738bc246bc8b288b849f46b8c3334bb89675ba 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,63 @@ >+2019-01-10 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 NOBODY (OOPS!). >+ >+ 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. >+ >+ Test: editing/undo/UndoManager/undo-manager-interfaces.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::UndoManager): >+ * page/UndoManager.idl: Added. >+ * page/mac/WheelEventDeltaFilterMac.h: >+ >+ Necessary (albeit unrelated) build fix to appease unified sources. >+ > 2019-01-10 Simon Fraser <simon.fraser@apple.com> > > Fix rare crash under ScrollbarThemeMac::paintScrollCorner() >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index d768ac97748f4dfc61a0171ffa5566494cc5f97a..49abe15e9946be2099be626920407103fabaac99 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,23 @@ >+2019-01-10 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 NOBODY (OOPS!). >+ >+ 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 Per Arne Vollan <pvollan@apple.com> > > [macOS] Add name of IORegistry key in sandbox. >diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt >index 1dd5329a9b596798239e7e2a71405873e402044c..320d169796af97969b9dcf7f6497ec41a8a13e78 100644 >--- a/Source/WebCore/CMakeLists.txt >+++ b/Source/WebCore/CMakeLists.txt >@@ -926,6 +926,8 @@ set(WebCore_NON_SVG_IDL_FILES > page/ScrollLogicalPosition.idl > page/ScrollToOptions.idl > page/ShareData.idl >+ page/UndoItem.idl >+ page/UndoManager.idl > page/VisualViewport.idl > page/WebKitPoint.idl > page/WindowEventHandlers.idl >diff --git a/Source/WebCore/DerivedSources-input.xcfilelist b/Source/WebCore/DerivedSources-input.xcfilelist >index 90b25fa1e53185a10d30ae5ef1d34f5ae8cc475f..fff1d07441d166a31d39390a76770cd69b514dda 100644 >--- a/Source/WebCore/DerivedSources-input.xcfilelist >+++ b/Source/WebCore/DerivedSources-input.xcfilelist >@@ -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/UndoItem.idl >+$(PROJECT_DIR)/page/UndoManager.idl > $(PROJECT_DIR)/page/UserMessageHandler.idl > $(PROJECT_DIR)/page/UserMessageHandlersNamespace.idl > $(PROJECT_DIR)/page/VisualViewport.idl >diff --git a/Source/WebCore/DerivedSources-output.xcfilelist b/Source/WebCore/DerivedSources-output.xcfilelist >index dfbb88b0c675c70c10cc27ce8a26fa148ce67cc8..8d2ac9d57c513f28291ab25a70014bcfb7f6263a 100644 >--- a/Source/WebCore/DerivedSources-output.xcfilelist >+++ b/Source/WebCore/DerivedSources-output.xcfilelist >@@ -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/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 >diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make >index e17c6afa7a7c013191c8c3e9757f36eb60fb3e55..e6babe73a3182861b1796856e1748b0f1a3ce4fb 100644 >--- a/Source/WebCore/DerivedSources.make >+++ b/Source/WebCore/DerivedSources.make >@@ -875,6 +875,8 @@ JS_BINDING_IDLS = \ > $(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 \ >diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt >index e70346076183c9ed769b3f481c68c1fe99470050..823c3dde3e674433865a1308bce3f7d982b3318f 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -1506,6 +1506,7 @@ page/SocketProvider.cpp > page/SpatialNavigation.cpp > page/SuspendableTimer.cpp > page/TextIndicator.cpp >+page/UndoManager.cpp > page/UserContentProvider.cpp > page/UserContentController.cpp > page/UserContentURLPattern.cpp >@@ -3222,6 +3223,8 @@ JSTextMetrics.cpp > JSTimeRanges.cpp > JSTransitionEvent.cpp > JSTreeWalker.cpp >+JSUndoItem.cpp >+JSUndoManager.cpp > JSUIEvent.cpp > JSUIEventInit.cpp > JSURLSearchParams.cpp >diff --git a/Source/WebCore/UnifiedSources-input.xcfilelist b/Source/WebCore/UnifiedSources-input.xcfilelist >index dfc2a3c29529a4146448ec8c3b5bcee081411730..07ce9464a8999726ee1a60435951312ef339da15 100644 >--- a/Source/WebCore/UnifiedSources-input.xcfilelist >+++ b/Source/WebCore/UnifiedSources-input.xcfilelist >@@ -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/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 >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 09c07bb5dac616f0504b34525da26db36e165fa0..394f30fb897d489a9270f17e9fe6d316b33aacdb 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -868,6 +868,8 @@ > 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 */; }; >@@ -6833,6 +6835,11 @@ > 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>"; }; >@@ -20222,6 +20229,11 @@ > 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 */, >@@ -31859,6 +31871,8 @@ > 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 */, >diff --git a/Source/WebCore/bindings/js/WebCoreBuiltinNames.h b/Source/WebCore/bindings/js/WebCoreBuiltinNames.h >index 2ae1ecf78361d866821c6e9c83ed5c43bbec456c..f89ff0d9acd74ba06e2f84a771ea10abc273f417 100644 >--- a/Source/WebCore/bindings/js/WebCoreBuiltinNames.h >+++ b/Source/WebCore/bindings/js/WebCoreBuiltinNames.h >@@ -178,6 +178,8 @@ namespace WebCore { > macro(StaticRange) \ > macro(StylePropertyMapReadOnly) \ > macro(StylePropertyMap) \ >+ macro(UndoItem) \ >+ macro(UndoManager) \ > macro(VRDisplay) \ > macro(VRDisplayCapabilities) \ > macro(VRDisplayEvent) \ >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index e60a0b48f5c294d097307a15e0fe8ffea336b641..74fe60763b2bba923a255009ddc7b5b01ca85eba 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -210,6 +210,7 @@ > #include "TextNodeTraversal.h" > #include "TransformSource.h" > #include "TreeWalker.h" >+#include "UndoManager.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_undoManager(UndoManager::create(*this)) > { > auto addResult = allDocumentsMap().add(m_identifier, this); > ASSERT_UNUSED(addResult, addResult.isNewEntry); >diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h >index 77f2dbd68f53f70fbf85c6a80abf77e815c30a26..1df75ec3e3f8e3e7bcd8b8c77f5ac4b9e0f1da46 100644 >--- a/Source/WebCore/dom/Document.h >+++ b/Source/WebCore/dom/Document.h >@@ -186,6 +186,7 @@ class StyleSheetList; > class Text; > class TextResourceDecoder; > class TreeWalker; >+class UndoManager; > 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); > >+ UndoManager& undoManager() const { return m_undoManager.get(); } >+ > // 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 }; >+ >+ Ref<UndoManager> m_undoManager; > }; > > Element* eventTargetElementForDocument(Document*); >diff --git a/Source/WebCore/dom/Document.idl b/Source/WebCore/dom/Document.idl >index 1b68f24364d2ff583aa8d944df36490b4a3d7f1f..6f6379b8cffc95cf5d1c6ee807779667185419d8 100644 >--- a/Source/WebCore/dom/Document.idl >+++ b/Source/WebCore/dom/Document.idl >@@ -126,6 +126,7 @@ typedef ( > 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; >diff --git a/Source/WebCore/page/RuntimeEnabledFeatures.h b/Source/WebCore/page/RuntimeEnabledFeatures.h >index 114558efa65818dbf6b38dae4abc46a2fb3e31b6..02face0d3574bdc3bb5a3318a2e721c20289e26d 100644 >--- a/Source/WebCore/page/RuntimeEnabledFeatures.h >+++ b/Source/WebCore/page/RuntimeEnabledFeatures.h >@@ -315,6 +315,9 @@ public: > 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; } >@@ -506,6 +509,8 @@ private: > bool m_systemPreviewEnabled { false }; > #endif > >+ bool m_undoManagerAPIEnabled { false }; >+ > friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>; > }; > >diff --git a/Source/WebCore/page/UndoItem.h b/Source/WebCore/page/UndoItem.h >new file mode 100644 >index 0000000000000000000000000000000000000000..22c3bf1ddc63383370fd24e6f522c428429537dd >--- /dev/null >+++ b/Source/WebCore/page/UndoItem.h >@@ -0,0 +1,66 @@ >+/* >+ * 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/RefCounted.h> >+#include <wtf/text/WTFString.h> >+ >+namespace WebCore { >+ >+class UndoItem : public RefCounted<UndoItem> { >+public: >+ struct Init { >+ RefPtr<VoidCallback> undo; >+ RefPtr<VoidCallback> redo; >+ }; >+ >+ static Ref<UndoItem> create(String&& label, Init&& init) >+ { >+ return adoptRef(*new UndoItem(WTFMove(label), WTFMove(init))); >+ } >+ >+ virtual ~UndoItem() = default; >+ >+ const String& label() const { return m_label; } >+ VoidCallback& undoHandler() const { return m_undoHandler.get(); } >+ VoidCallback& redoHandler() const { return m_redoHandler.get(); } >+ >+private: >+ UndoItem(String&& label, Init&& init) >+ : m_label(WTFMove(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 >index 0000000000000000000000000000000000000000..ea458f2873d599a011f07112805b2b6ba16639da >--- /dev/null >+++ b/Source/WebCore/page/UndoItem.idl >@@ -0,0 +1,38 @@ >+/* >+ * 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 VoidCallback undo; >+ required VoidCallback redo; >+}; >+ >+[ >+ EnabledAtRuntime=UndoManagerAPI, >+ Constructor(DOMString label, 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 >index 0000000000000000000000000000000000000000..293163dc3f52bf3ec8c86f17db67faf86e3163e0 >--- /dev/null >+++ b/Source/WebCore/page/UndoManager.cpp >@@ -0,0 +1,39 @@ >+/* >+ * 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" >+ >+namespace WebCore { >+ >+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 >index 0000000000000000000000000000000000000000..7c106e37ead7947b372703d80c333bd95d2269c7 >--- /dev/null >+++ b/Source/WebCore/page/UndoManager.h >@@ -0,0 +1,55 @@ >+/* >+ * 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/Ref.h> >+#include <wtf/RefCounted.h> >+ >+namespace WebCore { >+ >+class Document; >+class UndoItem; >+ >+class UndoManager : public RefCounted<UndoManager> { >+public: >+ static Ref<UndoManager> create(Document& document) >+ { >+ return adoptRef(*new UndoManager(document)); >+ } >+ >+ virtual ~UndoManager() = default; >+ void addItem(Ref<UndoItem>&&); >+ >+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 >index 0000000000000000000000000000000000000000..92ca17591b59cf7cef47f5fe08629ef98653a750 >--- /dev/null >+++ b/Source/WebCore/page/UndoManager.idl >@@ -0,0 +1,30 @@ >+/* >+ * 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 >+] interface UndoManager { >+ void addItem(UndoItem item); >+}; >diff --git a/Source/WebCore/page/mac/WheelEventDeltaFilterMac.h b/Source/WebCore/page/mac/WheelEventDeltaFilterMac.h >index 310822ccbc15dbdd771982374c08924841f7fd57..2cc98bf791cd27ca5d6b77e0f5a5adac45ea19e9 100644 >--- a/Source/WebCore/page/mac/WheelEventDeltaFilterMac.h >+++ b/Source/WebCore/page/mac/WheelEventDeltaFilterMac.h >@@ -28,6 +28,7 @@ > #if PLATFORM(MAC) > > #include "WheelEventDeltaFilter.h" >+#include <wtf/MonotonicTime.h> > #include <wtf/RetainPtr.h> > > OBJC_CLASS _NSScrollingPredominantAxisFilter; >diff --git a/Source/WebKit/Shared/WebPreferences.yaml b/Source/WebKit/Shared/WebPreferences.yaml >index 00a8de82488a15a8d02933cc76d2c70bb9716bbc..bcfa73faedfbfd21a0155adcbf643bf5ce1477eb 100644 >--- a/Source/WebKit/Shared/WebPreferences.yaml >+++ b/Source/WebKit/Shared/WebPreferences.yaml >@@ -1528,3 +1528,11 @@ RestrictedHTTPResponseAccess: > 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 >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >index cf1919c93a738530759e37f33dbb10b4cd045878..11633c6b4d02fef7cab0d6a27eeb380c29f5f230 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >@@ -645,6 +645,7 @@ - (void)_initializeWithConfiguration:(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::undoManagerAPIEnabledKey(), WebKit::WebPreferencesStore::Value(!![_configuration _undoManagerAPIEnabled])); > > #if ENABLE(LEGACY_ENCRYPTED_MEDIA) > pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::legacyEncryptedMediaAPIEnabledKey(), WebKit::WebPreferencesStore::Value(!![_configuration _legacyEncryptedMediaAPIEnabled])); >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm >index de6f33ed972ec7f039ba6e21a59bc69805820257..f983fa6477ad971cbe7cef7a49e53ea0dc11d791 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm >@@ -160,6 +160,7 @@ @implementation WKWebViewConfiguration { > BOOL _shouldDeferAsynchronousScriptsUntilAfterDocumentLoad; > BOOL _drawsBackground; > BOOL _editableImagesEnabled; >+ BOOL _undoManagerAPIEnabled; > > RetainPtr<NSString> _mediaContentTypesRequiringHardwareSupport; > RetainPtr<NSArray<NSString *>> _additionalSupportedImageTypes; >@@ -248,6 +249,7 @@ - (instancetype)init > _drawsBackground = YES; > > _editableImagesEnabled = NO; >+ _undoManagerAPIEnabled = YES; > > return self; > } >@@ -409,6 +411,7 @@ - (id)copyWithZone:(NSZone *)zone > configuration->_drawsBackground = self->_drawsBackground; > > configuration->_editableImagesEnabled = self->_editableImagesEnabled; >+ configuration->_undoManagerAPIEnabled = self->_undoManagerAPIEnabled; > > return configuration; > } >@@ -1037,6 +1040,16 @@ - (BOOL)_editableImagesEnabled > return _editableImagesEnabled; > } > >+- (void)_setUndoManagerAPIEnabled:(BOOL)enabled >+{ >+ _undoManagerAPIEnabled = enabled; >+} >+ >+- (BOOL)_undoManagerAPIEnabled >+{ >+ return _undoManagerAPIEnabled; >+} >+ > @end > > @implementation WKWebViewConfiguration (WKDeprecated) >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h >index 37c430fbe8a5160df669e013e0e12e51617799bd..2abc8c14abf8b7eb64ff9e068f13caa5e78845ac 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h >@@ -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, setter=_setUndoManagerAPIEnabled:) BOOL _undoManagerAPIEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); > > @end > >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 6545e9bce7c37b2e99458af185f556f39f4155f7..162db7f63c20fee14a2991e09c81f5c6a4441401 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,20 @@ >+2019-01-10 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 NOBODY (OOPS!). >+ >+ 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-10 Joseph Pecoraro <pecoraro@apple.com> > > Leak of WKWebProcessPlugInHitTestResult (160 bytes) in com.apple.WebKit.WebContent running layout tests >diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp >index 6d4dffb49656524c64d962e79fe238384c69c0c6..7c88e0027f3d750be61567232a881adcdfb4dda8 100644 >--- a/Tools/WebKitTestRunner/TestController.cpp >+++ b/Tools/WebKitTestRunner/TestController.cpp >@@ -1264,6 +1264,8 @@ static void updateTestOptionsFromTestHeader(TestOptions& testOptions, const std: > testOptions.enableEditableImages = parseBooleanTestHeaderValue(value); > else if (key == "editable") > testOptions.editable = parseBooleanTestHeaderValue(value); >+ else if (key == "enableUndoManagerAPI") >+ testOptions.enableUndoManagerAPI = parseBooleanTestHeaderValue(value); > pairStart = pairEnd + 1; > } > } >diff --git a/Tools/WebKitTestRunner/TestOptions.h b/Tools/WebKitTestRunner/TestOptions.h >index 05a4efbf90e5cce9dc404e841c700612278a60e5..10cd4e4c34571b0b1b8a02cb6dd479c67fec7340 100644 >--- a/Tools/WebKitTestRunner/TestOptions.h >+++ b/Tools/WebKitTestRunner/TestOptions.h >@@ -67,6 +67,7 @@ struct TestOptions { > bool shouldShowSpellCheckingDots { false }; > bool enableEditableImages { false }; > bool editable { false }; >+ bool enableUndoManagerAPI { false }; > > float deviceScaleFactor { 1 }; > Vector<String> overrideLanguages; >@@ -111,7 +112,8 @@ struct TestOptions { > || shouldShowSpellCheckingDots != options.shouldShowSpellCheckingDots > || shouldIgnoreMetaViewport != options.shouldIgnoreMetaViewport > || enableEditableImages != options.enableEditableImages >- || editable != options.editable) >+ || editable != options.editable >+ || enableUndoManagerAPI != options.enableUndoManagerAPI) > return false; > > if (experimentalFeatures != options.experimentalFeatures) >diff --git a/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm b/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm >index 11b0e3ae34fbbe7e1ba9e1721a4d118d33026796..2c1f6a63c9e49e7cce81dacb60dda2f8f5b18a83 100644 >--- a/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm >+++ b/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm >@@ -161,6 +161,9 @@ void TestController::platformCreateWebView(WKPageConfigurationRef, const TestOpt > 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]; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 2ecf09afc99591e32526ab26bd28f05d942d0096..6948638ee9631389336f66642f60edc14630aefc 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,19 @@ >+2019-01-10 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 NOBODY (OOPS!). >+ >+ Add UndoManager tests to exercise new bindings. >+ >+ * TestExpectations: >+ * editing/undo/UndoManager/undo-manager-interfaces-expected.txt: Added. >+ * editing/undo/UndoManager/undo-manager-interfaces.html: Added. >+ * platform/ios-wk2/TestExpectations: >+ * platform/mac-wk2/TestExpectations: >+ > 2019-01-10 Eric Carlson <eric.carlson@apple.com> > > Define page media state flags for display capture. >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index ddf324e9d8342c3b34dc67f4fe52cc745347b1a2..99289b89d88e53be4385b155b5b8cce9a647a1a9 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -19,6 +19,7 @@ editing/input/ios [ Skip ] > editing/find [ Skip ] > editing/pasteboard/gtk [ Skip ] > editing/selection/ios [ Skip ] >+editing/undo/UndoManager [ Skip ] > tiled-drawing [ Skip ] > fast/css/watchos [ Skip ] > fast/dom/Window/watchos [ Skip ] >diff --git a/LayoutTests/editing/undo/UndoManager/undo-manager-interfaces-expected.txt b/LayoutTests/editing/undo/UndoManager/undo-manager-interfaces-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..5b428d8905612ee85edb6511e6f214ea0d1fb562 >--- /dev/null >+++ b/LayoutTests/editing/undo/UndoManager/undo-manager-interfaces-expected.txt >@@ -0,0 +1,44 @@ >+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('') threw exception TypeError: Not enough arguments. >+PASS new UndoItem('', 0) threw exception TypeError: Type error. >+PASS new UndoItem('', { }) threw exception TypeError: Member UndoItemInit.redo is required and must be an instance of VoidCallback. >+PASS new UndoItem('', { 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: Type error. >+PASS new UndoItem('', { undo: emptyFunction }) threw exception TypeError: Member UndoItemInit.redo is required and must be an instance of VoidCallback. >+PASS new UndoItem('', { redo: emptyFunction }) threw exception TypeError: Member UndoItemInit.undo is required and must be an instance of VoidCallback. >+PASS new UndoItem('', { undo: null, redo: null }) threw exception TypeError: Type error. >+PASS new UndoItem('', { undo: '', redo: emptyFunction }) threw exception TypeError: Type error. >+PASS new UndoItem('', { undo: emptyFunction, redo: 10 }) threw exception TypeError: Type error. >+PASS new UndoItem('', { undo: emptyFunction, redo: emptyFunction, foo: 'hi' }) instanceof UndoItem is true >+PASS Object.getPrototypeOf(new UndoItem('', { undo: emptyFunction, redo: emptyFunction })) === UndoItem.prototype is true >+PASS new UndoItem('foo', { undo: emptyFunction, redo: emptyFunction }).label is "foo" >+PASS UndoItem.toString() is "function UndoItem() {\n [native code]\n}" >+PASS new UndoItem('', { undo: emptyFunction, redo: emptyFunction }).toString() is "[object UndoItem]" >+PASS document.undoManager.addItem(new UndoItem('', { undo: emptyFunction, redo: emptyFunction })) did not throw exception. >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/editing/undo/UndoManager/undo-manager-interfaces.html b/LayoutTests/editing/undo/UndoManager/undo-manager-interfaces.html >new file mode 100644 >index 0000000000000000000000000000000000000000..418c272ce33d7e0d98f06104fc9b2bf20f6d9d45 >--- /dev/null >+++ b/LayoutTests/editing/undo/UndoManager/undo-manager-interfaces.html >@@ -0,0 +1,50 @@ >+<!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('')"); >+ shouldThrow("new UndoItem('', 0)"); >+ shouldThrow("new UndoItem('', { })"); >+ shouldThrow("new UndoItem('', { undo: null })"); >+ shouldThrow("new UndoItem('', { redo: null })"); >+ shouldThrow("new UndoItem('', { undo: emptyFunction })"); >+ shouldThrow("new UndoItem('', { redo: emptyFunction })"); >+ shouldThrow("new UndoItem('', { undo: null, redo: null })"); >+ shouldThrow("new UndoItem('', { undo: '', redo: emptyFunction })"); >+ shouldThrow("new UndoItem('', { undo: emptyFunction, redo: 10 })"); >+ shouldBeTrue("new UndoItem('', { undo: emptyFunction, redo: emptyFunction, foo: 'hi' }) instanceof UndoItem"); >+ shouldBeTrue("Object.getPrototypeOf(new UndoItem('', { undo: emptyFunction, redo: emptyFunction })) === UndoItem.prototype"); >+ shouldBeEqualToString("new UndoItem('foo', { undo: emptyFunction, redo: emptyFunction }).label", "foo"); >+ shouldBeEqualToString("UndoItem.toString()", "function UndoItem() {\n [native code]\n}"); >+ shouldBeEqualToString("new UndoItem('', { undo: emptyFunction, redo: emptyFunction }).toString()", "[object UndoItem]"); >+ shouldNotThrow("document.undoManager.addItem(new UndoItem('', { undo: emptyFunction, redo: emptyFunction }))"); >+ } >+ </script> >+ <body onload=runTest()></body> >+</html> >diff --git a/LayoutTests/platform/ios-wk2/TestExpectations b/LayoutTests/platform/ios-wk2/TestExpectations >index 034f122f421d0f3235d99c785ed7e71d2ed8da38..998a42b11d89df0d57713d4ff1676153af0d9370 100644 >--- a/LayoutTests/platform/ios-wk2/TestExpectations >+++ b/LayoutTests/platform/ios-wk2/TestExpectations >@@ -16,6 +16,7 @@ tiled-drawing/ios [ Pass ] > fast/web-share [ Pass ] > editing/find [ Pass ] > editing/input/ios [ Pass ] >+editing/undo/UndoManager [ Pass ] > > editing/selection/character-granularity-rect.html [ Failure ] > >diff --git a/LayoutTests/platform/mac-wk2/TestExpectations b/LayoutTests/platform/mac-wk2/TestExpectations >index 714d9e9c52a88a51bcba6bd6cf2e81212d627c04..8b64f431b2a8876edb1f62af2d1dae99e466924d 100644 >--- a/LayoutTests/platform/mac-wk2/TestExpectations >+++ b/LayoutTests/platform/mac-wk2/TestExpectations >@@ -11,6 +11,7 @@ fast/visual-viewport/tiled-drawing [ Pass ] > swipe [ Pass ] > fast/web-share [ Pass ] > editing/find [ Pass ] >+editing/undo/UndoManager [ Pass ] > > fast/events/autoscroll-when-zoomed.html [ Pass ] > fast/events/autoscroll-main-document.html [ Pass ]
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
rniwa
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193109
:
358282
| 358847 |
358873