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,13 +1887,17 @@ void Document::clearFocusedElementTimerFired(Timer<Document>*) ...@@ -1887,13 +1887,17 @@ void Document::clearFocusedElementTimerFired(Timer<Document>*)
setFocusedElement(nullptr); setFocusedElement(nullptr);
} }
void Document::recalcStyleForLayoutIgnoringPendingStylesheets() // 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.
void Document::updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks runPostLayoutTasks)
{ {
ASSERT(m_styleEngine->ignoringPendingStylesheets()); StyleEngine::IgnoringPendingStylesheet ignoring(m_styleEngine.get());
if (!m_styleEngine->hasPendingSheets())
return;
if (m_styleEngine->hasPendingSheets()) {
// FIXME: We are willing to attempt to suppress painting with outdated style info only once. // 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 // 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 // content has already been loaded and displayed with accurate style information. (Our
...@@ -1911,19 +1915,10 @@ void Document::recalcStyleForLayoutIgnoringPendingStylesheets() ...@@ -1911,19 +1915,10 @@ void Document::recalcStyleForLayoutIgnoringPendingStylesheets()
// gets cleaned when style sheets arrive but here we need up-to-date style immediately. // gets cleaned when style sheets arrive but here we need up-to-date style immediately.
updateStyle(Force); 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
// 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.
void Document::updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks runPostLayoutTasks)
{
StyleEngine::IgnoringPendingStylesheet ignoring(m_styleEngine.get());
recalcStyleForLayoutIgnoringPendingStylesheets();
updateLayout(); updateLayout();
if (runPostLayoutTasks == RunPostLayoutTasksSynchronously && view()) if (runPostLayoutTasks == RunPostLayoutTasksSynchronously && view())
view()->flushAnyPendingPostLayoutTasks(); view()->flushAnyPendingPostLayoutTasks();
} }
......
...@@ -1113,8 +1113,6 @@ private: ...@@ -1113,8 +1113,6 @@ private:
void executeScriptsWaitingForResourcesIfNeeded(); void executeScriptsWaitingForResourcesIfNeeded();
void recalcStyleForLayoutIgnoringPendingStylesheets();
PassRefPtr<NodeList> handleZeroPadding(const HitTestRequest&, HitTestResult&) const; PassRefPtr<NodeList> handleZeroPadding(const HitTestRequest&, HitTestResult&) const;
void loadEventDelayTimerFired(Timer<Document>*); 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