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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 StyleInvalidator::~StyleInvalidator() | 68 StyleInvalidator::~StyleInvalidator() |
69 { | 69 { |
70 } | 70 } |
71 | 71 |
72 void StyleInvalidator::RecursionData::pushInvalidationSet(const DescendantInvali
dationSet& invalidationSet) | 72 void StyleInvalidator::RecursionData::pushInvalidationSet(const DescendantInvali
dationSet& invalidationSet) |
73 { | 73 { |
74 ASSERT(!m_wholeSubtreeInvalid); | 74 ASSERT(!m_wholeSubtreeInvalid); |
75 if (invalidationSet.treeBoundaryCrossing()) | 75 if (invalidationSet.treeBoundaryCrossing()) |
76 m_treeBoundaryCrossing = true; | 76 m_treeBoundaryCrossing = true; |
| 77 if (invalidationSet.insertionPointCrossing()) |
| 78 m_insertionPointCrossing = true; |
77 if (invalidationSet.wholeSubtreeInvalid()) { | 79 if (invalidationSet.wholeSubtreeInvalid()) { |
78 m_wholeSubtreeInvalid = true; | 80 m_wholeSubtreeInvalid = true; |
79 return; | 81 return; |
80 } | 82 } |
81 m_invalidationSets.append(&invalidationSet); | 83 m_invalidationSets.append(&invalidationSet); |
82 m_invalidateCustomPseudo = invalidationSet.customPseudoInvalid(); | 84 m_invalidateCustomPseudo = invalidationSet.customPseudoInvalid(); |
83 } | 85 } |
84 | 86 |
85 bool StyleInvalidator::RecursionData::matchesCurrentInvalidationSets(Element& el
ement) | 87 bool StyleInvalidator::RecursionData::matchesCurrentInvalidationSets(Element& el
ement) |
86 { | 88 { |
87 ASSERT(!m_wholeSubtreeInvalid); | 89 ASSERT(!m_wholeSubtreeInvalid); |
88 | 90 |
89 if (m_invalidateCustomPseudo && element.shadowPseudoId() != nullAtom) | 91 if (m_invalidateCustomPseudo && element.shadowPseudoId() != nullAtom) |
90 return true; | 92 return true; |
91 | 93 |
| 94 if (m_insertionPointCrossing && element.isInsertionPoint()) |
| 95 return true; |
| 96 |
92 for (InvalidationSets::iterator it = m_invalidationSets.begin(); it != m_inv
alidationSets.end(); ++it) { | 97 for (InvalidationSets::iterator it = m_invalidationSets.begin(); it != m_inv
alidationSets.end(); ++it) { |
93 if ((*it)->invalidatesElement(element)) | 98 if ((*it)->invalidatesElement(element)) |
94 return true; | 99 return true; |
95 } | 100 } |
96 | 101 |
97 return false; | 102 return false; |
98 } | 103 } |
99 | 104 |
100 bool StyleInvalidator::checkInvalidationSetsAgainstElement(Element& element, Sty
leInvalidator::RecursionData& recursionData) | 105 bool StyleInvalidator::checkInvalidationSetsAgainstElement(Element& element, Sty
leInvalidator::RecursionData& recursionData) |
101 { | 106 { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 if (thisElementNeedsStyleRecalc) { | 152 if (thisElementNeedsStyleRecalc) { |
148 element.setNeedsStyleRecalc(recursionData.wholeSubtreeInvalid() ? Subtre
eStyleChange : LocalStyleChange, StyleChangeReasonForTracing::create(StyleChange
Reason::StyleInvalidator)); | 153 element.setNeedsStyleRecalc(recursionData.wholeSubtreeInvalid() ? Subtre
eStyleChange : LocalStyleChange, StyleChangeReasonForTracing::create(StyleChange
Reason::StyleInvalidator)); |
149 } else if (recursionData.hasInvalidationSets() && someChildrenNeedStyleRecal
c) { | 154 } else if (recursionData.hasInvalidationSets() && someChildrenNeedStyleRecal
c) { |
150 // Clone the RenderStyle in order to preserve correct style sharing, if
possible. Otherwise recalc style. | 155 // Clone the RenderStyle in order to preserve correct style sharing, if
possible. Otherwise recalc style. |
151 if (RenderObject* renderer = element.renderer()) | 156 if (RenderObject* renderer = element.renderer()) |
152 renderer->setStyleInternal(RenderStyle::clone(renderer->style())); | 157 renderer->setStyleInternal(RenderStyle::clone(renderer->style())); |
153 else | 158 else |
154 element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTr
acing::create(StyleChangeReason::StyleInvalidator)); | 159 element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTr
acing::create(StyleChangeReason::StyleInvalidator)); |
155 } | 160 } |
156 | 161 |
| 162 if (recursionData.insertionPointCrossing() && element.isInsertionPoint()) { |
| 163 const InsertionPoint& insertionPoint = toInsertionPoint(element); |
| 164 for (size_t i = 0; i < insertionPoint.size(); ++i) |
| 165 insertionPoint.at(i)->setNeedsStyleRecalc(SubtreeStyleChange, StyleC
hangeReasonForTracing::create(StyleChangeReason::StyleInvalidator)); |
| 166 } |
| 167 |
157 element.clearChildNeedsStyleInvalidation(); | 168 element.clearChildNeedsStyleInvalidation(); |
158 element.clearNeedsStyleInvalidation(); | 169 element.clearNeedsStyleInvalidation(); |
159 | 170 |
160 return thisElementNeedsStyleRecalc; | 171 return thisElementNeedsStyleRecalc; |
161 } | 172 } |
162 | 173 |
163 void StyleInvalidator::trace(Visitor* visitor) | 174 void StyleInvalidator::trace(Visitor* visitor) |
164 { | 175 { |
165 #if ENABLE(OILPAN) | 176 #if ENABLE(OILPAN) |
166 visitor->trace(m_pendingInvalidationMap); | 177 visitor->trace(m_pendingInvalidationMap); |
167 #endif | 178 #endif |
168 } | 179 } |
169 | 180 |
170 } // namespace blink | 181 } // namespace blink |
OLD | NEW |