Changeset 237935 in webkit


Ignore:
Timestamp:
Nov 7, 2018 12:12:49 PM (5 years ago)
Author:
dbates@webkit.org
Message:

Override +[UIKeyboard isInHardwareKeyboardMode] in WebKitTestRunner and DumpRenderTree
https://bugs.webkit.org/show_bug.cgi?id=190141

Reviewed by Darin Adler.

Source/WebCore:

Remove the runtime application check for WebKitTestRunner as we no longer need this
now that WebKitTestRunner and DumpRenderTree override +[UIKeyboard isInHardwareKeyboardMode].

  • platform/RuntimeApplicationChecks.h:
  • platform/cocoa/RuntimeApplicationChecksCocoa.mm:

(WebCore::IOSApplication::isWebKitTestRunner): Deleted.

Source/WebKit:

Directly use +[UIKeyboard isInHardwareKeyboardMode]. We will override this class method
in DumpRenderTree and WebKitTestRunner to always return NO so as to make test runs
deterministic regardless of whether a hardware keyboard is attached.

  • Shared/NativeWebKeyboardEvent.h:
  • Shared/ios/NativeWebKeyboardEventIOS.mm:

(WebKit::isInHardwareKeyboardMode): Deleted.

  • UIProcess/ios/WKContentViewInteraction.mm:

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

  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::platformEditorState const):

Tools:

Override +[UIKeyboard isInHardwareKeyboardMode] to always return NO so as to make test
runs deterministic regardless of whether a hardware keyboard is attached.

  • DumpRenderTree/mac/DumpRenderTree.mm:

(overrideIsInHardwareKeyboardMode): Added.
(prepareConsistentTestingEnvironment):

  • TestRunnerShared/spi/UIKitTestSPI.h: Forward declare SPI.
  • WebKitTestRunner/ios/TestControllerIOS.mm:

(overrideIsInHardwareKeyboardMode): Added.
(WTR::TestController::platformInitialize):

Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r237934 r237935  
     12018-11-07  Daniel Bates  <dabates@apple.com>
     2
     3        Override +[UIKeyboard isInHardwareKeyboardMode] in WebKitTestRunner and DumpRenderTree
     4        https://bugs.webkit.org/show_bug.cgi?id=190141
     5
     6        Reviewed by Darin Adler.
     7
     8        Remove the runtime application check for WebKitTestRunner as we no longer need this
     9        now that WebKitTestRunner and DumpRenderTree override +[UIKeyboard isInHardwareKeyboardMode].
     10
     11        * platform/RuntimeApplicationChecks.h:
     12        * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
     13        (WebCore::IOSApplication::isWebKitTestRunner): Deleted.
     14
    1152018-11-07  Joseph Pecoraro  <pecoraro@apple.com>
    216
  • trunk/Source/WebCore/platform/RuntimeApplicationChecks.h

    r237636 r237935  
    8080WEBCORE_EXPORT bool isMobileSafari();
    8181WEBCORE_EXPORT bool isWebBookmarksD();
    82 WEBCORE_EXPORT bool isWebKitTestRunner();
    8382WEBCORE_EXPORT bool isDumpRenderTree();
    8483bool isMobileStore();
  • trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm

    r237266 r237935  
    218218}
    219219
    220 bool IOSApplication::isWebKitTestRunner()
    221 {
    222     // We use a prefix match instead of strict equality since multiple instances of WebKitTestRunner
    223     // may be launched, where the bundle identifier of each instance has a unique suffix.
    224     static bool isWebKitTestRunner = applicationBundleIsEqualTo("org.webkit.WebKitTestRunnerApp"_s); // e.g. org.webkit.WebKitTestRunnerApp0
    225     return isWebKitTestRunner;
    226 }
    227 
    228220bool IOSApplication::isMobileStore()
    229221{
  • trunk/Source/WebKit/ChangeLog

    r237924 r237935  
     12018-11-07  Daniel Bates  <dabates@apple.com>
     2
     3        Override +[UIKeyboard isInHardwareKeyboardMode] in WebKitTestRunner and DumpRenderTree
     4        https://bugs.webkit.org/show_bug.cgi?id=190141
     5
     6        Reviewed by Darin Adler.
     7
     8        Directly use +[UIKeyboard isInHardwareKeyboardMode]. We will override this class method
     9        in DumpRenderTree and WebKitTestRunner to always return NO so as to make test runs
     10        deterministic regardless of whether a hardware keyboard is attached.
     11
     12        * Shared/NativeWebKeyboardEvent.h:
     13        * Shared/ios/NativeWebKeyboardEventIOS.mm:
     14        (WebKit::isInHardwareKeyboardMode): Deleted.
     15        * UIProcess/ios/WKContentViewInteraction.mm:
     16        (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
     17        * WebProcess/WebPage/ios/WebPageIOS.mm:
     18        (WebKit::WebPage::platformEditorState const):
     19
    1202018-11-07  Zamiul Haque  <zhaque@apple.com>
    221
  • trunk/Source/WebKit/Shared/NativeWebKeyboardEvent.h

    r237266 r237935  
    106106};
    107107
    108 // FIXME: Find a better place for this.
    109 #if PLATFORM(IOS_FAMILY)
    110 bool isInHardwareKeyboardMode();
    111 #endif
    112 
    113108} // namespace WebKit
    114109
  • trunk/Source/WebKit/Shared/ios/NativeWebKeyboardEventIOS.mm

    r237266 r237935  
    3535namespace WebKit {
    3636
    37 bool isInHardwareKeyboardMode()
    38 {
    39     return !WebCore::IOSApplication::isDumpRenderTree() && !WebCore::IOSApplication::isWebKitTestRunner() && [UIKeyboard isInHardwareKeyboardMode];
    40 }
    41 
    4237NativeWebKeyboardEvent::NativeWebKeyboardEvent(::WebEvent *event)
    4338    : WebKeyboardEvent(WebIOSEventFactory::createWebKeyboardEvent(event))
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r237924 r237935  
    42174217#else
    42184218            || _isChangingFocus
    4219             || isInHardwareKeyboardMode()
     4219            || [UIKeyboard isInHardwareKeyboardMode]
    42204220#endif
    42214221#if ENABLE(DRAG_SUPPORT)
  • trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

    r237266 r237935  
    4343#import "RemoteLayerTreeDrawingArea.h"
    4444#import "SandboxUtilities.h"
     45#import "UIKitSPI.h"
    4546#import "UserData.h"
    4647#import "VisibleContentRectUpdateInfo.h"
     
    198199    // immediately so that the UIProcess can update UI, including the position of the caret.
    199200    bool needsLayout = !frame.view() || frame.view()->needsLayout();
    200     if (shouldIncludePostLayoutData == IncludePostLayoutDataHint::No && needsLayout && !isInHardwareKeyboardMode() && !frame.editor().hasComposition()) {
     201    if (shouldIncludePostLayoutData == IncludePostLayoutDataHint::No && needsLayout && ![UIKeyboard isInHardwareKeyboardMode] && !frame.editor().hasComposition()) {
    201202        result.isMissingPostLayoutData = true;
    202203        return;
  • trunk/Tools/ChangeLog

    r237931 r237935  
     12018-11-07  Daniel Bates  <dabates@apple.com>
     2
     3        Override +[UIKeyboard isInHardwareKeyboardMode] in WebKitTestRunner and DumpRenderTree
     4        https://bugs.webkit.org/show_bug.cgi?id=190141
     5
     6        Reviewed by Darin Adler.
     7
     8        Override +[UIKeyboard isInHardwareKeyboardMode] to always return NO so as to make test
     9        runs deterministic regardless of whether a hardware keyboard is attached.
     10
     11        * DumpRenderTree/mac/DumpRenderTree.mm:
     12        (overrideIsInHardwareKeyboardMode): Added.
     13        (prepareConsistentTestingEnvironment):
     14        * TestRunnerShared/spi/UIKitTestSPI.h: Forward declare SPI.
     15        * WebKitTestRunner/ios/TestControllerIOS.mm:
     16        (overrideIsInHardwareKeyboardMode): Added.
     17        (WTR::TestController::platformInitialize):
     18
    1192018-11-07  Jonathan Bedard  <jbedard@apple.com>
    220
  • trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm

    r237266 r237935  
    12021202}
    12031203
     1204#if PLATFORM(IOS_FAMILY)
     1205static BOOL overrideIsInHardwareKeyboardMode()
     1206{
     1207    return NO;
     1208}
     1209#endif
     1210
    12041211static void prepareConsistentTestingEnvironment()
    12051212{
     
    12091216#else
    12101217    poseAsClass("DumpRenderTreeEvent", "GSEvent");
     1218
     1219    // Override the implementation of +[UIKeyboard isInHardwareKeyboardMode] to ensure that test runs are deterministic
     1220    // regardless of whether a hardware keyboard is attached. We intentionally never restore the original implementation.
     1221    method_setImplementation(class_getClassMethod([UIKeyboard class], @selector(isInHardwareKeyboardMode)), reinterpret_cast<IMP>(overrideIsInHardwareKeyboardMode));
    12111222#endif
    12121223
  • trunk/Tools/TestRunnerShared/spi/UIKitTestSPI.h

    r237266 r237935  
    6464@interface UIKeyboard ()
    6565+ (void)removeAllDynamicDictionaries;
     66+ (BOOL)isInHardwareKeyboardMode;
    6667@end
    6768
  • trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm

    r237893 r237935  
    4343#import <WebKit/WKWebViewConfigurationPrivate.h>
    4444#import <WebKit/WKWebViewPrivate.h>
     45#import <objc/runtime.h>
    4546#import <wtf/MainThread.h>
     47
     48static BOOL overrideIsInHardwareKeyboardMode()
     49{
     50    return NO;
     51}
    4652
    4753namespace WTR {
     
    7480    CFNotificationCenterAddObserver(center, this, handleKeyboardWillHideNotification, (CFStringRef)UIKeyboardWillHideNotification, nullptr, CFNotificationSuspensionBehaviorDeliverImmediately);
    7581    CFNotificationCenterAddObserver(center, this, handleKeyboardDidHideNotification, (CFStringRef)UIKeyboardDidHideNotification, nullptr, CFNotificationSuspensionBehaviorDeliverImmediately);
     82
     83    // Override the implementation of +[UIKeyboard isInHardwareKeyboardMode] to ensure that test runs are deterministic
     84    // regardless of whether a hardware keyboard is attached. We intentionally never restore the original implementation.
     85    method_setImplementation(class_getClassMethod([UIKeyboard class], @selector(isInHardwareKeyboardMode)), reinterpret_cast<IMP>(overrideIsInHardwareKeyboardMode));
    7686}
    7787
Note: See TracChangeset for help on using the changeset viewer.