| OLD | NEW |
| 1 | 1 |
| 2 // Copyright 2014 The Chromium Authors. All rights reserved. | 2 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 #include "config.h" | 6 #include "config.h" |
| 7 | 7 |
| 8 #include "core/css/invalidation/StyleInvalidator.h" | 8 #include "core/css/invalidation/StyleInvalidator.h" |
| 9 | 9 |
| 10 #include "core/css/invalidation/DescendantInvalidationSet.h" | 10 #include "core/css/invalidation/DescendantInvalidationSet.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 { | 64 { |
| 65 } | 65 } |
| 66 | 66 |
| 67 StyleInvalidator::~StyleInvalidator() | 67 StyleInvalidator::~StyleInvalidator() |
| 68 { | 68 { |
| 69 } | 69 } |
| 70 | 70 |
| 71 void StyleInvalidator::RecursionData::pushInvalidationSet(const DescendantInvali
dationSet& invalidationSet) | 71 void StyleInvalidator::RecursionData::pushInvalidationSet(const DescendantInvali
dationSet& invalidationSet) |
| 72 { | 72 { |
| 73 ASSERT(!m_wholeSubtreeInvalid); | 73 ASSERT(!m_wholeSubtreeInvalid); |
| 74 if (invalidationSet.treeBoundaryCrossing()) |
| 75 m_treeBoundaryCrossing = true; |
| 74 if (invalidationSet.wholeSubtreeInvalid()) { | 76 if (invalidationSet.wholeSubtreeInvalid()) { |
| 75 m_wholeSubtreeInvalid = true; | 77 m_wholeSubtreeInvalid = true; |
| 76 return; | 78 return; |
| 77 } | 79 } |
| 78 m_invalidationSets.append(&invalidationSet); | 80 m_invalidationSets.append(&invalidationSet); |
| 79 m_invalidateCustomPseudo = invalidationSet.customPseudoInvalid(); | 81 m_invalidateCustomPseudo = invalidationSet.customPseudoInvalid(); |
| 80 } | 82 } |
| 81 | 83 |
| 82 bool StyleInvalidator::RecursionData::matchesCurrentInvalidationSets(Element& el
ement) | 84 bool StyleInvalidator::RecursionData::matchesCurrentInvalidationSets(Element& el
ement) |
| 83 { | 85 { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 108 return true; | 110 return true; |
| 109 } | 111 } |
| 110 } | 112 } |
| 111 return m_recursionData.matchesCurrentInvalidationSets(element); | 113 return m_recursionData.matchesCurrentInvalidationSets(element); |
| 112 } | 114 } |
| 113 | 115 |
| 114 bool StyleInvalidator::invalidateChildren(Element& element) | 116 bool StyleInvalidator::invalidateChildren(Element& element) |
| 115 { | 117 { |
| 116 bool someChildrenNeedStyleRecalc = false; | 118 bool someChildrenNeedStyleRecalc = false; |
| 117 for (ShadowRoot* root = element.youngestShadowRoot(); root; root = root->old
erShadowRoot()) { | 119 for (ShadowRoot* root = element.youngestShadowRoot(); root; root = root->old
erShadowRoot()) { |
| 118 for (Element* child = ElementTraversal::firstWithin(*root); child; child
= ElementTraversal::nextSibling(*child)) { | 120 if (!m_recursionData.treeBoundaryCrossing() && !root->childNeedsStyleInv
alidation() && !root->needsStyleInvalidation()) |
| 121 continue; |
| 122 for (Element* child = ElementTraversal::firstChild(*root); child; child
= ElementTraversal::nextSibling(*child)) { |
| 119 bool childRecalced = invalidate(*child); | 123 bool childRecalced = invalidate(*child); |
| 120 someChildrenNeedStyleRecalc = someChildrenNeedStyleRecalc || childRe
calced; | 124 someChildrenNeedStyleRecalc = someChildrenNeedStyleRecalc || childRe
calced; |
| 121 } | 125 } |
| 122 root->clearChildNeedsStyleInvalidation(); | 126 root->clearChildNeedsStyleInvalidation(); |
| 123 root->clearNeedsStyleInvalidation(); | 127 root->clearNeedsStyleInvalidation(); |
| 124 } | 128 } |
| 125 for (Element* child = ElementTraversal::firstWithin(element); child; child =
ElementTraversal::nextSibling(*child)) { | 129 for (Element* child = ElementTraversal::firstChild(element); child; child =
ElementTraversal::nextSibling(*child)) { |
| 126 bool childRecalced = invalidate(*child); | 130 bool childRecalced = invalidate(*child); |
| 127 someChildrenNeedStyleRecalc = someChildrenNeedStyleRecalc || childRecalc
ed; | 131 someChildrenNeedStyleRecalc = someChildrenNeedStyleRecalc || childRecalc
ed; |
| 128 } | 132 } |
| 129 return someChildrenNeedStyleRecalc; | 133 return someChildrenNeedStyleRecalc; |
| 130 } | 134 } |
| 131 | 135 |
| 132 bool StyleInvalidator::invalidate(Element& element) | 136 bool StyleInvalidator::invalidate(Element& element) |
| 133 { | 137 { |
| 134 RecursionCheckpoint checkpoint(&m_recursionData); | 138 RecursionCheckpoint checkpoint(&m_recursionData); |
| 135 | 139 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 154 | 158 |
| 155 return thisElementNeedsStyleRecalc; | 159 return thisElementNeedsStyleRecalc; |
| 156 } | 160 } |
| 157 | 161 |
| 158 void StyleInvalidator::trace(Visitor* visitor) | 162 void StyleInvalidator::trace(Visitor* visitor) |
| 159 { | 163 { |
| 160 visitor->trace(m_pendingInvalidationMap); | 164 visitor->trace(m_pendingInvalidationMap); |
| 161 } | 165 } |
| 162 | 166 |
| 163 } // namespace WebCore | 167 } // namespace WebCore |
| OLD | NEW |