Title: [208106] trunk/Tools
Revision
208106
Author
[email protected]
Date
2016-10-29 09:32:53 -0700 (Sat, 29 Oct 2016)

Log Message

UIScriptControllerIOS.mm should not be soft-linking UIKit
https://bugs.webkit.org/show_bug.cgi?id=164171

Reviewed by Darin Adler.

Follow-up to r208090. Instead of soft-linking, we can simply grab UIKeyboardPredictionView by name instead.

* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::waitForTextPredictionsViewAndSelectCandidateAtIndex):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (208105 => 208106)


--- trunk/Tools/ChangeLog	2016-10-29 16:21:20 UTC (rev 208105)
+++ trunk/Tools/ChangeLog	2016-10-29 16:32:53 UTC (rev 208106)
@@ -1,3 +1,15 @@
+2016-10-29  Wenson Hsieh  <[email protected]>
+
+        UIScriptControllerIOS.mm should not be soft-linking UIKit
+        https://bugs.webkit.org/show_bug.cgi?id=164171
+
+        Reviewed by Darin Adler.
+
+        Follow-up to r208090. Instead of soft-linking, we can simply grab UIKeyboardPredictionView by name instead.
+
+        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+        (WTR::UIScriptController::waitForTextPredictionsViewAndSelectCandidateAtIndex):
+
 2016-10-28  Darin Adler  <[email protected]>
 
         Move all classes in the HTML directory from ExceptionCode to Exception

Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (208105 => 208106)


--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2016-10-29 16:21:20 UTC (rev 208105)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2016-10-29 16:32:53 UTC (rev 208106)
@@ -38,13 +38,9 @@
 #import <_javascript_Core/OpaqueJSString.h>
 #import <UIKit/UIKit.h>
 #import <WebCore/FloatRect.h>
-#import <WebCore/SoftLinking.h>
 #import <WebKit/WKWebViewPrivate.h>
 #import <WebKit/WebKit.h>
 
-SOFT_LINK_FRAMEWORK(UIKit)
-SOFT_LINK_CLASS_OPTIONAL(UIKit, UIKeyboardPredictionView)
-
 namespace WTR {
 
 void UIScriptController::doAsyncTask(JSValueRef callback)
@@ -275,8 +271,12 @@
 
 void UIScriptController::waitForTextPredictionsViewAndSelectCandidateAtIndex(long index, unsigned callbackID, float interval)
 {
+    id UIKeyboardPredictionViewClass = NSClassFromString(@"UIKeyboardPredictionView");
+    if (!UIKeyboardPredictionViewClass)
+        return;
+
 #if USE(APPLE_INTERNAL_SDK)
-    if (![[getUIKeyboardPredictionViewClass() activeInstance] hasPredictions]) {
+    if (![[UIKeyboardPredictionViewClass activeInstance] hasPredictions]) {
         dispatch_after(dispatch_time(DISPATCH_TIME_NOW, interval * NSEC_PER_SEC), dispatch_get_main_queue(), ^() {
             waitForTextPredictionsViewAndSelectCandidateAtIndex(index, callbackID, interval);
         });
@@ -284,10 +284,10 @@
     }
 
     PlatformWKView webView = TestController::singleton().mainWebView()->platformView();
-    CGRect predictionViewFrame = [[getUIKeyboardPredictionViewClass() activeInstance] frame];
+    CGRect predictionViewFrame = [[UIKeyboardPredictionViewClass activeInstance] frame];
     // This assumes there are 3 predicted text cells of equal width, which is the case on iOS.
     float offsetX = (index * 2 + 1) * CGRectGetWidth(predictionViewFrame) / 6;
-    float offsetY = CGRectGetHeight(webView.window.frame) - CGRectGetHeight([[[getUIKeyboardPredictionViewClass() activeInstance] superview] frame]) + CGRectGetHeight(predictionViewFrame) / 2;
+    float offsetY = CGRectGetHeight(webView.window.frame) - CGRectGetHeight([[[UIKeyboardPredictionViewClass activeInstance] superview] frame]) + CGRectGetHeight(predictionViewFrame) / 2;
     [[HIDEventGenerator sharedHIDEventGenerator] tap:CGPointMake(offsetX, offsetY) completionBlock:^{
         if (m_context)
             m_context->asyncTaskComplete(callbackID);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to