Chromium Code Reviews| 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(); |