<!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>[213701] 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/213701">213701</a></dd>
<dt>Author</dt> <dd>ryanhaddad@apple.com</dd>
<dt>Date</dt> <dd>2017-03-09 21:08:40 -0800 (Thu, 09 Mar 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/213633">r213633</a>.
This change caused LayoutTest imported/w3c/web-platform-
tests/html/semantics/embedded-content/the-img-
element/sizes/parse-a-sizes-attribute.html to become a flaky
failure.
Reverted changeset:
"Loading in-body stylesheets should not block rendering of
elements before them"
https://bugs.webkit.org/show_bug.cgi?id=169345
http://trac.webkit.org/changeset/213633</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolvercpp">trunk/Source/WebCore/css/StyleResolver.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumenth">trunk/Source/WebCore/dom/Document.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLFrameSetElementcpp">trunk/Source/WebCore/html/HTMLFrameSetElement.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockcpp">trunk/Source/WebCore/rendering/RenderBlock.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleRenderStylecpp">trunk/Source/WebCore/rendering/style/RenderStyle.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleRenderStyleh">trunk/Source/WebCore/rendering/style/RenderStyle.h</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleStyleRareNonInheritedDatacpp">trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleStyleRareNonInheritedDatah">trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h</a></li>
<li><a href="#trunkSourceWebCorestyleStyleScopecpp">trunk/Source/WebCore/style/StyleScope.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleStyleTreeResolvercpp">trunk/Source/WebCore/style/StyleTreeResolver.cpp</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestsincrementalresourcesdelayedcssphp">trunk/LayoutTests/http/tests/incremental/resources/delayed-css.php</a></li>
<li><a href="#trunkLayoutTestshttptestsincrementalstylesheetbodyincrementalrenderingexpectedhtml">trunk/LayoutTests/http/tests/incremental/stylesheet-body-incremental-rendering-expected.html</a></li>
<li><a href="#trunkLayoutTestshttptestsincrementalstylesheetbodyincrementalrenderinghtml">trunk/LayoutTests/http/tests/incremental/stylesheet-body-incremental-rendering.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (213700 => 213701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-03-10 04:55:19 UTC (rev 213700)
+++ trunk/LayoutTests/ChangeLog        2017-03-10 05:08:40 UTC (rev 213701)
</span><span class="lines">@@ -1,5 +1,21 @@
</span><span class="cx"> 2017-03-09 Ryan Haddad <ryanhaddad@apple.com>
</span><span class="cx">
</span><ins>+ Unreviewed, rolling out r213633.
+
+ This change caused LayoutTest imported/w3c/web-platform-
+ tests/html/semantics/embedded-content/the-img-
+ element/sizes/parse-a-sizes-attribute.html to become a flaky
+ failure.
+
+ Reverted changeset:
+
+ "Loading in-body stylesheets should not block rendering of
+ elements before them"
+ https://bugs.webkit.org/show_bug.cgi?id=169345
+ http://trac.webkit.org/changeset/213633
+
+2017-03-09 Ryan Haddad <ryanhaddad@apple.com>
+
</ins><span class="cx"> Rebaseline js/dom/global-constructors-attributes.html.
</span><span class="cx">
</span><span class="cx"> Unreviewed test gardening.
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsincrementalresourcesdelayedcssphp"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/http/tests/incremental/resources/delayed-css.php (213700 => 213701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/incremental/resources/delayed-css.php        2017-03-10 04:55:19 UTC (rev 213700)
+++ trunk/LayoutTests/http/tests/incremental/resources/delayed-css.php        2017-03-10 05:08:40 UTC (rev 213701)
</span><span class="lines">@@ -1,8 +0,0 @@
</span><del>-<?php
-header("Cache-Control: no-cache, no-store");
-header("Content-Type: text/css");
-
-$delay = $_GET['delay'];
-usleep($delay * 1000);
-?>
-.delayed { background-color: green !important }
</del></span></pre></div>
<a id="trunkLayoutTestshttptestsincrementalstylesheetbodyincrementalrenderingexpectedhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/http/tests/incremental/stylesheet-body-incremental-rendering-expected.html (213700 => 213701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/incremental/stylesheet-body-incremental-rendering-expected.html        2017-03-10 04:55:19 UTC (rev 213700)
+++ trunk/LayoutTests/http/tests/incremental/stylesheet-body-incremental-rendering-expected.html        2017-03-10 05:08:40 UTC (rev 213701)
</span><span class="lines">@@ -1,6 +0,0 @@
</span><del>-<div style="width:100px; height:100px; background-color:green"></div>
-<div style="width:100px; height:100px; background-color:green"></div>
-<p>
-Before stylesheet load: (repaint rects (rect 8 8 100 100) )<br>
-After stylesheet load: (repaint rects (rect 8 108 100 100) )<br>
-</p>
</del></span></pre></div>
<a id="trunkLayoutTestshttptestsincrementalstylesheetbodyincrementalrenderinghtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/http/tests/incremental/stylesheet-body-incremental-rendering.html (213700 => 213701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/incremental/stylesheet-body-incremental-rendering.html        2017-03-10 04:55:19 UTC (rev 213700)
+++ trunk/LayoutTests/http/tests/incremental/stylesheet-body-incremental-rendering.html        2017-03-10 05:08:40 UTC (rev 213701)
</span><span class="lines">@@ -1,24 +0,0 @@
</span><del>-<body>
-<script>
-document.body.offsetWidth;
-
-internals.startTrackingRepaints();
-let initialRects;
-setTimeout(() => {
- initialRects = internals.repaintRectsAsText();
- internals.stopTrackingRepaints();
- internals.startTrackingRepaints();
-}, 0);
-
-document.body.onload = () => {
- let finalRects = internals.repaintRectsAsText();
- internals.stopTrackingRepaints();
- document.body.innerHTML += `<p>
- Before stylesheet load: ${initialRects}<br>
- After stylesheet load: ${finalRects}<br>
- </p>`;
-};
-</script>
-<div style="width:100px; height:100px; background-color:green"></div>
-<link rel="stylesheet" href="resources/delayed-css.php?delay=300">
-<div class=delayed style="width:100px; height:100px; background-color:red"></div>
</del></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (213700 => 213701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-03-10 04:55:19 UTC (rev 213700)
+++ trunk/Source/WebCore/ChangeLog        2017-03-10 05:08:40 UTC (rev 213701)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2017-03-09 Ryan Haddad <ryanhaddad@apple.com>
+
+ Unreviewed, rolling out r213633.
+
+ This change caused LayoutTest imported/w3c/web-platform-
+ tests/html/semantics/embedded-content/the-img-
+ element/sizes/parse-a-sizes-attribute.html to become a flaky
+ failure.
+
+ Reverted changeset:
+
+ "Loading in-body stylesheets should not block rendering of
+ elements before them"
+ https://bugs.webkit.org/show_bug.cgi?id=169345
+ http://trac.webkit.org/changeset/213633
+
</ins><span class="cx"> 2017-03-09 Alex Christensen <achristensen@webkit.org>
</span><span class="cx">
</span><span class="cx"> Fix CMake build
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.cpp (213700 => 213701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.cpp        2017-03-10 04:55:19 UTC (rev 213700)
+++ trunk/Source/WebCore/css/StyleResolver.cpp        2017-03-10 05:08:40 UTC (rev 213701)
</span><span class="lines">@@ -1123,8 +1123,8 @@
</span><span class="cx">
</span><span class="cx"> Vector<RefPtr<StyleRule>> StyleResolver::pseudoStyleRulesForElement(const Element* element, PseudoId pseudoId, unsigned rulesToInclude)
</span><span class="cx"> {
</span><del>- if (!element)
- return { };
</del><ins>+ if (!element || !element->document().haveStylesheetsLoaded())
+ return Vector<RefPtr<StyleRule>>();
</ins><span class="cx">
</span><span class="cx"> m_state = State(*element, nullptr);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (213700 => 213701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2017-03-10 04:55:19 UTC (rev 213700)
+++ trunk/Source/WebCore/dom/Document.cpp        2017-03-10 05:08:40 UTC (rev 213701)
</span><span class="lines">@@ -442,8 +442,9 @@
</span><span class="cx"> #endif
</span><span class="cx"> , m_referencingNodeCount(0)
</span><span class="cx"> , m_settings(frame ? Ref<Settings>(frame->settings()) : Settings::create(nullptr))
</span><del>- , m_hasNodesWithNonFinalStyle(false)
</del><ins>+ , m_hasNodesWithPlaceholderStyle(false)
</ins><span class="cx"> , m_ignorePendingStylesheets(false)
</span><ins>+ , m_pendingSheetLayout(NoLayoutWithPendingSheets)
</ins><span class="cx"> , m_cachedResourceLoader(m_frame ? Ref<CachedResourceLoader>(m_frame->loader().activeDocumentLoader()->cachedResourceLoader()) : CachedResourceLoader::create(nullptr))
</span><span class="cx"> , m_activeParserCount(0)
</span><span class="cx"> , m_wellFormed(false)
</span><span class="lines">@@ -1781,7 +1782,7 @@
</span><span class="cx">
</span><span class="cx"> if (type == ResolveStyleType::Rebuild) {
</span><span class="cx"> // This may get set again during style resolve.
</span><del>- m_hasNodesWithNonFinalStyle = false;
</del><ins>+ m_hasNodesWithPlaceholderStyle = false;
</ins><span class="cx">
</span><span class="cx"> auto documentStyle = Style::resolveForDocument(*this);
</span><span class="cx">
</span><span class="lines">@@ -1817,9 +1818,6 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> updatedCompositingLayers = frameView.updateCompositingLayersAfterStyleChange();
</span><del>-
- if (m_renderView->needsLayout())
- frameView.scheduleRelayout();
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // If we wanted to call implicitClose() during recalcStyle, do so now that we're finished.
</span><span class="lines">@@ -1913,6 +1911,12 @@
</span><span class="cx"> frameView->layout();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// FIXME: This is a bad idea and needs to be removed eventually.
+// Other browsers load stylesheets before they continue parsing the web page.
+// Since we don't, we can run JavaScript code that needs answers before the
+// stylesheets are loaded. Doing a layout ignoring the pending stylesheets
+// lets us get reasonable answers. The long term solution to this problem is
+// to instead suspend JavaScript execution.
</ins><span class="cx"> void Document::updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks runPostLayoutTasks)
</span><span class="cx"> {
</span><span class="cx"> bool oldIgnore = m_ignorePendingStylesheets;
</span><span class="lines">@@ -1919,9 +1923,22 @@
</span><span class="cx">
</span><span class="cx"> if (!haveStylesheetsLoaded()) {
</span><span class="cx"> m_ignorePendingStylesheets = true;
</span><del>- // FIXME: This should just invalidate elements with non-final styles.
- if (m_hasNodesWithNonFinalStyle)
</del><ins>+ // FIXME: We are willing to attempt to suppress painting with outdated style info only once. Our assumption is that it would be
+ // dangerous to try to stop it a second time, after page content has already been loaded and displayed
+ // with accurate style information. (Our suppression involves blanking the whole page at the
+ // moment. If it were more refined, we might be able to do something better.)
+ // It's worth noting though that this entire method is a hack, since what we really want to do is
+ // suspend JS instead of doing a layout with inaccurate information.
+ HTMLElement* bodyElement = bodyOrFrameset();
+ if (bodyElement && !bodyElement->renderer() && m_pendingSheetLayout == NoLayoutWithPendingSheets) {
+ m_pendingSheetLayout = DidLayoutWithPendingSheets;
+ styleScope().didChangeActiveStyleSheetCandidates();
</ins><span class="cx"> resolveStyle(ResolveStyleType::Rebuild);
</span><ins>+ } else if (m_hasNodesWithPlaceholderStyle)
+ // If new nodes have been added or style recalc has been done with style sheets still pending, some nodes
+ // may not have had their real style calculated yet. Normally this gets cleaned when style sheets arrive
+ // but here we need up-to-date style immediately.
+ resolveStyle(ResolveStyleType::Rebuild);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> updateLayout();
</span><span class="lines">@@ -2754,16 +2771,14 @@
</span><span class="cx">
</span><span class="cx"> bool Document::shouldScheduleLayout()
</span><span class="cx"> {
</span><del>- if (!documentElement())
- return false;
- if (!is<HTMLHtmlElement>(*documentElement()))
- return true;
- if (!bodyOrFrameset())
- return false;
- if (styleScope().hasPendingSheetsBeforeBody())
- return false;
</del><ins>+ // This function will only be called when FrameView thinks a layout is needed.
+ // This enforces a couple extra rules.
+ //
+ // (a) Only schedule a layout once the stylesheets are loaded.
+ // (b) Only schedule layout once we have a body element.
</ins><span class="cx">
</span><del>- return true;
</del><ins>+ return (haveStylesheetsLoaded() && bodyOrFrameset())
+ || (documentElement() && !is<HTMLHtmlElement>(*documentElement()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool Document::isLayoutTimerActive()
</span><span class="lines">@@ -3067,6 +3082,15 @@
</span><span class="cx">
</span><span class="cx"> void Document::didRemoveAllPendingStylesheet()
</span><span class="cx"> {
</span><ins>+ if (m_pendingSheetLayout == DidLayoutWithPendingSheets) {
+ // Painting is disabled when doing layouts with pending sheets to avoid FOUC.
+ // We need to force paint when coming out from this state.
+ // FIXME: This is not very elegant.
+ m_pendingSheetLayout = IgnoreLayoutWithPendingSheets;
+ if (renderView())
+ renderView()->repaintViewAndCompositedLayers();
+ }
+
</ins><span class="cx"> if (auto* parser = scriptableDocumentParser())
</span><span class="cx"> parser->executeScriptsWaitingForStylesheetsSoon();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (213700 => 213701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2017-03-10 04:55:19 UTC (rev 213700)
+++ trunk/Source/WebCore/dom/Document.h        2017-03-10 05:08:40 UTC (rev 213701)
</span><span class="lines">@@ -936,9 +936,13 @@
</span><span class="cx"> WEBCORE_EXPORT Ref<XPathNSResolver> createNSResolver(Node* nodeResolver);
</span><span class="cx"> WEBCORE_EXPORT ExceptionOr<Ref<XPathResult>> evaluate(const String& expression, Node* contextNode, RefPtr<XPathNSResolver>&&, unsigned short type, XPathResult*);
</span><span class="cx">
</span><del>- bool hasNodesWithNonFinalStyle() const { return m_hasNodesWithNonFinalStyle; }
- void setHasNodesWithNonFinalStyle() { m_hasNodesWithNonFinalStyle = true; }
</del><ins>+ enum PendingSheetLayout { NoLayoutWithPendingSheets, DidLayoutWithPendingSheets, IgnoreLayoutWithPendingSheets };
</ins><span class="cx">
</span><ins>+ bool didLayoutWithPendingStylesheets() const { return m_pendingSheetLayout == DidLayoutWithPendingSheets; }
+
+ bool hasNodesWithPlaceholderStyle() const { return m_hasNodesWithPlaceholderStyle; }
+ void setHasNodesWithPlaceholderStyle() { m_hasNodesWithPlaceholderStyle = true; }
+
</ins><span class="cx"> void updateFocusAppearanceSoon(SelectionRestorationMode);
</span><span class="cx"> void cancelFocusAppearanceUpdate();
</span><span class="cx">
</span><span class="lines">@@ -1381,11 +1385,16 @@
</span><span class="cx"> const Ref<Settings> m_settings;
</span><span class="cx">
</span><span class="cx"> std::unique_ptr<StyleResolver> m_userAgentShadowTreeStyleResolver;
</span><del>- bool m_hasNodesWithNonFinalStyle;
</del><ins>+ bool m_hasNodesWithPlaceholderStyle;
</ins><span class="cx"> // But sometimes you need to ignore pending stylesheet count to
</span><span class="cx"> // force an immediate layout when requested by JS.
</span><span class="cx"> bool m_ignorePendingStylesheets;
</span><span class="cx">
</span><ins>+ // If we do ignore the pending stylesheet count, then we need to add a boolean
+ // to track that this happened so that we can do a full repaint when the stylesheets
+ // do eventually load.
+ PendingSheetLayout m_pendingSheetLayout;
+
</ins><span class="cx"> RefPtr<DOMWindow> m_domWindow;
</span><span class="cx"> WeakPtr<Document> m_contextDocument;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLFrameSetElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLFrameSetElement.cpp (213700 => 213701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLFrameSetElement.cpp        2017-03-10 04:55:19 UTC (rev 213700)
+++ trunk/Source/WebCore/html/HTMLFrameSetElement.cpp        2017-03-10 05:08:40 UTC (rev 213701)
</span><span class="lines">@@ -153,7 +153,7 @@
</span><span class="cx"> {
</span><span class="cx"> // For compatibility, frames render even when display: none is set.
</span><span class="cx"> // However, we delay creating a renderer until stylesheets have loaded.
</span><del>- return !style.isNotFinal();
</del><ins>+ return !style.isPlaceholderStyle();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RenderPtr<RenderElement> HTMLFrameSetElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (213700 => 213701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2017-03-10 04:55:19 UTC (rev 213700)
+++ trunk/Source/WebCore/page/FrameView.cpp        2017-03-10 05:08:40 UTC (rev 213701)
</span><span class="lines">@@ -4629,10 +4629,6 @@
</span><span class="cx"> if (!frame().document()->parsing() && frame().loader().stateMachine().committedFirstRealDocumentLoad())
</span><span class="cx"> return true;
</span><span class="cx">
</span><del>- // FIXME: We should also ignore renderers with non-final style.
- if (frame().document()->styleScope().hasPendingSheetsBeforeBody())
- return false;
-
</del><span class="cx"> // Require the document to grow a bit.
</span><span class="cx"> // Using a value of 48 allows the header on Google's search page to render immediately before search results populate later.
</span><span class="cx"> static const int documentHeightThreshold = 48;
</span><span class="lines">@@ -5175,7 +5171,7 @@
</span><span class="cx"> updateIsVisuallyNonEmpty();
</span><span class="cx">
</span><span class="cx"> // If the layout was done with pending sheets, we are not in fact visually non-empty yet.
</span><del>- if (m_isVisuallyNonEmpty &&m_firstVisuallyNonEmptyLayoutCallbackPending) {
</del><ins>+ if (m_isVisuallyNonEmpty && !frame().document()->didLayoutWithPendingStylesheets() && m_firstVisuallyNonEmptyLayoutCallbackPending) {
</ins><span class="cx"> m_firstVisuallyNonEmptyLayoutCallbackPending = false;
</span><span class="cx"> if (requestedMilestones & DidFirstVisuallyNonEmptyLayout)
</span><span class="cx"> milestonesAchieved |= DidFirstVisuallyNonEmptyLayout;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (213700 => 213701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlock.cpp        2017-03-10 04:55:19 UTC (rev 213700)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp        2017-03-10 05:08:40 UTC (rev 213701)
</span><span class="lines">@@ -1569,10 +1569,10 @@
</span><span class="cx">
</span><span class="cx"> void RenderBlock::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
</span><span class="cx"> {
</span><del>- // Style is non-final if the element has a pending stylesheet before it. We end up with renderers with such styles if a script
- // forces renderer construction by querying something layout dependent.
- // Avoid FOUC by not painting. Switching to final style triggers repaint.
- if (style().isNotFinal())
</del><ins>+ // Avoid painting descendants of the root element when stylesheets haven't loaded. This eliminates FOUC.
+ // It's ok not to draw, because later on, when all the stylesheets do load, styleResolverChanged() on the Document
+ // will do a full repaint.
+ if (document().didLayoutWithPendingStylesheets() && !isRenderView())
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (childrenInline())
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (213700 => 213701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp        2017-03-10 04:55:19 UTC (rev 213700)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp        2017-03-10 05:08:40 UTC (rev 213701)
</span><span class="lines">@@ -3939,7 +3939,10 @@
</span><span class="cx">
</span><span class="cx"> static inline bool shouldSuppressPaintingLayer(RenderLayer* layer)
</span><span class="cx"> {
</span><del>- if (layer->renderer().style().isNotFinal() && !layer->isRootLayer() && !layer->renderer().isDocumentElementRenderer())
</del><ins>+ // Avoid painting descendants of the root layer when stylesheets haven't loaded. This eliminates FOUC.
+ // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document
+ // will do a full repaint().
+ if (layer->renderer().document().didLayoutWithPendingStylesheets() && !layer->isRootLayer() && !layer->renderer().isDocumentElementRenderer())
</ins><span class="cx"> return true;
</span><span class="cx">
</span><span class="cx"> // Avoid painting all layers if the document is in a state where visual updates aren't allowed.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStylecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (213700 => 213701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp        2017-03-10 04:55:19 UTC (rev 213700)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp        2017-03-10 05:08:40 UTC (rev 213701)
</span><span class="lines">@@ -853,9 +853,6 @@
</span><span class="cx"> || m_rareInheritedData->imageRendering != other.m_rareInheritedData->imageRendering)
</span><span class="cx"> return true;
</span><span class="cx">
</span><del>- if (m_rareNonInheritedData->isNotFinal != other.m_rareNonInheritedData->isNotFinal)
- return true;
-
</del><span class="cx"> if (m_rareNonInheritedData->shapeOutside != other.m_rareNonInheritedData->shapeOutside)
</span><span class="cx"> return true;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStyleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (213700 => 213701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyle.h        2017-03-10 04:55:19 UTC (rev 213700)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h        2017-03-10 05:08:40 UTC (rev 213701)
</span><span class="lines">@@ -1653,9 +1653,8 @@
</span><span class="cx"> static Isolation initialIsolation() { return IsolationAuto; }
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>- // Indicates the style is likely to change due to a pending stylesheet load.
- bool isNotFinal() const { return m_rareNonInheritedData->isNotFinal; }
- void setIsNotFinal() { SET_VAR(m_rareNonInheritedData, isNotFinal, true); }
</del><ins>+ bool isPlaceholderStyle() const { return m_rareNonInheritedData->isPlaceholderStyle; }
+ void setIsPlaceholderStyle() { SET_VAR(m_rareNonInheritedData, isPlaceholderStyle, true); }
</ins><span class="cx">
</span><span class="cx"> void setVisitedLinkColor(const Color&);
</span><span class="cx"> void setVisitedLinkBackgroundColor(const Color& v) { SET_VAR(m_rareNonInheritedData, visitedLinkBackgroundColor, v); }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleStyleRareNonInheritedDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp (213700 => 213701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp        2017-03-10 04:55:19 UTC (rev 213700)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp        2017-03-10 05:08:40 UTC (rev 213701)
</span><span class="lines">@@ -107,7 +107,7 @@
</span><span class="cx"> , breakInside(RenderStyle::initialBreakInside())
</span><span class="cx"> , resize(RenderStyle::initialResize())
</span><span class="cx"> , hasAttrContent(false)
</span><del>- , isNotFinal(false)
</del><ins>+ , isPlaceholderStyle(false)
</ins><span class="cx"> {
</span><span class="cx"> maskBoxImage.setMaskDefaults();
</span><span class="cx"> }
</span><span class="lines">@@ -200,7 +200,7 @@
</span><span class="cx"> , breakInside(o.breakInside)
</span><span class="cx"> , resize(o.resize)
</span><span class="cx"> , hasAttrContent(o.hasAttrContent)
</span><del>- , isNotFinal(o.isNotFinal)
</del><ins>+ , isPlaceholderStyle(o.isPlaceholderStyle)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -304,7 +304,7 @@
</span><span class="cx"> && breakInside == o.breakInside
</span><span class="cx"> && resize == o.resize
</span><span class="cx"> && hasAttrContent == o.hasAttrContent
</span><del>- && isNotFinal == o.isNotFinal;
</del><ins>+ && isPlaceholderStyle == o.isPlaceholderStyle;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool StyleRareNonInheritedData::contentDataEquivalent(const StyleRareNonInheritedData& other) const
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleStyleRareNonInheritedDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h (213700 => 213701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h        2017-03-10 04:55:19 UTC (rev 213700)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h        2017-03-10 05:08:40 UTC (rev 213701)
</span><span class="lines">@@ -220,7 +220,7 @@
</span><span class="cx">
</span><span class="cx"> unsigned hasAttrContent : 1;
</span><span class="cx">
</span><del>- unsigned isNotFinal : 1;
</del><ins>+ unsigned isPlaceholderStyle : 1;
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> StyleRareNonInheritedData();
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStyleScopecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StyleScope.cpp (213700 => 213701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleScope.cpp        2017-03-10 04:55:19 UTC (rev 213700)
+++ trunk/Source/WebCore/style/StyleScope.cpp        2017-03-10 05:08:40 UTC (rev 213701)
</span><span class="lines">@@ -389,7 +389,7 @@
</span><span class="cx"> auto styleResolverUpdateType = hasInsertions ? Reset : Additive;
</span><span class="cx">
</span><span class="cx"> // If we are already parsing the body and so may have significant amount of elements, put some effort into trying to avoid style recalcs.
</span><del>- if (!m_document.bodyOrFrameset() || m_document.hasNodesWithNonFinalStyle())
</del><ins>+ if (!m_document.bodyOrFrameset() || m_document.hasNodesWithPlaceholderStyle())
</ins><span class="cx"> return styleResolverUpdateType;
</span><span class="cx">
</span><span class="cx"> StyleInvalidationAnalysis invalidationAnalysis(addedSheets, styleResolver.mediaQueryEvaluator());
</span><span class="lines">@@ -440,7 +440,7 @@
</span><span class="cx">
</span><span class="cx"> // Don't bother updating, since we haven't loaded all our style info yet
</span><span class="cx"> // and haven't calculated the style resolver for the first time.
</span><del>- if (!m_shadowRoot && !m_didUpdateActiveStyleSheets && hasPendingSheetsBeforeBody()) {
</del><ins>+ if (!m_shadowRoot && !m_didUpdateActiveStyleSheets && hasPendingSheets()) {
</ins><span class="cx"> clearResolver();
</span><span class="cx"> return;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStyleTreeResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StyleTreeResolver.cpp (213700 => 213701)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleTreeResolver.cpp        2017-03-10 04:55:19 UTC (rev 213700)
+++ trunk/Source/WebCore/style/StyleTreeResolver.cpp        2017-03-10 05:08:40 UTC (rev 213701)
</span><span class="lines">@@ -51,6 +51,24 @@
</span><span class="cx">
</span><span class="cx"> namespace Style {
</span><span class="cx">
</span><ins>+static std::unique_ptr<RenderStyle> makePlaceholderStyle(Document& document)
+{
+ auto placeholderStyle = RenderStyle::createPtr();
+ placeholderStyle->setDisplay(NONE);
+ placeholderStyle->setIsPlaceholderStyle();
+
+ FontCascadeDescription fontDescription;
+ fontDescription.setOneFamily(standardFamily);
+ fontDescription.setKeywordSizeFromIdentifier(CSSValueMedium);
+ float size = Style::fontSizeForKeyword(CSSValueMedium, false, document);
+ fontDescription.setSpecifiedSize(size);
+ fontDescription.setComputedSize(size);
+ placeholderStyle->setFontDescription(fontDescription);
+
+ placeholderStyle->fontCascade().update(&document.fontSelector());
+ return placeholderStyle;
+}
+
</ins><span class="cx"> TreeResolver::TreeResolver(Document& document)
</span><span class="cx"> : m_document(document)
</span><span class="cx"> {
</span><span class="lines">@@ -108,6 +126,11 @@
</span><span class="cx">
</span><span class="cx"> std::unique_ptr<RenderStyle> TreeResolver::styleForElement(Element& element, const RenderStyle& inheritedStyle)
</span><span class="cx"> {
</span><ins>+ if (m_didSeePendingStylesheet && !element.renderer() && !m_document.isIgnoringPendingStylesheets()) {
+ m_document.setHasNodesWithPlaceholderStyle();
+ return makePlaceholderStyle(m_document);
+ }
+
</ins><span class="cx"> if (element.hasCustomStyleResolveCallbacks()) {
</span><span class="cx"> RenderStyle* shadowHostStyle = scope().shadowRoot ? m_update->elementStyle(*scope().shadowRoot->host()) : nullptr;
</span><span class="cx"> if (auto customStyle = element.resolveCustomStyle(inheritedStyle, shadowHostStyle)) {
</span><span class="lines">@@ -167,25 +190,15 @@
</span><span class="cx">
</span><span class="cx"> ElementUpdate TreeResolver::resolveElement(Element& element)
</span><span class="cx"> {
</span><del>- if (m_didSeePendingStylesheet && !element.renderer() && !m_document.isIgnoringPendingStylesheets()) {
- m_document.setHasNodesWithNonFinalStyle();
- return { };
- }
-
</del><span class="cx"> auto newStyle = styleForElement(element, parent().style);
</span><span class="cx">
</span><span class="cx"> if (!affectsRenderedSubtree(element, *newStyle))
</span><span class="cx"> return { };
</span><span class="cx">
</span><ins>+ auto update = createAnimatedElementUpdate(WTFMove(newStyle), element, parent().change);
+
</ins><span class="cx"> auto* existingStyle = element.renderStyle();
</span><span class="cx">
</span><del>- if (m_didSeePendingStylesheet && (!existingStyle || existingStyle->isNotFinal())) {
- newStyle->setIsNotFinal();
- m_document.setHasNodesWithNonFinalStyle();
- }
-
- auto update = createAnimatedElementUpdate(WTFMove(newStyle), element, parent().change);
-
</del><span class="cx"> if (&element == m_document.documentElement()) {
</span><span class="cx"> m_documentElementStyle = RenderStyle::clonePtr(*update.style);
</span><span class="cx"> scope().styleResolver.setOverrideDocumentElementStyle(m_documentElementStyle.get());
</span></span></pre>
</div>
</div>
</body>
</html>