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

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

Issue 768533004: Make getComputedStyle optimization work for adjacent combinators. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Redistribution might change computed style. Created 6 years 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
« no previous file with comments | « Source/core/dom/ContainerNode.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index e156af0b099036a0dd188ee81cad39af540ff99e..7968c9bc2d43ef5c059576eb7bc30056ee20a165 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -1895,12 +1895,16 @@ void Document::updateStyle(StyleRecalcChange change)
void Document::updateRenderTreeForNodeIfNeeded(Node* node)
{
+ ASSERT(node);
if (!node->canParticipateInComposedTree())
return;
- bool needsRecalc = needsFullRenderTreeUpdate();
- for (const Node* ancestor = node; ancestor && !needsRecalc; ancestor = NodeRenderingTraversal::parent(*ancestor))
- needsRecalc = ancestor->needsStyleRecalc() || ancestor->needsStyleInvalidation();
+ bool needsRecalc = needsFullRenderTreeUpdate() || childNeedsDistributionRecalc() || node->needsStyleRecalc() || node->needsStyleInvalidation();
+
+ if (!needsRecalc) {
+ for (const ContainerNode* ancestor = NodeRenderingTraversal::parent(*node); ancestor && !needsRecalc; ancestor = NodeRenderingTraversal::parent(*ancestor))
+ needsRecalc = ancestor->needsStyleRecalc() || ancestor->needsStyleInvalidation() || ancestor->needsAdjacentStyleRecalc();
+ }
if (needsRecalc)
updateRenderTreeIfNeeded();
« no previous file with comments | « Source/core/dom/ContainerNode.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698