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

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: 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 | « LayoutTests/fast/css/getComputedStyle/computed-style-recalc-expected.txt ('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 63cb1e518c441db49e3ef02308e29485cf4d1bf2..6f541e9fec97793ac051a56e69f1674fabf04d13 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -1897,8 +1897,16 @@ void Document::updateRenderTreeForNodeIfNeeded(Node* node)
{
bool needsRecalc = needsFullRenderTreeUpdate();
- for (const Node* ancestor = node; ancestor && !needsRecalc; ancestor = NodeRenderingTraversal::parent(*ancestor))
- needsRecalc = ancestor->needsStyleRecalc() || ancestor->needsStyleInvalidation();
+ for (const Node* ancestor = node; ancestor && !needsRecalc; ancestor = NodeRenderingTraversal::parent(*ancestor)) {
+ bool childrenAffectedByAdjacent = node != ancestor
esprehn 2014/12/05 09:52:36 Can we hoist this out of the loop? if (node->need
+ && ancestor->isContainerNode()
esprehn 2014/12/05 09:52:36 this statement doesn't make sense, an ancestor mus
+ && (toContainerNode(ancestor)->childrenAffectedByDirectAdjacentRules()
+ || toContainerNode(ancestor)->childrenAffectedByIndirectAdjacentRules());
+
+ needsRecalc = ancestor->needsStyleRecalc()
+ || ancestor->needsStyleInvalidation()
+ || (childrenAffectedByAdjacent && (ancestor->childNeedsStyleRecalc() || ancestor->childNeedsStyleInvalidation()));
esprehn 2014/12/05 09:52:36 It seems like you can combine this with the above
+ }
if (needsRecalc)
updateRenderTreeIfNeeded();
« no previous file with comments | « LayoutTests/fast/css/getComputedStyle/computed-style-recalc-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698