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 d303cfccd4c229df7d7afba8c0aebc6ac52d3e0c..33b528736e228cd05446a1594b8b3e3e7b26674f 100644 |
--- a/third_party/WebKit/Source/core/dom/Document.cpp |
+++ b/third_party/WebKit/Source/core/dom/Document.cpp |
@@ -533,7 +533,7 @@ MediaQueryMatcher& Document::mediaQueryMatcher() |
void Document::mediaQueryAffectingValueChanged() |
{ |
m_evaluateMediaQueriesOnStyleRecalc = true; |
- styleEngine().clearMediaQueryRuleSetStyleSheets(); |
+ styleEngine().mediaQueryAffectingValueChanged(); |
InspectorInstrumentation::mediaQueryResultChanged(this); |
} |
@@ -557,10 +557,13 @@ void Document::setDoctype(DocumentType* docType) |
m_docType = docType; |
if (m_docType) { |
this->adoptIfNeeded(*m_docType); |
- if (m_docType->publicId().startsWith("-//wapforum//dtd xhtml mobile 1.", TextCaseInsensitive)) |
+ if (m_docType->publicId().startsWith("-//wapforum//dtd xhtml mobile 1.", TextCaseInsensitive)) { |
m_isMobileDocument = true; |
+ styleEngine().setNeedsActiveStyleUpdate(*this); |
+ } |
} |
// Doctype affects the interpretation of the stylesheets. |
+ // TODO(rune@opera.com): Is this necessary? Smaller cannon? |
styleEngine().clearResolver(); |
} |
@@ -1479,6 +1482,8 @@ bool Document::needsFullLayoutTreeUpdate() const |
// FIXME: The childNeedsDistributionRecalc bit means either self or children, we should fix that. |
if (childNeedsDistributionRecalc()) |
return true; |
+ if (m_styleEngine->needsActiveStyleUpdate()) |
+ return true; |
if (DocumentAnimations::needsAnimationTimingUpdate(*this)) |
return true; |
return false; |
@@ -1519,15 +1524,14 @@ bool Document::hasPendingForcedStyleRecalc() const |
return hasPendingVisualUpdate() && !inStyleRecalc() && getStyleChangeType() >= SubtreeStyleChange; |
} |
-void Document::updateStyleInvalidationIfNeeded() |
+void Document::updateStyleInvalidation() |
{ |
ScriptForbiddenScope forbidScript; |
- if (!isActive()) |
- return; |
+ DCHECK(isActive()); |
if (!childNeedsStyleInvalidation()) |
return; |
- TRACE_EVENT0("blink", "Document::updateStyleInvalidationIfNeeded"); |
+ TRACE_EVENT0("blink", "Document::updateStyleInvalidation"); |
styleEngine().styleInvalidator().invalidate(*this); |
} |
@@ -1745,7 +1749,8 @@ void Document::updateStyleAndLayoutTree() |
evaluateMediaQueryListIfNeeded(); |
updateUseShadowTreesIfNeeded(); |
updateDistribution(); |
- updateStyleInvalidationIfNeeded(); |
+ styleEngine().updateActiveStyle(); |
+ updateStyleInvalidation(); |
// FIXME: We should update style on our ancestor chain before proceeding |
// however doing so currently causes several tests to crash, as LocalFrame::setDocument calls Document::attach |
@@ -1993,7 +1998,8 @@ void Document::updateStyleAndLayoutTreeIgnorePendingStylesheets() |
HTMLElement* bodyElement = body(); |
if (bodyElement && !bodyElement->layoutObject() && m_pendingSheetLayout == NoLayoutWithPendingSheets) { |
m_pendingSheetLayout = DidLayoutWithPendingSheets; |
- styleEngine().resolverChanged(FullStyleUpdate); |
+ styleEngine().markAllTreeScopesDirty(); |
+ setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::CleanupPlaceholderStyles)); |
} 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 |
@@ -3452,7 +3458,10 @@ void Document::notifyResizeForViewportUnits() |
void Document::styleResolverMayHaveChanged() |
{ |
- styleEngine().resolverChanged(hasNodesWithPlaceholderStyle() ? FullStyleUpdate : AnalyzedStyleUpdate); |
+ if (hasNodesWithPlaceholderStyle()) { |
+ styleEngine().markAllTreeScopesDirty(); |
+ setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::CleanupPlaceholderStyles)); |
+ } |
if (didLayoutWithPendingStylesheets() && !styleEngine().hasPendingScriptBlockingSheets()) { |
// We need to manually repaint because we avoid doing all repaints in layout or style |