Title: [234115] trunk/Tools
Revision
234115
Author
[email protected]
Date
2018-07-23 16:00:00 -0700 (Mon, 23 Jul 2018)

Log Message

DRT relies on [webView display] to call -viewWillDraw on the WebHTMLView
https://bugs.webkit.org/show_bug.cgi?id=187924
<rdar://problem/41745884>

Reviewed by Simon Fraser.

WebKit relies on -viewWillDraw getting called on WebHTMLView, even though that view has not been marked as needing display.

* DumpRenderTree/mac/PixelDumpSupportMac.mm:
(createBitmapContextFromWebView):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (234114 => 234115)


--- trunk/Tools/ChangeLog	2018-07-23 22:53:07 UTC (rev 234114)
+++ trunk/Tools/ChangeLog	2018-07-23 23:00:00 UTC (rev 234115)
@@ -1,3 +1,16 @@
+2018-07-23  Zalan Bujtas  <[email protected]>
+
+        DRT relies on [webView display] to call -viewWillDraw on the WebHTMLView
+        https://bugs.webkit.org/show_bug.cgi?id=187924
+        <rdar://problem/41745884>
+
+        Reviewed by Simon Fraser.
+
+        WebKit relies on -viewWillDraw getting called on WebHTMLView, even though that view has not been marked as needing display.
+
+        * DumpRenderTree/mac/PixelDumpSupportMac.mm:
+        (createBitmapContextFromWebView):
+
 2018-07-23  Chris Dumez  <[email protected]>
 
         WebResourceLoadStatisticsStore fails to unregister itself as a MessageReceiver in its destructor

Modified: trunk/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm (234114 => 234115)


--- trunk/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm	2018-07-23 22:53:07 UTC (rev 234114)
+++ trunk/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm	2018-07-23 23:00:00 UTC (rev 234115)
@@ -49,6 +49,10 @@
 + (void)synchronize;
 @end
 
+@interface WebView ()
+- (BOOL)_flushCompositingChanges;
+@end
+
 static void paintRepaintRectOverlay(WebView* webView, CGContextRef context)
 {
     CGRect viewRect = NSRectToCGRect([webView bounds]);
@@ -87,10 +91,6 @@
     if ([view _isUsingAcceleratedCompositing])
         _onscreen_ = YES;
 
-    // If the window is layer-backed, its backing store will be empty, so we have to use a window server snapshot.
-    if ([view.window.contentView layer])
-        _onscreen_ = YES;
-
     float deviceScaleFactor = [view _backingScaleFactor];
     NSSize webViewSize = [view frame].size;
     size_t pixelsWide = static_cast<size_t>(webViewSize.width * deviceScaleFactor);
@@ -122,6 +122,7 @@
             // FIXME: This will break repaint testing if we have compositing in repaint tests.
             // (displayWebView() painted gray over the webview, but we'll be making everything repaint again).
             [view display];
+            [view _flushCompositingChanges];
             [CATransaction flush];
             [CATransaction synchronize];
 
@@ -133,30 +134,12 @@
 
             if ([view isTrackingRepaints])
                 paintRepaintRectOverlay(view, context);
-        } else if (deviceScaleFactor != 1) {
+        } else {
             // Call displayRectIgnoringOpacity for HiDPI tests since it ensures we paint directly into the context
             // that we have appropriately sized and scaled.
             [view displayRectIgnoringOpacity:[view bounds] inContext:nsContext];
             if ([view isTrackingRepaints])
                 paintRepaintRectOverlay(view, context);
-        } else {
-            // Make sure the view has been painted.
-            [view displayIfNeeded];
-
-            // Grab directly the contents of the window backing buffer (this ignores any surfaces on the window)
-            // FIXME: This path is suboptimal: data is read from window backing store, converted to RGB8 then drawn again into an RGBA8 bitmap
-            [view lockFocus];
-            NSBitmapImageRep *imageRep = [[[NSBitmapImageRep alloc] initWithFocusedViewRect:[view frame]] autorelease];
-            [view unlockFocus];
-
-            RetainPtr<NSGraphicsContext> savedContext = [NSGraphicsContext currentContext];
-            [NSGraphicsContext setCurrentContext:nsContext];
-            [imageRep draw];
-            
-            if ([view isTrackingRepaints])
-                paintRepaintRectOverlay(view, context);
-            
-            [NSGraphicsContext setCurrentContext:savedContext.get()];
         }
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to