Title: [174650] trunk
Revision
174650
Author
[email protected]
Date
2014-10-13 10:33:28 -0700 (Mon, 13 Oct 2014)

Log Message

iOS DRT snapshots are limited to the page visible area
https://bugs.webkit.org/show_bug.cgi?id=137650

Reviewed by Daniel Bates.
Source/WebCore:

LegacyTileCache drawing was limited to the window's visible area, found by
crawling up the layer hierarchy to the root layer. This caused test snapshots to
be missing non-composited content outside the iPhone visible area, which hinders
testing.

Fix by adding a test-only mode where the window visible area is the entire window.

* platform/ios/wak/WAKWindow.h:
* platform/ios/wak/WAKWindow.mm:
(-[WAKWindow setEntireWindowVisibleForTesting:]):
(-[WAKWindow _visibleRectRespectingMasksToBounds:]):

Tools:

LegacyTileCache drawing was limited to the window's visible area, found by
crawling up the layer hierarchy to the root layer. This caused test snapshots to
be missing non-composited content outside the iPhone visible area, which hinders
testing.

Fix by adding a test-only mode where the window visible area is the entire window.

* DumpRenderTree/ios/PixelDumpSupportIOS.mm:
(dumpWebViewAsPixelsAndCompareWithExpected): Drive-by RetainPtr fix.
* DumpRenderTree/mac/DumpRenderTreeWindow.mm:
(-[DumpRenderTreeWindow initWithLayer:]): Call setEntireWindowVisibleForTesting:YES
for the DRT window.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (174649 => 174650)


--- trunk/Source/WebCore/ChangeLog	2014-10-13 16:08:07 UTC (rev 174649)
+++ trunk/Source/WebCore/ChangeLog	2014-10-13 17:33:28 UTC (rev 174650)
@@ -1,3 +1,22 @@
+2014-10-13  Simon Fraser  <[email protected]>
+
+        iOS DRT snapshots are limited to the page visible area
+        https://bugs.webkit.org/show_bug.cgi?id=137650
+
+        Reviewed by Daniel Bates.
+
+        LegacyTileCache drawing was limited to the window's visible area, found by
+        crawling up the layer hierarchy to the root layer. This caused test snapshots to
+        be missing non-composited content outside the iPhone visible area, which hinders
+        testing.
+        
+        Fix by adding a test-only mode where the window visible area is the entire window.
+
+        * platform/ios/wak/WAKWindow.h:
+        * platform/ios/wak/WAKWindow.mm:
+        (-[WAKWindow setEntireWindowVisibleForTesting:]):
+        (-[WAKWindow _visibleRectRespectingMasksToBounds:]):
+
 2014-10-13  Mihnea Ovidenie  <[email protected]>
 
         [CSSRegions] Make RenderNamedFlowFragment::computeStyleInRegion const

Modified: trunk/Source/WebCore/platform/ios/wak/WAKWindow.h (174649 => 174650)


--- trunk/Source/WebCore/platform/ios/wak/WAKWindow.h	2014-10-13 16:08:07 UTC (rev 174649)
+++ trunk/Source/WebCore/platform/ios/wak/WAKWindow.h	2014-10-13 17:33:28 UTC (rev 174650)
@@ -85,6 +85,7 @@
 
     BOOL _visible;
     BOOL _useOrientationDependentFontAntialiasing;
+    BOOL _entireWindowVisibleForTesting;
 }
 
 @property (nonatomic, assign) BOOL useOrientationDependentFontAntialiasing;
@@ -132,6 +133,8 @@
 - (CGRect)exposedScrollViewRect;
 // setExposedScrollViewRect should only ever be called from UIKit.
 - (void)setExposedScrollViewRect:(CGRect)exposedScrollViewRect;
+// Used only by DumpRenderTree.
+- (void)setEntireWindowVisibleForTesting:(BOOL)entireWindowVisible;
 
 // Tiling support
 - (void)layoutTiles;

Modified: trunk/Source/WebCore/platform/ios/wak/WAKWindow.mm (174649 => 174650)


--- trunk/Source/WebCore/platform/ios/wak/WAKWindow.mm	2014-10-13 16:08:07 UTC (rev 174649)
+++ trunk/Source/WebCore/platform/ios/wak/WAKWindow.mm	2014-10-13 17:33:28 UTC (rev 174650)
@@ -425,6 +425,11 @@
     _tileCache->setTilesOpaque(opaque);
 }
 
+- (void)setEntireWindowVisibleForTesting:(BOOL)entireWindowVisible
+{
+    _entireWindowVisibleForTesting = entireWindowVisible;
+}
+
 - (CGRect)_visibleRectRespectingMasksToBounds:(BOOL)respectsMasksToBounds
 {
     if (!CGRectIsNull(_frozenVisibleRect))
@@ -432,6 +437,8 @@
 
     CALayer* layer = _hostLayer;
     CGRect bounds = [layer bounds];
+    if (_entireWindowVisibleForTesting)
+        return bounds;
     CGRect rect = bounds;
     CALayer* superlayer = [layer superlayer];
 

Modified: trunk/Tools/ChangeLog (174649 => 174650)


--- trunk/Tools/ChangeLog	2014-10-13 16:08:07 UTC (rev 174649)
+++ trunk/Tools/ChangeLog	2014-10-13 17:33:28 UTC (rev 174650)
@@ -1,3 +1,24 @@
+2014-10-13  Simon Fraser  <[email protected]>
+
+        iOS DRT snapshots are limited to the page visible area
+        https://bugs.webkit.org/show_bug.cgi?id=137650
+
+        Reviewed by Daniel Bates.
+        
+        LegacyTileCache drawing was limited to the window's visible area, found by
+        crawling up the layer hierarchy to the root layer. This caused test snapshots to
+        be missing non-composited content outside the iPhone visible area, which hinders
+        testing.
+        
+        Fix by adding a test-only mode where the window visible area is the entire window.
+        
+        * DumpRenderTree/ios/PixelDumpSupportIOS.mm:
+        (dumpWebViewAsPixelsAndCompareWithExpected): Drive-by RetainPtr fix.
+        * DumpRenderTree/mac/DumpRenderTreeWindow.mm:
+        (-[DumpRenderTreeWindow initWithLayer:]): Call setEntireWindowVisibleForTesting:YES
+        for the DRT window.
+        
+
 2014-10-12  Simon Fraser  <[email protected]>
 
         Page not fully rendered in iOS DRT snapshots

Modified: trunk/Tools/DumpRenderTree/ios/PixelDumpSupportIOS.mm (174649 => 174650)


--- trunk/Tools/DumpRenderTree/ios/PixelDumpSupportIOS.mm	2014-10-13 16:08:07 UTC (rev 174649)
+++ trunk/Tools/DumpRenderTree/ios/PixelDumpSupportIOS.mm	2014-10-13 17:33:28 UTC (rev 174650)
@@ -60,8 +60,8 @@
     WebThreadLock();
     [gWebBrowserView setNeedsDisplay];
     [gWebBrowserView layoutTilesNow];
-    CGImageRef snapshot = [gWebBrowserView createSnapshotWithRect:[[mainFrame webView] frame]];
-    NSData *pngData = UIImagePNGRepresentation([UIImage imageWithCGImage:snapshot]);
+    RetainPtr<CGImageRef> snapshot = adoptCF([gWebBrowserView newSnapshotWithRect:[[mainFrame webView] frame]]);
+    NSData *pngData = UIImagePNGRepresentation([UIImage imageWithCGImage:snapshot.get()]);
     
     // Hash the PNG data
     char actualHash[33];
@@ -76,5 +76,4 @@
     printf("Content-Type: image/png\n");
     printf("Content-Length: %lu\n", (unsigned long)[pngData length]);
     fwrite([pngData bytes], 1, [pngData length], stdout);
-    CGImageRelease(snapshot);
 }

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.mm (174649 => 174650)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.mm	2014-10-13 16:08:07 UTC (rev 174649)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTreeWindow.mm	2014-10-13 17:33:28 UTC (rev 174650)
@@ -81,8 +81,10 @@
 #else
 - (id)initWithLayer:(CALayer *)layer
 {
-    if ((self = [super initWithLayer:layer]))
+    if ((self = [super initWithLayer:layer])) {
+        [self setEntireWindowVisibleForTesting:YES];
         [self _addToOpenWindows];
+    }
 
     return self;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to