WebKit Bugzilla
Attachment 371632 Details for
Bug 198681
: Extend quirks to emulate bold/italic/underline in hidden editable areas
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-198681-20190607165450.patch (text/plain), 12.22 KB, created by
Megan Gardner
on 2019-06-07 16:54:51 PDT
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Megan Gardner
Created:
2019-06-07 16:54:51 PDT
Size:
12.22 KB
patch
obsolete
>Subversion Revision: 246125 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index e8d099365b10c918d5ccac368401dda01953947b..2e66cbda8cb7bfe44e94a02acc8bd9d44be708b6 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1 +1,19 @@ >+2019-06-07 Megan Gardner <megan_gardner@apple.com> >+ >+ Extend quirks to emulate bold/italic/underline in hidden editable areas >+ https://bugs.webkit.org/show_bug.cgi?id=198681 >+ >+ Reviewed by Wenson Hsieh. >+ >+ Rename only. >+ >+ Rename quirks to be more accurate for new extended use. >+ >+ * page/Quirks.cpp: >+ (WebCore::shouldEmulateEditingButtonsAndGesturesInHiddenEditableAreasForHost): >+ (WebCore::Quirks::shouldEmulateEditingButtonsAndGesturesInHiddenEditableAreas const): >+ (WebCore::shouldEmulateUndoRedoInHiddenEditableAreasForHost): Deleted. >+ (WebCore::Quirks::shouldEmulateUndoRedoInHiddenEditableAreas const): Deleted. >+ * page/Quirks.h: >+ > == Rolled over to ChangeLog-2019-06-05 == >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index f87c2aaf679a19227280e8c6af78ce9ed7f426d3..a5eaafe83e8f4be007a0fb30e0bfdb24bf94120c 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,27 @@ >+2019-06-07 Megan Gardner <megan_gardner@apple.com> >+ >+ Extend quirks to emulate bold/italic/underline in hidden editable areas >+ https://bugs.webkit.org/show_bug.cgi?id=198681 >+ >+ Reviewed by Wenson Hsieh. >+ >+ * Shared/FocusedElementInformation.cpp: >+ (WebKit::FocusedElementInformation::encode const): >+ (WebKit::FocusedElementInformation::decode): >+ * Shared/FocusedElementInformation.h: >+ * Shared/SyntheticEditingCommandType.h: >+ * UIProcess/ios/WKContentView.mm: >+ (-[WKContentView undoManager]): >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (shouldSynthezieKeyEvents): >+ (-[WKContentView toggleBoldfaceForWebView:]): >+ (-[WKContentView toggleItalicsForWebView:]): >+ (-[WKContentView toggleUnderlineForWebView:]): >+ (-[WKContentView _elementDidBlur]): >+ * WebProcess/WebPage/ios/WebPageIOS.mm: >+ (WebKit::WebPage::generateSyntheticEditingCommand): >+ (WebKit::WebPage::getFocusedElementInformation): >+ > 2019-06-05 Youenn Fablet <youenn@apple.com> > > Remove logSiteIdentifier from UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame >diff --git a/Source/WebCore/page/Quirks.cpp b/Source/WebCore/page/Quirks.cpp >index 2aaa07113a1bebb0b5d327c0342ba0a487ef141b..a42d22a10cf0bf6d4744b62207556a4407a8b948 100644 >--- a/Source/WebCore/page/Quirks.cpp >+++ b/Source/WebCore/page/Quirks.cpp >@@ -238,7 +238,7 @@ static bool shouldSuppressAutocorrectionAndAutocaptializationInHiddenEditableAre > #endif > } > >-static bool shouldEmulateUndoRedoInHiddenEditableAreasForHost(const StringView& host) >+static bool shouldEmulateEditingButtonsAndGesturesInHiddenEditableAreasForHost(const StringView& host) > { > #if PLATFORM(IOS_FAMILY) > return equalLettersIgnoringASCIICase(host, "docs.google.com"); >@@ -266,12 +266,12 @@ bool Quirks::shouldDispatchSyntheticMouseEventsWhenModifyingSelection() const > return false; > } > >-bool Quirks::shouldEmulateUndoRedoInHiddenEditableAreas() const >+bool Quirks::shouldEmulateEditingButtonsAndGesturesInHiddenEditableAreas() const > { > if (!needsQuirks()) > return false; > >- return shouldEmulateUndoRedoInHiddenEditableAreasForHost(m_document->topDocument().url().host()); >+ return shouldEmulateEditingButtonsAndGesturesInHiddenEditableAreasForHost(m_document->topDocument().url().host()); > } > > bool Quirks::shouldSuppressAutocorrectionAndAutocaptializationInHiddenEditableAreas() const >diff --git a/Source/WebCore/page/Quirks.h b/Source/WebCore/page/Quirks.h >index 6b1f1bb9537a5d033d957e851e9b4c15f3f1b194..3a6ba1bd85dc87f8c93bd52a2762e9747ada60b6 100644 >--- a/Source/WebCore/page/Quirks.h >+++ b/Source/WebCore/page/Quirks.h >@@ -55,7 +55,7 @@ public: > > WEBCORE_EXPORT bool shouldDispatchSyntheticMouseEventsWhenModifyingSelection() const; > WEBCORE_EXPORT bool shouldSuppressAutocorrectionAndAutocaptializationInHiddenEditableAreas() const; >- WEBCORE_EXPORT bool shouldEmulateUndoRedoInHiddenEditableAreas() const; >+ WEBCORE_EXPORT bool shouldEmulateEditingButtonsAndGesturesInHiddenEditableAreas() const; > WEBCORE_EXPORT bool isTouchBarUpdateSupressedForHiddenContentEditable() const; > WEBCORE_EXPORT bool isNeverRichlyEditableForTouchBar() const; > >diff --git a/Source/WebKit/Shared/FocusedElementInformation.cpp b/Source/WebKit/Shared/FocusedElementInformation.cpp >index cdef1a24be55ce2f4b3e7e3858360d024b1981f8..48fb32423d558b20dbe7d9eb10c8e87072b140db 100644 >--- a/Source/WebKit/Shared/FocusedElementInformation.cpp >+++ b/Source/WebKit/Shared/FocusedElementInformation.cpp >@@ -104,7 +104,7 @@ void FocusedElementInformation::encode(IPC::Encoder& encoder) const > encoder << suggestedColors; > #endif > #endif >- encoder << shouldSynthesizeKeyEventsForUndoAndRedo; >+ encoder << shouldSynthesizeKeyEventsForEditing; > } > > bool FocusedElementInformation::decode(IPC::Decoder& decoder, FocusedElementInformation& result) >@@ -223,7 +223,7 @@ bool FocusedElementInformation::decode(IPC::Decoder& decoder, FocusedElementInfo > return false; > #endif > #endif >- if (!decoder.decode(result.shouldSynthesizeKeyEventsForUndoAndRedo)) >+ if (!decoder.decode(result.shouldSynthesizeKeyEventsForEditing)) > return false; > > return true; >diff --git a/Source/WebKit/Shared/FocusedElementInformation.h b/Source/WebKit/Shared/FocusedElementInformation.h >index b3900ceb3cb2ade052d49c58ff7942394b1477ca..8d03ae2e5b5418f60e7d26c9d92f7cc324aa8d04 100644 >--- a/Source/WebKit/Shared/FocusedElementInformation.h >+++ b/Source/WebKit/Shared/FocusedElementInformation.h >@@ -136,7 +136,7 @@ struct FocusedElementInformation { > Vector<WebCore::Color> suggestedColors; > #endif > #endif >- bool shouldSynthesizeKeyEventsForUndoAndRedo { false }; >+ bool shouldSynthesizeKeyEventsForEditing { false }; > > FocusedElementIdentifier focusedElementIdentifier { 0 }; > >diff --git a/Source/WebKit/Shared/SyntheticEditingCommandType.h b/Source/WebKit/Shared/SyntheticEditingCommandType.h >index 7e381e47d0c915ee2f4b29a47f359bd69382200a..f7814d3dd19366c7b437eb0771a2072b8b8ab1e4 100644 >--- a/Source/WebKit/Shared/SyntheticEditingCommandType.h >+++ b/Source/WebKit/Shared/SyntheticEditingCommandType.h >@@ -29,7 +29,10 @@ namespace WebKit { > > enum class SyntheticEditingCommandType : uint8_t { > Undo, >- Redo >+ Redo, >+ ToggleBoldface, >+ ToggleItalic, >+ ToggleUnderline > }; > > } // namespace WebKit >@@ -40,7 +43,10 @@ template<> struct EnumTraits<WebKit::SyntheticEditingCommandType> { > using values = EnumValues < > WebKit::SyntheticEditingCommandType, > WebKit::SyntheticEditingCommandType::Undo, >- WebKit::SyntheticEditingCommandType::Redo >+ WebKit::SyntheticEditingCommandType::Redo, >+ WebKit::SyntheticEditingCommandType::ToggleBoldface, >+ WebKit::SyntheticEditingCommandType::ToggleItalic, >+ WebKit::SyntheticEditingCommandType::ToggleUnderline > >; > }; > >diff --git a/Source/WebKit/UIProcess/ios/WKContentView.mm b/Source/WebKit/UIProcess/ios/WKContentView.mm >index 56b4562c796a714b9a0937d66828137b88b46923..315c7b9a31e10a79ea5bed26ef0def2ed241fa8f 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentView.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentView.mm >@@ -443,7 +443,7 @@ - (void)didZoomToScale:(CGFloat)scale > > - (NSUndoManager *)undoManager > { >- if (self.focusedElementInformation.shouldSynthesizeKeyEventsForUndoAndRedo && self.hasHiddenContentEditable) { >+ if (self.focusedElementInformation.shouldSynthesizeKeyEventsForEditing && self.hasHiddenContentEditable) { > if (!_quirkyUndoManager) > _quirkyUndoManager = adoptNS([[WKQuirkyNSUndoManager alloc] initWithContentView:self]); > return _quirkyUndoManager.get(); >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index 9a6d214e4bc98eaf2ad3c30dda8d8c92a7fe555c..433c4e640f42a2c1915c946924eee8234d6ba2c8 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -3117,12 +3117,22 @@ - (void)selectAllForWebView:(id)sender > _page->selectAll(); > } > >+- (BOOL)shouldSynthesizeKeyEvents >+{ >+ if (_focusedElementInformation.shouldSynthesizeKeyEventsForEditing && self.hasHiddenContentEditable) >+ return true; >+ return false; >+} >+ > - (void)toggleBoldfaceForWebView:(id)sender > { > if (!_page->editorState().isContentRichlyEditable) > return; > > [self executeEditCommandWithCallback:@"toggleBold"]; >+ >+ if (self.shouldSynthesizeKeyEvents) >+ _page->generateSyntheticEditingCommand(WebKit::SyntheticEditingCommandType::ToggleBoldface); > } > > - (void)toggleItalicsForWebView:(id)sender >@@ -3131,6 +3141,9 @@ - (void)toggleItalicsForWebView:(id)sender > return; > > [self executeEditCommandWithCallback:@"toggleItalic"]; >+ >+ if (self.shouldSynthesizeKeyEvents) >+ _page->generateSyntheticEditingCommand(WebKit::SyntheticEditingCommandType::ToggleItalic); > } > > - (void)toggleUnderlineForWebView:(id)sender >@@ -3139,6 +3152,9 @@ - (void)toggleUnderlineForWebView:(id)sender > return; > > [self executeEditCommandWithCallback:@"toggleUnderline"]; >+ >+ if (self.shouldSynthesizeKeyEvents) >+ _page->generateSyntheticEditingCommand(WebKit::SyntheticEditingCommandType::ToggleUnderline); > } > > - (void)_showTextStyleOptionsForWebView:(id)sender >@@ -5219,7 +5235,7 @@ - (void)_elementDidBlur > BOOL editableChanged = [self setIsEditable:NO]; > > _focusedElementInformation.elementType = WebKit::InputType::None; >- _focusedElementInformation.shouldSynthesizeKeyEventsForUndoAndRedo = false; >+ _focusedElementInformation.shouldSynthesizeKeyEventsForEditing = false; > _inputPeripheral = nil; > _focusRequiresStrongPasswordAssistance = NO; > >diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >index f4212b003d9ca00102220bcb67cbcd9c4dd6f1f9..38bf8fe5f77a8c16d6610b0a1596bb71eaaf7a50 100644 >--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >@@ -615,6 +615,36 @@ void WebPage::generateSyntheticEditingCommand(SyntheticEditingCommandType comman > #endif > @"U+0059", 89, false, false, false, modifiers, WallTime::now()); > break; >+ case SyntheticEditingCommandType::ToggleBoldface: >+ keyEvent = PlatformKeyboardEvent(PlatformEvent::KeyDown, "b", "b", >+#if ENABLE(KEYBOARD_KEY_ATTRIBUTE) >+ "b", >+#endif >+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE) >+ "KeyB"_s, >+#endif >+ @"U+0042", 66, false, false, false, modifiers, WallTime::now()); >+ break; >+ case SyntheticEditingCommandType::ToggleItalic: >+ keyEvent = PlatformKeyboardEvent(PlatformEvent::KeyDown, "i", "i", >+#if ENABLE(KEYBOARD_KEY_ATTRIBUTE) >+ "i", >+#endif >+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE) >+ "KeyI"_s, >+#endif >+ @"U+0049", 73, false, false, false, modifiers, WallTime::now()); >+ break; >+ case SyntheticEditingCommandType::ToggleUnderline: >+ keyEvent = PlatformKeyboardEvent(PlatformEvent::KeyDown, "u", "u", >+#if ENABLE(KEYBOARD_KEY_ATTRIBUTE) >+ "u", >+#endif >+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE) >+ "KeyU"_s, >+#endif >+ @"U+0055", 85, false, false, false, modifiers, WallTime::now()); >+ break; > default: > break; > } >@@ -2877,7 +2907,7 @@ void WebPage::getFocusedElementInformation(FocusedElementInformation& informatio > information.isAutocorrect = focusedElement.shouldAutocorrect(); > information.autocapitalizeType = focusedElement.autocapitalizeType(); > information.inputMode = focusedElement.canonicalInputMode(); >- information.shouldSynthesizeKeyEventsForUndoAndRedo = focusedElement.document().quirks().shouldEmulateUndoRedoInHiddenEditableAreas(); >+ information.shouldSynthesizeKeyEventsForEditing = focusedElement.document().quirks().shouldEmulateEditingButtonsAndGesturesInHiddenEditableAreas(); > } else { > information.isAutocorrect = true; > information.autocapitalizeType = AutocapitalizeTypeDefault;
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 198681
:
371614
|
371619
| 371632