Title: [204931] trunk
Revision
204931
Author
[email protected]
Date
2016-08-24 13:53:30 -0700 (Wed, 24 Aug 2016)

Log Message

[iOS DRT] Get basic viewport tests working in DRT
https://bugs.webkit.org/show_bug.cgi?id=161160

Reviewed by Tim Horton.

Tools:

Hook up enough of UIScriptController in iOS DRT to be able to read viewport
scale, and get the contentVisibleRect.

Requires exposing a bit of UIWebBrowserView SPI from UIKit, which in turn
requires typing the gWebBrowserView as a DumpRenderTreeBrowserView * everywhere.

One test has different results between DRT and WTR, but DRT behavior seems to differ
from UIWebView here, so just give it a WK1-specific result.

* DumpRenderTree/ios/DumpRenderTreeBrowserView.h:
* DumpRenderTree/ios/DumpRenderTreeBrowserView.mm:
(-[DumpRenderTreeBrowserView documentVisibleRect]):
* DumpRenderTree/ios/PixelDumpSupportIOS.mm:
* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::zoomScale):
(WTR::UIScriptController::minimumZoomScale):
(WTR::UIScriptController::maximumZoomScale):
(WTR::UIScriptController::contentVisibleRect):
* DumpRenderTree/mac/DumpRenderTree.mm:
(createWebViewAndOffscreenWindow):
* DumpRenderTree/mac/DumpRenderTreeMac.h:

LayoutTests:

Enable some fast/viewport/ios/ tests for ios-simulator-wk1 that work now.

"body-overflow-hidden" tests should pass everywhere now since the behavior of overflow:hidden
on the body was reverted.

* fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-expected.txt:
* fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall-expected.txt:
* fast/viewport/ios/width-is-device-width-overflowing-expected.txt:
* platform/ios-simulator-wk1/TestExpectations:
* platform/ios-simulator-wk1/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall-expected.txt: Renamed from LayoutTests/platform/ios-simulator/fast/viewport/ios/width-is-device-width-overflowing-expected.txt.
* platform/ios-simulator-wk2/TestExpectations:
* platform/ios-simulator/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-expected.txt: Removed.
* platform/ios-simulator/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall-expected.txt: Removed.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (204930 => 204931)


--- trunk/LayoutTests/ChangeLog	2016-08-24 20:53:25 UTC (rev 204930)
+++ trunk/LayoutTests/ChangeLog	2016-08-24 20:53:30 UTC (rev 204931)
@@ -1,3 +1,24 @@
+2016-08-24  Simon Fraser  <[email protected]>
+
+        [iOS DRT] Get basic viewport tests working in DRT
+        https://bugs.webkit.org/show_bug.cgi?id=161160
+
+        Reviewed by Tim Horton.
+        
+        Enable some fast/viewport/ios/ tests for ios-simulator-wk1 that work now.
+        
+        "body-overflow-hidden" tests should pass everywhere now since the behavior of overflow:hidden
+        on the body was reverted.
+
+        * fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-expected.txt:
+        * fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall-expected.txt:
+        * fast/viewport/ios/width-is-device-width-overflowing-expected.txt:
+        * platform/ios-simulator-wk1/TestExpectations:
+        * platform/ios-simulator-wk1/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall-expected.txt: Renamed from LayoutTests/platform/ios-simulator/fast/viewport/ios/width-is-device-width-overflowing-expected.txt.
+        * platform/ios-simulator-wk2/TestExpectations:
+        * platform/ios-simulator/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-expected.txt: Removed.
+        * platform/ios-simulator/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall-expected.txt: Removed.
+
 2016-08-24  Ryan Haddad  <[email protected]>
 
         Marking wpt LayoutTest scroll-restoration-fragment-scrolling-samedoc.html as flaky on ios-simulator.

Modified: trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-expected.txt (204930 => 204931)


--- trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-expected.txt	2016-08-24 20:53:25 UTC (rev 204930)
+++ trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-expected.txt	2016-08-24 20:53:30 UTC (rev 204931)
@@ -1,7 +1,7 @@
 Viewport: width=device-width
 
-scale	5.00000
+scale	1.00000
 maxScale	5.00000
-minScale	5.00000
-visibleRect	{"left":"0.00000","top":"0.00000","width":"64.00000","height":"96.00000"}
+minScale	1.00000
+visibleRect	{"left":"0.00000","top":"0.00000","width":"320.00000","height":"568.00000"}
 

Modified: trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall-expected.txt (204930 => 204931)


--- trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall-expected.txt	2016-08-24 20:53:25 UTC (rev 204930)
+++ trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall-expected.txt	2016-08-24 20:53:30 UTC (rev 204931)
@@ -1,7 +1,7 @@
 Viewport: width=device-width
 
-scale	1.05263
+scale	0.55469
 maxScale	5.00000
-minScale	1.05263
-visibleRect	{"left":"0.00000","top":"0.00000","width":"303.99999","height":"455.99998"}
+minScale	0.55469
+visibleRect	{"left":"0.00000","top":"0.00000","width":"576.90143","height":"1024.00000"}
 

Modified: trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-expected.txt (204930 => 204931)


--- trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-expected.txt	2016-08-24 20:53:25 UTC (rev 204930)
+++ trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-expected.txt	2016-08-24 20:53:30 UTC (rev 204931)
@@ -3,5 +3,5 @@
 scale	1.00000
 maxScale	5.00000
 minScale	1.00000
-visibleRect	{"left":"0.00000","top":"0.00000","width":"320.00000","height":"480.00000"}
+visibleRect	{"left":"0.00000","top":"0.00000","width":"320.00000","height":"568.00000"}
 

Deleted: trunk/LayoutTests/platform/ios-simulator/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-expected.txt (204930 => 204931)


--- trunk/LayoutTests/platform/ios-simulator/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-expected.txt	2016-08-24 20:53:25 UTC (rev 204930)
+++ trunk/LayoutTests/platform/ios-simulator/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-expected.txt	2016-08-24 20:53:30 UTC (rev 204931)
@@ -1,7 +0,0 @@
-Viewport: width=device-width
-
-scale	1.00000
-maxScale	5.00000
-minScale	1.00000
-visibleRect	{"left":"0.00000","top":"0.00000","width":"320.00000","height":"480.00000"}
-

Deleted: trunk/LayoutTests/platform/ios-simulator/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall-expected.txt (204930 => 204931)


--- trunk/LayoutTests/platform/ios-simulator/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall-expected.txt	2016-08-24 20:53:25 UTC (rev 204930)
+++ trunk/LayoutTests/platform/ios-simulator/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall-expected.txt	2016-08-24 20:53:30 UTC (rev 204931)
@@ -1,7 +0,0 @@
-Viewport: width=device-width
-
-scale	0.46875
-maxScale	5.00000
-minScale	0.46875
-visibleRect	{"left":"0.00000","top":"0.00000","width":"682.66667","height":"1024.00000"}
-

Deleted: trunk/LayoutTests/platform/ios-simulator/fast/viewport/ios/width-is-device-width-overflowing-expected.txt (204930 => 204931)


--- trunk/LayoutTests/platform/ios-simulator/fast/viewport/ios/width-is-device-width-overflowing-expected.txt	2016-08-24 20:53:25 UTC (rev 204930)
+++ trunk/LayoutTests/platform/ios-simulator/fast/viewport/ios/width-is-device-width-overflowing-expected.txt	2016-08-24 20:53:30 UTC (rev 204931)
@@ -1,7 +0,0 @@
-Viewport: width=device-width
-
-scale	1.00000
-maxScale	5.00000
-minScale	1.00000
-visibleRect	{"left":"0.00000","top":"0.00000","width":"320.00000","height":"480.00000"}
-

Modified: trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations (204930 => 204931)


--- trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations	2016-08-24 20:53:25 UTC (rev 204930)
+++ trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations	2016-08-24 20:53:30 UTC (rev 204931)
@@ -2,6 +2,14 @@
 #
 # See http://trac.webkit.org/wiki/TestExpectations for more information on this file.
 
+# Selectively re-enable viewport tests that work
+fast/viewport/ios/width-is-device-width.html [ Pass ]
+fast/viewport/ios/width-is-device-width-overflowing.html [ Pass ]
+fast/viewport/ios/width-is-device-width-overflowing-no-shrink-to-fit.html [ Pass ]
+fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden.html [ Pass ]
+fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall.html [ Pass ]
+fast/viewport/ios/ipad/width-is-device-width.html [ Pass ]
+
 # <rdar://problem/6501130> LayoutTests: Enable editing tests after we support editing
 editing/deleting/4922367.html
 editing/deleting/5126166.html

Copied: trunk/LayoutTests/platform/ios-simulator-wk1/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall-expected.txt (from rev 204930, trunk/LayoutTests/platform/ios-simulator/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-expected.txt) (0 => 204931)


--- trunk/LayoutTests/platform/ios-simulator-wk1/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator-wk1/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall-expected.txt	2016-08-24 20:53:30 UTC (rev 204931)
@@ -0,0 +1,7 @@
+Viewport: width=device-width
+
+scale	1.00000
+maxScale	5.00000
+minScale	1.00000
+visibleRect	{"left":"0.00000","top":"0.00000","width":"320.00000","height":"568.00000"}
+

Modified: trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations (204930 => 204931)


--- trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2016-08-24 20:53:25 UTC (rev 204930)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2016-08-24 20:53:30 UTC (rev 204931)
@@ -1769,11 +1769,6 @@
 
 # Forcing always allow user scalable is not supported on certain OS version.
 webkit.org/b/155056 fast/viewport/ios/force-always-user-scalable.html [ Skip ]
-webkit.org/b/153110 fast/viewport/ios/width-is-device-width-overflowing.html [ Pass Failure ]
-webkit.org/b/153110 fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden.html [ Pass Failure ]
-webkit.org/b/153110 fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall.html [ Pass Failure ]
-fast/viewport/ios/width-is-device-width.html [ Pass ]
-fast/viewport/ios/width-is-device-width-overflowing-no-shrink-to-fit.html [ Pass ]
 
 webkit.org/b/155501 animations/3d/transform-origin-vs-functions.html [ Pass Failure ]
 

Modified: trunk/Tools/ChangeLog (204930 => 204931)


--- trunk/Tools/ChangeLog	2016-08-24 20:53:25 UTC (rev 204930)
+++ trunk/Tools/ChangeLog	2016-08-24 20:53:30 UTC (rev 204931)
@@ -1,5 +1,34 @@
 2016-08-24  Simon Fraser  <[email protected]>
 
+        [iOS DRT] Get basic viewport tests working in DRT
+        https://bugs.webkit.org/show_bug.cgi?id=161160
+
+        Reviewed by Tim Horton.
+        
+        Hook up enough of UIScriptController in iOS DRT to be able to read viewport
+        scale, and get the contentVisibleRect.
+        
+        Requires exposing a bit of UIWebBrowserView SPI from UIKit, which in turn
+        requires typing the gWebBrowserView as a DumpRenderTreeBrowserView * everywhere.
+        
+        One test has different results between DRT and WTR, but DRT behavior seems to differ
+        from UIWebView here, so just give it a WK1-specific result.
+
+        * DumpRenderTree/ios/DumpRenderTreeBrowserView.h:
+        * DumpRenderTree/ios/DumpRenderTreeBrowserView.mm:
+        (-[DumpRenderTreeBrowserView documentVisibleRect]):
+        * DumpRenderTree/ios/PixelDumpSupportIOS.mm:
+        * DumpRenderTree/ios/UIScriptControllerIOS.mm:
+        (WTR::UIScriptController::zoomScale):
+        (WTR::UIScriptController::minimumZoomScale):
+        (WTR::UIScriptController::maximumZoomScale):
+        (WTR::UIScriptController::contentVisibleRect):
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (createWebViewAndOffscreenWindow):
+        * DumpRenderTree/mac/DumpRenderTreeMac.h:
+
+2016-08-24  Simon Fraser  <[email protected]>
+
         Minor project rearrangement.
 
         * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:

Modified: trunk/Tools/DumpRenderTree/ios/DumpRenderTreeBrowserView.h (204930 => 204931)


--- trunk/Tools/DumpRenderTree/ios/DumpRenderTreeBrowserView.h	2016-08-24 20:53:25 UTC (rev 204930)
+++ trunk/Tools/DumpRenderTree/ios/DumpRenderTreeBrowserView.h	2016-08-24 20:53:30 UTC (rev 204931)
@@ -33,3 +33,9 @@
 @property (nonatomic, assign) BOOL scrollingUsesUIWebScrollView;
 
 @end
+
+@interface DumpRenderTreeBrowserView (DRTTesting)
+
+- (CGRect)documentVisibleRect;
+
+@end

Modified: trunk/Tools/DumpRenderTree/ios/DumpRenderTreeBrowserView.mm (204930 => 204931)


--- trunk/Tools/DumpRenderTree/ios/DumpRenderTreeBrowserView.mm	2016-08-24 20:53:25 UTC (rev 204930)
+++ trunk/Tools/DumpRenderTree/ios/DumpRenderTreeBrowserView.mm	2016-08-24 20:53:30 UTC (rev 204931)
@@ -23,6 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
+#import "config.h"
 #import "DumpRenderTreeBrowserView.h"
 
 #if PLATFORM(IOS)
@@ -33,6 +34,10 @@
 - (BOOL)webView:(WebView *)webView shouldScrollToPoint:(CGPoint)point forFrame:(WebFrame *)frame;
 @end
 
+@interface UIWebBrowserView (UIKitInternals)
+- (CGRect)_documentViewVisibleRect;
+@end
+
 @implementation DumpRenderTreeBrowserView
 
 @synthesize scrollingUsesUIWebScrollView = _scrollingUsesUIWebScrollView;
@@ -73,4 +78,13 @@
 
 @end
 
+@implementation DumpRenderTreeBrowserView (DRTTesting)
+
+- (CGRect)documentVisibleRect
+{
+    return [self _documentViewVisibleRect];
+}
+
+@end
+
 #endif // PLATFORM(IOS)

Modified: trunk/Tools/DumpRenderTree/ios/PixelDumpSupportIOS.mm (204930 => 204931)


--- trunk/Tools/DumpRenderTree/ios/PixelDumpSupportIOS.mm	2016-08-24 20:53:25 UTC (rev 204930)
+++ trunk/Tools/DumpRenderTree/ios/PixelDumpSupportIOS.mm	2016-08-24 20:53:30 UTC (rev 204931)
@@ -46,7 +46,7 @@
 #import <wtf/RetainPtr.h>
 
 extern DumpRenderTreeWindow *gDrtWindow;
-extern UIWebBrowserView *gWebBrowserView;
+extern DumpRenderTreeBrowserView *gWebBrowserView;
 
 PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool incrementalRepaint, bool sweepHorizontally, bool drawSelectionRect)
 {

Modified: trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm (204930 => 204931)


--- trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm	2016-08-24 20:53:25 UTC (rev 204930)
+++ trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm	2016-08-24 20:53:30 UTC (rev 204931)
@@ -28,8 +28,13 @@
 
 #if PLATFORM(IOS)
 
+#import "DumpRenderTreeBrowserView.h"
 #import "UIScriptContext.h"
+#import <WebCore/FloatRect.h>
 
+extern DumpRenderTreeBrowserView *gWebBrowserView;
+extern UIWebScrollView *gWebScrollView;
+
 namespace WTR {
 
 void UIScriptController::doAsyncTask(JSValueRef callback)
@@ -49,7 +54,7 @@
 
 double UIScriptController::zoomScale() const
 {
-    return 1;
+    return gWebScrollView.zoomScale;
 }
 
 void UIScriptController::touchDownAtPoint(long x, long y, long touchCount, JSValueRef callback)
@@ -106,17 +111,19 @@
 
 double UIScriptController::minimumZoomScale() const
 {
-    return 1;
+    return gWebScrollView.minimumZoomScale;
 }
 
 double UIScriptController::maximumZoomScale() const
 {
-    return 1;
+    return gWebScrollView.maximumZoomScale;
 }
 
 JSObjectRef UIScriptController::contentVisibleRect() const
 {
-    return nullptr;
+    CGRect contentVisibleRect = [gWebBrowserView documentVisibleRect];
+    WebCore::FloatRect rect(contentVisibleRect.origin.x, contentVisibleRect.origin.y, contentVisibleRect.size.width, contentVisibleRect.size.height);
+    return m_context->objectFromRect(rect);
 }
 
 void UIScriptController::platformSetDidStartFormControlInteractionCallback()

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (204930 => 204931)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2016-08-24 20:53:25 UTC (rev 204930)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2016-08-24 20:53:30 UTC (rev 204931)
@@ -221,7 +221,7 @@
 
 #if PLATFORM(IOS)
 const CGRect layoutTestViewportRect = { {0, 0}, {static_cast<CGFloat>(TestRunner::viewWidth), static_cast<CGFloat>(TestRunner::viewHeight)} };
-UIWebBrowserView *gWebBrowserView = nil;
+DumpRenderTreeBrowserView *gWebBrowserView = nil;
 UIWebScrollView *gWebScrollView = nil;
 DumpRenderTreeWindow *gDrtWindow = nil;
 #endif
@@ -758,7 +758,7 @@
     NSRect rect = NSMakeRect(0, 0, TestRunner::viewWidth, TestRunner::viewHeight);
     WebView *webView = [[WebView alloc] initWithFrame:rect frameName:nil groupName:@"org.webkit.DumpRenderTree"];
 #else
-    UIWebBrowserView *webBrowserView = [[[DumpRenderTreeBrowserView alloc] initWithFrame:layoutTestViewportRect] autorelease];
+    DumpRenderTreeBrowserView *webBrowserView = [[[DumpRenderTreeBrowserView alloc] initWithFrame:layoutTestViewportRect] autorelease];
     [webBrowserView setInputViewObeysDOMFocus:YES];
     WebView *webView = [[webBrowserView webView] retain];
     [webView setGroupName:@"org.webkit.DumpRenderTree"];

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTreeMac.h (204930 => 204931)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTreeMac.h	2016-08-24 20:53:25 UTC (rev 204930)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTreeMac.h	2016-08-24 20:53:30 UTC (rev 204931)
@@ -69,8 +69,8 @@
 - (void)_waitForWebThread;
 @end
 
-@class UIWebBrowserView;
-extern UIWebBrowserView *gWebBrowserView;
+@class DumpRenderTreeBrowserView;
+extern DumpRenderTreeBrowserView *gWebBrowserView;
 #endif
 
 int DumpRenderTreeMain(int, const char *[]);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to