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

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

Issue 129633003: Add a first pass of a class descendant invalidator, and a containing RuleSetAnalyzer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removed extra line. Created 6 years, 11 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) 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 return; 62 return;
63 63
64 for (const CSSSelector* selector = selectorList->first(); selector; selector = CSSSelectorList::next(selector)) { 64 for (const CSSSelector* selector = selectorList->first(); selector; selector = CSSSelectorList::next(selector)) {
65 for (const CSSSelector* subSelector = selector; subSelector; subSelector = subSelector->tagHistory()) 65 for (const CSSSelector* subSelector = selector; subSelector; subSelector = subSelector->tagHistory())
66 collectFeaturesFromSelector(subSelector); 66 collectFeaturesFromSelector(subSelector);
67 } 67 }
68 } 68 }
69 69
70 void RuleFeatureSet::add(const RuleFeatureSet& other) 70 void RuleFeatureSet::add(const RuleFeatureSet& other)
71 { 71 {
72 if (other.getRuleSetAnalyzer())
esprehn 2014/01/14 21:32:56 if (RuleSetAnalyzer* analyzer = ...) analyzer->.
chrishtr 2014/01/14 23:33:00 Done.
73 ensureRuleSetAnalyzer()->combine(*other.getRuleSetAnalyzer());
74
72 HashSet<AtomicString>::const_iterator end = other.idsInRules.end(); 75 HashSet<AtomicString>::const_iterator end = other.idsInRules.end();
73 for (HashSet<AtomicString>::const_iterator it = other.idsInRules.begin(); it != end; ++it) 76 for (HashSet<AtomicString>::const_iterator it = other.idsInRules.begin(); it != end; ++it)
74 idsInRules.add(*it); 77 idsInRules.add(*it);
75 end = other.classesInRules.end(); 78 end = other.classesInRules.end();
76 for (HashSet<AtomicString>::const_iterator it = other.classesInRules.begin() ; it != end; ++it) 79 for (HashSet<AtomicString>::const_iterator it = other.classesInRules.begin() ; it != end; ++it)
77 classesInRules.add(*it); 80 classesInRules.add(*it);
78 end = other.attrsInRules.end(); 81 end = other.attrsInRules.end();
79 for (HashSet<AtomicString>::const_iterator it = other.attrsInRules.begin(); it != end; ++it) 82 for (HashSet<AtomicString>::const_iterator it = other.attrsInRules.begin(); it != end; ++it)
80 attrsInRules.add(*it); 83 attrsInRules.add(*it);
81 siblingRules.append(other.siblingRules); 84 siblingRules.append(other.siblingRules);
82 uncommonAttributeRules.append(other.uncommonAttributeRules); 85 uncommonAttributeRules.append(other.uncommonAttributeRules);
83 m_usesFirstLineRules = m_usesFirstLineRules || other.m_usesFirstLineRules; 86 m_usesFirstLineRules = m_usesFirstLineRules || other.m_usesFirstLineRules;
84 m_maxDirectAdjacentSelectors = std::max(m_maxDirectAdjacentSelectors, other. maxDirectAdjacentSelectors()); 87 m_maxDirectAdjacentSelectors = std::max(m_maxDirectAdjacentSelectors, other. maxDirectAdjacentSelectors());
85 } 88 }
86 89
87 void RuleFeatureSet::clear() 90 void RuleFeatureSet::clear()
88 { 91 {
89 idsInRules.clear(); 92 idsInRules.clear();
90 classesInRules.clear(); 93 classesInRules.clear();
91 attrsInRules.clear(); 94 attrsInRules.clear();
92 siblingRules.clear(); 95 siblingRules.clear();
93 uncommonAttributeRules.clear(); 96 uncommonAttributeRules.clear();
94 m_usesFirstLineRules = false; 97 m_usesFirstLineRules = false;
95 m_maxDirectAdjacentSelectors = 0; 98 m_maxDirectAdjacentSelectors = 0;
96 } 99 }
97 100
101 const RuleSetAnalyzer* RuleFeatureSet::getRuleSetAnalyzer() const
102 {
103 return ruleSetAnalyzer.get();
104 }
105
106 RuleSetAnalyzer* RuleFeatureSet::ensureRuleSetAnalyzer()
107 {
108 if (!ruleSetAnalyzer)
109 ruleSetAnalyzer = RuleSetAnalyzer::create();
110 return ruleSetAnalyzer.get();
111 }
112
98 } // namespace WebCore 113 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698