Chromium Code Reviews| Index: Source/core/css/invalidation/StyleInvalidator.cpp |
| diff --git a/Source/core/css/invalidation/StyleInvalidator.cpp b/Source/core/css/invalidation/StyleInvalidator.cpp |
| index 39fb027fdba4805885ac8874bede480d3cc688ce..ff09a69f16077e69ccb49f394a73d6b9898bfe6c 100644 |
| --- a/Source/core/css/invalidation/StyleInvalidator.cpp |
| +++ b/Source/core/css/invalidation/StyleInvalidator.cpp |
| @@ -75,6 +75,8 @@ void StyleInvalidator::RecursionData::pushInvalidationSet(const DescendantInvali |
| m_wholeSubtreeInvalid = true; |
| return; |
|
chrishtr
2014/05/29 20:54:07
Move tree boundary crossing before this early retu
esprehn
2014/05/29 21:07:30
That would make us traverse too far down the tree
|
| } |
| + if (invalidationSet.treeBoundaryCrossing()) |
| + m_treeBoundaryCrossing = true; |
| m_invalidationSets.append(&invalidationSet); |
| m_invalidateCustomPseudo = invalidationSet.customPseudoInvalid(); |
| } |
| @@ -115,14 +117,16 @@ bool StyleInvalidator::invalidateChildren(Element& element) |
| { |
| bool someChildrenNeedStyleRecalc = false; |
| for (ShadowRoot* root = element.youngestShadowRoot(); root; root = root->olderShadowRoot()) { |
| - for (Element* child = ElementTraversal::firstWithin(*root); child; child = ElementTraversal::nextSibling(*child)) { |
| + if (!m_recursionData.treeBoundaryCrossing() && !root->childNeedsStyleInvalidation() && !root->needsStyleInvalidation()) |
| + continue; |
| + for (Element* child = ElementTraversal::firstChild(*root); child; child = ElementTraversal::nextSibling(*child)) { |
| bool childRecalced = invalidate(*child); |
| someChildrenNeedStyleRecalc = someChildrenNeedStyleRecalc || childRecalced; |
| } |
| root->clearChildNeedsStyleInvalidation(); |
| root->clearNeedsStyleInvalidation(); |
| } |
| - for (Element* child = ElementTraversal::firstWithin(element); child; child = ElementTraversal::nextSibling(*child)) { |
| + for (Element* child = ElementTraversal::firstChild(element); child; child = ElementTraversal::nextSibling(*child)) { |
| bool childRecalced = invalidate(*child); |
| someChildrenNeedStyleRecalc = someChildrenNeedStyleRecalc || childRecalced; |
| } |