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

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

Issue 652223002: Support style invalidation for ::content. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Missing removal of PseudoContent case when moving. 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 (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 void DescendantInvalidationSet::cacheTracingFlag() 49 void DescendantInvalidationSet::cacheTracingFlag()
50 { 50 {
51 s_tracingEnabled = TRACE_EVENT_API_GET_CATEGORY_ENABLED(TRACE_DISABLED_BY_DE FAULT("devtools.timeline.invalidationTracking")); 51 s_tracingEnabled = TRACE_EVENT_API_GET_CATEGORY_ENABLED(TRACE_DISABLED_BY_DE FAULT("devtools.timeline.invalidationTracking"));
52 } 52 }
53 53
54 DescendantInvalidationSet::DescendantInvalidationSet() 54 DescendantInvalidationSet::DescendantInvalidationSet()
55 : m_allDescendantsMightBeInvalid(false) 55 : m_allDescendantsMightBeInvalid(false)
56 , m_customPseudoInvalid(false) 56 , m_customPseudoInvalid(false)
57 , m_treeBoundaryCrossing(false) 57 , m_treeBoundaryCrossing(false)
58 , m_insertionPointCrossing(false)
58 { 59 {
59 } 60 }
60 61
61 bool DescendantInvalidationSet::invalidatesElement(Element& element) const 62 bool DescendantInvalidationSet::invalidatesElement(Element& element) const
62 { 63 {
63 if (m_allDescendantsMightBeInvalid) 64 if (m_allDescendantsMightBeInvalid)
64 return true; 65 return true;
65 66
66 if (m_tagNames && m_tagNames->contains(element.tagQName().localName())) { 67 if (m_tagNames && m_tagNames->contains(element.tagQName().localName())) {
67 TRACE_STYLE_INVALIDATOR_INVALIDATION_SELECTORPART_IF_ENABLED(element, In validationSetMatchedTagName, element.tagQName().localName()); 68 TRACE_STYLE_INVALIDATOR_INVALIDATION_SELECTORPART_IF_ENABLED(element, In validationSetMatchedTagName, element.tagQName().localName());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 setWholeSubtreeInvalid(); 106 setWholeSubtreeInvalid();
106 return; 107 return;
107 } 108 }
108 109
109 if (other.customPseudoInvalid()) 110 if (other.customPseudoInvalid())
110 setCustomPseudoInvalid(); 111 setCustomPseudoInvalid();
111 112
112 if (other.treeBoundaryCrossing()) 113 if (other.treeBoundaryCrossing())
113 setTreeBoundaryCrossing(); 114 setTreeBoundaryCrossing();
114 115
116 if (other.insertionPointCrossing())
117 setInsertionPointCrossing();
118
115 if (other.m_classes) { 119 if (other.m_classes) {
116 for (const auto& className : *other.m_classes) 120 for (const auto& className : *other.m_classes)
117 addClass(className); 121 addClass(className);
118 } 122 }
119 123
120 if (other.m_ids) { 124 if (other.m_ids) {
121 for (const auto& id : *other.m_ids) 125 for (const auto& id : *other.m_ids)
122 addId(id); 126 addId(id);
123 } 127 }
124 128
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 ensureAttributeSet().add(attribute); 193 ensureAttributeSet().add(attribute);
190 } 194 }
191 195
192 void DescendantInvalidationSet::setWholeSubtreeInvalid() 196 void DescendantInvalidationSet::setWholeSubtreeInvalid()
193 { 197 {
194 if (m_allDescendantsMightBeInvalid) 198 if (m_allDescendantsMightBeInvalid)
195 return; 199 return;
196 200
197 m_allDescendantsMightBeInvalid = true; 201 m_allDescendantsMightBeInvalid = true;
198 m_treeBoundaryCrossing = false; 202 m_treeBoundaryCrossing = false;
203 m_insertionPointCrossing = false;
199 m_classes = nullptr; 204 m_classes = nullptr;
200 m_ids = nullptr; 205 m_ids = nullptr;
201 m_tagNames = nullptr; 206 m_tagNames = nullptr;
202 m_attributes = nullptr; 207 m_attributes = nullptr;
203 } 208 }
204 209
205 void DescendantInvalidationSet::trace(Visitor* visitor) 210 void DescendantInvalidationSet::trace(Visitor* visitor)
206 { 211 {
207 #if ENABLE(OILPAN) 212 #if ENABLE(OILPAN)
208 visitor->trace(m_classes); 213 visitor->trace(m_classes);
209 visitor->trace(m_ids); 214 visitor->trace(m_ids);
210 visitor->trace(m_tagNames); 215 visitor->trace(m_tagNames);
211 visitor->trace(m_attributes); 216 visitor->trace(m_attributes);
212 #endif 217 #endif
213 } 218 }
214 219
215 void DescendantInvalidationSet::toTracedValue(TracedValue* value) const 220 void DescendantInvalidationSet::toTracedValue(TracedValue* value) const
216 { 221 {
217 value->beginDictionary(); 222 value->beginDictionary();
218 223
219 if (m_allDescendantsMightBeInvalid) 224 if (m_allDescendantsMightBeInvalid)
220 value->setBoolean("allDescendantsMightBeInvalid", true); 225 value->setBoolean("allDescendantsMightBeInvalid", true);
221 if (m_customPseudoInvalid) 226 if (m_customPseudoInvalid)
222 value->setBoolean("customPseudoInvalid", true); 227 value->setBoolean("customPseudoInvalid", true);
223 if (m_treeBoundaryCrossing) 228 if (m_treeBoundaryCrossing)
224 value->setBoolean("treeBoundaryCrossing", true); 229 value->setBoolean("treeBoundaryCrossing", true);
230 if (m_insertionPointCrossing)
231 value->setBoolean("insertionPointCrossing", true);
225 232
226 if (m_ids) { 233 if (m_ids) {
227 value->beginArray("ids"); 234 value->beginArray("ids");
228 for (const auto& id : *m_ids) 235 for (const auto& id : *m_ids)
229 value->pushString(id); 236 value->pushString(id);
230 value->endArray(); 237 value->endArray();
231 } 238 }
232 239
233 if (m_classes) { 240 if (m_classes) {
234 value->beginArray("classes"); 241 value->beginArray("classes");
(...skipping 22 matching lines...) Expand all
257 #ifndef NDEBUG 264 #ifndef NDEBUG
258 void DescendantInvalidationSet::show() const 265 void DescendantInvalidationSet::show() const
259 { 266 {
260 RefPtr<TracedValue> value = TracedValue::create(); 267 RefPtr<TracedValue> value = TracedValue::create();
261 toTracedValue(value.get()); 268 toTracedValue(value.get());
262 fprintf(stderr, "%s\n", value->asTraceFormat().ascii().data()); 269 fprintf(stderr, "%s\n", value->asTraceFormat().ascii().data());
263 } 270 }
264 #endif // NDEBUG 271 #endif // NDEBUG
265 272
266 } // namespace blink 273 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/invalidation/DescendantInvalidationSet.h ('k') | Source/core/css/invalidation/StyleInvalidator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698