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

Changeset 243630 in webkit


Ignore:
Timestamp:
Mar 28, 2019, 4:30:52 PM (7 years ago)
Author:
pvollan@apple.com
Message:

[iOS] Automatic focus of input field is flaky
https://bugs.webkit.org/show_bug.cgi?id=196302

Reviewed by Brent Fulgham.

Sometimes the status of whether a keyboard is connected can be incorrect, both in the UI process, and in
the WebContent process. Fix this by sending the keyboard status to the WebContent process as part of the
Web page creation parameters. Stop caching the keyboard status in the Web process proxy, and call
[UIKeyboard isInHardwareKeyboardMode] instead, since this method is swizzled in the test harness.

  • Shared/WebPageCreationParameters.cpp:

(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):

  • Shared/WebPageCreationParameters.h:
  • UIProcess/API/Cocoa/WKWebView.mm:

(hardwareKeyboardAvailabilityChangedCallback):

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::creationParameters):

  • UIProcess/WebPageProxy.h:
  • UIProcess/WebProcessProxy.cpp:
  • UIProcess/WebProcessProxy.h:

(WebKit::WebProcessProxy::setKeyboardIsAttached): Deleted.
(WebKit::WebProcessProxy::keyboardIsAttached const): Deleted.

  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):

  • UIProcess/ios/WebPageProxyIOS.mm:

(WebKit::WebPageProxy::isInHardwareKeyboardMode):
(WebKit::WebPageProxy::applicationWillEnterForeground):

  • WebProcess/WebPage/WebPage.cpp:
  • WebProcess/WebPage/WebPage.h:
Location:
trunk/Source/WebKit
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r243618 r243630  
     12019-03-28  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [iOS] Automatic focus of input field is flaky
     4        https://bugs.webkit.org/show_bug.cgi?id=196302
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Sometimes the status of whether a keyboard is connected can be incorrect, both in the UI process, and in
     9        the WebContent process. Fix this by sending the keyboard status to the WebContent process as part of the
     10        Web page creation parameters. Stop caching the keyboard status in the Web process proxy, and call
     11        [UIKeyboard isInHardwareKeyboardMode] instead, since this method is swizzled in the test harness.
     12
     13        * Shared/WebPageCreationParameters.cpp:
     14        (WebKit::WebPageCreationParameters::encode const):
     15        (WebKit::WebPageCreationParameters::decode):
     16        * Shared/WebPageCreationParameters.h:
     17        * UIProcess/API/Cocoa/WKWebView.mm:
     18        (hardwareKeyboardAvailabilityChangedCallback):
     19        * UIProcess/WebPageProxy.cpp:
     20        (WebKit::WebPageProxy::creationParameters):
     21        * UIProcess/WebPageProxy.h:
     22        * UIProcess/WebProcessProxy.cpp:
     23        * UIProcess/WebProcessProxy.h:
     24        (WebKit::WebProcessProxy::setKeyboardIsAttached): Deleted.
     25        (WebKit::WebProcessProxy::keyboardIsAttached const): Deleted.
     26        * UIProcess/ios/WKContentViewInteraction.mm:
     27        (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
     28        * UIProcess/ios/WebPageProxyIOS.mm:
     29        (WebKit::WebPageProxy::isInHardwareKeyboardMode):
     30        (WebKit::WebPageProxy::applicationWillEnterForeground):
     31        * WebProcess/WebPage/WebPage.cpp:
     32        * WebProcess/WebPage/WebPage.h:
     33
    1342019-03-28  Tim Horton  <timothy_horton@apple.com>
    235
  • trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp

    r243163 r243630  
    9494    encoder << maximumUnobscuredSize;
    9595    encoder << deviceOrientation;
     96    encoder << keyboardIsAttached;
    9697#endif
    9798#if PLATFORM(COCOA)
     
    274275    if (!decoder.decode(parameters.deviceOrientation))
    275276        return WTF::nullopt;
     277    if (!decoder.decode(parameters.keyboardIsAttached))
     278        return WTF::nullopt;
    276279#endif
    277280
  • trunk/Source/WebKit/Shared/WebPageCreationParameters.h

    r242082 r243630  
    152152    WebCore::FloatSize maximumUnobscuredSize;
    153153    int32_t deviceOrientation { 0 };
     154    bool keyboardIsAttached { false };
    154155#endif
    155156#if PLATFORM(COCOA)
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm

    r243523 r243630  
    33233323    ASSERT(observer);
    33243324    WKWebView *webView = (__bridge WKWebView *)observer;
    3325     auto keyboardIsAttached = GSEventIsHardwareKeyboardAttached();
    3326     webView._page->process().setKeyboardIsAttached(keyboardIsAttached);
    3327     webView._page->hardwareKeyboardAvailabilityChanged(keyboardIsAttached);
     3325    webView._page->hardwareKeyboardAvailabilityChanged(GSEventIsHardwareKeyboardAttached());
    33283326}
    33293327
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r243384 r243630  
    70237023    parameters.maximumUnobscuredSize = m_maximumUnobscuredSize;
    70247024    parameters.deviceOrientation = m_deviceOrientation;
     7025    parameters.keyboardIsAttached = isInHardwareKeyboardMode();
    70257026#endif
    70267027
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r243354 r243630  
    20512051#endif
    20522052
     2053#if PLATFORM(IOS_FAMILY)
     2054    static bool isInHardwareKeyboardMode();
     2055#endif
     2056
    20532057    WeakPtr<PageClient> m_pageClient;
    20542058    Ref<API::PageConfiguration> m_configuration;
  • trunk/Source/WebKit/UIProcess/WebProcessProxy.h

    r243388 r243630  
    276276    void didSetAssertionState(AssertionState) override;
    277277
    278 #if PLATFORM(IOS_FAMILY)
    279     void setKeyboardIsAttached(bool keyboardIsAttached) { m_keyboardIsAttached = keyboardIsAttached; }
    280     bool keyboardIsAttached() const { return m_keyboardIsAttached; }
    281 #endif
    282 
    283278#if PLATFORM(COCOA)
    284279    enum SandboxExtensionType : uint32_t {
     
    476471#endif
    477472
    478 #if PLATFORM(IOS_FAMILY)
    479     bool m_keyboardIsAttached { false };
    480 #endif
    481 
    482473#if PLATFORM(COCOA)
    483474    MediaCaptureSandboxExtensions m_mediaCaptureSandboxExtensions { SandboxExtensionType::None };
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r243618 r243630  
    49314931                    return YES;
    49324932
    4933                 if (_page->process().keyboardIsAttached())
     4933                if ([UIKeyboard isInHardwareKeyboardMode])
    49344934                    return YES;
    49354935#endif
  • trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm

    r243354 r243630  
    664664}
    665665
     666bool WebPageProxy::isInHardwareKeyboardMode()
     667{
     668    return [UIKeyboard isInHardwareKeyboardMode];
     669}
     670
    666671void WebPageProxy::applicationWillEnterForeground()
    667672{
    668673    bool isSuspendedUnderLock = [UIApp isSuspendedUnderLock];
    669674    m_process->send(Messages::WebPage::ApplicationWillEnterForeground(isSuspendedUnderLock), m_pageID);
    670     m_process->setKeyboardIsAttached([UIKeyboard isInHardwareKeyboardMode]);
    671     m_process->send(Messages::WebPage::HardwareKeyboardAvailabilityChanged(m_process->keyboardIsAttached()), m_pageID);
     675    m_process->send(Messages::WebPage::HardwareKeyboardAvailabilityChanged(isInHardwareKeyboardMode()), m_pageID);
    672676}
    673677
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r243461 r243630  
    407407    , m_overrideScreenSize(parameters.overrideScreenSize)
    408408    , m_deviceOrientation(parameters.deviceOrientation)
     409    , m_keyboardIsAttached(parameters.keyboardIsAttached)
    409410#endif
    410411    , m_layerVolatilityTimer(*this, &WebPage::layerVolatilityTimerFired)
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r243461 r243630  
    18051805    WebCore::FloatSize m_maximumUnobscuredSize;
    18061806    int32_t m_deviceOrientation { 0 };
     1807    bool m_keyboardIsAttached { false };
    18071808    bool m_inDynamicSizeUpdate { false };
    18081809    HashMap<std::pair<WebCore::IntSize, double>, WebCore::IntPoint> m_dynamicSizeUpdateHistory;
     
    18851886    bool m_isSuspended { false };
    18861887    bool m_needsFontAttributes { false };
    1887 #if PLATFORM(IOS_FAMILY)
    1888     bool m_keyboardIsAttached { false };
    1889 #endif
    18901888};
    18911889
Note: See TracChangeset for help on using the changeset viewer.