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"); |