Chromium Code Reviews| Index: Source/core/css/ElementRuleCollector.cpp |
| diff --git a/Source/core/css/ElementRuleCollector.cpp b/Source/core/css/ElementRuleCollector.cpp |
| index d7c7a0e596bc0ab06ef9ca89b5d1db75176712e3..0c739f4724a1fd4725f0785e860c90f706745713 100644 |
| --- a/Source/core/css/ElementRuleCollector.cpp |
| +++ b/Source/core/css/ElementRuleCollector.cpp |
| @@ -81,16 +81,12 @@ PassRefPtrWillBeRawPtr<CSSRuleList> ElementRuleCollector::matchedCSSRuleList() |
| inline void ElementRuleCollector::addMatchedRule(const RuleData* rule, unsigned specificity, CascadeScope cascadeScope, CascadeOrder cascadeOrder, unsigned styleSheetIndex, const CSSStyleSheet* parentStyleSheet) |
| { |
| - if (!m_matchedRules) |
| - m_matchedRules = adoptPtrWillBeNoop(new WillBeHeapVector<MatchedRule, 32>); |
| - m_matchedRules->append(MatchedRule(rule, specificity, cascadeScope, cascadeOrder, styleSheetIndex, parentStyleSheet)); |
| + m_matchedRules.append(MatchedRule(rule, specificity, cascadeScope, cascadeOrder, styleSheetIndex, parentStyleSheet)); |
| } |
| void ElementRuleCollector::clearMatchedRules() |
| { |
| - if (!m_matchedRules) |
| - return; |
| - m_matchedRules->clear(); |
| + m_matchedRules.clear(); |
| } |
| inline StyleRuleList* ElementRuleCollector::ensureStyleRuleList() |
| @@ -227,12 +223,12 @@ void ElementRuleCollector::appendCSSOMWrapperForRule(CSSStyleSheet* parentStyleS |
| void ElementRuleCollector::sortAndTransferMatchedRules() |
| { |
| - if (!m_matchedRules || m_matchedRules->isEmpty()) |
| + if (m_matchedRules.isEmpty()) |
| return; |
| sortMatchedRules(); |
| - WillBeHeapVector<MatchedRule, 32>& matchedRules = *m_matchedRules; |
| + WillBeHeapVector<MatchedRule, 32>& matchedRules = m_matchedRules; |
|
rune
2014/12/12 07:10:35
Is it really necessary to have a new reference her
sof
2014/12/12 07:13:23
Yes, we can simplify this away now. Will do.
|
| if (m_mode == SelectorChecker::CollectingStyleRules) { |
| for (unsigned i = 0; i < matchedRules.size(); ++i) |
| ensureStyleRuleList()->m_list.append(matchedRules[i].ruleData()->rule()); |
| @@ -330,8 +326,7 @@ static inline bool compareRules(const MatchedRule& matchedRule1, const MatchedRu |
| void ElementRuleCollector::sortMatchedRules() |
| { |
| - ASSERT(m_matchedRules); |
| - std::sort(m_matchedRules->begin(), m_matchedRules->end(), compareRules); |
| + std::sort(m_matchedRules.begin(), m_matchedRules.end(), compareRules); |
| } |
| bool ElementRuleCollector::hasAnyMatchingRules(RuleSet* ruleSet) |
| @@ -347,7 +342,7 @@ bool ElementRuleCollector::hasAnyMatchingRules(RuleSet* ruleSet) |
| // FIXME: Verify whether it's ok to ignore CascadeScope here. |
| collectMatchingRules(MatchRequest(ruleSet), ruleRange); |
| - return m_matchedRules && !m_matchedRules->isEmpty(); |
| + return !m_matchedRules.isEmpty(); |
| } |
| } // namespace blink |