Changeset 245148 in webkit


Ignore:
Timestamp:
May 9, 2019 11:58:45 AM (5 years ago)
Author:
dbates@webkit.org
Message:

REGRESSION (r241734): 1% slower PLT on iPad
https://bugs.webkit.org/show_bug.cgi?id=197745
<rdar://problem/50457731>

Reviewed by Per Arne Vollan.

For now, only create a keyboard when WKContentView becomes first responder if a hardware keyboard
is attached or an editable element is focused to recover the 1% loss when a keyboard is not attached.
We can do better and by that I mean be lazier. We'll do this <https://bugs.webkit.org/show_bug.cgi?id=197746>.

In r241734 we unified the key event handling code paths so we use exactly one for both software and
hardware key events. We took a simple approach of always requesting UIKit to create a keyboard when
the WKContentView becomes first responder. We did this so that we could continue listening for hardware
key events even when a non-editable element is focused and dispatch DOM events. As it turns out, always
creating a keyboard is expensive and caused a ~1% slowdown in page load time on iPad.

  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView _requiresKeyboardWhenFirstResponder]): Only create a keyboard if a hardware keyboard is
attached or an editable element is focused.
(-[WKContentView _hardwareKeyboardAvailabilityChanged]): Reload all input view (this will cause keyboard
creation) if -_requiresKeyboardWhenFirstResponder returns YES.

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r245144 r245148  
     12019-05-09  Daniel Bates  <dabates@apple.com>
     2
     3        REGRESSION (r241734): 1% slower PLT on iPad
     4        https://bugs.webkit.org/show_bug.cgi?id=197745
     5        <rdar://problem/50457731>
     6
     7        Reviewed by Per Arne Vollan.
     8
     9        For now, only create a keyboard when WKContentView becomes first responder if a hardware keyboard
     10        is attached or an editable element is focused to recover the 1% loss when a keyboard is not attached.
     11        We can do better and by that I mean be lazier. We'll do this <https://bugs.webkit.org/show_bug.cgi?id=197746>.
     12
     13        In r241734 we unified the key event handling code paths so we use exactly one for both software and
     14        hardware key events. We took a simple approach of always requesting UIKit to create a keyboard when
     15        the WKContentView becomes first responder. We did this so that we could continue listening for hardware
     16        key events even when a non-editable element is focused and dispatch DOM events. As it turns out, always
     17        creating a keyboard is expensive and caused a ~1% slowdown in page load time on iPad.
     18
     19        * UIProcess/ios/WKContentViewInteraction.mm:
     20        (-[WKContentView _requiresKeyboardWhenFirstResponder]): Only create a keyboard if a hardware keyboard is
     21        attached or an editable element is focused.
     22        (-[WKContentView _hardwareKeyboardAvailabilityChanged]): Reload all input view (this will cause keyboard
     23        creation) if -_requiresKeyboardWhenFirstResponder returns YES.
     24
    1252019-05-09  Daniel Bates  <dabates@apple.com>
    226
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r245144 r245148  
    16651665- (BOOL)_requiresKeyboardWhenFirstResponder
    16661666{
     1667    // FIXME: Only create keyboard if [self shouldShowAutomaticKeyboardUI] returns YES or
     1668    // on first hardware keydown in a non-editable element. See <https://bugs.webkit.org/show_bug.cgi?id=197746>.
    16671669#if USE(UIKIT_KEYBOARD_ADDITIONS)
    1668     return YES;
    1669 #else
     1670    if (GSEventIsHardwareKeyboardAttached())
     1671        return YES;
     1672#endif
    16701673    // FIXME: We should add the logic to handle keyboard visibility during focus redirects.
    16711674    return [self shouldShowAutomaticKeyboardUI];
    1672 #endif
    16731675}
    16741676
     
    52195221- (void)_hardwareKeyboardAvailabilityChanged
    52205222{
    5221     if (hasFocusedElement(_focusedElementInformation) && _focusedElementInformation.inputMode == WebCore::InputMode::None)
    5222         [self reloadInputViews];
     5223    [self reloadInputViews];
    52235224}
    52245225
Note: See TracChangeset for help on using the changeset viewer.