WebKit Bugzilla
Attachment 369322 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-20190507132633.patch (text/plain), 28.33 KB, created by
Megan Gardner
on 2019-05-07 13:26:34 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Megan Gardner
Created:
2019-05-07 13:26:34 PDT
Size:
28.33 KB
patch
obsolete
>Subversion Revision: 245021 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 1b2d9db69bb644da635812d997e714244795a906..80df32f692df3cc0fe0b0c44583806eff8bff193 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-07 Antoine Quint <graouts@apple.com> > > [Pointer Events] isPrimary property of pointercancel events should match previous events for that pointer >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 3fb03b1295f2d11aa66a1bb09145c1ed300888cd..3345e243730acfdb389dc8c066059d9d451d18bb 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-07 Chris Dumez <cdumez@apple.com> > > Rename ConnectionMac.mm to ConnectionCocoa.mm since it is used on both macOS and iOS >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index ce429277c7eac60022375d9cb89e8d651d43daa0..00bad18fa6e32047196c2dcf4dec7b244cd57664 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -3160,6 +3160,11 @@ void Document::setURL(const URL& url) > m_url = newURL; > m_documentURI = m_url.string(); > updateBaseURL(); >+ >+#if PLATFORM(IOS_FAMILY) >+ if (page()) >+ 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 c9e7722e3410e09bbdba91725c5fbd4b8b31215d..1fd7098114b98b131dcab64d49a33407e8370723 100644 >--- a/Source/WebCore/page/Page.cpp >+++ b/Source/WebCore/page/Page.cpp >@@ -1400,6 +1400,14 @@ void Page::userStyleSheetLocationChanged() > frame->document()->extensionStyleSheets().updatePageUserSheet(); > } > } >+ >+void Page::needsSiteSpecificQuirksChanged() >+{ >+#if PLATFORM(IOS_FAMILY) >+ if (mainFrame().document()) >+ chrome().client().setNeedsQuirkyNSUndoManager(mainFrame().document()->quirks().shouldEmulateUndoRedoInHiddenEditableAreas()); >+#endif >+} > > const String& Page::userStyleSheet() const > { >diff --git a/Source/WebCore/page/Page.h b/Source/WebCore/page/Page.h >index fcf3f77590f6a69213c80c5b0e7b6269c31d9883..1b03a2a03c0ac8e8b64c8a6df4c6bc120e1b22fa 100644 >--- a/Source/WebCore/page/Page.h >+++ b/Source/WebCore/page/Page.h >@@ -483,6 +483,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 b1f1ffdb5ae4011c0a96f1f19c92b4e2e9cbfe94..386b1d72f820a4cf8e9a923cdccff794a86a02cc 100644 >--- a/Source/WebCore/page/Quirks.cpp >+++ b/Source/WebCore/page/Quirks.cpp >@@ -235,8 +235,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 e920bc326797ee888842e91fd36b76461343c4c8..66e984ea017749f258b646cb636c0fed492149de 100644 >--- a/Source/WebCore/page/Quirks.h >+++ b/Source/WebCore/page/Quirks.h >@@ -53,12 +53,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 b7a02a90349fe1730bc733d1a98409a534c9b53f..85c272c364a5de6461f210d1fb10487bc6253d4d 100644 >--- a/Source/WebCore/platform/PlatformKeyboardEvent.h >+++ b/Source/WebCore/platform/PlatformKeyboardEvent.h >@@ -128,6 +128,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); >@@ -190,6 +193,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 68cfc5b717fe8973278284d1ab9c55d4fb2887f2..cdf1972ab82bd467ed7bde387732177d065dfe7a 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >@@ -470,6 +470,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 f302bafc4cc48665fd7b5e6b5e2541f70f709ee8..94bd0d9ba9dc9721fa5a1710f8895446db2aa128 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -4482,6 +4482,11 @@ - (void)_handleKeyUIEvent:(::UIEvent *)event > [super _handleKeyUIEvent:event]; > } > >+- (void)generateSyntheticUndoRedo:(BOOL)isUndo >+{ >+ _page->generateSyntheticUndoRedo(isUndo); >+} >+ > #if !USE(UIKIT_KEYBOARD_ADDITIONS) > - (void)handleKeyEvent:(::UIEvent *)event > { >@@ -5736,6 +5741,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 9030b7b87c337b75e3fcfe5f49adc701249961b6..cc80cf6640fb7d17a56045b54bf143b7a08d674e 100644 >--- a/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >+++ b/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >@@ -1102,6 +1102,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; >@@ -1266,6 +1274,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 d9d804cbd637991052c8c6d2c1ce229e67d36a98..30f319111b70aef0e4258fa9f765f1d24224daa5 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -1221,6 +1221,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 c2db1f5b30b3c70e1993fe65d63e13581c2f8568..1f65b6392248b9d0d92199dda5cf7fa664aa3287 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