[iOS] Add iPad viewport and form tests, and revert the iPad-testing part of r202132
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Aug 2016 21:18:44 +0000 (21:18 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Aug 2016 21:18:44 +0000 (21:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=160878

Reviewed by Tim Horton.
Source/WebKit2:

Remove testing-specific "forceIPadStyleZoomOnInputFocus" behavior added in r202132
now that we have the ability to run tests in the iPad simulator.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView forceIPadStyleZoomOnInputFocus]): Deleted.
(-[WKWebView setForceIPadStyleZoomOnInputFocus:]): Deleted.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _displayFormNodeInputView]):
(-[WKContentView requiresAccessoryView]):
(-[WKContentView inputAccessoryView]):
(-[WKContentView requiresAccessoryView:]): Deleted.
(-[WKContentView forceIPadStyleZoomOnInputFocus]): Deleted.
(-[WKContentView setForceIPadStyleZoomOnInputFocus:]): Deleted.

Tools:

Remove testing-specific "forceIPadStyleZoomOnInputFocus" behavior added in r202132
now that we have the ability to run tests in the iPad simulator.

* WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl:
* WebKitTestRunner/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::forceIPadStyleZoomOnInputFocus): Deleted.
(WTR::UIScriptController::setForceIPadStyleZoomOnInputFocus): Deleted.
* WebKitTestRunner/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues): Deleted.
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::forceIPadStyleZoomOnInputFocus): Deleted.
(WTR::UIScriptController::setForceIPadStyleZoomOnInputFocus): Deleted.

LayoutTests:

Move forms/ios/focus-input-via-button-ipad.html into fast/forms/ios/ipad, making it
an iPad test, which allows for the removal of the "useIPadBehavior" flag.

Add fast/viewport/ios/ipad/width-is-device-width.html with iPad-specific results.

* fast/forms/ios/ipad/focus-input-via-button-expected.txt: Renamed from LayoutTests/fast/forms/ios/focus-input-via-button-ipad-expected.txt.
* fast/forms/ios/ipad/focus-input-via-button.html: Renamed from LayoutTests/fast/forms/ios/focus-input-via-button-ipad.html.
* fast/forms/ios/resources/zooming-test-utils.js:
(testZoomAfterTap):
* fast/viewport/ios/ipad/width-is-device-width-expected.txt: Added.
* fast/viewport/ios/ipad/width-is-device-width.html: Added.
* platform/ios-simulator-wk2/TestExpectations: Enable fast/viewport/ios, because leaving
them skipped from the base TestExpectations is evil.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204523 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/ios/ipad/focus-input-via-button-expected.txt [moved from LayoutTests/fast/forms/ios/focus-input-via-button-ipad-expected.txt with 53% similarity]
LayoutTests/fast/forms/ios/ipad/focus-input-via-button.html [moved from LayoutTests/fast/forms/ios/focus-input-via-button-ipad.html with 81% similarity]
LayoutTests/fast/forms/ios/resources/zooming-test-utils.js
LayoutTests/fast/viewport/ios/ipad/width-is-device-width-expected.txt [new file with mode: 0644]
LayoutTests/fast/viewport/ios/ipad/width-is-device-width.html [new file with mode: 0644]
LayoutTests/platform/ios-simulator-wk2/TestExpectations
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
Tools/ChangeLog
Tools/WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl
Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp
Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h
Tools/WebKitTestRunner/ios/TestControllerIOS.mm
Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm

index ca197e68b62c8855497592ba53b19fa078adea19..016f4a14979f8f59c5158783404a20d06cf802ab 100644 (file)
@@ -1,3 +1,24 @@
+2016-08-15  Simon Fraser  <simon.fraser@apple.com>
+
+        [iOS] Add iPad viewport and form tests, and revert the iPad-testing part of r202132
+        https://bugs.webkit.org/show_bug.cgi?id=160878
+
+        Reviewed by Tim Horton.
+        
+        Move forms/ios/focus-input-via-button-ipad.html into fast/forms/ios/ipad, making it
+        an iPad test, which allows for the removal of the "useIPadBehavior" flag.
+        
+        Add fast/viewport/ios/ipad/width-is-device-width.html with iPad-specific results.
+        
+        * fast/forms/ios/ipad/focus-input-via-button-expected.txt: Renamed from LayoutTests/fast/forms/ios/focus-input-via-button-ipad-expected.txt.
+        * fast/forms/ios/ipad/focus-input-via-button.html: Renamed from LayoutTests/fast/forms/ios/focus-input-via-button-ipad.html.
+        * fast/forms/ios/resources/zooming-test-utils.js:
+        (testZoomAfterTap):
+        * fast/viewport/ios/ipad/width-is-device-width-expected.txt: Added.
+        * fast/viewport/ios/ipad/width-is-device-width.html: Added.
+        * platform/ios-simulator-wk2/TestExpectations: Enable fast/viewport/ios, because leaving
+        them skipped from the base TestExpectations is evil.
+
 2016-08-16  Chris Dumez  <cdumez@apple.com>
 
         querySelector() / querySelectorAll() should always throw a SyntaxError when failing to parse selector string
similarity index 53%
rename from LayoutTests/fast/forms/ios/focus-input-via-button-ipad-expected.txt
rename to LayoutTests/fast/forms/ios/ipad/focus-input-via-button-expected.txt
index 09d4a1236b5ed83347a31f62dcebff39e5d9a7b1..3a542e9ed22327d28496b4d2353753b025de2aa6 100644 (file)
@@ -3,5 +3,5 @@ Tests zooming into a text input on tap.
 Click to focus input
 
 tap location   { x: 20.000, y: 62.000 }
-scale  1.455
-visibleRect    { left: 0.000, top: 798.797, width: 219.979, height: 390.462 }
+scale  1.500
+visibleRect    { left: 0.000, top: 654.667, width: 512.000, height: 682.667 }
similarity index 81%
rename from LayoutTests/fast/forms/ios/focus-input-via-button-ipad.html
rename to LayoutTests/fast/forms/ios/ipad/focus-input-via-button.html
index 47f3cb43358a4178f1570d7234e26408ce87ef04..43deef8032917ba2c97ffe48bf29edd8f5f4c71d 100644 (file)
@@ -2,7 +2,7 @@
 
 <html>
 <head>
-    <meta name="viewport" content="initial-scale=0.5">
+    <meta name="viewport" content="initial-scale=1.5">
     <style>
         input[type="text"] {
             margin: 800px 20px;
@@ -12,7 +12,7 @@
         }
     </style>
     
-    <script src="resources/zooming-test-utils.js"></script>
+    <script src="../resources/zooming-test-utils.js"></script>
     <script>
     if (window.testRunner) {
         testRunner.dumpAsText();
@@ -26,8 +26,7 @@
 
     function doTest()
     {
-        const useIPadZoomingBehavior = true;
-        testZoomAfterTap(document.getElementById('target'), 10, 10, useIPadZoomingBehavior);
+        testZoomAfterTap(document.getElementById('target'), 10, 10);
     }
 
     window.addEventListener('load', doTest, false);
index 720f192dc661a1c4b30a570fbe8ef20c9da6661d..0e3f4a59558c7ed641f6767b046e450a658661e2 100644 (file)
@@ -1,12 +1,12 @@
 
-function testZoomAfterTap(targetElement, xOffset, yOffset, useIPadBehavior)
+function testZoomAfterTap(targetElement, xOffset, yOffset)
 {
     if (!window.testRunner || !testRunner.runUIScript)
         return;
 
     var point = getPointInsideElement(targetElement, xOffset, yOffset);
 
-    var uiScript = zoomAfterSingleTapUIScript(point.x, point.y, useIPadBehavior);
+    var uiScript = zoomAfterSingleTapUIScript(point.x, point.y);
     testRunner.runUIScript(uiScript, function(result) {
         var results = tableFromJSON(result);
         document.body.appendChild(results);
@@ -14,7 +14,7 @@ function testZoomAfterTap(targetElement, xOffset, yOffset, useIPadBehavior)
     });
 }
 
-function zoomAfterSingleTapUIScript(x, y, useIPadBehavior)
+function zoomAfterSingleTapUIScript(x, y)
 {
     return `
         (function() {
@@ -34,8 +34,6 @@ function zoomAfterSingleTapUIScript(x, y, useIPadBehavior)
                 uiController.uiScriptComplete(result);
             };
 
-            if (${useIPadBehavior})
-                uiController.forceIPadStyleZoomOnInputFocus = true;
             uiController.singleTapAtPoint(${x}, ${y}, function() {});
         })();`
 }
diff --git a/LayoutTests/fast/viewport/ios/ipad/width-is-device-width-expected.txt b/LayoutTests/fast/viewport/ios/ipad/width-is-device-width-expected.txt
new file mode 100644 (file)
index 0000000..7ee4d83
--- /dev/null
@@ -0,0 +1,6 @@
+Viewport: width=device-width
+
+scale  1.00000
+maxScale       5.00000
+minScale       1.00000
+visibleRect    {"left":"0.00000","top":"0.00000","width":"768.00000","height":"1024.00000"}
diff --git a/LayoutTests/fast/viewport/ios/ipad/width-is-device-width.html b/LayoutTests/fast/viewport/ios/ipad/width-is-device-width.html
new file mode 100644 (file)
index 0000000..5788a10
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <meta name="viewport" content="width=device-width">
+    <script src="../resources/viewport-test-utils.js"></script>
+</head>
+<body onload="runTest()">
+
+<p>Viewport: <span id="viewport"></span></p>
+<div id="result"></div>
+
+</body>
+</html>
index 5c789d40534f0e52b552dd94f8c9d5f72e72b6c7..5c52072c084a32c1ff58150aba819898b1a698c3 100644 (file)
@@ -8,8 +8,9 @@
 
 fast/harness/ui-side-scripts.html [ Pass ]
 fast/harness/concurrent-ui-side-scripts.html [ Pass ]
-fast/zooming/ios [ Pass ]
 fast/scrolling/ios [ Pass ]
+fast/viewport/ios [ Pass ]
+fast/zooming/ios [ Pass ]
 
 #//////////////////////////////////////////////////////////////////////////////////////////
 # End platform-specific directories.
index 091e290ec44981959162ffacf5f3211b80a60977..cc5f45cbc392d73169827f104fb17e0406d112b3 100644 (file)
@@ -1,3 +1,26 @@
+2016-08-15  Simon Fraser  <simon.fraser@apple.com>
+
+        [iOS] Add iPad viewport and form tests, and revert the iPad-testing part of r202132
+        https://bugs.webkit.org/show_bug.cgi?id=160878
+
+        Reviewed by Tim Horton.
+
+        Remove testing-specific "forceIPadStyleZoomOnInputFocus" behavior added in r202132
+        now that we have the ability to run tests in the iPad simulator.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView forceIPadStyleZoomOnInputFocus]): Deleted.
+        (-[WKWebView setForceIPadStyleZoomOnInputFocus:]): Deleted.
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _displayFormNodeInputView]):
+        (-[WKContentView requiresAccessoryView]):
+        (-[WKContentView inputAccessoryView]):
+        (-[WKContentView requiresAccessoryView:]): Deleted.
+        (-[WKContentView forceIPadStyleZoomOnInputFocus]): Deleted.
+        (-[WKContentView setForceIPadStyleZoomOnInputFocus:]): Deleted.
+
 2016-08-16  Alex Christensen  <achristensen@webkit.org>
 
         Clean up WebSockets
index 8d62b7d7a00b02e7f55d9a35cebfa3107fea7330..de9bd032cbb378b2a774878d76d8c1ff2c216bcf 100644 (file)
@@ -4517,16 +4517,6 @@ static WebCore::UserInterfaceLayoutDirection toUserInterfaceLayoutDirection(UISe
     [_contentView accessoryTab:NO];
 }
 
-- (BOOL)forceIPadStyleZoomOnInputFocus
-{
-    return [_contentView forceIPadStyleZoomOnInputFocus];
-}
-
-- (void)setForceIPadStyleZoomOnInputFocus:(BOOL)forceIPadStyleZoom
-{
-    [_contentView setForceIPadStyleZoomOnInputFocus:forceIPadStyleZoom];
-}
-
 #endif // PLATFORM(IOS)
 
 #if PLATFORM(MAC)
index 3cabe0d671b08641432b0112667255cef9b17cd1..2360cce403cc2601b8d898b2b1caf8ed13125f38 100644 (file)
@@ -260,8 +260,6 @@ typedef NS_ENUM(NSInteger, _WKImmediateActionType) {
 
 - (void)keyboardAccessoryBarNext WK_API_AVAILABLE(ios(WK_IOS_TBA));
 - (void)keyboardAccessoryBarPrevious WK_API_AVAILABLE(ios(WK_IOS_TBA));
-
-@property (nonatomic) BOOL forceIPadStyleZoomOnInputFocus WK_API_AVAILABLE(ios(WK_IOS_TBA));
 #endif
 
 #if !TARGET_OS_IPHONE
index c44a485ae4d90190e29d363a09ffbf88c0bfd824..be0121c041708192500bb4717547464d90ac12fe 100644 (file)
@@ -171,9 +171,6 @@ struct WKAutoCorrectionData {
     BOOL _showDebugTapHighlightsForFastClicking;
 
     BOOL _resigningFirstResponder;
-
-    // For testing.
-    BOOL _forceIPadStyleZoomOnInputFocus;
 }
 
 @end
@@ -234,10 +231,4 @@ struct WKAutoCorrectionData {
 @end
 #endif
 
-@interface WKContentView (WKInteractionTesting)
-
-@property (nonatomic) BOOL forceIPadStyleZoomOnInputFocus;
-
-@end
-
 #endif // PLATFORM(IOS)
index 476d3e03df0262b5a2776b5d5173f262db7836df..0cc4f1a52ddf93089ccc28a920284791c2b3e769 100644 (file)
@@ -1072,8 +1072,8 @@ static NSValue *nsSizeForTapHighlightBorderRadius(WebCore::IntSize borderRadius,
                   fontSize:_assistedNodeInformation.nodeFontSize
               minimumScale:_assistedNodeInformation.minimumScaleFactor
               maximumScale:_assistedNodeInformation.maximumScaleFactor
-              allowScaling:(_assistedNodeInformation.allowsUserScalingIgnoringForceAlwaysScaling && (!UICurrentUserInterfaceIdiomIsPad() || _forceIPadStyleZoomOnInputFocus))
-               forceScroll:[self requiresAccessoryView:_forceIPadStyleZoomOnInputFocus]];
+              allowScaling:(_assistedNodeInformation.allowsUserScalingIgnoringForceAlwaysScaling && !UICurrentUserInterfaceIdiomIsPad())
+               forceScroll:[self requiresAccessoryView]];
 
     _didAccessoryTabInitiateFocus = NO;
     [self _ensureFormAccessoryView];
@@ -1573,7 +1573,7 @@ static void cancelPotentialTapIfNecessary(WKContentView* contentView)
     [_textSelectionAssistant didEndScrollingOverflow];
 }
 
-- (BOOL)requiresAccessoryView:(BOOL)forceIPadBehavior
+- (BOOL)requiresAccessoryView
 {
     if ([_formInputSession accessoryViewShouldNotShow])
         return NO;
@@ -1598,7 +1598,7 @@ static void cancelPotentialTapIfNecessary(WKContentView* contentView)
     case InputType::Month:
     case InputType::Week:
     case InputType::Time:
-        return !(UICurrentUserInterfaceIdiomIsPad() || forceIPadBehavior);
+        return !UICurrentUserInterfaceIdiomIsPad();
     }
 }
 
@@ -1613,7 +1613,7 @@ static void cancelPotentialTapIfNecessary(WKContentView* contentView)
 
 - (UIView *)inputAccessoryView
 {
-    if (![self requiresAccessoryView:NO])
+    if (![self requiresAccessoryView])
         return nil;
 
     return self.formAccessoryView;
@@ -4110,21 +4110,6 @@ static NSString *previewIdentifierForElementAction(_WKElementAction *action)
 
 #endif
 
-@implementation WKContentView (WKInteractionTesting)
-
-- (BOOL)forceIPadStyleZoomOnInputFocus
-{
-    return _forceIPadStyleZoomOnInputFocus;
-}
-
-- (void)setForceIPadStyleZoomOnInputFocus:(BOOL)forceIPadStyleZoom
-{
-    _forceIPadStyleZoomOnInputFocus = forceIPadStyleZoom;
-}
-
-@end
-
-
 // UITextRange, UITextPosition and UITextSelectionRect implementations for WK2
 
 @implementation WKTextRange (UITextInputAdditions)
index eac885a9785a82be33118af3dc59c32c312136b1..f51e3189bdbd57cb46926e980a08f891a505b205 100644 (file)
@@ -1,3 +1,24 @@
+2016-08-15  Simon Fraser  <simon.fraser@apple.com>
+
+        [iOS] Add iPad viewport and form tests, and revert the iPad-testing part of r202132
+        https://bugs.webkit.org/show_bug.cgi?id=160878
+
+        Reviewed by Tim Horton.
+        
+        Remove testing-specific "forceIPadStyleZoomOnInputFocus" behavior added in r202132
+        now that we have the ability to run tests in the iPad simulator.
+
+        * WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl:
+        * WebKitTestRunner/UIScriptContext/UIScriptController.cpp:
+        (WTR::UIScriptController::forceIPadStyleZoomOnInputFocus): Deleted.
+        (WTR::UIScriptController::setForceIPadStyleZoomOnInputFocus): Deleted.
+        * WebKitTestRunner/UIScriptContext/UIScriptController.h:
+        * WebKitTestRunner/ios/TestControllerIOS.mm:
+        (WTR::TestController::platformResetStateToConsistentValues): Deleted.
+        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+        (WTR::UIScriptController::forceIPadStyleZoomOnInputFocus): Deleted.
+        (WTR::UIScriptController::setForceIPadStyleZoomOnInputFocus): Deleted.
+
 2016-08-15  Anders Carlsson  <andersca@apple.com>
 
         Add an address-of operator to RetainPtr
index 778ed619447dce9837d039d1a5ec4ef83448bb97..3bc5a6b153bffd007a7ad2efb14f108960ee949f 100644 (file)
@@ -60,8 +60,5 @@ interface UIScriptController {
 
     readonly attribute object contentVisibleRect; // Returned object has 'left', 'top', 'width', 'height' properties.
 
-    // Behavior
-    attribute boolean forceIPadStyleZoomOnInputFocus;
-
     void uiScriptComplete(DOMString result);
 };
index 6011fca5d86965fc67914b0005c097acf9fe64b4..f327bf99187e90c756dab6ef8c7c6aba9170a9cf 100644 (file)
@@ -178,15 +178,6 @@ JSObjectRef UIScriptController::contentVisibleRect() const
     return nullptr;
 }
 
-bool UIScriptController::forceIPadStyleZoomOnInputFocus() const
-{
-    return false;
-}
-
-void UIScriptController::setForceIPadStyleZoomOnInputFocus(bool)
-{
-}
-
 void UIScriptController::platformSetWillBeginZoomingCallback()
 {
 }
index 49ee2727c0ccc502ca61ebd9b13260b6059c0386..eb05089ef4f5811ec20476e748c53beec5879d0e 100644 (file)
@@ -81,9 +81,6 @@ public:
 
     JSObjectRef contentVisibleRect() const;
     
-    bool forceIPadStyleZoomOnInputFocus() const;
-    void setForceIPadStyleZoomOnInputFocus(bool);
-
     void uiScriptComplete(JSStringRef result);
 
 private:
index 9fb66fc320caaab50279b79cb48734fa1c4ff01a..03454a5b5d4847e015a142a19b31920141373bb4 100644 (file)
@@ -83,7 +83,6 @@ void TestController::platformResetPreferencesToConsistentValues()
 void TestController::platformResetStateToConsistentValues()
 {
     cocoaResetStateToConsistentValues();
-    [mainWebView()->platformView() setForceIPadStyleZoomOnInputFocus:NO];
 }
 
 void TestController::platformConfigureViewForTest(const TestInvocation& test)
index 8f7ad58bdf6c52514e4033305a72d05bda6a3f78..76d8e6f119bf25d6120a8748c4bba4f888b3abbb 100644 (file)
@@ -209,18 +209,6 @@ JSObjectRef UIScriptController::contentVisibleRect() const
     return m_context->objectFromRect(wkRect);
 }
 
-bool UIScriptController::forceIPadStyleZoomOnInputFocus() const
-{
-    TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
-    return webView.forceIPadStyleZoomOnInputFocus;
-}
-
-void UIScriptController::setForceIPadStyleZoomOnInputFocus(bool value)
-{
-    TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
-    webView.forceIPadStyleZoomOnInputFocus = value;
-}
-
 void UIScriptController::platformSetWillBeginZoomingCallback()
 {
     TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();