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

Side by Side Diff: Source/core/css/RuleFeature.cpp

Issue 684993007: Support style invalidation for ::cue selectors. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « LayoutTests/media/track/cue-style-invalidation-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 case CSSSelector::PseudoEnd: 131 case CSSSelector::PseudoEnd:
132 case CSSSelector::PseudoDoubleButton: 132 case CSSSelector::PseudoDoubleButton:
133 case CSSSelector::PseudoSingleButton: 133 case CSSSelector::PseudoSingleButton:
134 case CSSSelector::PseudoNoButton: 134 case CSSSelector::PseudoNoButton:
135 case CSSSelector::PseudoFullScreen: 135 case CSSSelector::PseudoFullScreen:
136 case CSSSelector::PseudoFullScreenDocument: 136 case CSSSelector::PseudoFullScreenDocument:
137 case CSSSelector::PseudoFullScreenAncestor: 137 case CSSSelector::PseudoFullScreenAncestor:
138 case CSSSelector::PseudoInRange: 138 case CSSSelector::PseudoInRange:
139 case CSSSelector::PseudoOutOfRange: 139 case CSSSelector::PseudoOutOfRange:
140 case CSSSelector::PseudoWebKitCustomElement: 140 case CSSSelector::PseudoWebKitCustomElement:
141 case CSSSelector::PseudoCue:
142 case CSSSelector::PseudoFutureCue:
143 case CSSSelector::PseudoPastCue:
141 case CSSSelector::PseudoUnresolved: 144 case CSSSelector::PseudoUnresolved:
142 case CSSSelector::PseudoContent: 145 case CSSSelector::PseudoContent:
143 case CSSSelector::PseudoHost: 146 case CSSSelector::PseudoHost:
144 case CSSSelector::PseudoShadow: 147 case CSSSelector::PseudoShadow:
145 case CSSSelector::PseudoListBox: 148 case CSSSelector::PseudoListBox:
146 return true; 149 return true;
147 case CSSSelector::PseudoNotParsed: 150 case CSSSelector::PseudoNotParsed:
148 case CSSSelector::PseudoUnknown: 151 case CSSSelector::PseudoUnknown:
149 case CSSSelector::PseudoLeftPage: 152 case CSSSelector::PseudoLeftPage:
150 case CSSSelector::PseudoRightPage: 153 case CSSSelector::PseudoRightPage:
(...skipping 13 matching lines...) Expand all
164 static bool requiresSubtreeInvalidation(const CSSSelector& selector) 167 static bool requiresSubtreeInvalidation(const CSSSelector& selector)
165 { 168 {
166 if (!selector.matchesPseudoElement() && selector.match() != CSSSelector::Pse udoClass) { 169 if (!selector.matchesPseudoElement() && selector.match() != CSSSelector::Pse udoClass) {
167 ASSERT(supportsInvalidation(selector.match())); 170 ASSERT(supportsInvalidation(selector.match()));
168 return false; 171 return false;
169 } 172 }
170 173
171 switch (selector.pseudoType()) { 174 switch (selector.pseudoType()) {
172 case CSSSelector::PseudoFirstLine: 175 case CSSSelector::PseudoFirstLine:
173 case CSSSelector::PseudoFirstLetter: 176 case CSSSelector::PseudoFirstLetter:
174 case CSSSelector::PseudoCue:
175 case CSSSelector::PseudoFutureCue:
176 case CSSSelector::PseudoPastCue:
177 case CSSSelector::PseudoSpatialNavigationFocus: 177 case CSSSelector::PseudoSpatialNavigationFocus:
178 // FIXME: Most pseudo classes/elements above can be supported and moved 178 // FIXME: Most pseudo classes/elements above can be supported and moved
179 // to assertSupportedPseudo(). Move on a case-by-case basis. If they 179 // to assertSupportedPseudo(). Move on a case-by-case basis. If they
180 // require subtree invalidation, document why. 180 // require subtree invalidation, document why.
181 case CSSSelector::PseudoHostContext: 181 case CSSSelector::PseudoHostContext:
182 // :host-context matches a shadow host, yet the simple selectors inside 182 // :host-context matches a shadow host, yet the simple selectors inside
183 // :host-context matches an ancestor of the shadow host. 183 // :host-context matches an ancestor of the shadow host.
184 return true; 184 return true;
185 default: 185 default:
186 ASSERT(supportsInvalidation(selector.pseudoType())); 186 ASSERT(supportsInvalidation(selector.pseudoType()));
(...skipping 22 matching lines...) Expand all
209 209
210 if (component->match() == CSSSelector::Class || component->match() == CS SSelector::Id 210 if (component->match() == CSSSelector::Class || component->match() == CS SSelector::Id
211 || (component->match() == CSSSelector::Tag && component->tagQName(). localName() != starAtom) 211 || (component->match() == CSSSelector::Tag && component->tagQName(). localName() != starAtom)
212 || component->isAttributeSelector() || component->isCustomPseudoElem ent()) { 212 || component->isAttributeSelector() || component->isCustomPseudoElem ent()) {
213 if (!foundCombinator) { 213 if (!foundCombinator) {
214 // We have found an invalidation set feature in the rightmost co mpound selector. 214 // We have found an invalidation set feature in the rightmost co mpound selector.
215 foundIdent = true; 215 foundIdent = true;
216 } 216 }
217 } else if (component->pseudoType() == CSSSelector::PseudoNot 217 } else if (component->pseudoType() == CSSSelector::PseudoNot
218 || component->pseudoType() == CSSSelector::PseudoHost 218 || component->pseudoType() == CSSSelector::PseudoHost
219 || component->pseudoType() == CSSSelector::PseudoAny) { 219 || component->pseudoType() == CSSSelector::PseudoAny
220 || component->pseudoType() == CSSSelector::PseudoCue) {
220 if (const CSSSelectorList* selectorList = component->selectorList()) { 221 if (const CSSSelectorList* selectorList = component->selectorList()) {
221 // Features inside :not() are not added to the feature set, so c onsider it a universal selector. 222 // Features inside :not() are not added to the feature set, so c onsider it a universal selector.
222 bool foundUniversal = component->pseudoType() == CSSSelector::Ps eudoNot; 223 bool foundUniversal = component->pseudoType() == CSSSelector::Ps eudoNot;
223 for (const CSSSelector* selector = selectorList->first(); select or; selector = CSSSelectorList::next(*selector)) { 224 for (const CSSSelector* selector = selectorList->first(); select or; selector = CSSSelectorList::next(*selector)) {
224 // Find the invalidation set mode for each of the selectors in the selector list 225 // Find the invalidation set mode for each of the selectors in the selector list
225 // of a :not(), :host(), etc. For instance, ".x :-webkit-any (.a, .b)" yields an 226 // of a :not(), :host(), etc. For instance, ".x :-webkit-any (.a, .b)" yields an
226 // AddFeatures mode for both ".a" and ".b". ":-webkit-any(.a , *)" yields AddFeatures 227 // AddFeatures mode for both ".a" and ".b". ":-webkit-any(.a , *)" yields AddFeatures
227 // for ".a", but UseSubtreeStyleChange for "*". One sub-sele ctor without invalidation 228 // for ".a", but UseSubtreeStyleChange for "*". One sub-sele ctor without invalidation
228 // set features is sufficient to cause the selector to be a universal selector as far 229 // set features is sufficient to cause the selector to be a universal selector as far
229 // the invalidation set is concerned. 230 // the invalidation set is concerned.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 return AddFeatures; 337 return AddFeatures;
337 } 338 }
338 339
339 const CSSSelector* RuleFeatureSet::extractInvalidationSetFeatures(const CSSSelec tor& selector, InvalidationSetFeatures& features, bool negated) 340 const CSSSelector* RuleFeatureSet::extractInvalidationSetFeatures(const CSSSelec tor& selector, InvalidationSetFeatures& features, bool negated)
340 { 341 {
341 for (const CSSSelector* current = &selector; current; current = current->tag History()) { 342 for (const CSSSelector* current = &selector; current; current = current->tag History()) {
342 if (!negated) 343 if (!negated)
343 extractInvalidationSetFeature(*current, features); 344 extractInvalidationSetFeature(*current, features);
344 // Initialize the entry in the invalidation set map, if supported. 345 // Initialize the entry in the invalidation set map, if supported.
345 invalidationSetForSelector(*current); 346 invalidationSetForSelector(*current);
346 if (current->pseudoType() == CSSSelector::PseudoHost || current->pseudoT ype() == CSSSelector::PseudoAny || current->pseudoType() == CSSSelector::PseudoN ot) { 347 if (current->pseudoType() == CSSSelector::PseudoHost || current->pseudoT ype() == CSSSelector::PseudoAny || current->pseudoType() == CSSSelector::PseudoN ot || current->pseudoType() == CSSSelector::PseudoCue) {
347 if (const CSSSelectorList* selectorList = current->selectorList()) { 348 if (const CSSSelectorList* selectorList = current->selectorList()) {
348 for (const CSSSelector* selector = selectorList->first(); select or; selector = CSSSelectorList::next(*selector)) 349 for (const CSSSelector* selector = selectorList->first(); select or; selector = CSSSelectorList::next(*selector))
349 extractInvalidationSetFeatures(*selector, features, current- >pseudoType() == CSSSelector::PseudoNot); 350 extractInvalidationSetFeatures(*selector, features, current- >pseudoType() == CSSSelector::PseudoNot);
350 } 351 }
351 } 352 }
352 353
353 if (current->relation() == CSSSelector::SubSelector) 354 if (current->relation() == CSSSelector::SubSelector)
354 continue; 355 continue;
355 356
356 features.treeBoundaryCrossing = current->isShadowSelector(); 357 features.treeBoundaryCrossing = current->isShadowSelector();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 { 399 {
399 for (const CSSSelector* current = &selector; current; current = current->tag History()) { 400 for (const CSSSelector* current = &selector; current; current = current->tag History()) {
400 if (DescendantInvalidationSet* invalidationSet = invalidationSetForSelec tor(*current)) { 401 if (DescendantInvalidationSet* invalidationSet = invalidationSetForSelec tor(*current)) {
401 addFeaturesToInvalidationSet(*invalidationSet, features); 402 addFeaturesToInvalidationSet(*invalidationSet, features);
402 } else { 403 } else {
403 if (current->isTreeBoundaryCrossing()) 404 if (current->isTreeBoundaryCrossing())
404 features.treeBoundaryCrossing = true; 405 features.treeBoundaryCrossing = true;
405 if (current->isInsertionPointCrossing()) 406 if (current->isInsertionPointCrossing())
406 features.insertionPointCrossing = true; 407 features.insertionPointCrossing = true;
407 if (const CSSSelectorList* selectorList = current->selectorList()) { 408 if (const CSSSelectorList* selectorList = current->selectorList()) {
408 ASSERT(current->pseudoType() == CSSSelector::PseudoHost || curre nt->pseudoType() == CSSSelector::PseudoAny || current->pseudoType() == CSSSelect or::PseudoNot); 409 ASSERT(current->pseudoType() == CSSSelector::PseudoHost || curre nt->pseudoType() == CSSSelector::PseudoAny || current->pseudoType() == CSSSelect or::PseudoNot || current->pseudoType() == CSSSelector::PseudoCue);
chrishtr 2014/11/12 21:36:42 This code is repeated 3 times at line 219, 347 and
409 for (const CSSSelector* selector = selectorList->first(); select or; selector = CSSSelectorList::next(*selector)) 410 for (const CSSSelector* selector = selectorList->first(); select or; selector = CSSSelectorList::next(*selector))
410 addFeaturesToInvalidationSets(*selector, features); 411 addFeaturesToInvalidationSets(*selector, features);
411 } 412 }
412 } 413 }
413 414
414 if (current->relation() == CSSSelector::SubSelector) 415 if (current->relation() == CSSSelector::SubSelector)
415 continue; 416 continue;
416 417
417 if (current->isShadowSelector()) 418 if (current->isShadowSelector())
418 features.treeBoundaryCrossing = true; 419 features.treeBoundaryCrossing = true;
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 visitor->trace(uncommonAttributeRules); 653 visitor->trace(uncommonAttributeRules);
653 visitor->trace(m_classInvalidationSets); 654 visitor->trace(m_classInvalidationSets);
654 visitor->trace(m_attributeInvalidationSets); 655 visitor->trace(m_attributeInvalidationSets);
655 visitor->trace(m_idInvalidationSets); 656 visitor->trace(m_idInvalidationSets);
656 visitor->trace(m_pseudoInvalidationSets); 657 visitor->trace(m_pseudoInvalidationSets);
657 visitor->trace(m_styleInvalidator); 658 visitor->trace(m_styleInvalidator);
658 #endif 659 #endif
659 } 660 }
660 661
661 } // namespace blink 662 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/media/track/cue-style-invalidation-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698