Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2484863003: Make updateStyleAndLayoutTree ready for async stylesheet update. (Closed)
Patch Set: Rebased Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 4ea28a71e472ac90b904ef538954f21f0d609eca..0ec25824974f8beea269725f8fe42799c637f914 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -606,11 +606,11 @@ void Document::setDoctype(DocumentType* docType) {
if (m_docType) {
this->adoptIfNeeded(*m_docType);
if (m_docType->publicId().startsWith("-//wapforum//dtd xhtml mobile 1.",
- TextCaseInsensitive))
+ TextCaseInsensitive)) {
m_isMobileDocument = true;
+ m_styleEngine->viewportRulesChanged();
+ }
}
- // Doctype affects the interpretation of the stylesheets.
- styleEngine().clearResolver();
}
DOMImplementation& Document::implementation() {
@@ -1566,6 +1566,8 @@ bool Document::needsLayoutTreeUpdate() const {
bool Document::needsFullLayoutTreeUpdate() const {
if (!isActive() || !view())
return false;
+ if (m_styleEngine->needsActiveStyleUpdate())
+ return true;
if (!m_useElementsNeedingUpdate.isEmpty())
return true;
if (needsStyleRecalc())
@@ -1618,10 +1620,9 @@ bool Document::hasPendingForcedStyleRecalc() const {
}
void Document::updateStyleInvalidationIfNeeded() {
+ DCHECK(isActive());
ScriptForbiddenScope forbidScript;
- if (!isActive())
- return;
if (!childNeedsStyleInvalidation())
return;
TRACE_EVENT0("blink", "Document::updateStyleInvalidationIfNeeded");
@@ -1875,6 +1876,7 @@ void Document::updateStyleAndLayoutTree() {
evaluateMediaQueryListIfNeeded();
updateUseShadowTreesIfNeeded();
updateDistribution();
+ updateActiveStyle();
updateStyleInvalidationIfNeeded();
// FIXME: We should update style on our ancestor chain before proceeding
@@ -1917,6 +1919,13 @@ void Document::updateStyleAndLayoutTree() {
PerformanceMonitor::didRecalculateStyle(this);
}
+void Document::updateActiveStyle() {
+ DCHECK(isActive());
+ DCHECK(isMainThread());
+ TRACE_EVENT0("blink", "Document::updateActiveStyle");
+ styleEngine().updateActiveStyle();
+}
+
void Document::updateStyle() {
DCHECK(!view()->shouldThrottleRendering());
TRACE_EVENT_BEGIN0("blink,blink_style", "Document::updateStyle");
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698