Commit 76b73659 authored by esprehn@chromium.org's avatar esprehn@chromium.org

Merge recalcStyleForLayoutIgnoringPendingStylesheets into updateLayoutIgnorePendingStylesheets

Now that we don't have partial layout we can recombine these methods. No
one should be calling the other one except updateLayoutIgnorePendingStylesheets
anyway.

R=pdr@chromium.org,ojan@chromium.org

Review URL: https://codereview.chromium.org/209323003

git-svn-id: svn://svn.chromium.org/blink/trunk@169815 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 9f39885c
......@@ -1887,32 +1887,6 @@ void Document::clearFocusedElementTimerFired(Timer<Document>*)
setFocusedElement(nullptr);
}
void Document::recalcStyleForLayoutIgnoringPendingStylesheets()
{
ASSERT(m_styleEngine->ignoringPendingStylesheets());
if (!m_styleEngine->hasPendingSheets())
return;
// 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 = body();
if (bodyElement && !bodyElement->renderer() && m_pendingSheetLayout == NoLayoutWithPendingSheets) {
m_pendingSheetLayout = DidLayoutWithPendingSheets;
styleResolverChanged(RecalcStyleImmediately);
} 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.
updateStyle(Force);
}
}
// 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
......@@ -1922,8 +1896,29 @@ void Document::recalcStyleForLayoutIgnoringPendingStylesheets()
void Document::updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks runPostLayoutTasks)
{
StyleEngine::IgnoringPendingStylesheet ignoring(m_styleEngine.get());
recalcStyleForLayoutIgnoringPendingStylesheets();
if (m_styleEngine->hasPendingSheets()) {
// 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 = body();
if (bodyElement && !bodyElement->renderer() && m_pendingSheetLayout == NoLayoutWithPendingSheets) {
m_pendingSheetLayout = DidLayoutWithPendingSheets;
styleResolverChanged(RecalcStyleImmediately);
} 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.
updateStyle(Force);
}
}
updateLayout();
if (runPostLayoutTasks == RunPostLayoutTasksSynchronously && view())
view()->flushAnyPendingPostLayoutTasks();
}
......
......@@ -1113,8 +1113,6 @@ private:
void executeScriptsWaitingForResourcesIfNeeded();
void recalcStyleForLayoutIgnoringPendingStylesheets();
PassRefPtr<NodeList> handleZeroPadding(const HitTestRequest&, HitTestResult&) const;
void loadEventDelayTimerFired(Timer<Document>*);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment