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

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

Issue 322803004: Make all CSSSelector data members private (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix win dbg build error Created 6 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2012 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 analyzeStyleSheet(sheets[i]); 44 analyzeStyleSheet(sheets[i]);
45 } 45 }
46 46
47 static bool determineSelectorScopes(const CSSSelectorList& selectorList, HashSet <StringImpl*>& idScopes, HashSet<StringImpl*>& classScopes) 47 static bool determineSelectorScopes(const CSSSelectorList& selectorList, HashSet <StringImpl*>& idScopes, HashSet<StringImpl*>& classScopes)
48 { 48 {
49 for (const CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(*selector)) { 49 for (const CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(*selector)) {
50 const CSSSelector* scopeSelector = 0; 50 const CSSSelector* scopeSelector = 0;
51 // This picks the widest scope, not the narrowest, to minimize the numbe r of found scopes. 51 // This picks the widest scope, not the narrowest, to minimize the numbe r of found scopes.
52 for (const CSSSelector* current = selector; current; current = current-> tagHistory()) { 52 for (const CSSSelector* current = selector; current; current = current-> tagHistory()) {
53 // Prefer ids over classes. 53 // Prefer ids over classes.
54 if (current->m_match == CSSSelector::Id) 54 if (current->match() == CSSSelector::Id)
55 scopeSelector = current; 55 scopeSelector = current;
56 else if (current->m_match == CSSSelector::Class && (!scopeSelector | | scopeSelector->m_match != CSSSelector::Id)) 56 else if (current->match() == CSSSelector::Class && (!scopeSelector | | scopeSelector->match() != CSSSelector::Id))
57 scopeSelector = current; 57 scopeSelector = current;
58 CSSSelector::Relation relation = current->relation(); 58 CSSSelector::Relation relation = current->relation();
59 // FIXME: it would be better to use setNeedsStyleRecalc for all shad ow hosts matching 59 // FIXME: it would be better to use setNeedsStyleRecalc for all shad ow hosts matching
60 // scopeSelector. Currently requests full style recalc. 60 // scopeSelector. Currently requests full style recalc.
61 if (relation == CSSSelector::ShadowDeep || relation == CSSSelector:: ShadowPseudo) 61 if (relation == CSSSelector::ShadowDeep || relation == CSSSelector:: ShadowPseudo)
62 return false; 62 return false;
63 if (relation != CSSSelector::Descendant && relation != CSSSelector:: Child && relation != CSSSelector::SubSelector) 63 if (relation != CSSSelector::Descendant && relation != CSSSelector:: Child && relation != CSSSelector::SubSelector)
64 break; 64 break;
65 } 65 }
66 if (!scopeSelector) 66 if (!scopeSelector)
67 return false; 67 return false;
68 ASSERT(scopeSelector->m_match == CSSSelector::Class || scopeSelector->m_ match == CSSSelector::Id); 68 ASSERT(scopeSelector->match() == CSSSelector::Class || scopeSelector->ma tch() == CSSSelector::Id);
69 if (scopeSelector->m_match == CSSSelector::Id) 69 if (scopeSelector->match() == CSSSelector::Id)
70 idScopes.add(scopeSelector->value().impl()); 70 idScopes.add(scopeSelector->value().impl());
71 else 71 else
72 classScopes.add(scopeSelector->value().impl()); 72 classScopes.add(scopeSelector->value().impl());
73 } 73 }
74 return true; 74 return true;
75 } 75 }
76 76
77 static bool hasDistributedRule(StyleSheetContents* styleSheetContents) 77 static bool hasDistributedRule(StyleSheetContents* styleSheetContents)
78 { 78 {
79 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase> >& rules = styleShe etContents->childRules(); 79 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase> >& rules = styleShe etContents->childRules();
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 element->setNeedsStyleRecalc(SubtreeStyleChange); 212 element->setNeedsStyleRecalc(SubtreeStyleChange);
213 // The whole subtree is now invalidated, we can skip to the next sib ling. 213 // The whole subtree is now invalidated, we can skip to the next sib ling.
214 element = ElementTraversal::nextSkippingChildren(*element); 214 element = ElementTraversal::nextSkippingChildren(*element);
215 continue; 215 continue;
216 } 216 }
217 element = ElementTraversal::next(*element); 217 element = ElementTraversal::next(*element);
218 } 218 }
219 } 219 }
220 220
221 } 221 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698