WebKit1 is flashy when compositing layers come and go
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 May 2014 18:49:26 +0000 (18:49 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 May 2014 18:49:26 +0000 (18:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=132655

Source/WebKit/mac:

Reviewed by Sam Weinig.

In r166117 I removed code to flush compositing layers in FrameView::paintContents(),
which caused problems when painting iframes. However, this removed a flush
that WebKit1 relied on to flush compositing layers when painting, which caused
flashing when compositing layers come and go, and broke WebView snapshotting
in some cases.

Fix by adding back compositing layer flushing, but this time in WebKit1's
-viewWillDraw code path. This allows removal of some flushing in DumpRenderTree.

* WebView/WebHTMLView.mm:
(-[WebHTMLView viewWillDraw]):
* WebView/WebView.mm:
(-[WebView _flushCompositingChanges]):
* WebView/WebViewInternal.h:
* WebView/WebViewPrivate.h:

Tools:
<rdar://problem/16830981&16788846>

Reviewed by Sam Weinig.

Revert the change from r166117.

* DumpRenderTree/mac/DumpRenderTree.mm:
(updateDisplay):

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

Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebHTMLView.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/mac/WebView/WebViewInternal.h
Source/WebKit/mac/WebView/WebViewPrivate.h
Tools/ChangeLog
Tools/DumpRenderTree/mac/DumpRenderTree.mm

index 3704300..6218256 100644 (file)
@@ -1,3 +1,26 @@
+2014-05-07  Simon Fraser  <simon.fraser@apple.com>
+
+        WebKit1 is flashy when compositing layers come and go
+        https://bugs.webkit.org/show_bug.cgi?id=132655
+
+        Reviewed by Sam Weinig.
+        
+        In r166117 I removed code to flush compositing layers in FrameView::paintContents(),
+        which caused problems when painting iframes. However, this removed a flush
+        that WebKit1 relied on to flush compositing layers when painting, which caused
+        flashing when compositing layers come and go, and broke WebView snapshotting
+        in some cases.
+        
+        Fix by adding back compositing layer flushing, but this time in WebKit1's
+        -viewWillDraw code path. This allows removal of some flushing in DumpRenderTree.
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView viewWillDraw]):
+        * WebView/WebView.mm:
+        (-[WebView _flushCompositingChanges]):
+        * WebView/WebViewInternal.h:
+        * WebView/WebViewPrivate.h:
+
 2014-05-07  Manuel Rego Casasnovas  <rego@igalia.com>
 
         [CSS Grid Layout] Remove runtime feature
index 6e95a00..d342046 100644 (file)
@@ -1394,8 +1394,10 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
     // On window close we will be called when the datasource is nil, then hit an assert in _topHTMLView
     // So check if the dataSource is nil before calling [self _isTopHTMLView], this can be removed
     // once the FIXME in _isTopHTMLView is fixed.
-    if (_private->dataSource && [self _isTopHTMLView])
+    if (_private->dataSource && [self _isTopHTMLView]) {
         [self _web_updateLayoutAndStyleIfNeededRecursive];
+        [[self _webView] _flushCompositingChanges];
+    }
 
     [super viewWillDraw];
 }
index e4c36a5..7c4024b 100644 (file)
@@ -3870,15 +3870,6 @@ static inline IMP getMethod(id o, SEL s)
     return NO;
 }
 
-- (BOOL)_flushCompositingChanges
-{
-    Frame* frame = [self _mainCoreFrame];
-    if (frame && frame->view())
-        return frame->view()->flushCompositingStateIncludingSubframes();
-
-    return YES;
-}
-
 - (void)_setBaseCTM:(CGAffineTransform)transform forContext:(CGContextRef)context
 {
     WKSetBaseCTM(context, transform);
@@ -8420,6 +8411,15 @@ bool LayerFlushController::flushLayers()
     _private->layerFlushController->scheduleLayerFlush();
 }
 
+- (BOOL)_flushCompositingChanges
+{
+    Frame* frame = [self _mainCoreFrame];
+    if (frame && frame->view())
+        return frame->view()->flushCompositingStateIncludingSubframes();
+
+    return YES;
+}
+
 #if PLATFORM(IOS)
 - (void)_scheduleLayerFlushForPendingTileCacheRepaint
 {
index 77e7756..f599de4 100644 (file)
@@ -102,6 +102,7 @@ OBJC_CLASS NSTextAlternatives;
 - (BOOL)_needsOneShotDrawingSynchronization;
 - (void)_setNeedsOneShotDrawingSynchronization:(BOOL)needsSynchronization;
 - (void)_scheduleCompositingLayerFlush;
+- (BOOL)_flushCompositingChanges;
 
 #if USE(GLIB)
 - (void)_scheduleGlibContextIterations;
index c9aea78..053c43b 100644 (file)
@@ -771,7 +771,6 @@ Could be worth adding to the API.
 - (BOOL)_postsAcceleratedCompositingNotifications;
 - (void)_setPostsAcceleratedCompositingNotifications:(BOOL)flag;
 - (BOOL)_isUsingAcceleratedCompositing;
-- (BOOL)_flushCompositingChanges;
 - (void)_setBaseCTM:(CGAffineTransform)transform forContext:(CGContextRef)context;
 
 // For DumpRenderTree
index 8c2a835..beed16a 100644 (file)
@@ -1,3 +1,16 @@
+2014-05-07  Simon Fraser  <simon.fraser@apple.com>
+
+        WebKit1 is flashy when compositing layers come and go
+        https://bugs.webkit.org/show_bug.cgi?id=132655
+        <rdar://problem/16830981&16788846>
+
+        Reviewed by Sam Weinig.
+        
+        Revert the change from r166117.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (updateDisplay):
+
 2014-05-07  Chris Fleizach  <cfleizach@apple.com>
 
         AX: AXSelectTextWithCriteria should support capitalize/lowercase/uppercase
index 886ebac..1b04f6a 100644 (file)
@@ -1521,8 +1521,6 @@ static void updateDisplay()
         [webView display];
     else
         [webView displayIfNeeded];
-
-    [webView _flushCompositingChanges];
 }
 
 void dump()