WebKit Bugzilla
Attachment 358243 Details for
Bug 193100
: WebUndoStep's monotonically increasing identifier should be a WebUndoStepID instead of uint64_t
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193100-20190102203014.patch (text/plain), 16.60 KB, created by
Wenson Hsieh
on 2019-01-02 20:30:14 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2019-01-02 20:30:14 PST
Size:
16.60 KB
patch
obsolete
>Subversion Revision: 239584 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index ff74565c9f92faeec0eec8c32ffe4eab00b7d079..e3b09397aaf4e8a0063e0389071b9844c1e2c90b 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,49 @@ >+2019-01-02 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ WebUndoStep's monotonically increasing identifier should be a WebUndoStepID instead of uint64_t >+ https://bugs.webkit.org/show_bug.cgi?id=193100 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a type alias, WebUndoStepID, to represent the monotonically increasing undo step ID for each undoable >+ editing command, and use this type alias in lieu of `uint64_t`. No change in behavior. >+ >+ * UIProcess/WebEditCommandProxy.cpp: >+ (WebKit::WebEditCommandProxy::WebEditCommandProxy): >+ * UIProcess/WebEditCommandProxy.h: >+ (WebKit::WebEditCommandProxy::create): >+ (WebKit::WebEditCommandProxy::commandID const): >+ * UIProcess/WebPageProxy.cpp: >+ (WebKit::WebPageProxy::registerEditCommandForUndo): >+ * UIProcess/WebPageProxy.h: >+ * WebKit.xcodeproj/project.pbxproj: >+ * WebProcess/WebCoreSupport/WebEditorClient.cpp: >+ (WebKit::WebEditorClient::registerUndoStep): >+ >+ Store the step ID in a temporary variable, since `webUndoStep` is now moved when calling `addWebUndoStep`. >+ >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::webUndoStep): >+ (WebKit::WebPage::addWebUndoStep): >+ >+ Make this take a `Ref<WebUndoStep>&&` instead of a `WebUndoStep*`, and use move semantics to transfer the >+ given `Ref` to the table. >+ >+ (WebKit::WebPage::removeWebEditCommand): >+ (WebKit::WebPage::unapplyEditCommand): >+ (WebKit::WebPage::reapplyEditCommand): >+ >+ Use `auto*` in a couple of places. >+ >+ (WebKit::WebPage::didRemoveEditCommand): >+ * WebProcess/WebPage/WebPage.h: >+ * WebProcess/WebPage/WebUndoStep.cpp: >+ (WebKit::generateUndoStep): >+ * WebProcess/WebPage/WebUndoStep.h: >+ (WebKit::WebUndoStep::stepID const): >+ (WebKit::WebUndoStep::WebUndoStep): >+ * WebProcess/WebPage/WebUndoStepID.h: Copied from Source/WebKit/WebProcess/WebPage/WebUndoStep.cpp. >+ > 2019-01-02 Wenson Hsieh <wenson_hsieh@apple.com> > > Add support for using the current text selection as the find string on iOS >diff --git a/Source/WebKit/UIProcess/WebEditCommandProxy.cpp b/Source/WebKit/UIProcess/WebEditCommandProxy.cpp >index a526477687c2f6fa5313123bb89f1aa1436c3cff..f9ac146cc0d262d7eaedf159d02cc01a6684551f 100644 >--- a/Source/WebKit/UIProcess/WebEditCommandProxy.cpp >+++ b/Source/WebKit/UIProcess/WebEditCommandProxy.cpp >@@ -36,7 +36,7 @@ > namespace WebKit { > using namespace WebCore; > >-WebEditCommandProxy::WebEditCommandProxy(uint64_t commandID, WebCore::EditAction editAction, WebPageProxy* page) >+WebEditCommandProxy::WebEditCommandProxy(WebUndoStepID commandID, WebCore::EditAction editAction, WebPageProxy* page) > : m_commandID(commandID) > , m_editAction(editAction) > , m_page(page) >diff --git a/Source/WebKit/UIProcess/WebEditCommandProxy.h b/Source/WebKit/UIProcess/WebEditCommandProxy.h >index 070906f607f744d5087b3735441975c2ca3cad13..b4e767f63f13b82270f2afd9cf7a23a33667900c 100644 >--- a/Source/WebKit/UIProcess/WebEditCommandProxy.h >+++ b/Source/WebKit/UIProcess/WebEditCommandProxy.h >@@ -26,6 +26,7 @@ > #pragma once > > #include "APIObject.h" >+#include "WebUndoStepID.h" > #include <WebCore/EditAction.h> > #include <wtf/Forward.h> > #include <wtf/RefCounted.h> >@@ -37,13 +38,13 @@ class WebPageProxy; > > class WebEditCommandProxy : public API::ObjectImpl<API::Object::Type::EditCommandProxy> { > public: >- static Ref<WebEditCommandProxy> create(uint64_t commandID, WebCore::EditAction editAction, WebPageProxy* page) >+ static Ref<WebEditCommandProxy> create(WebUndoStepID commandID, WebCore::EditAction editAction, WebPageProxy* page) > { > return adoptRef(*new WebEditCommandProxy(commandID, editAction, page)); > } > ~WebEditCommandProxy(); > >- uint64_t commandID() const { return m_commandID; } >+ WebUndoStepID commandID() const { return m_commandID; } > WebCore::EditAction editAction() const { return m_editAction; } > > void invalidate() { m_page = 0; } >@@ -54,9 +55,9 @@ public: > static String nameForEditAction(WebCore::EditAction); > > private: >- WebEditCommandProxy(uint64_t commandID, WebCore::EditAction, WebPageProxy*); >+ WebEditCommandProxy(WebUndoStepID commandID, WebCore::EditAction, WebPageProxy*); > >- uint64_t m_commandID; >+ WebUndoStepID m_commandID; > WebCore::EditAction m_editAction; > WebPageProxy* m_page; > }; >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index 9db70710d990100c5cb058bfde92bc77ea51b11d..da7a94a33d81935ca14320734688cc98973a5482 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -5340,7 +5340,7 @@ void WebPageProxy::compositionWasCanceled() > > // Undo management > >-void WebPageProxy::registerEditCommandForUndo(uint64_t commandID, uint32_t editAction) >+void WebPageProxy::registerEditCommandForUndo(WebUndoStepID commandID, uint32_t editAction) > { > registerEditCommand(WebEditCommandProxy::create(commandID, static_cast<EditAction>(editAction), this), UndoOrRedo::Undo); > } >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index 52834e6d6ef8c5a4d41edb778bb3a16afeba9fa8..18bf8101a0edd2b4a0fe98760def4388b3403018 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -65,6 +65,7 @@ > #include "WebPageProxyMessages.h" > #include "WebPopupMenuProxy.h" > #include "WebProcessLifetimeTracker.h" >+#include "WebUndoStepID.h" > #include "WebsitePoliciesData.h" > #include <WebCore/ActivityState.h> > #include <WebCore/AutoplayEvent.h> >@@ -1615,7 +1616,7 @@ private: > void backForwardClear(); > > // Undo management >- void registerEditCommandForUndo(uint64_t commandID, uint32_t editAction); >+ void registerEditCommandForUndo(WebUndoStepID commandID, uint32_t editAction); > void registerInsertionUndoGrouping(); > void clearAllEditCommands(); > void canUndoRedo(UndoOrRedo, bool& result); >diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >index 743d012853725c8ca9e7b5d00bcbd5d3f44da93b..92dd695e246f72d39e228407108c6443994f217c 100644 >--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj >+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >@@ -4511,6 +4511,7 @@ > F48D2A8421583A0200C6752B /* AppKitSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppKitSPI.h; sourceTree = "<group>"; }; > F496A42F1F58A272004C1757 /* DragDropInteractionState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = DragDropInteractionState.h; path = ios/DragDropInteractionState.h; sourceTree = "<group>"; }; > F496A4301F58A272004C1757 /* DragDropInteractionState.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = DragDropInteractionState.mm; path = ios/DragDropInteractionState.mm; sourceTree = "<group>"; }; >+ F4B378D021DDBBAB0095A378 /* WebUndoStepID.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebUndoStepID.h; sourceTree = "<group>"; }; > F4D5F519206087A00038BBA8 /* WKTextInputListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKTextInputListViewController.h; path = ios/forms/WKTextInputListViewController.h; sourceTree = "<group>"; }; > F4D5F51A206087A10038BBA8 /* WKTextInputListViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKTextInputListViewController.mm; path = ios/forms/WKTextInputListViewController.mm; sourceTree = "<group>"; }; > F4D5F51B206087A10038BBA8 /* WKQuickboardListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKQuickboardListViewController.h; path = ios/forms/WKQuickboardListViewController.h; sourceTree = "<group>"; }; >@@ -7268,6 +7269,7 @@ > 2D5C9D0419C81D8F00B3C5C1 /* WebPageOverlay.h */, > BCA0EF7E12331E78007D3CFB /* WebUndoStep.cpp */, > BCA0EF7D12331E78007D3CFB /* WebUndoStep.h */, >+ F4B378D021DDBBAB0095A378 /* WebUndoStepID.h */, > 51D1242A1E6D41BC002B2820 /* WebURLSchemeHandlerProxy.cpp */, > 51D1242B1E6D41BC002B2820 /* WebURLSchemeHandlerProxy.h */, > 51D124211E6D349A002B2820 /* WebURLSchemeTaskProxy.cpp */, >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp >index ab3367aa6761869f41168115badad5c9c4cfbc55..0094e356d514b877db1f30b6a68ed2d73c9f1357 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp >@@ -310,10 +310,11 @@ void WebEditorClient::registerUndoStep(UndoStep& step) > return; > > auto webStep = WebUndoStep::create(step); >+ auto stepID = webStep->stepID(); > auto editAction = static_cast<uint32_t>(webStep->step().editingAction()); > >- m_page->addWebUndoStep(webStep->stepID(), webStep.ptr()); >- m_page->send(Messages::WebPageProxy::RegisterEditCommandForUndo(webStep->stepID(), editAction), m_page->pageID(), IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply); >+ m_page->addWebUndoStep(stepID, WTFMove(webStep)); >+ m_page->send(Messages::WebPageProxy::RegisterEditCommandForUndo(stepID, editAction), m_page->pageID(), IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply); > } > > void WebEditorClient::registerRedoStep(UndoStep&) >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index d1616244b2bf23ed290fa3cf4ad15b155f9fd5f5..a97901d3e207dd4d95e92c19c8d95c9625e02759 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -3765,17 +3765,17 @@ void WebPage::dragCancelled() > > #endif // ENABLE(DRAG_SUPPORT) > >-WebUndoStep* WebPage::webUndoStep(uint64_t stepID) >+WebUndoStep* WebPage::webUndoStep(WebUndoStepID stepID) > { > return m_undoStepMap.get(stepID); > } > >-void WebPage::addWebUndoStep(uint64_t stepID, WebUndoStep* entry) >+void WebPage::addWebUndoStep(WebUndoStepID stepID, Ref<WebUndoStep>&& entry) > { >- m_undoStepMap.set(stepID, entry); >+ m_undoStepMap.set(stepID, WTFMove(entry)); > } > >-void WebPage::removeWebEditCommand(uint64_t stepID) >+void WebPage::removeWebEditCommand(WebUndoStepID stepID) > { > m_undoStepMap.remove(stepID); > } >@@ -3785,18 +3785,18 @@ bool WebPage::isAlwaysOnLoggingAllowed() const > return corePage() && corePage()->isAlwaysOnLoggingAllowed(); > } > >-void WebPage::unapplyEditCommand(uint64_t stepID) >+void WebPage::unapplyEditCommand(WebUndoStepID stepID) > { >- WebUndoStep* step = webUndoStep(stepID); >+ auto* step = webUndoStep(stepID); > if (!step) > return; > > step->step().unapply(); > } > >-void WebPage::reapplyEditCommand(uint64_t stepID) >+void WebPage::reapplyEditCommand(WebUndoStepID stepID) > { >- WebUndoStep* step = webUndoStep(stepID); >+ auto* step = webUndoStep(stepID); > if (!step) > return; > >@@ -3805,7 +3805,7 @@ void WebPage::reapplyEditCommand(uint64_t stepID) > m_isInRedo = false; > } > >-void WebPage::didRemoveEditCommand(uint64_t commandID) >+void WebPage::didRemoveEditCommand(WebUndoStepID commandID) > { > removeWebEditCommand(commandID); > } >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index d8b8b30e57aa966b6eb6da5d9d7487823bdbf6f0..0b42a617ccc1098a575eb47cc641f60355e68db6 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -50,6 +50,7 @@ > #include "UserData.h" > #include "WebBackForwardListProxy.h" > #include "WebURLSchemeHandler.h" >+#include "WebUndoStepID.h" > #include "WebUserContentController.h" > #include "WebsitePoliciesData.h" > #include <JavaScriptCore/InspectorFrontendChannel.h> >@@ -355,9 +356,9 @@ public: > > const String& overrideContentSecurityPolicy() const { return m_overrideContentSecurityPolicy; } > >- WebUndoStep* webUndoStep(uint64_t); >- void addWebUndoStep(uint64_t, WebUndoStep*); >- void removeWebEditCommand(uint64_t); >+ WebUndoStep* webUndoStep(WebUndoStepID); >+ void addWebUndoStep(WebUndoStepID, Ref<WebUndoStep>&&); >+ void removeWebEditCommand(WebUndoStepID); > bool isInRedo() const { return m_isInRedo; } > > bool isAlwaysOnLoggingAllowed() const; >@@ -1324,9 +1325,9 @@ private: > > void setMainFrameIsScrollable(bool); > >- void unapplyEditCommand(uint64_t commandID); >- void reapplyEditCommand(uint64_t commandID); >- void didRemoveEditCommand(uint64_t commandID); >+ void unapplyEditCommand(WebUndoStepID commandID); >+ void reapplyEditCommand(WebUndoStepID commandID); >+ void didRemoveEditCommand(WebUndoStepID commandID); > > void findString(const String&, uint32_t findOptions, uint32_t maxMatchCount); > void findStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount); >@@ -1574,7 +1575,7 @@ private: > RunLoop::Timer<WebPage> m_setCanStartMediaTimer; > bool m_mayStartMediaWhenInWindow { false }; > >- HashMap<uint64_t, RefPtr<WebUndoStep>> m_undoStepMap; >+ HashMap<WebUndoStepID, RefPtr<WebUndoStep>> m_undoStepMap; > > #if ENABLE(CONTEXT_MENUS) > std::unique_ptr<API::InjectedBundle::PageContextMenuClient> m_contextMenuClient; >diff --git a/Source/WebKit/WebProcess/WebPage/WebUndoStep.cpp b/Source/WebKit/WebProcess/WebPage/WebUndoStep.cpp >index 55ec55041706f42906eabd54bd7039248921701a..1762c84d00aeabc3337553f61c458c0859d89f95 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebUndoStep.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebUndoStep.cpp >@@ -28,9 +28,9 @@ > > namespace WebKit { > >-static uint64_t generateUndoStep() >+static WebUndoStepID generateUndoStep() > { >- static uint64_t uniqueEntryID = 1; >+ static WebUndoStepID uniqueEntryID = 1; > return uniqueEntryID++; > } > >diff --git a/Source/WebKit/WebProcess/WebPage/WebUndoStep.h b/Source/WebKit/WebProcess/WebPage/WebUndoStep.h >index 9b6fcf89a46feb47e64d7318417d16ede41992e2..211fd99e5e6c696fa7c399f7f7edd038ab8a8d8a 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebUndoStep.h >+++ b/Source/WebKit/WebProcess/WebPage/WebUndoStep.h >@@ -25,6 +25,7 @@ > > #pragma once > >+#include "WebUndoStepID.h" > #include <WebCore/UndoStep.h> > #include <wtf/Ref.h> > >@@ -36,17 +37,17 @@ public: > ~WebUndoStep(); > > WebCore::UndoStep& step() const { return m_step.get(); } >- uint64_t stepID() const { return m_stepID; } >+ WebUndoStepID stepID() const { return m_stepID; } > > private: >- WebUndoStep(Ref<WebCore::UndoStep>&& step, uint64_t stepID) >+ WebUndoStep(Ref<WebCore::UndoStep>&& step, WebUndoStepID stepID) > : m_step(WTFMove(step)) > , m_stepID(stepID) > { > } > > Ref<WebCore::UndoStep> m_step; >- uint64_t m_stepID; >+ WebUndoStepID m_stepID; > }; > > } // namespace WebKit >diff --git a/Source/WebKit/WebProcess/WebPage/WebUndoStepID.h b/Source/WebKit/WebProcess/WebPage/WebUndoStepID.h >new file mode 100644 >index 0000000000000000000000000000000000000000..7fafc8fd4d2adb16c149babf721fb229021986d4 >--- /dev/null >+++ b/Source/WebKit/WebProcess/WebPage/WebUndoStepID.h >@@ -0,0 +1,28 @@ >+/* >+ * 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 >+ >+using WebUndoStepID = uint64_t;
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 193100
: 358243