WebKit Bugzilla
Attachment 359856 Details for
Bug 193706
: Introduce UndoStep::label() and adopt it in WebKitLegacy and WebKit
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193706-20190122223440.patch (text/plain), 28.21 KB, created by
Wenson Hsieh
on 2019-01-22 22:34:42 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2019-01-22 22:34:42 PST
Size:
28.21 KB
patch
obsolete
>Subversion Revision: 240329 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 57e0d649a59035050fcfdc710a7c3b8fd1aa6784..69b854660e20dccf5c22971fc6f575bd0fbc7c40 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,43 @@ >+2019-01-22 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Introduce UndoStep::undoRedoLabel() and adopt it in WebKitLegacy and WebKit >+ https://bugs.webkit.org/show_bug.cgi?id=193706 >+ <rdar://problem/44807048> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Refactors some existing logic when registering undoable actions, such that we propagate the undoable action's >+ label string instead of the EditAction to the client layer. This will help make handling of CustomUndoStep's >+ undo/redo label simpler, as the client layer won't need to worry about managing an EditAction and undo/redo >+ label simultaneously. There should be no change in behavior. >+ >+ * editing/CompositeEditCommand.cpp: >+ (WebCore::EditCommandComposition::undoRedoLabel const): >+ * editing/CompositeEditCommand.h: >+ * editing/CustomUndoStep.cpp: >+ (WebCore::CustomUndoStep::undoRedoLabel const): >+ * editing/CustomUndoStep.h: >+ * editing/EditAction.cpp: >+ (WebCore::undoRedoLabel): >+ (WebCore::nameForUndoRedo): Deleted. >+ * editing/EditAction.h: >+ >+ Rename nameForUndoRedo to undoRedoLabel, and remove the WEBCORE_EXPORT since it's no longer needed in WebKit or >+ WebKitLegacy. >+ >+ * editing/UndoStep.h: >+ >+ Add UndoStep::undoRedoLabel(). While EditCommandComposition implements this by mapping its EditAction to a >+ localized string, CustomUndoStep implements this by returning the undoable action label provided by script. >+ >+ * loader/EmptyClients.cpp: >+ (WebCore::EmptyEditorClient::registerUndoStep): >+ (WebCore::EmptyEditorClient::registerRedoStep): >+ >+ Also tweak these client functions to take a `Ref<UndoStep>&&`. >+ >+ * page/EditorClient.h: >+ > 2019-01-22 Wenson Hsieh <wenson_hsieh@apple.com> > > Introduce CustomUndoStep.h and CustomUndoStep.cpp >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 63044153f92110e072a217ecdbf1c1620bb7205e..7535551b5648b349e0883488979ef8c4e4fb5bd6 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,50 @@ >+2019-01-22 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Introduce UndoStep::undoRedoLabel() and adopt it in WebKitLegacy and WebKit >+ https://bugs.webkit.org/show_bug.cgi?id=193706 >+ <rdar://problem/44807048> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * UIProcess/Cocoa/WebViewImpl.mm: >+ (WebKit::WebViewImpl::registerEditCommand): >+ * UIProcess/WebEditCommandProxy.cpp: >+ (WebKit::WebEditCommandProxy::WebEditCommandProxy): >+ * UIProcess/WebEditCommandProxy.h: >+ >+ Drive-by tweak: make WebEditCommandProxy's backpointer to its WebPageProxy a WeakPtr instead of a raw pointer. >+ Additionally, call clear() instead of setting m_page to 0 upon invalidation. Also, turn the WebPageProxy* >+ argument into a WebPageProxy&, since the WebPageProxy is assumed to exist when it creates a new >+ WebEditCommandProxy. >+ >+ (WebKit::WebEditCommandProxy::create): >+ (WebKit::WebEditCommandProxy::undoRedoLabel const): >+ (WebKit::WebEditCommandProxy::invalidate): >+ (WebKit::WebEditCommandProxy::editAction const): Deleted. >+ >+ Adjust UI-side logic to just handle the `undoRedoLabel`, rather than map the edit action to a localized string. >+ >+ * UIProcess/WebPageProxy.cpp: >+ (WebKit::WebPageProxy::registerEditCommandForUndo): >+ (WebKit::WebPageProxy::resetState): >+ >+ Tweak this to use std::exchange instead of copying all the WebEditCommandProxy RefPtrs into a separate Vector >+ and then iterating over the Vector. >+ >+ * UIProcess/WebPageProxy.h: >+ * UIProcess/WebPageProxy.messages.in: >+ >+ Adjust this so that we only send the undo/redo label over IPC, rather than the edit action type. >+ >+ * UIProcess/ios/PageClientImplIOS.mm: >+ (WebKit::PageClientImpl::registerEditCommand): >+ * WebProcess/WebCoreSupport/WebEditorClient.cpp: >+ (WebKit::WebEditorClient::registerUndoStep): >+ (WebKit::WebEditorClient::registerRedoStep): >+ * WebProcess/WebCoreSupport/WebEditorClient.h: >+ >+ Adjust this to take Ref<UndoStep>&&. >+ > 2019-01-22 Chris Dumez <cdumez@apple.com> > > Regression(r240178) Some API tests are crashing >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index c07f40f2bab5d891fff387682a54aa719957d225..e9f81db02397c61ce6f6c25ed70cb507f13399a9 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,21 @@ >+2019-01-22 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Introduce UndoStep::undoRedoLabel() and adopt it in WebKitLegacy and WebKit >+ https://bugs.webkit.org/show_bug.cgi?id=193706 >+ <rdar://problem/44807048> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Adjust for some changed interfaces. >+ >+ * WebCoreSupport/WebEditorClient.h: >+ * WebCoreSupport/WebEditorClient.mm: >+ (-[WebUndoStep initWithUndoStep:]): >+ (+[WebUndoStep stepWithUndoStep:]): >+ (WebEditorClient::registerUndoOrRedoStep): >+ (WebEditorClient::registerUndoStep): >+ (WebEditorClient::registerRedoStep): >+ > 2019-01-22 Alex Christensen <achristensen@webkit.org> > > Move NetworkStorageSession ownership to NetworkProcess >diff --git a/Source/WebKitLegacy/win/ChangeLog b/Source/WebKitLegacy/win/ChangeLog >index 4a6c903baf0ee21f6d84153628cfcae586ecd15d..40215a75ac8ec502f3b1d5b93d374cb9b12b5ef8 100644 >--- a/Source/WebKitLegacy/win/ChangeLog >+++ b/Source/WebKitLegacy/win/ChangeLog >@@ -1,3 +1,18 @@ >+2019-01-22 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Introduce UndoStep::undoRedoLabel() and adopt it in WebKitLegacy and WebKit >+ https://bugs.webkit.org/show_bug.cgi?id=193706 >+ <rdar://problem/44807048> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Adjust for some changed interfaces. >+ >+ * WebCoreSupport/WebEditorClient.cpp: >+ (WebEditorClient::registerUndoStep): >+ (WebEditorClient::registerRedoStep): >+ * WebCoreSupport/WebEditorClient.h: >+ > 2019-01-22 Alex Christensen <achristensen@webkit.org> > > Move NetworkStorageSession ownership to NetworkProcess >diff --git a/Source/WebCore/editing/CompositeEditCommand.cpp b/Source/WebCore/editing/CompositeEditCommand.cpp >index 242bd985cf620e4326f572cfb94594564dd5f9c5..6aabba90dd21519e34f48beafcca7c83cc7a8593 100644 >--- a/Source/WebCore/editing/CompositeEditCommand.cpp >+++ b/Source/WebCore/editing/CompositeEditCommand.cpp >@@ -302,6 +302,11 @@ void EditCommandComposition::getNodesInCommand(HashSet<Node*>& nodes) > } > #endif > >+String EditCommandComposition::undoRedoLabel() const >+{ >+ return WebCore::undoRedoLabel(m_editAction); >+} >+ > CompositeEditCommand::CompositeEditCommand(Document& document, EditAction editingAction) > : EditCommand(document, editingAction) > { >diff --git a/Source/WebCore/editing/CompositeEditCommand.h b/Source/WebCore/editing/CompositeEditCommand.h >index 2da520fdc4649292dc7bfca20b7d11b118c5da1c..1cfa9363f1dd0c10585ebcb3f5d09cbd097ae55d 100644 >--- a/Source/WebCore/editing/CompositeEditCommand.h >+++ b/Source/WebCore/editing/CompositeEditCommand.h >@@ -88,6 +88,8 @@ public: > private: > EditCommandComposition(Document&, const VisibleSelection& startingSelection, const VisibleSelection& endingSelection, EditAction); > >+ String undoRedoLabel() const final; >+ > RefPtr<Document> m_document; > VisibleSelection m_startingSelection; > VisibleSelection m_endingSelection; >diff --git a/Source/WebCore/editing/CustomUndoStep.cpp b/Source/WebCore/editing/CustomUndoStep.cpp >index 917f2aab75a68f19c24dd8cc625a69ecf3b3fb6b..60382a18889046466aa715a550662166f90f7e23 100644 >--- a/Source/WebCore/editing/CustomUndoStep.cpp >+++ b/Source/WebCore/editing/CustomUndoStep.cpp >@@ -65,4 +65,13 @@ bool CustomUndoStep::isValid() const > return m_undoItem && m_undoItem->isValid(); > } > >+String CustomUndoStep::undoRedoLabel() const >+{ >+ if (!isValid()) { >+ ASSERT_NOT_REACHED(); >+ return emptyString(); >+ } >+ return m_undoItem->label(); >+} >+ > } // namespace WebCore >diff --git a/Source/WebCore/editing/CustomUndoStep.h b/Source/WebCore/editing/CustomUndoStep.h >index fbce4543623125acc5f8d79660c9ed71c67f8294..1da240cbca5c622ca68c552757484017c9c97e4c 100644 >--- a/Source/WebCore/editing/CustomUndoStep.h >+++ b/Source/WebCore/editing/CustomUndoStep.h >@@ -47,6 +47,7 @@ private: > void unapply() final; > void reapply() final; > EditAction editingAction() const final { return EditAction::Unspecified; } >+ String undoRedoLabel() const final; > > bool isValid() const; > >diff --git a/Source/WebCore/editing/EditAction.cpp b/Source/WebCore/editing/EditAction.cpp >index 4125e35078f25a6edcf8e1d6899475474e962e3a..31d216f1d041fef3ce3d4f4f61b1d823206de7da 100644 >--- a/Source/WebCore/editing/EditAction.cpp >+++ b/Source/WebCore/editing/EditAction.cpp >@@ -30,7 +30,7 @@ > > namespace WebCore { > >-String nameForUndoRedo(EditAction editAction) >+String undoRedoLabel(EditAction editAction) > { > switch (editAction) { > case EditAction::Unspecified: >diff --git a/Source/WebCore/editing/EditAction.h b/Source/WebCore/editing/EditAction.h >index b6c45daf846a649e02e2945c12c8bcfead60b76d..17e8be976c5c9cd383bf1f500fcd5691f36e81b9 100644 >--- a/Source/WebCore/editing/EditAction.h >+++ b/Source/WebCore/editing/EditAction.h >@@ -95,6 +95,6 @@ enum class EditAction : uint8_t { > InsertEditableImage > }; > >-WEBCORE_EXPORT WTF::String nameForUndoRedo(EditAction); >+WTF::String undoRedoLabel(EditAction); > > } // namespace WebCore >diff --git a/Source/WebCore/editing/UndoStep.h b/Source/WebCore/editing/UndoStep.h >index 00c1700107b2cc79cc132679d898d705ba787e78..435d6e2cc71407192201e818163fbbcb8623847b 100644 >--- a/Source/WebCore/editing/UndoStep.h >+++ b/Source/WebCore/editing/UndoStep.h >@@ -32,6 +32,7 @@ > > #include "EditAction.h" > #include <wtf/RefCounted.h> >+#include <wtf/text/WTFString.h> > > namespace WebCore { > >@@ -42,6 +43,7 @@ public: > virtual void unapply() = 0; > virtual void reapply() = 0; > virtual EditAction editingAction() const = 0; >+ virtual String undoRedoLabel() const = 0; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/loader/EmptyClients.cpp b/Source/WebCore/loader/EmptyClients.cpp >index a5e5ef758354fec743608a033eb69cd701805b47..ae920f01abf8721c362a5536136aab38d081144c 100644 >--- a/Source/WebCore/loader/EmptyClients.cpp >+++ b/Source/WebCore/loader/EmptyClients.cpp >@@ -186,8 +186,8 @@ private: > void requestCandidatesForSelection(const VisibleSelection&) final { } > void handleAcceptedCandidateWithSoftSpaces(TextCheckingResult) final { } > >- void registerUndoStep(UndoStep&) final; >- void registerRedoStep(UndoStep&) final; >+ void registerUndoStep(Ref<UndoStep>&&) final; >+ void registerRedoStep(Ref<UndoStep>&&) final; > void clearUndoRedoOperations() final { } > > bool canCopyCut(Frame*, bool defaultValue) const final { return defaultValue; } >@@ -507,11 +507,11 @@ void EmptyEditorClient::EmptyTextCheckerClient::requestCheckingOfString(TextChec > { > } > >-void EmptyEditorClient::registerUndoStep(UndoStep&) >+void EmptyEditorClient::registerUndoStep(Ref<UndoStep>&&) > { > } > >-void EmptyEditorClient::registerRedoStep(UndoStep&) >+void EmptyEditorClient::registerRedoStep(Ref<UndoStep>&&) > { > } > >diff --git a/Source/WebCore/page/EditorClient.h b/Source/WebCore/page/EditorClient.h >index 37bf1823a98c2d9e52f3d02cbf5bcffaee358c44..abbf5829c17dcae97d04b2ccfb4e0dd3344d42ac 100644 >--- a/Source/WebCore/page/EditorClient.h >+++ b/Source/WebCore/page/EditorClient.h >@@ -104,8 +104,8 @@ public: > virtual void canceledComposition() = 0; > virtual void didUpdateComposition() = 0; > >- virtual void registerUndoStep(UndoStep&) = 0; >- virtual void registerRedoStep(UndoStep&) = 0; >+ virtual void registerUndoStep(Ref<UndoStep>&&) = 0; >+ virtual void registerRedoStep(Ref<UndoStep>&&) = 0; > virtual void clearUndoRedoOperations() = 0; > > virtual bool canCopyCut(Frame*, bool defaultValue) const = 0; >diff --git a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm b/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >index 064e0dfd90ff6bb9ddc3ab442ec8cda69aa2d96d..8d1a97ff4556968e12038844f5e61fe8bbf54fb3 100644 >--- a/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >+++ b/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm >@@ -2692,7 +2692,7 @@ void WebViewImpl::executeEditCommandForSelector(SEL selector, const String& argu > > void WebViewImpl::registerEditCommand(Ref<WebEditCommandProxy>&& command, UndoOrRedo undoOrRedo) > { >- auto actionName = WebCore::nameForUndoRedo(command->editAction()); >+ auto actionName = command->undoRedoLabel(); > auto commandObjC = adoptNS([[WKEditCommand alloc] initWithWebEditCommandProxy:WTFMove(command)]); > > NSUndoManager *undoManager = [m_view undoManager]; >diff --git a/Source/WebKit/UIProcess/WebEditCommandProxy.cpp b/Source/WebKit/UIProcess/WebEditCommandProxy.cpp >index 9f83e3c19d86c9f2353a7e957610a1ea5d8584b2..9619eec3caefc8000703f5fe3bd99774c01596f1 100644 >--- a/Source/WebKit/UIProcess/WebEditCommandProxy.cpp >+++ b/Source/WebKit/UIProcess/WebEditCommandProxy.cpp >@@ -36,10 +36,10 @@ > namespace WebKit { > using namespace WebCore; > >-WebEditCommandProxy::WebEditCommandProxy(WebUndoStepID commandID, WebCore::EditAction editAction, WebPageProxy* page) >+WebEditCommandProxy::WebEditCommandProxy(WebUndoStepID commandID, const String& undoRedoLabel, WebPageProxy& page) > : m_commandID(commandID) >- , m_editAction(editAction) >- , m_page(page) >+ , m_undoRedoLabel(undoRedoLabel) >+ , m_page(makeWeakPtr(page)) > { > m_page->addEditCommand(*this); > } >diff --git a/Source/WebKit/UIProcess/WebEditCommandProxy.h b/Source/WebKit/UIProcess/WebEditCommandProxy.h >index 716cb58f403dd823196f8642f75f4df3d71aa8ca..20ed694c0d4361a109a0d8d01d1af76a4df8e882 100644 >--- a/Source/WebKit/UIProcess/WebEditCommandProxy.h >+++ b/Source/WebKit/UIProcess/WebEditCommandProxy.h >@@ -31,6 +31,7 @@ > #include <wtf/Forward.h> > #include <wtf/RefCounted.h> > #include <wtf/RefPtr.h> >+#include <wtf/WeakPtr.h> > > namespace WebKit { > >@@ -38,26 +39,26 @@ class WebPageProxy; > > class WebEditCommandProxy : public API::ObjectImpl<API::Object::Type::EditCommandProxy> { > public: >- static Ref<WebEditCommandProxy> create(WebUndoStepID commandID, WebCore::EditAction editAction, WebPageProxy* page) >+ static Ref<WebEditCommandProxy> create(WebUndoStepID commandID, const String& undoRedoLabel, WebPageProxy& page) > { >- return adoptRef(*new WebEditCommandProxy(commandID, editAction, page)); >+ return adoptRef(*new WebEditCommandProxy(commandID, undoRedoLabel, page)); > } > ~WebEditCommandProxy(); > > WebUndoStepID commandID() const { return m_commandID; } >- WebCore::EditAction editAction() const { return m_editAction; } >+ const String& undoRedoLabel() const { return m_undoRedoLabel; } > >- void invalidate() { m_page = 0; } >+ void invalidate() { m_page.clear(); } > > void unapply(); > void reapply(); > > private: >- WebEditCommandProxy(WebUndoStepID commandID, WebCore::EditAction, WebPageProxy*); >+ WebEditCommandProxy(WebUndoStepID commandID, const String& undoRedoLabel, WebPageProxy&); > > WebUndoStepID m_commandID; >- WebCore::EditAction m_editAction; >- WebPageProxy* m_page; >+ String m_undoRedoLabel; >+ WeakPtr<WebPageProxy> m_page; > }; > > } // namespace WebKit >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index e74f38dc59b400d4026e2cad3c659e0525b43c9a..c2f8063b6412cf84f0ca3bf93d46cf69451c0fb4 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -5439,9 +5439,9 @@ void WebPageProxy::compositionWasCanceled() > > // Undo management > >-void WebPageProxy::registerEditCommandForUndo(WebUndoStepID commandID, uint32_t editAction) >+void WebPageProxy::registerEditCommandForUndo(WebUndoStepID commandID, const String& undoRedoLabel) > { >- registerEditCommand(WebEditCommandProxy::create(commandID, static_cast<EditAction>(editAction), this), UndoOrRedo::Undo); >+ registerEditCommand(WebEditCommandProxy::create(commandID, undoRedoLabel, *this), UndoOrRedo::Undo); > } > > void WebPageProxy::registerInsertionUndoGrouping() >@@ -6652,10 +6652,7 @@ void WebPageProxy::resetState(ResetStateReason resetStateReason) > m_callbacks.invalidate(error); > m_loadDependentStringCallbackIDs.clear(); > >- auto editCommandVector = copyToVector(m_editCommandSet); >- m_editCommandSet.clear(); >- >- for (auto& editCommand : editCommandVector) >+ for (auto& editCommand : std::exchange(m_editCommandSet, { })) > editCommand->invalidate(); > > m_activePopupMenu = nullptr; >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index ac5600f62acc6a36ed30e02a9fd724301be0bf4c..ee89f4bdebc163bdc7fec566194a247d93c1c1d0 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -1644,7 +1644,7 @@ private: > void backForwardClear(); > > // Undo management >- void registerEditCommandForUndo(WebUndoStepID commandID, uint32_t editAction); >+ void registerEditCommandForUndo(WebUndoStepID commandID, const String& undoRedoLabel); > void registerInsertionUndoGrouping(); > void clearAllEditCommands(); > void canUndoRedo(UndoOrRedo, bool& result); >diff --git a/Source/WebKit/UIProcess/WebPageProxy.messages.in b/Source/WebKit/UIProcess/WebPageProxy.messages.in >index 389a32bda14cd01db4c4b99cc24c694d1c1a5d9f..0cc3f85c9e6dfc41b177757604ea0d0e7059e771 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.messages.in >+++ b/Source/WebKit/UIProcess/WebPageProxy.messages.in >@@ -233,7 +233,7 @@ messages -> WebPageProxy { > WillGoToBackForwardListItem(struct WebCore::BackForwardItemIdentifier itemID, bool inPageCache) > > # Undo/Redo messages >- RegisterEditCommandForUndo(uint64_t commandID, uint32_t editAction) >+ RegisterEditCommandForUndo(uint64_t commandID, String undoRedoLabel) > ClearAllEditCommands() > RegisterInsertionUndoGrouping() > CanUndoRedo(enum:bool WebKit::UndoOrRedo undoOrRedo) -> (bool result) LegacySync >diff --git a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >index 71ea6b8ffe7bbad929d680a4e853f01d0c8c3de1..daed2a816980b9593f69266167d14a2024610818 100644 >--- a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >+++ b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >@@ -267,7 +267,7 @@ void PageClientImpl::didChangeViewportProperties(const ViewportAttributes&) > > void PageClientImpl::registerEditCommand(Ref<WebEditCommandProxy>&& command, UndoOrRedo undoOrRedo) > { >- auto actionName = WebCore::nameForUndoRedo(command->editAction()); >+ auto actionName = command->undoRedoLabel(); > auto commandObjC = adoptNS([[WKEditCommand alloc] initWithWebEditCommandProxy:WTFMove(command)]); > > NSUndoManager *undoManager = [m_contentView undoManager]; >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp >index 0094e356d514b877db1f30b6a68ed2d73c9f1357..cf8f0627b33a14a64e79fa191c716a6b5e250329 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp >@@ -302,22 +302,22 @@ String WebEditorClient::replacementURLForResource(Ref<WebCore::SharedBuffer>&& r > return m_page->injectedBundleEditorClient().replacementURLForResource(*m_page, WTFMove(resourceData), mimeType); > } > >-void WebEditorClient::registerUndoStep(UndoStep& step) >+void WebEditorClient::registerUndoStep(Ref<UndoStep>&& step) > { > // FIXME: Add assertion that the command being reapplied is the same command that is > // being passed to us. > if (m_page->isInRedo()) > return; > >- auto webStep = WebUndoStep::create(step); >+ auto label = step->undoRedoLabel(); >+ auto webStep = WebUndoStep::create(WTFMove(step)); > auto stepID = webStep->stepID(); >- auto editAction = static_cast<uint32_t>(webStep->step().editingAction()); > > m_page->addWebUndoStep(stepID, WTFMove(webStep)); >- m_page->send(Messages::WebPageProxy::RegisterEditCommandForUndo(stepID, editAction), m_page->pageID(), IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply); >+ m_page->send(Messages::WebPageProxy::RegisterEditCommandForUndo(stepID, WTFMove(label)), m_page->pageID(), IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply); > } > >-void WebEditorClient::registerRedoStep(UndoStep&) >+void WebEditorClient::registerRedoStep(Ref<UndoStep>&&) > { > } > >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h >index 4720b71175412a59a229bc47106dab2da3c8756e..f41b086321c1f42825c5ad9ae2d96a9e2d705b6f 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h >@@ -85,8 +85,8 @@ private: > void getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer>>& pasteboardData) final; > String replacementURLForResource(Ref<WebCore::SharedBuffer>&& resourceData, const String& mimeType) final; > >- void registerUndoStep(WebCore::UndoStep&) final; >- void registerRedoStep(WebCore::UndoStep&) final; >+ void registerUndoStep(Ref<WebCore::UndoStep>&&) final; >+ void registerRedoStep(Ref<WebCore::UndoStep>&&) final; > void clearUndoRedoOperations() final; > > bool canCopyCut(WebCore::Frame*, bool defaultValue) const final; >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h b/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h >index f0f968b7e2b66c891dc14b6c1faaf0b8bbe1d19e..af35db25acbbd4af32827fc2da9ce1287e05b802 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h >@@ -114,8 +114,8 @@ private: > void canceledComposition() final; > void didUpdateComposition() final { } > >- void registerUndoStep(WebCore::UndoStep&) final; >- void registerRedoStep(WebCore::UndoStep&) final; >+ void registerUndoStep(Ref<WebCore::UndoStep>&&) final; >+ void registerRedoStep(Ref<WebCore::UndoStep>&&) final; > void clearUndoRedoOperations() final; > > bool canCopyCut(WebCore::Frame*, bool defaultValue) const final; >@@ -172,7 +172,7 @@ private: > void handleAcceptedCandidateWithSoftSpaces(WebCore::TextCheckingResult) final; > #endif > >- void registerUndoOrRedoStep(WebCore::UndoStep&, bool isRedo); >+ void registerUndoOrRedoStep(Ref<WebCore::UndoStep>&&, bool isRedo); > > WebView *m_webView; > RetainPtr<WebEditorUndoTarget> m_undoTarget; >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm b/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm >index ccc33f940fbc9e631fdd98d2ea16b97e156bd0b3..d704ce6a43bb3c0c0d4f7c257f2aeaef175f7782 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm >@@ -125,7 +125,7 @@ @interface WebUndoStep : NSObject > RefPtr<UndoStep> m_step; > } > >-+ (WebUndoStep *)stepWithUndoStep:(UndoStep&)step; >++ (WebUndoStep *)stepWithUndoStep:(Ref<UndoStep>&&)step; > - (UndoStep&)step; > > @end >@@ -141,12 +141,12 @@ + (void)initialize > #endif > } > >-- (id)initWithUndoStep:(UndoStep&)step >+- (id)initWithUndoStep:(Ref<UndoStep>&&)step > { > self = [super init]; > if (!self) > return nil; >- m_step = &step; >+ m_step = WTFMove(step); > return self; > } > >@@ -158,9 +158,9 @@ - (void)dealloc > [super dealloc]; > } > >-+ (WebUndoStep *)stepWithUndoStep:(UndoStep&)step >++ (WebUndoStep *)stepWithUndoStep:(Ref<UndoStep>&&)step > { >- return [[[WebUndoStep alloc] initWithUndoStep:step] autorelease]; >+ return [[[WebUndoStep alloc] initWithUndoStep:WTFMove(step)] autorelease]; > } > > - (UndoStep&)step >@@ -589,7 +589,7 @@ bool WebEditorClient::shouldInsertNode(Node *node, Range* replacingRange, Editor > return [[m_webView _editingDelegateForwarder] webView:m_webView shouldInsertNode:kit(node) replacingDOMRange:kit(replacingRange) givenAction:(WebViewInsertAction)givenAction]; > } > >-void WebEditorClient::registerUndoOrRedoStep(UndoStep& step, bool isRedo) >+void WebEditorClient::registerUndoOrRedoStep(Ref<UndoStep>&& step, bool isRedo) > { > NSUndoManager *undoManager = [m_webView undoManager]; > >@@ -601,9 +601,8 @@ void WebEditorClient::registerUndoOrRedoStep(UndoStep& step, bool isRedo) > return; > #endif > >- NSString *actionName = WebCore::nameForUndoRedo(step.editingAction()); >- WebUndoStep *webEntry = [WebUndoStep stepWithUndoStep:step]; >- [undoManager registerUndoWithTarget:m_undoTarget.get() selector:(isRedo ? @selector(redoEditing:) : @selector(undoEditing:)) object:webEntry]; >+ NSString *actionName = step->undoRedoLabel(); >+ [undoManager registerUndoWithTarget:m_undoTarget.get() selector:(isRedo ? @selector(redoEditing:) : @selector(undoEditing:)) object:[WebUndoStep stepWithUndoStep:WTFMove(step)]]; > if (actionName) > [undoManager setActionName:actionName]; > m_haveUndoRedoOperations = YES; >@@ -629,14 +628,14 @@ void WebEditorClient::updateEditorStateAfterLayoutIfEditabilityChanged() > [m_webView updateTouchBar]; > } > >-void WebEditorClient::registerUndoStep(UndoStep& cmd) >+void WebEditorClient::registerUndoStep(Ref<UndoStep>&& command) > { >- registerUndoOrRedoStep(cmd, false); >+ registerUndoOrRedoStep(WTFMove(command), false); > } > >-void WebEditorClient::registerRedoStep(UndoStep& cmd) >+void WebEditorClient::registerRedoStep(Ref<UndoStep>&& command) > { >- registerUndoOrRedoStep(cmd, true); >+ registerUndoOrRedoStep(WTFMove(command), true); > } > > void WebEditorClient::clearUndoRedoOperations() >diff --git a/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.cpp b/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.cpp >index 2e7ea5819432ad557caf788fd139674b1b67417f..aaa70e9fad64ff94bf31acd3a84e3ffc678b0556 100644 >--- a/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.cpp >+++ b/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.cpp >@@ -630,12 +630,12 @@ static String undoNameForEditAction(EditAction editAction) > return String(); > } > >-void WebEditorClient::registerUndoStep(UndoStep& step) >+void WebEditorClient::registerUndoStep(Ref<WebCore::UndoStep>&& step) > { > IWebUIDelegate* uiDelegate = 0; > if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) { >- String actionName = undoNameForEditAction(step.editingAction()); >- WebEditorUndoCommand* undoCommand = new WebEditorUndoCommand(step, true); >+ String actionName = undoNameForEditAction(step->editingAction()); >+ WebEditorUndoCommand* undoCommand = new WebEditorUndoCommand(step.get(), true); > if (!undoCommand) > return; > uiDelegate->registerUndoWithTarget(m_undoTarget, 0, undoCommand); >@@ -646,11 +646,11 @@ void WebEditorClient::registerUndoStep(UndoStep& step) > } > } > >-void WebEditorClient::registerRedoStep(UndoStep& step) >+void WebEditorClient::registerRedoStep(Ref<WebCore::UndoStep>&& step) > { > IWebUIDelegate* uiDelegate = 0; > if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) { >- WebEditorUndoCommand* undoCommand = new WebEditorUndoCommand(step, false); >+ WebEditorUndoCommand* undoCommand = new WebEditorUndoCommand(step.get(), false); > if (!undoCommand) > return; > uiDelegate->registerUndoWithTarget(m_undoTarget, 0, undoCommand); >diff --git a/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.h b/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.h >index 7a6edde8193613859a31d2f0d2ebb35f822c5d2b..2a0d030f6ae076099c24027fe97fd04cf8517c8a 100644 >--- a/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.h >+++ b/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.h >@@ -74,8 +74,8 @@ private: > bool smartInsertDeleteEnabled() final; > bool isSelectTrailingWhitespaceEnabled() const final; > >- void registerUndoStep(WebCore::UndoStep&) final; >- void registerRedoStep(WebCore::UndoStep&) final; >+ void registerUndoStep(Ref<WebCore::UndoStep>&&) final; >+ void registerRedoStep(Ref<WebCore::UndoStep>&&) final; > void clearUndoRedoOperations(); > > bool canCopyCut(WebCore::Frame*, bool defaultValue) const final;
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
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193706
:
359856
|
359857
|
359882