OLD | NEW |
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, 2013 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 PassRefPtrWillBeRawPtr<CSSRuleList> ElementRuleCollector::matchedCSSRuleList() | 75 PassRefPtrWillBeRawPtr<CSSRuleList> ElementRuleCollector::matchedCSSRuleList() |
76 { | 76 { |
77 ASSERT(m_mode == SelectorChecker::CollectingCSSRules); | 77 ASSERT(m_mode == SelectorChecker::CollectingCSSRules); |
78 return m_cssRuleList.release(); | 78 return m_cssRuleList.release(); |
79 } | 79 } |
80 | 80 |
81 inline void ElementRuleCollector::addMatchedRule(const RuleData* rule, unsigned
specificity, CascadeScope cascadeScope, CascadeOrder cascadeOrder, unsigned styl
eSheetIndex, const CSSStyleSheet* parentStyleSheet) | 81 inline void ElementRuleCollector::addMatchedRule(const RuleData* rule, unsigned
specificity, CascadeScope cascadeScope, CascadeOrder cascadeOrder, unsigned styl
eSheetIndex, const CSSStyleSheet* parentStyleSheet) |
82 { | 82 { |
83 if (!m_matchedRules) | 83 if (!m_matchedRules) |
84 m_matchedRules = adoptPtr(new Vector<MatchedRule, 32>); | 84 m_matchedRules = adoptPtrWillBeNoop(new WillBeHeapVector<MatchedRule, 32
>); |
85 m_matchedRules->append(MatchedRule(rule, specificity, cascadeScope, cascadeO
rder, styleSheetIndex, parentStyleSheet)); | 85 m_matchedRules->append(MatchedRule(rule, specificity, cascadeScope, cascadeO
rder, styleSheetIndex, parentStyleSheet)); |
86 } | 86 } |
87 | 87 |
88 void ElementRuleCollector::clearMatchedRules() | 88 void ElementRuleCollector::clearMatchedRules() |
89 { | 89 { |
90 if (!m_matchedRules) | 90 if (!m_matchedRules) |
91 return; | 91 return; |
92 m_matchedRules->clear(); | 92 m_matchedRules->clear(); |
93 } | 93 } |
94 | 94 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 ensureRuleList()->rules().append(cssRule); | 227 ensureRuleList()->rules().append(cssRule); |
228 } | 228 } |
229 | 229 |
230 void ElementRuleCollector::sortAndTransferMatchedRules() | 230 void ElementRuleCollector::sortAndTransferMatchedRules() |
231 { | 231 { |
232 if (!m_matchedRules || m_matchedRules->isEmpty()) | 232 if (!m_matchedRules || m_matchedRules->isEmpty()) |
233 return; | 233 return; |
234 | 234 |
235 sortMatchedRules(); | 235 sortMatchedRules(); |
236 | 236 |
237 Vector<MatchedRule, 32>& matchedRules = *m_matchedRules; | 237 WillBeHeapVector<MatchedRule, 32>& matchedRules = *m_matchedRules; |
238 if (m_mode == SelectorChecker::CollectingStyleRules) { | 238 if (m_mode == SelectorChecker::CollectingStyleRules) { |
239 for (unsigned i = 0; i < matchedRules.size(); ++i) | 239 for (unsigned i = 0; i < matchedRules.size(); ++i) |
240 ensureStyleRuleList()->m_list.append(matchedRules[i].ruleData()->rul
e()); | 240 ensureStyleRuleList()->m_list.append(matchedRules[i].ruleData()->rul
e()); |
241 return; | 241 return; |
242 } | 242 } |
243 | 243 |
244 if (m_mode == SelectorChecker::CollectingCSSRules) { | 244 if (m_mode == SelectorChecker::CollectingCSSRules) { |
245 for (unsigned i = 0; i < matchedRules.size(); ++i) | 245 for (unsigned i = 0; i < matchedRules.size(); ++i) |
246 appendCSSOMWrapperForRule(const_cast<CSSStyleSheet*>(matchedRules[i]
.parentStyleSheet()), matchedRules[i].ruleData()->rule()); | 246 appendCSSOMWrapperForRule(const_cast<CSSStyleSheet*>(matchedRules[i]
.parentStyleSheet()), matchedRules[i].ruleData()->rule()); |
247 return; | 247 return; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 // information about "scope". | 365 // information about "scope". |
366 int firstRuleIndex = -1, lastRuleIndex = -1; | 366 int firstRuleIndex = -1, lastRuleIndex = -1; |
367 RuleRange ruleRange(firstRuleIndex, lastRuleIndex); | 367 RuleRange ruleRange(firstRuleIndex, lastRuleIndex); |
368 // FIXME: Verify whether it's ok to ignore CascadeScope here. | 368 // FIXME: Verify whether it's ok to ignore CascadeScope here. |
369 collectMatchingRules(MatchRequest(ruleSet), ruleRange, SelectorChecker::Stay
sWithinTreeScope); | 369 collectMatchingRules(MatchRequest(ruleSet), ruleRange, SelectorChecker::Stay
sWithinTreeScope); |
370 | 370 |
371 return m_matchedRules && !m_matchedRules->isEmpty(); | 371 return m_matchedRules && !m_matchedRules->isEmpty(); |
372 } | 372 } |
373 | 373 |
374 } // namespace WebCore | 374 } // namespace WebCore |
OLD | NEW |