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

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

Issue 221643002: Only support AddFeatures invalidation set mode for :host or :any in a rightmost selector (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix compilation. Created 6 years, 8 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 | Annotate | Revision Log
« Source/core/css/RuleFeature.h ('K') | « Source/core/css/RuleFeature.h ('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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 case CSSSelector::PseudoInRange: 96 case CSSSelector::PseudoInRange:
97 case CSSSelector::PseudoOutOfRange: 97 case CSSSelector::PseudoOutOfRange:
98 case CSSSelector::PseudoUnresolved: 98 case CSSSelector::PseudoUnresolved:
99 return true; 99 return true;
100 default: 100 default:
101 return false; 101 return false;
102 } 102 }
103 } 103 }
104 104
105 // This method is somewhat conservative in what it accepts. 105 // This method is somewhat conservative in what it accepts.
106 RuleFeatureSet::InvalidationSetMode RuleFeatureSet::supportsClassDescendantInval idation(const CSSSelector& selector) 106 RuleFeatureSet::InvalidationSetMode RuleFeatureSet::getInvalidationSetMode(const CSSSelector& selector)
107 { 107 {
108 bool foundDescendantRelation = false; 108 bool foundDescendantRelation = false;
109 bool foundIdent = false; 109 bool foundIdent = false;
110 for (const CSSSelector* component = &selector; component; component = compon ent->tagHistory()) { 110 for (const CSSSelector* component = &selector; component; component = compon ent->tagHistory()) {
111 111
112 // FIXME: next up: Tag and Id. 112 // FIXME: next up: Tag and Id.
113 if (component->m_match == CSSSelector::Class || component->isAttributeSe lector()) { 113 if (component->m_match == CSSSelector::Class || component->isAttributeSe lector()) {
114 if (!foundDescendantRelation) 114 if (!foundDescendantRelation)
115 foundIdent = true; 115 foundIdent = true;
116 } else if (component->pseudoType() == CSSSelector::PseudoHost || compone nt->pseudoType() == CSSSelector::PseudoAny) { 116 } else if (component->pseudoType() == CSSSelector::PseudoHost || compone nt->pseudoType() == CSSSelector::PseudoAny) {
117 if (const CSSSelectorList* selectorList = component->selectorList()) { 117 if (const CSSSelectorList* selectorList = component->selectorList()) {
118 for (const CSSSelector* selector = selectorList->first(); select or; selector = CSSSelectorList::next(*selector)) { 118 for (const CSSSelector* selector = selectorList->first(); select or; selector = CSSSelectorList::next(*selector)) {
119 InvalidationSetMode hostMode = supportsClassDescendantInvali dation(*selector); 119 InvalidationSetMode hostMode = getInvalidationSetMode(*selec tor);
120 if (hostMode == UseSubtreeStyleChange) 120 if (hostMode == UseSubtreeStyleChange)
121 return foundDescendantRelation ? UseLocalStyleChange : U seSubtreeStyleChange; 121 return foundDescendantRelation ? UseLocalStyleChange : U seSubtreeStyleChange;
122 if (hostMode == AddFeatures) 122 if (!foundDescendantRelation && hostMode == AddFeatures)
123 foundIdent = true; 123 foundIdent = true;
124 } 124 }
125 } 125 }
126 } else if (!isSkippableComponentForInvalidation(*component)) { 126 } else if (!isSkippableComponentForInvalidation(*component)) {
127 return foundDescendantRelation ? UseLocalStyleChange : UseSubtreeSty leChange; 127 return foundDescendantRelation ? UseLocalStyleChange : UseSubtreeSty leChange;
128 } 128 }
129 switch (component->relation()) { 129 switch (component->relation()) {
130 case CSSSelector::Descendant: 130 case CSSSelector::Descendant:
131 case CSSSelector::Child: 131 case CSSSelector::Child:
132 case CSSSelector::ShadowPseudo: 132 case CSSSelector::ShadowPseudo:
(...skipping 30 matching lines...) Expand all
163 { 163 {
164 if (selector.m_match == CSSSelector::Class) 164 if (selector.m_match == CSSSelector::Class)
165 return &ensureClassInvalidationSet(selector.value()); 165 return &ensureClassInvalidationSet(selector.value());
166 if (selector.isAttributeSelector()) 166 if (selector.isAttributeSelector())
167 return &ensureAttributeInvalidationSet(selector.attribute().localName()) ; 167 return &ensureAttributeInvalidationSet(selector.attribute().localName()) ;
168 return 0; 168 return 0;
169 } 169 }
170 170
171 RuleFeatureSet::InvalidationSetMode RuleFeatureSet::updateInvalidationSets(const CSSSelector& selector) 171 RuleFeatureSet::InvalidationSetMode RuleFeatureSet::updateInvalidationSets(const CSSSelector& selector)
172 { 172 {
173 InvalidationSetMode mode = supportsClassDescendantInvalidation(selector); 173 InvalidationSetMode mode = getInvalidationSetMode(selector);
174 if (mode != AddFeatures) 174 if (mode != AddFeatures)
175 return mode; 175 return mode;
176 176
177 InvalidationSetFeatures features; 177 InvalidationSetFeatures features;
178 const CSSSelector* current = extractInvalidationSetFeatures(selector, featur es); 178 const CSSSelector* current = extractInvalidationSetFeatures(selector, featur es);
179 if (current) 179 if (current)
180 current = current->tagHistory(); 180 current = current->tagHistory();
181 181
182 if (current) 182 if (current)
183 addFeaturesToInvalidationSets(*current, features); 183 addFeaturesToInvalidationSets(*current, features);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 if (RefPtr<DescendantInvalidationSet> invalidationSet = m_classInvalidationS ets.get(className)) 403 if (RefPtr<DescendantInvalidationSet> invalidationSet = m_classInvalidationS ets.get(className))
404 m_styleInvalidator.scheduleInvalidation(invalidationSet, element); 404 m_styleInvalidator.scheduleInvalidation(invalidationSet, element);
405 } 405 }
406 406
407 StyleInvalidator& RuleFeatureSet::styleInvalidator() 407 StyleInvalidator& RuleFeatureSet::styleInvalidator()
408 { 408 {
409 return m_styleInvalidator; 409 return m_styleInvalidator;
410 } 410 }
411 411
412 } // namespace WebCore 412 } // namespace WebCore
OLDNEW
« Source/core/css/RuleFeature.h ('K') | « Source/core/css/RuleFeature.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698