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

Side by Side Diff: Source/core/css/invalidation/StyleInvalidator.cpp

Issue 652223002: Support style invalidation for ::content. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months 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 unified diff | Download patch
OLDNEW
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 StyleInvalidator::~StyleInvalidator() 77 StyleInvalidator::~StyleInvalidator()
78 { 78 {
79 } 79 }
80 80
81 void StyleInvalidator::RecursionData::pushInvalidationSet(const DescendantInvali dationSet& invalidationSet) 81 void StyleInvalidator::RecursionData::pushInvalidationSet(const DescendantInvali dationSet& invalidationSet)
82 { 82 {
83 ASSERT(!m_wholeSubtreeInvalid); 83 ASSERT(!m_wholeSubtreeInvalid);
84 if (invalidationSet.treeBoundaryCrossing()) 84 if (invalidationSet.treeBoundaryCrossing())
85 m_treeBoundaryCrossing = true; 85 m_treeBoundaryCrossing = true;
86 if (invalidationSet.insertionPointCrossing())
87 m_insertionPointCrossing = true;
86 if (invalidationSet.wholeSubtreeInvalid()) { 88 if (invalidationSet.wholeSubtreeInvalid()) {
87 m_wholeSubtreeInvalid = true; 89 m_wholeSubtreeInvalid = true;
88 return; 90 return;
89 } 91 }
90 m_invalidationSets.append(&invalidationSet); 92 m_invalidationSets.append(&invalidationSet);
91 m_invalidateCustomPseudo = invalidationSet.customPseudoInvalid(); 93 m_invalidateCustomPseudo = invalidationSet.customPseudoInvalid();
92 } 94 }
93 95
94 ALWAYS_INLINE bool StyleInvalidator::RecursionData::matchesCurrentInvalidationSe ts(Element& element) 96 ALWAYS_INLINE bool StyleInvalidator::RecursionData::matchesCurrentInvalidationSe ts(Element& element)
95 { 97 {
96 ASSERT(!m_wholeSubtreeInvalid); 98 ASSERT(!m_wholeSubtreeInvalid);
97 99
98 if (m_invalidateCustomPseudo && element.shadowPseudoId() != nullAtom) { 100 if (m_invalidateCustomPseudo && element.shadowPseudoId() != nullAtom) {
99 TRACE_STYLE_INVALIDATOR_INVALIDATION_IF_ENABLED(element, InvalidateCusto mPseudo); 101 TRACE_STYLE_INVALIDATOR_INVALIDATION_IF_ENABLED(element, InvalidateCusto mPseudo);
100 return true; 102 return true;
101 } 103 }
102 104
105 if (m_insertionPointCrossing && element.isInsertionPoint())
106 return true;
107
103 for (const auto& invalidationSet : m_invalidationSets) { 108 for (const auto& invalidationSet : m_invalidationSets) {
104 if (invalidationSet->invalidatesElement(element)) 109 if (invalidationSet->invalidatesElement(element))
105 return true; 110 return true;
106 } 111 }
107 112
108 return false; 113 return false;
109 } 114 }
110 115
111 ALWAYS_INLINE bool StyleInvalidator::checkInvalidationSetsAgainstElement(Element & element, StyleInvalidator::RecursionData& recursionData) 116 ALWAYS_INLINE bool StyleInvalidator::checkInvalidationSetsAgainstElement(Element & element, StyleInvalidator::RecursionData& recursionData)
112 { 117 {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } else if (recursionData.hasInvalidationSets() && someChildrenNeedStyleRecal c) { 171 } else if (recursionData.hasInvalidationSets() && someChildrenNeedStyleRecal c) {
167 // Clone the RenderStyle in order to preserve correct style sharing, if possible. Otherwise recalc style. 172 // Clone the RenderStyle in order to preserve correct style sharing, if possible. Otherwise recalc style.
168 if (RenderObject* renderer = element.renderer()) { 173 if (RenderObject* renderer = element.renderer()) {
169 renderer->setStyleInternal(RenderStyle::clone(renderer->style())); 174 renderer->setStyleInternal(RenderStyle::clone(renderer->style()));
170 } else { 175 } else {
171 TRACE_STYLE_INVALIDATOR_INVALIDATION_IF_ENABLED(element, PreventStyl eSharingForParent); 176 TRACE_STYLE_INVALIDATOR_INVALIDATION_IF_ENABLED(element, PreventStyl eSharingForParent);
172 element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTr acing::create(StyleChangeReason::StyleInvalidator)); 177 element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTr acing::create(StyleChangeReason::StyleInvalidator));
173 } 178 }
174 } 179 }
175 180
181 if (recursionData.insertionPointCrossing() && element.isInsertionPoint()) {
182 const InsertionPoint& insertionPoint = toInsertionPoint(element);
183 for (size_t i = 0; i < insertionPoint.size(); ++i)
esprehn 2014/10/16 02:19:06 Just set SubtreeStyleChange on the InsertionPoint
rune 2014/10/16 12:18:36 Done.
184 insertionPoint.at(i)->setNeedsStyleRecalc(SubtreeStyleChange, StyleC hangeReasonForTracing::create(StyleChangeReason::StyleInvalidator));
185 }
186
176 element.clearChildNeedsStyleInvalidation(); 187 element.clearChildNeedsStyleInvalidation();
177 element.clearNeedsStyleInvalidation(); 188 element.clearNeedsStyleInvalidation();
178 189
179 return thisElementNeedsStyleRecalc; 190 return thisElementNeedsStyleRecalc;
180 } 191 }
181 192
182 void StyleInvalidator::trace(Visitor* visitor) 193 void StyleInvalidator::trace(Visitor* visitor)
183 { 194 {
184 #if ENABLE(OILPAN) 195 #if ENABLE(OILPAN)
185 visitor->trace(m_pendingInvalidationMap); 196 visitor->trace(m_pendingInvalidationMap);
186 #endif 197 #endif
187 } 198 }
188 199
189 } // namespace blink 200 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698