⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 246226 in webkit


Ignore:
Timestamp:
Jun 7, 2019, 5:48:42 PM (7 years ago)
Author:
Megan Gardner
Message:

Extend quirks to emulate bold/italic/underline in hidden editable areas
https://bugs.webkit.org/show_bug.cgi?id=198681

Reviewed by Wenson Hsieh.

Source/WebCore:

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:

Source/WebKit:

  • 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):

Location:
trunk/Source
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r246225 r246226  
     12019-06-07  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Extend quirks to emulate bold/italic/underline in hidden editable areas
     4        https://bugs.webkit.org/show_bug.cgi?id=198681
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        Rename only.
     9
     10        Rename quirks to be more accurate for new extended use.
     11
     12        * page/Quirks.cpp:
     13        (WebCore::shouldEmulateEditingButtonsAndGesturesInHiddenEditableAreasForHost):
     14        (WebCore::Quirks::shouldEmulateEditingButtonsAndGesturesInHiddenEditableAreas const):
     15        (WebCore::shouldEmulateUndoRedoInHiddenEditableAreasForHost): Deleted.
     16        (WebCore::Quirks::shouldEmulateUndoRedoInHiddenEditableAreas const): Deleted.
     17        * page/Quirks.h:
     18
    1192019-06-07  Truitt Savell  <tsavell@apple.com>
    220
  • trunk/Source/WebCore/page/Quirks.cpp

    r246216 r246226  
    239239}
    240240
    241 static bool shouldEmulateUndoRedoInHiddenEditableAreasForHost(const StringView& host)
     241static bool shouldEmulateEditingButtonsAndGesturesInHiddenEditableAreasForHost(const StringView& host)
    242242{
    243243#if PLATFORM(IOS_FAMILY)
     
    267267}
    268268
    269 bool Quirks::shouldEmulateUndoRedoInHiddenEditableAreas() const
    270 {
    271     if (!needsQuirks())
    272         return false;
    273 
    274     return shouldEmulateUndoRedoInHiddenEditableAreasForHost(m_document->topDocument().url().host());
     269bool Quirks::shouldEmulateEditingButtonsAndGesturesInHiddenEditableAreas() const
     270{
     271    if (!needsQuirks())
     272        return false;
     273
     274    return shouldEmulateEditingButtonsAndGesturesInHiddenEditableAreasForHost(m_document->topDocument().url().host());
    275275}
    276276
  • trunk/Source/WebCore/page/Quirks.h

    r246216 r246226  
    5959    WEBCORE_EXPORT bool shouldDispatchSyntheticMouseEventsWhenModifyingSelection() const;
    6060    WEBCORE_EXPORT bool shouldSuppressAutocorrectionAndAutocaptializationInHiddenEditableAreas() const;
    61     WEBCORE_EXPORT bool shouldEmulateUndoRedoInHiddenEditableAreas() const;
     61    WEBCORE_EXPORT bool shouldEmulateEditingButtonsAndGesturesInHiddenEditableAreas() const;
    6262    WEBCORE_EXPORT bool isTouchBarUpdateSupressedForHiddenContentEditable() const;
    6363    WEBCORE_EXPORT bool isNeverRichlyEditableForTouchBar() const;
  • trunk/Source/WebKit/ChangeLog

    r246224 r246226  
     12019-06-07  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Extend quirks to emulate bold/italic/underline in hidden editable areas
     4        https://bugs.webkit.org/show_bug.cgi?id=198681
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        * Shared/FocusedElementInformation.cpp:
     9        (WebKit::FocusedElementInformation::encode const):
     10        (WebKit::FocusedElementInformation::decode):
     11        * Shared/FocusedElementInformation.h:
     12        * Shared/SyntheticEditingCommandType.h:
     13        * UIProcess/ios/WKContentView.mm:
     14        (-[WKContentView undoManager]):
     15        * UIProcess/ios/WKContentViewInteraction.mm:
     16        (shouldSynthezieKeyEvents):
     17        (-[WKContentView toggleBoldfaceForWebView:]):
     18        (-[WKContentView toggleItalicsForWebView:]):
     19        (-[WKContentView toggleUnderlineForWebView:]):
     20        (-[WKContentView _elementDidBlur]):
     21        * WebProcess/WebPage/ios/WebPageIOS.mm:
     22        (WebKit::WebPage::generateSyntheticEditingCommand):
     23        (WebKit::WebPage::getFocusedElementInformation):
     24
    1252019-06-05  Alex Christensen  <achristensen@webkit.org>
    226
  • trunk/Source/WebKit/Shared/FocusedElementInformation.cpp

    r245079 r246226  
    105105#endif
    106106#endif
    107     encoder << shouldSynthesizeKeyEventsForUndoAndRedo;
     107    encoder << shouldSynthesizeKeyEventsForEditing;
    108108}
    109109
     
    224224#endif
    225225#endif
    226     if (!decoder.decode(result.shouldSynthesizeKeyEventsForUndoAndRedo))
     226    if (!decoder.decode(result.shouldSynthesizeKeyEventsForEditing))
    227227        return false;
    228228
  • trunk/Source/WebKit/Shared/FocusedElementInformation.h

    r245079 r246226  
    137137#endif
    138138#endif
    139     bool shouldSynthesizeKeyEventsForUndoAndRedo { false };
     139    bool shouldSynthesizeKeyEventsForEditing { false };
    140140
    141141    FocusedElementIdentifier focusedElementIdentifier { 0 };
  • trunk/Source/WebKit/Shared/SyntheticEditingCommandType.h

    r245079 r246226  
    3030enum class SyntheticEditingCommandType : uint8_t  {
    3131    Undo,
    32     Redo
     32    Redo,
     33    ToggleBoldface,
     34    ToggleItalic,
     35    ToggleUnderline
    3336};
    3437
     
    4144    WebKit::SyntheticEditingCommandType,
    4245    WebKit::SyntheticEditingCommandType::Undo,
    43     WebKit::SyntheticEditingCommandType::Redo
     46    WebKit::SyntheticEditingCommandType::Redo,
     47    WebKit::SyntheticEditingCommandType::ToggleBoldface,
     48    WebKit::SyntheticEditingCommandType::ToggleItalic,
     49    WebKit::SyntheticEditingCommandType::ToggleUnderline
    4450    >;
    4551};
  • trunk/Source/WebKit/UIProcess/ios/WKContentView.mm

    r245787 r246226  
    444444- (NSUndoManager *)undoManager
    445445{
    446     if (self.focusedElementInformation.shouldSynthesizeKeyEventsForUndoAndRedo && self.hasHiddenContentEditable) {
     446    if (self.focusedElementInformation.shouldSynthesizeKeyEventsForEditing && self.hasHiddenContentEditable) {
    447447        if (!_quirkyUndoManager)
    448448            _quirkyUndoManager = adoptNS([[WKQuirkyNSUndoManager alloc] initWithContentView:self]);
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r246224 r246226  
    31193119}
    31203120
     3121- (BOOL)shouldSynthesizeKeyEvents
     3122{
     3123    if (_focusedElementInformation.shouldSynthesizeKeyEventsForEditing && self.hasHiddenContentEditable)
     3124        return true;
     3125    return false;
     3126}
     3127
    31213128- (void)toggleBoldfaceForWebView:(id)sender
    31223129{
     
    31253132
    31263133    [self executeEditCommandWithCallback:@"toggleBold"];
     3134
     3135    if (self.shouldSynthesizeKeyEvents)
     3136        _page->generateSyntheticEditingCommand(WebKit::SyntheticEditingCommandType::ToggleBoldface);
    31273137}
    31283138
     
    31333143
    31343144    [self executeEditCommandWithCallback:@"toggleItalic"];
     3145
     3146    if (self.shouldSynthesizeKeyEvents)
     3147        _page->generateSyntheticEditingCommand(WebKit::SyntheticEditingCommandType::ToggleItalic);
    31353148}
    31363149
     
    31413154
    31423155    [self executeEditCommandWithCallback:@"toggleUnderline"];
     3156
     3157    if (self.shouldSynthesizeKeyEvents)
     3158        _page->generateSyntheticEditingCommand(WebKit::SyntheticEditingCommandType::ToggleUnderline);
    31433159}
    31443160
     
    52255241
    52265242    _focusedElementInformation.elementType = WebKit::InputType::None;
    5227     _focusedElementInformation.shouldSynthesizeKeyEventsForUndoAndRedo = false;
     5243    _focusedElementInformation.shouldSynthesizeKeyEventsForEditing = false;
    52285244    _inputPeripheral = nil;
    52295245    _focusRequiresStrongPasswordAssistance = NO;
  • trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

    r246116 r246226  
    616616        @"U+0059", 89, false, false, false, modifiers, WallTime::now());
    617617        break;
     618    case SyntheticEditingCommandType::ToggleBoldface:
     619        keyEvent = PlatformKeyboardEvent(PlatformEvent::KeyDown, "b", "b",
     620#if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
     621        "b",
     622#endif
     623#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
     624        "KeyB"_s,
     625#endif
     626        @"U+0042", 66, false, false, false, modifiers, WallTime::now());
     627        break;
     628    case SyntheticEditingCommandType::ToggleItalic:
     629        keyEvent = PlatformKeyboardEvent(PlatformEvent::KeyDown, "i", "i",
     630#if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
     631        "i",
     632#endif
     633#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
     634        "KeyI"_s,
     635#endif
     636        @"U+0049", 73, false, false, false, modifiers, WallTime::now());
     637        break;
     638    case SyntheticEditingCommandType::ToggleUnderline:
     639        keyEvent = PlatformKeyboardEvent(PlatformEvent::KeyDown, "u", "u",
     640#if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
     641        "u",
     642#endif
     643#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
     644        "KeyU"_s,
     645#endif
     646        @"U+0055", 85, false, false, false, modifiers, WallTime::now());
     647        break;
    618648    default:
    619649        break;
     
    28782908            information.autocapitalizeType = focusedElement.autocapitalizeType();
    28792909            information.inputMode = focusedElement.canonicalInputMode();
    2880             information.shouldSynthesizeKeyEventsForUndoAndRedo = focusedElement.document().quirks().shouldEmulateUndoRedoInHiddenEditableAreas();
     2910            information.shouldSynthesizeKeyEventsForEditing = focusedElement.document().quirks().shouldEmulateEditingButtonsAndGesturesInHiddenEditableAreas();
    28812911        } else {
    28822912            information.isAutocorrect = true;
Note: See TracChangeset for help on using the changeset viewer.