<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[166117] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/166117">166117</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-03-22 10:52:14 -0700 (Sat, 22 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Source/WebCore: Don't flush compositing layers within FrameView::willPaintContents()
https://bugs.webkit.org/show_bug.cgi?id=130627
&lt;rdar://problem/16368869&gt;

Reviewed by Sam Weinig.

Remove the call to flushCompositingStateForThisFrame() here. We should
have always flushed before painting via other mechanisms in WebKit2 and WebKit2.
Flushing during painting is actually harmful, since we could be inside
a CA commit already, and creating or destroying layers via flushing is bad.

* page/FrameView.cpp:
(WebCore::FrameView::willPaintContents):

Source/WebKit/mac: Don't flush compositing layers within FrameView::willPaintContents()
https://bugs.webkit.org/show_bug.cgi?id=130627

Reviewed by Sam Weinig.

Make _flushCompositingChanges private so DRT can call it;
moved it into the Private category.

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

Tools: Don't flush compositing layers within FrameView::willPaintContents()
https://bugs.webkit.org/show_bug.cgi?id=130627
&lt;rdar://problem/16368869&gt;

Reviewed by Sam Weinig.

Fix DRT to correctly render tests with layers now that FrameView::paintContents
does not flush.

Move the -[WebView displayIfNeeded] from -[FrameLoadDelegate webView:didFinishLoadForFrame:]
into an explicit function called before dumping.

Then explicitly call _flushCompositingChanges to ensure that GraphicsLayer changes
are flushed to CA. They will be pushed to the window by snapshotting.

* DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
Fix weird path to IOKit.framework.
* DumpRenderTree/mac/DumpRenderTree.mm:
(updateDisplay):
(dump):
* DumpRenderTree/mac/FrameLoadDelegate.mm:
(-[FrameLoadDelegate webView:locationChangeDone:forDataSource:]): Fix parameter name.
(-[FrameLoadDelegate webView:didFinishLoadForFrame:]): Remove display call.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewPrivateh">trunk/Source/WebKit/mac/WebView/WebViewPrivate.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreeDumpRenderTreexcodeprojprojectpbxproj">trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkToolsDumpRenderTreemacDumpRenderTreemm">trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm</a></li>
<li><a href="#trunkToolsDumpRenderTreemacFrameLoadDelegatemm">trunk/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (166116 => 166117)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-03-22 17:51:00 UTC (rev 166116)
+++ trunk/Source/WebCore/ChangeLog        2014-03-22 17:52:14 UTC (rev 166117)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2014-03-21  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Don't flush compositing layers within FrameView::willPaintContents()
+        https://bugs.webkit.org/show_bug.cgi?id=130627
+        &lt;rdar://problem/16368869&gt;
+
+        Reviewed by Sam Weinig.
+
+        Remove the call to flushCompositingStateForThisFrame() here. We should
+        have always flushed before painting via other mechanisms in WebKit2 and WebKit2.
+        Flushing during painting is actually harmful, since we could be inside
+        a CA commit already, and creating or destroying layers via flushing is bad.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::willPaintContents):
+
</ins><span class="cx"> 2014-03-22  Martin Hodovan  &lt;mhodovan@inf.u-szeged.hu&gt;
</span><span class="cx"> 
</span><span class="cx">         ASSERTION FAILED: std::isfinite(num) in WebCore::CSSPrimitiveValue::CSSPrimitiveValue
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (166116 => 166117)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2014-03-22 17:51:00 UTC (rev 166116)
+++ trunk/Source/WebCore/page/FrameView.cpp        2014-03-22 17:52:14 UTC (rev 166117)
</span><span class="lines">@@ -3492,9 +3492,6 @@
</span><span class="cx">     if (paintingState.isTopLevelPainter)
</span><span class="cx">         sCurrentPaintTimeStamp = monotonicallyIncreasingTime();
</span><span class="cx"> 
</span><del>-    if (!context-&gt;paintingDisabled() &amp;&amp; !document-&gt;printing())
-        flushCompositingStateForThisFrame(&amp;frame());
-
</del><span class="cx">     paintingState.paintBehavior = m_paintBehavior;
</span><span class="cx">     
</span><span class="cx">     if (FrameView* parentView = parentFrameView()) {
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (166116 => 166117)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-03-22 17:51:00 UTC (rev 166116)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-03-22 17:52:14 UTC (rev 166117)
</span><span class="lines">@@ -1,5 +1,19 @@
</span><span class="cx"> 2014-03-21  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Don't flush compositing layers within FrameView::willPaintContents()
+        https://bugs.webkit.org/show_bug.cgi?id=130627
+
+        Reviewed by Sam Weinig.
+        
+        Make _flushCompositingChanges private so DRT can call it;
+        moved it into the Private category.
+
+        * WebView/WebView.mm:
+        (-[WebView _flushCompositingChanges]):
+        * WebView/WebViewPrivate.h:
+
+2014-03-21  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
</ins><span class="cx">         Remove duplicate line added during merging
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=130623
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (166116 => 166117)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2014-03-22 17:51:00 UTC (rev 166116)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2014-03-22 17:52:14 UTC (rev 166117)
</span><span class="lines">@@ -3868,6 +3868,15 @@
</span><span class="cx">     return NO;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (BOOL)_flushCompositingChanges
+{
+    Frame* frame = [self _mainCoreFrame];
+    if (frame &amp;&amp; frame-&gt;view())
+        return frame-&gt;view()-&gt;flushCompositingStateIncludingSubframes();
+
+    return YES;
+}
+
</ins><span class="cx"> - (void)_setBaseCTM:(CGAffineTransform)transform forContext:(CGContextRef)context
</span><span class="cx"> {
</span><span class="cx">     WKSetBaseCTM(context, transform);
</span><span class="lines">@@ -8328,15 +8337,6 @@
</span><span class="cx">     _private-&gt;needsOneShotDrawingSynchronization = needsSynchronization;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (BOOL)_flushCompositingChanges
-{
-    Frame* frame = [self _mainCoreFrame];
-    if (frame &amp;&amp; frame-&gt;view())
-        return frame-&gt;view()-&gt;flushCompositingStateIncludingSubframes();
-
-    return YES;
-}
-
</del><span class="cx"> /*
</span><span class="cx">     The order of events with compositing updates is this:
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebViewPrivate.h (166116 => 166117)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebViewPrivate.h        2014-03-22 17:51:00 UTC (rev 166116)
+++ trunk/Source/WebKit/mac/WebView/WebViewPrivate.h        2014-03-22 17:52:14 UTC (rev 166117)
</span><span class="lines">@@ -771,6 +771,7 @@
</span><span class="cx"> - (BOOL)_postsAcceleratedCompositingNotifications;
</span><span class="cx"> - (void)_setPostsAcceleratedCompositingNotifications:(BOOL)flag;
</span><span class="cx"> - (BOOL)_isUsingAcceleratedCompositing;
</span><ins>+- (BOOL)_flushCompositingChanges;
</ins><span class="cx"> - (void)_setBaseCTM:(CGAffineTransform)transform forContext:(CGContextRef)context;
</span><span class="cx"> 
</span><span class="cx"> // For DumpRenderTree
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (166116 => 166117)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-03-22 17:51:00 UTC (rev 166116)
+++ trunk/Tools/ChangeLog        2014-03-22 17:52:14 UTC (rev 166117)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2014-03-21  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Don't flush compositing layers within FrameView::willPaintContents()
+        https://bugs.webkit.org/show_bug.cgi?id=130627
+        &lt;rdar://problem/16368869&gt;
+
+        Reviewed by Sam Weinig.
+        
+        Fix DRT to correctly render tests with layers now that FrameView::paintContents
+        does not flush.
+        
+        Move the -[WebView displayIfNeeded] from -[FrameLoadDelegate webView:didFinishLoadForFrame:]
+        into an explicit function called before dumping. 
+        
+        Then explicitly call _flushCompositingChanges to ensure that GraphicsLayer changes
+        are flushed to CA. They will be pushed to the window by snapshotting.
+
+        * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+        Fix weird path to IOKit.framework.
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (updateDisplay):
+        (dump):
+        * DumpRenderTree/mac/FrameLoadDelegate.mm:
+        (-[FrameLoadDelegate webView:locationChangeDone:forDataSource:]): Fix parameter name.
+        (-[FrameLoadDelegate webView:didFinishLoadForFrame:]): Remove display call.
+
</ins><span class="cx"> 2014-03-21  David Kilzer  &lt;ddkilzer@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         fix-blink-patch: tool to fix up renamed directory paths in Blink
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeDumpRenderTreexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj (166116 => 166117)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj        2014-03-22 17:51:00 UTC (rev 166116)
+++ trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj        2014-03-22 17:52:14 UTC (rev 166117)
</span><span class="lines">@@ -232,7 +232,7 @@
</span><span class="cx">                 1A4CCD4E171375A300981040 /* ToStringAndValueOfObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ToStringAndValueOfObject.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A5CC1F3137DD2EC00A5D7E7 /* GetURLWithJavaScriptURL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetURLWithJavaScriptURL.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A66C34F14576A920099A115 /* ContentsScaleFactor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentsScaleFactor.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                1A7961061803454C00FE42CD /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = ../../../../../../../System/Library/Frameworks/IOKit.framework; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                1A7961061803454C00FE42CD /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 1A8F024C0BB9B056008CFA34 /* TestObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestObject.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1AC6C77F0D07589B00CD3161 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1AC6C7800D07589B00CD3161 /* PluginObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginObject.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacDumpRenderTreemm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (166116 => 166117)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm        2014-03-22 17:51:00 UTC (rev 166116)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm        2014-03-22 17:52:14 UTC (rev 166117)
</span><span class="lines">@@ -1523,6 +1523,18 @@
</span><span class="cx">     return !waitToDumpWatchdog &amp;&amp; useTimeoutWatchdog;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static void updateDisplay()
+{
+    WebView *webView = [mainFrame webView];
+
+    if ([webView _isUsingAcceleratedCompositing])
+        [webView display];
+    else
+        [webView displayIfNeeded];
+
+    [webView _flushCompositingChanges];
+}
+
</ins><span class="cx"> void dump()
</span><span class="cx"> {
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="lines">@@ -1533,7 +1545,9 @@
</span><span class="cx">     }
</span><span class="cx">     WebThreadLock();
</span><span class="cx"> #endif
</span><del>-    
</del><ins>+
+    updateDisplay();
+
</ins><span class="cx">     invalidateAnyPreviousWaitToDumpWatchdog();
</span><span class="cx">     ASSERT(!gTestRunner-&gt;hasPendingWebNotificationClick());
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacFrameLoadDelegatemm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm (166116 => 166117)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm        2014-03-22 17:51:00 UTC (rev 166116)
+++ trunk/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm        2014-03-22 17:52:14 UTC (rev 166117)
</span><span class="lines">@@ -156,7 +156,7 @@
</span><span class="cx">     accessibilityController-&gt;resetToConsistentState();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)webView:(WebView *)c locationChangeDone:(NSError *)error forDataSource:(WebDataSource *)dataSource
</del><ins>+- (void)webView:(WebView *)webView locationChangeDone:(NSError *)error forDataSource:(WebDataSource *)dataSource
</ins><span class="cx"> {
</span><span class="cx">     if ([dataSource webFrame] == topLoadingFrame) {
</span><span class="cx">         topLoadingFrame = nil;
</span><span class="lines">@@ -281,11 +281,6 @@
</span><span class="cx">         printf (&quot;%s\n&quot;, [string UTF8String]);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // FIXME: This call to displayIfNeeded can be removed when &lt;rdar://problem/5092361&gt; is fixed.
-    // After that is fixed, we will reenable painting after WebCore is done loading the document, 
-    // and this call will no longer be needed.
-    if ([[sender mainFrame] isEqual:frame])
-        [sender displayIfNeeded];
</del><span class="cx">     [self webView:sender locationChangeDone:nil forDataSource:[frame dataSource]];
</span><span class="cx">     [gNavigationController webView:sender didFinishLoadForFrame:frame];
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>