WebKit Bugzilla
Attachment 369172 Details for
Bug 197452
: Add quirks to emulate undo and redo in hidden editable areas on some websites
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197452-20190506150242.patch (text/plain), 28.17 KB, created by
Megan Gardner
on 2019-05-06 15:02:43 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Megan Gardner
Created:
2019-05-06 15:02:43 PDT
Size:
28.17 KB
patch
obsolete
>Subversion Revision: 244919 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 144e79b4ccc0390cb728bd96fcf2bf7fa9a9c27a..22b65f88cb75c49a8cf35b11721f816857ccedc6 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,30 @@ >+2019-04-30 Megan Gardner <megan_gardner@apple.com> >+ >+ Add quirks to emulate undo and redo in hidden editable areas on some websites >+ https://bugs.webkit.org/show_bug.cgi?id=197452 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ UI change, not testable. >+ >+ We need to send synthetic keyboard events to the web process to emulate undo and redo >+ key combinations for when we are trying to get our undo and redo UI to work >+ on rich editing websites that only listen to keystrokes, and don't let us use our >+ undo manager to help manage the input content. >+ >+ * page/EventHandler.cpp: >+ (WebCore::EventHandler::keyEvent): >+ * platform/PlatformKeyboardEvent.h: >+ (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): >+ (WebCore::PlatformKeyboardEvent::isSyntheticEvent): >+ (WebCore::PlatformKeyboardEvent::setSyntheticEvent): >+ * platform/ios/KeyEventIOS.mm: >+ (WebCore::PlatformKeyboardEvent::currentStateOfModifierKeys): >+ * platform/ios/PlatformEventFactoryIOS.mm: >+ (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder): >+ * platform/mac/PlatformEventFactoryMac.mm: >+ (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder): >+ > 2019-05-03 Youenn Fablet <youenn@apple.com> > > Cache.add and Cache.addAll should compute a correct response body size >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 5200b51b836528df35780edb583d3e620476336f..d1d4d12c58f8364926205b1a353f0efd7c3ab43c 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,37 @@ >+2019-04-30 Megan Gardner <megan_gardner@apple.com> >+ >+ Add quirks to emulate undo and redo in hidden editable areas on some websites >+ https://bugs.webkit.org/show_bug.cgi?id=197452 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ We need to make our own undo manager to allow undo even when >+ the manager is empty. This is to interface with rich editing >+ websites that don't actually interface with our undo abilities. >+ Then we need to generate synthetic undo and redo in the web process. >+ >+ * UIProcess/WebPageProxy.cpp: >+ (WebKit::WebPageProxy::isCurrentURLHost const): >+ * UIProcess/WebPageProxy.h: >+ * UIProcess/ios/WKContentView.mm: >+ (-[WKNSUndoManager initWithContentView:]): >+ (-[WKNSUndoManager canUndo]): >+ (-[WKNSUndoManager canRedo]): >+ (-[WKNSUndoManager undo]): >+ (-[WKNSUndoManager redo]): >+ (-[WKContentView undoManager]): >+ * UIProcess/ios/WKContentViewInteraction.h: >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView generateSyntheticUndoRedo:]): >+ (-[WKContentView hasHiddenContentEditable]): >+ * UIProcess/ios/WebPageProxyIOS.mm: >+ (WebKit::WebPageProxy::generateSyntheticUndoRedo): >+ * WebProcess/WebPage/WebPage.h: >+ * WebProcess/WebPage/WebPage.messages.in: >+ * WebProcess/WebPage/ios/WebPageIOS.mm: >+ (WebKit::WebPage::handleEditingKeyboardEvent): >+ (WebKit::WebPage::generateSyntheticUndoRedo): >+ > 2019-05-03 Brent Fulgham <bfulgham@apple.com> > > Use more efficient path resolution logic >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index 9136d9cf78c5c109605c39b54b0a0f6a3fd9c230..552b78a1fcf7b5d9e3becebe448cb73d789b9dd2 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -3160,6 +3160,10 @@ void Document::setURL(const URL& url) > m_url = newURL; > m_documentURI = m_url.string(); > updateBaseURL(); >+ >+#if PLATFORM(IOS_FAMILY) >+ page()->chrome().client().setNeedsQuirkyNSUndoManager(quirks().shouldEmulateUndoRedoInHiddenEditableAreas()); >+#endif > } > > void Document::updateBaseURL() >diff --git a/Source/WebCore/loader/EmptyClients.h b/Source/WebCore/loader/EmptyClients.h >index 6a663f826f3ae49c8c05bf03e3062ed7bb185630..0bc6a723b978124d3c5dec5f06a1dfb3a50b54a4 100644 >--- a/Source/WebCore/loader/EmptyClients.h >+++ b/Source/WebCore/loader/EmptyClients.h >@@ -180,6 +180,8 @@ class EmptyChromeClient : public ChromeClient { > > void webAppOrientationsUpdated() final { }; > void showPlaybackTargetPicker(bool, RouteSharingPolicy, const String&) final { }; >+ >+ void setNeedsQuirkyNSUndoManager(bool) final { }; > #endif // PLATFORM(IOS_FAMILY) > > #if ENABLE(ORIENTATION_EVENTS) >diff --git a/Source/WebCore/page/ChromeClient.h b/Source/WebCore/page/ChromeClient.h >index cddf13cae88930e236e9409f92efc2ffd40bf5d9..d6da4fe14b79956db1bb638e0482ce24b4d8b7b2 100644 >--- a/Source/WebCore/page/ChromeClient.h >+++ b/Source/WebCore/page/ChromeClient.h >@@ -270,6 +270,8 @@ public: > > virtual void webAppOrientationsUpdated() = 0; > virtual void showPlaybackTargetPicker(bool hasVideo, RouteSharingPolicy, const String&) = 0; >+ >+ virtual void setNeedsQuirkyNSUndoManager(bool) = 0; > #endif > > #if ENABLE(ORIENTATION_EVENTS) >diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp >index 22f099cb2b85e0859b1974be9d3336667d48b9f1..27901f73cc22bcaa453c49d423391a5d60a314f9 100644 >--- a/Source/WebCore/page/EventHandler.cpp >+++ b/Source/WebCore/page/EventHandler.cpp >@@ -3155,6 +3155,9 @@ bool EventHandler::isKeyEventAllowedInFullScreen(const PlatformKeyboardEvent& ke > > bool EventHandler::keyEvent(const PlatformKeyboardEvent& keyEvent) > { >+ bool shiftKey, ctrlKey, altKey, metaKey; >+ keyEvent.getCurrentModifierState(shiftKey, ctrlKey, altKey, metaKey); >+ > Document* topDocument = m_frame.document() ? &m_frame.document()->topDocument() : nullptr; > MonotonicTime savedLastHandledUserGestureTimestamp; > bool savedUserDidInteractWithPage = topDocument ? topDocument->userDidInteractWithPage() : false; >diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp >index 067c341135314619b9f2330bf6995ade1d75406c..273c614271468676fc610c2bdf1669e48765c6b7 100644 >--- a/Source/WebCore/page/Page.cpp >+++ b/Source/WebCore/page/Page.cpp >@@ -1390,6 +1390,13 @@ void Page::userStyleSheetLocationChanged() > frame->document()->extensionStyleSheets().updatePageUserSheet(); > } > } >+ >+void Page::needsSiteSpecificQuirksChanged() >+{ >+#if PLATFORM(IOS_FAMILY) >+ chrome().client().setNeedsQuirkyNSUndoManager(quirks().shouldEmulateUndoRedoInHiddenEditableAreas()); >+#endif >+} > > const String& Page::userStyleSheet() const > { >diff --git a/Source/WebCore/page/Page.h b/Source/WebCore/page/Page.h >index 666144b2a038f3df374a1b5bfe8fae3ee052e714..30d27f5a274fdd2309a0b6355c27f46db42704f2 100644 >--- a/Source/WebCore/page/Page.h >+++ b/Source/WebCore/page/Page.h >@@ -480,6 +480,7 @@ public: > bool scriptedAnimationsSuspended() const { return m_scriptedAnimationsSuspended; } > > void userStyleSheetLocationChanged(); >+ void needsSiteSpecificQuirksChanged(); > const String& userStyleSheet() const; > > WEBCORE_EXPORT void userAgentChanged(); >diff --git a/Source/WebCore/page/Quirks.cpp b/Source/WebCore/page/Quirks.cpp >index 5e731d78af3a3bda8fd272ef2e4e116afa142257..04d0f35e1b6b54bfe6feb6c84d0be0605eb22182 100644 >--- a/Source/WebCore/page/Quirks.cpp >+++ b/Source/WebCore/page/Quirks.cpp >@@ -204,8 +204,21 @@ static bool shouldSuppressAutocorrectionAndAutocaptializationInHiddenEditableAre > return false; > } > >+bool Quirks::shouldEmulateUndoRedoInHiddenEditableAreasForHost(const StringView&) >+{ >+ return false; >+} >+ > #endif > >+bool Quirks::shouldEmulateUndoRedoInHiddenEditableAreas() const >+{ >+ if (!needsQuirks()) >+ return false; >+ >+ return shouldEmulateUndoRedoInHiddenEditableAreasForHost(m_document->topDocument().url().host()); >+} >+ > bool Quirks::shouldSuppressAutocorrectionAndAutocaptializationInHiddenEditableAreas() const > { > if (!needsQuirks()) >diff --git a/Source/WebCore/page/Quirks.h b/Source/WebCore/page/Quirks.h >index 7988bbd95aa992e1889e0ea37cee241ca05a1a06..16dccdabdf06b43281ba44e6cd5fc2362b7ddad5 100644 >--- a/Source/WebCore/page/Quirks.h >+++ b/Source/WebCore/page/Quirks.h >@@ -51,12 +51,15 @@ public: > bool needsInputModeNoneImplicitly(const HTMLElement&) const; > > WEBCORE_EXPORT bool shouldSuppressAutocorrectionAndAutocaptializationInHiddenEditableAreas() const; >+ WEBCORE_EXPORT bool shouldEmulateUndoRedoInHiddenEditableAreas() const; > WEBCORE_EXPORT bool isTouchBarUpdateSupressedForHiddenContentEditable() const; > WEBCORE_EXPORT bool isNeverRichlyEditableForTouchBar() const; > > bool needsGMailOverflowScrollQuirk() const; > bool needsYouTubeOverflowScrollQuirk() const; > >+ WEBCORE_EXPORT static bool shouldEmulateUndoRedoInHiddenEditableAreasForHost(const StringView&); >+ > private: > bool needsQuirks() const; > >diff --git a/Source/WebCore/page/Settings.yaml b/Source/WebCore/page/Settings.yaml >index d30c815e9cc68eb27367111619f49a712bb80225..f2f1cdb728d825739e8d4939fd94b187abe427cf 100644 >--- a/Source/WebCore/page/Settings.yaml >+++ b/Source/WebCore/page/Settings.yaml >@@ -181,6 +181,7 @@ scriptMarkupEnabled: > needsSiteSpecificQuirks: > initial: false > inspectorOverride: true >+ onChange: needsSiteSpecificQuirksChanged > domTimersThrottlingEnabled: > initial: true > webArchiveDebugModeEnabled: >diff --git a/Source/WebCore/page/SettingsBase.cpp b/Source/WebCore/page/SettingsBase.cpp >index 582f23b74bc32e2c802aa45864f2310d2c2170be..d9fc2cbb597035470d509ba151acc106e3b1563f 100644 >--- a/Source/WebCore/page/SettingsBase.cpp >+++ b/Source/WebCore/page/SettingsBase.cpp >@@ -366,6 +366,12 @@ void SettingsBase::userStyleSheetLocationChanged() > if (m_page) > m_page->userStyleSheetLocationChanged(); > } >+ >+void SettingsBase::needsSiteSpecificQuirksChanged() >+{ >+ if (m_page) >+ m_page->needsSiteSpecificQuirksChanged(); >+} > > void SettingsBase::usesPageCacheChanged() > { >diff --git a/Source/WebCore/page/SettingsBase.h b/Source/WebCore/page/SettingsBase.h >index 42622f132c7d0c278a9cc218da982fcb200edfca..01f96bd3f53f6dd2ddb58bbb5af3013b687968a8 100644 >--- a/Source/WebCore/page/SettingsBase.h >+++ b/Source/WebCore/page/SettingsBase.h >@@ -186,6 +186,7 @@ protected: > void imagesEnabledChanged(); > void pluginsEnabledChanged(); > void userStyleSheetLocationChanged(); >+ void needsSiteSpecificQuirksChanged(); > void usesPageCacheChanged(); > void dnsPrefetchingEnabledChanged(); > void storageBlockingPolicyChanged(); >diff --git a/Source/WebCore/platform/PlatformKeyboardEvent.h b/Source/WebCore/platform/PlatformKeyboardEvent.h >index 519b6cd77e8970a7e17918deb2c7769c278b7801..351486d3fd2134c3a29b27fc8eb284458a8ea223 100644 >--- a/Source/WebCore/platform/PlatformKeyboardEvent.h >+++ b/Source/WebCore/platform/PlatformKeyboardEvent.h >@@ -134,6 +134,9 @@ namespace WebCore { > bool isAutoRepeat() const { return m_autoRepeat; } > bool isKeypad() const { return m_isKeypad; } > bool isSystemKey() const { return m_isSystemKey; } >+ >+ bool isSyntheticEvent() { return m_isSyntheticEvent; } >+ void setSyntheticEvent() { m_isSyntheticEvent = true; } > > WEBCORE_EXPORT static bool currentCapsLockState(); > WEBCORE_EXPORT static void getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey); >@@ -196,6 +199,8 @@ namespace WebCore { > bool m_autoRepeat; > bool m_isKeypad; > bool m_isSystemKey; >+ >+ bool m_isSyntheticEvent { false }; > > #if PLATFORM(COCOA) > #if !PLATFORM(IOS_FAMILY) >diff --git a/Source/WebKit/UIProcess/PageClient.h b/Source/WebKit/UIProcess/PageClient.h >index c89cbb1f237b6f149fc5519cdfe2fdbc43fb691e..e61c3da4ccd4cc35626708f85b1e0e0b88c76867 100644 >--- a/Source/WebKit/UIProcess/PageClient.h >+++ b/Source/WebKit/UIProcess/PageClient.h >@@ -505,6 +505,10 @@ public: > #if PLATFORM(WPE) > virtual IPC::Attachment hostFileDescriptor() = 0; > #endif >+#if PLATFORM(IOS_FAMILY) >+ virtual void setNeedsQuirkyNSUndoManager(bool) = 0; >+#endif >+ > }; > > } // namespace WebKit >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index 8720eebd7fb7ccf0b37388ab8bf2fdfed7b1c19b..3294d81b4734dbfc0aba6ad3e4ef089ce60d2232 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -550,6 +550,7 @@ public: > bool canShowMIMEType(const String& mimeType); > > String currentURL() const; >+ bool isCurrentURLHost(const String& base) const; > > float topContentInset() const { return m_topContentInset; } > void setTopContentInset(float); >@@ -720,6 +721,7 @@ public: > void requestEvasionRectsAboveSelection(CompletionHandler<void(const Vector<WebCore::FloatRect>&)>&&); > void updateSelectionWithDelta(int64_t locationDelta, int64_t lengthDelta, CompletionHandler<void()>&&); > void requestDocumentEditingContext(WebKit::DocumentEditingContextRequest, CompletionHandler<void(WebKit::DocumentEditingContext)>&&); >+ void generateSyntheticUndoRedo(bool isUndo); > #if ENABLE(DATA_INTERACTION) > void didHandleDragStartRequest(bool started); > void didHandleAdditionalDragItemsRequest(bool added); >@@ -727,7 +729,8 @@ public: > void requestAdditionalItemsForDragSession(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, WebCore::DragSourceAction allowedActions); > void didConcludeEditDrag(Optional<WebCore::TextIndicatorData>); > #endif >-#endif >+ void setNeedsQuirkyNSUndoManager(bool); >+#endif // PLATFORM(IOS_FAMILY) > #if ENABLE(DATA_DETECTION) > void setDataDetectionResult(const DataDetectionResult&); > #endif >diff --git a/Source/WebKit/UIProcess/WebPageProxy.messages.in b/Source/WebKit/UIProcess/WebPageProxy.messages.in >index 691b417e9170d80f926f8e50c88db6bc68121b3f..640d92747a641a51466c57198b3070f7fee0f9be 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.messages.in >+++ b/Source/WebKit/UIProcess/WebPageProxy.messages.in >@@ -422,6 +422,8 @@ messages -> WebPageProxy { > > UpdateStringForFind(String findString) > HandleAutocorrectionContext(struct WebKit::WebAutocorrectionContext context) >+ >+ SetNeedsQuirkyNSUndoManager(bool needsQuirkyNSUndoManager) > #endif > > DidChangeInspectorFrontendCount(uint64_t count) >diff --git a/Source/WebKit/UIProcess/ios/PageClientImplIOS.h b/Source/WebKit/UIProcess/ios/PageClientImplIOS.h >index 3872fbd72185ad4f14d99d6af4071fb7ee37e6bb..a40de24196fea9ee7e0a60e5e0fbe0205b5371b8 100644 >--- a/Source/WebKit/UIProcess/ios/PageClientImplIOS.h >+++ b/Source/WebKit/UIProcess/ios/PageClientImplIOS.h >@@ -253,6 +253,8 @@ private: > void cancelPointersForGestureRecognizer(UIGestureRecognizer*) override; > #endif > >+ void setNeedsQuirkyNSUndoManager(bool) override; >+ > WKContentView *m_contentView; > RetainPtr<WKEditorUndoTarget> m_undoTarget; > }; >diff --git a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >index 9d27bc4e5bf4d8ffc4a9db953556046b673c8636..ada2299bf6fea1238fc4d5f55519b857d1834ad7 100644 >--- a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >+++ b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >@@ -873,6 +873,11 @@ void PageClientImpl::handleAutocorrectionContext(const WebAutocorrectionContext& > [m_contentView _handleAutocorrectionContext:context]; > } > >+void PageClientImpl::setNeedsQuirkyNSUndoManager(bool needsQuirkyNSUndoManager) >+{ >+ [m_contentView _setNeedsQuirkyNSUndoManager:needsQuirkyNSUndoManager]; >+} >+ > } // namespace WebKit > > #endif // PLATFORM(IOS_FAMILY) >diff --git a/Source/WebKit/UIProcess/ios/WKContentView.h b/Source/WebKit/UIProcess/ios/WKContentView.h >index daa39102c7d82e1adae4b5a669d5ee76197fffc3..1a8d01a53d6cccf27a886fe5470ca744a2a9dfe3 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentView.h >+++ b/Source/WebKit/UIProcess/ios/WKContentView.h >@@ -116,4 +116,6 @@ class WebProcessPool; > - (double)_contentZoomScale; > - (double)_targetContentZoomScaleForRect:(const WebCore::FloatRect&)targetRect currentScale:(double)currentScale fitEntireRect:(BOOL)fitEntireRect minimumScale:(double)minimumScale maximumScale:(double)maximumScale; > >+- (void)_setNeedsQuirkyNSUndoManager:(bool)needsQuirkyNSUndoManager; >+ > @end >diff --git a/Source/WebKit/UIProcess/ios/WKContentView.mm b/Source/WebKit/UIProcess/ios/WKContentView.mm >index 6b2d9f9644f7b934d71bf17c3ae588c7c238b439..3397af3ae7485958cbef5bb861c7f4dbad22e8a1 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentView.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentView.mm >@@ -59,6 +59,7 @@ > #import <WebCore/InspectorOverlay.h> > #import <WebCore/NotImplemented.h> > #import <WebCore/PlatformScreen.h> >+#import <WebCore/Quirks.h> > #import <pal/spi/cocoa/QuartzCoreSPI.h> > #import <wtf/RetainPtr.h> > #import <wtf/text/TextStream.h> >@@ -172,6 +173,41 @@ - (instancetype)initWithFrame:(CGRect)frame > > @end > >+@interface WKQuirkyNSUndoManager : NSUndoManager >+@property (readonly, weak) WKContentView *contentView; >+@end >+ >+@implementation WKQuirkyNSUndoManager >+- (instancetype)initWithContentView:(WKContentView *)contentView >+{ >+ if (!(self = [super init])) >+ return nil; >+ _contentView = contentView; >+ return self; >+} >+ >+- (BOOL)canUndo >+{ >+ return YES; >+} >+ >+- (BOOL)canRedo >+{ >+ return YES; >+} >+ >+- (void)undo >+{ >+ [self.contentView generateSyntheticUndoRedo:YES]; >+} >+ >+- (void)redo >+{ >+ [self.contentView generateSyntheticUndoRedo:NO]; >+} >+ >+@end >+ > @implementation WKContentView { > std::unique_ptr<WebKit::PageClientImpl> _pageClient; > ALLOW_DEPRECATED_DECLARATIONS_BEGIN >@@ -189,7 +225,9 @@ @implementation WKContentView { > > WebKit::HistoricalVelocityData _historicalKinematicData; > >+ BOOL _isUsingQuirkyNSUndoManager; > RetainPtr<NSUndoManager> _undoManager; >+ RetainPtr<WKQuirkyNSUndoManager> _quirkyUndoManager; > > BOOL _isPrintingToPDF; > RetainPtr<CGPDFDocumentRef> _printedDocument; >@@ -496,11 +534,24 @@ - (void)didZoomToScale:(CGFloat)scale > [self _didEndScrollingOrZooming]; > } > >+- (void)_setNeedsQuirkyNSUndoManager:(BOOL)needsQuirkyNSUndoManager >+{ >+ _isUsingQuirkyNSUndoManager = needsQuirkyNSUndoManager; >+} >+ > - (NSUndoManager *)undoManager > { >+ if (_isUsingQuirkyNSUndoManager && WebCore::Quirks::shouldEmulateUndoRedoInHiddenEditableAreasForHost(URL({ }, _page->currentURL()).host())) { >+ if (self.hasHiddenContentEditable) { >+ if (!_quirkyUndoManager) >+ _quirkyUndoManager = adoptNS([[WKQuirkyNSUndoManager alloc] initWithContentView:self]); >+ return _quirkyUndoManager.get(); >+ } >+ } else >+ _isUsingQuirkyNSUndoManager = NO; >+ > if (!_undoManager) > _undoManager = adoptNS([[NSUndoManager alloc] init]); >- > return _undoManager.get(); > } > >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >index a61f519f75c09bddbae133797a9189ee1980bbee..46d5762204a02f1dbd3dad8b20a04b6f8acef30c 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >@@ -467,6 +467,9 @@ FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW) > > - (void)willFinishIgnoringCalloutBarFadeAfterPerformingAction; > >+- (BOOL)hasHiddenContentEditable; >+- (void)generateSyntheticUndoRedo:(BOOL)isUndo; >+ > // UIWebFormAccessoryDelegate protocol > - (void)accessoryDone; > >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index db1dd7611dbe415d16eb6ec17006e55a4cf302c6..c7a3d2f0aed76739570cb58392b88772493564ef 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -4476,6 +4476,11 @@ - (void)_handleKeyUIEvent:(::UIEvent *)event > [super _handleKeyUIEvent:event]; > } > >+- (void)generateSyntheticUndoRedo:(BOOL)isUndo >+{ >+ _page->generateSyntheticUndoRedo(isUndo); >+} >+ > #if !USE(UIKIT_KEYBOARD_ADDITIONS) > - (void)handleKeyEvent:(::UIEvent *)event > { >@@ -5710,6 +5715,11 @@ - (BOOL)shouldAllowHidingSelectionCommands > return !_ignoreSelectionCommandFadeCount; > } > >+- (BOOL)hasHiddenContentEditable >+{ >+ return _suppressSelectionAssistantReasons.contains(WebKit::EditableRootIsTransparentOrFullyClipped); >+} >+ > - (BOOL)_shouldSuppressSelectionCommands > { > return !!_suppressSelectionAssistantReasons; >diff --git a/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm b/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >index a670f9ceadceab8fa63dbb678ceb76b77de965ef..42e4d97ef74fee64a0ab61a3c7843ceb5974e3bb 100644 >--- a/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >+++ b/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >@@ -1107,6 +1107,14 @@ void WebPageProxy::contentSizeCategoryDidChange(const String& contentSizeCategor > process().send(Messages::WebPage::ContentSizeCategoryDidChange(contentSizeCategory), m_pageID); > } > >+void WebPageProxy::generateSyntheticUndoRedo(bool isUndo) >+{ >+ if (!hasRunningProcess()) >+ return; >+ >+ process().send(Messages::WebPage::GenerateSyntheticUndoRedo(isUndo), m_pageID); >+} >+ > void WebPageProxy::updateEditorState(const EditorState& editorState) > { > bool couldChangeSecureInputState = m_editorState.isInPasswordField != editorState.isInPasswordField || m_editorState.selectionIsNone; >@@ -1271,6 +1279,12 @@ const String& WebPageProxy::paymentCoordinatorCTDataConnectionServiceType(const > > #endif > >+void WebPageProxy::setNeedsQuirkyNSUndoManager(bool needsQuirkyNSUndoManager) >+{ >+ pageClient().setNeedsQuirkyNSUndoManager(needsQuirkyNSUndoManager); >+} >+ >+ > #if USE(APPLE_INTERNAL_SDK) > #import <WebKitAdditions/WebPageProxyIOSAdditions.mm> > #endif >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >index 705b25e9fc912a63b5b4577ef2b8d5e0717a3540..c0d75edd56843c334b1820fd5db45a0d8fc844da 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >@@ -180,6 +180,8 @@ private: > void associateEditableImageWithAttachment(WebCore::GraphicsLayer::EmbeddedViewID, const String& attachmentID) final; > void didCreateEditableImage(WebCore::GraphicsLayer::EmbeddedViewID) final; > void didDestroyEditableImage(WebCore::GraphicsLayer::EmbeddedViewID) final; >+ >+ void setNeedsQuirkyNSUndoManager(bool) final; > #endif > > #if ENABLE(ORIENTATION_EVENTS) >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm b/Source/WebKit/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm >index 2944091e3aa13d4ea9e3c5290f2211b2e2fc8b7e..0633c76ff21ac0a5abc15919f5585d69830c01f6 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm >+++ b/Source/WebKit/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm >@@ -181,6 +181,11 @@ void WebChromeClient::didDestroyEditableImage(GraphicsLayer::EmbeddedViewID embe > #endif > } > >+void WebChromeClient::setNeedsQuirkyNSUndoManager(bool needsQuirkyNSUndoManager) >+{ >+ m_page.send(Messages::WebPageProxy::SetNeedsQuirkyNSUndoManager(needsQuirkyNSUndoManager)); >+} >+ > } // namespace WebKit > > #endif // PLATFORM(IOS_FAMILY) >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index cc4d7973d2446a657354ddb9bbef56a8ed9c8c5c..a21e9fa957c214b52618890521c61a2641bc9e20 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -1220,6 +1220,7 @@ private: > RefPtr<WebCore::Range> rangeForWebSelectionAtPosition(const WebCore::IntPoint&, const WebCore::VisiblePosition&, SelectionFlags&); > void getFocusedElementInformation(FocusedElementInformation&); > void platformInitializeAccessibility(); >+ void generateSyntheticUndoRedo(bool); > void handleSyntheticClick(WebCore::Node& nodeRespondingToClick, const WebCore::FloatPoint& location, OptionSet<WebKit::WebEvent::Modifier>); > void completeSyntheticClick(WebCore::Node& nodeRespondingToClick, const WebCore::FloatPoint& location, OptionSet<WebKit::WebEvent::Modifier>, WebCore::SyntheticClickType); > void sendTapHighlightForNodeIfNecessary(uint64_t requestID, WebCore::Node*); >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >index 0123fd9d4fb4b0a19097677046c4dceed6c980ac..3f325b846662203ae3024f0347c7fc71078210b6 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >@@ -113,6 +113,7 @@ messages -> WebPage LegacyReceiver { > SetIsShowingInputViewForFocusedElement(bool showingInputView) > UpdateSelectionWithDelta(int64_t locationDelta, int64_t lengthDelta) -> () Async > RequestDocumentEditingContext(struct WebKit::DocumentEditingContextRequest request) -> (struct WebKit::DocumentEditingContext response) Async >+ GenerateSyntheticUndoRedo(bool isUndo) > #endif > > SetControlledByAutomation(bool controlled) >diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >index 83f3126ee5dfcd82ea50b25113b2545be981510d..dc7dfc10f130f8a65ecb5d2057ae1bd9f242f99b 100644 >--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >@@ -419,6 +419,11 @@ bool WebPage::handleEditingKeyboardEvent(KeyboardEvent* event) > auto* platformEvent = event->underlyingPlatformEvent(); > if (!platformEvent) > return false; >+ >+ // Don't send synthetic events to the UIProcess. They are only >+ // used for interacting with JavaScript. >+ if (platformEvent->isSyntheticEvent()) >+ return false; > > // FIXME: Interpret the event immediately upon receiving it in UI process, without sending to WebProcess first. > bool eventWasHandled = false; >@@ -580,6 +585,39 @@ static bool nodeAlwaysTriggersClick(const Node& targetNode) > return AccessibilityObject::isARIAControl(ariaRole) || AccessibilityObject::isARIAInput(ariaRole); > } > >+void WebPage::generateSyntheticUndoRedo(bool isUndo) >+{ >+ PlatformKeyboardEvent keyEvent; >+ auto& frame = m_page->focusController().focusedOrMainFrame(); >+ >+ OptionSet<PlatformEvent::Modifier> modifiers; >+ modifiers.add(PlatformEvent::Modifier::MetaKey); >+ >+ if (isUndo) { >+ keyEvent = PlatformKeyboardEvent(PlatformEvent::KeyDown, "z", "z", >+#if ENABLE(KEYBOARD_KEY_ATTRIBUTE) >+ "z", >+#endif >+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE) >+ "KeyZ"_s, >+#endif >+ @"U+005A", 90, false, false, false, modifiers, WallTime::now()); >+ } else { >+ keyEvent = PlatformKeyboardEvent(PlatformEvent::KeyDown, "y", "y", >+#if ENABLE(KEYBOARD_KEY_ATTRIBUTE) >+ "y", >+#endif >+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE) >+ "KeyY"_s, >+#endif >+ @"U+0059", 89, false, false, false, modifiers, WallTime::now()); >+ } >+ >+ PlatformKeyboardEvent::setCurrentModifierState(modifiers); >+ >+ frame.eventHandler().keyEvent(keyEvent); >+} >+ > void WebPage::handleSyntheticClick(Node& nodeRespondingToClick, const WebCore::FloatPoint& location, OptionSet<WebEvent::Modifier> modifiers) > { > if (!nodeRespondingToClick.document().settings().contentChangeObserverEnabled()) { >diff --git a/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h b/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h >index 127633e6bce382a0af914868acd7182fc3835fc9..f9ef4159f6a24914742ff214e99db2d64051f959 100644 >--- a/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h >+++ b/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.h >@@ -93,6 +93,8 @@ private: > void showPlaybackTargetPicker(bool hasVideo, WebCore::RouteSharingPolicy, const String&) final; > RefPtr<WebCore::Icon> createIconForFiles(const Vector<String>& filenames) final; > >+ void setNeedsQuirkyNSUndoManager(bool) final; >+ > #if ENABLE(ORIENTATION_EVENTS) > int deviceOrientation() const final; > #endif >diff --git a/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.mm b/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.mm >index 786431f722076ce4c83dcca7c2d5ce91cbc08f50..a194b554dd8de98bd46d88c55bd924a62740b833 100644 >--- a/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.mm >+++ b/Source/WebKitLegacy/ios/WebCoreSupport/WebChromeClientIOS.mm >@@ -389,4 +389,8 @@ int WebChromeClientIOS::deviceOrientation() const > } > #endif > >+void WebChromeClientIOS::setNeedsQuirkyNSUndoManager(bool needsQuirkyNSUndoManager) >+{ >+} >+ > #endif // PLATFORM(IOS_FAMILY)
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 197452
:
368878
|
368882
|
368987
|
368989
|
369001
|
369040
|
369172
|
369209
|
369214
|
369221
|
369254
|
369322
|
369342
|
369346
|
369356
|
369362
|
369396
|
369400
|
369413
|
369416
|
369440