| 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. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. |
| 6 * All rights reserved. | 6 * All rights reserved. |
| 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 10 * (http://www.torchmobile.com/) | 10 * (http://www.torchmobile.com/) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 m_matchingUARules(false), | 62 m_matchingUARules(false), |
| 63 m_includeEmptyRules(false) {} | 63 m_includeEmptyRules(false) {} |
| 64 | 64 |
| 65 ElementRuleCollector::~ElementRuleCollector() {} | 65 ElementRuleCollector::~ElementRuleCollector() {} |
| 66 | 66 |
| 67 const MatchResult& ElementRuleCollector::matchedResult() const { | 67 const MatchResult& ElementRuleCollector::matchedResult() const { |
| 68 return m_result; | 68 return m_result; |
| 69 } | 69 } |
| 70 | 70 |
| 71 StyleRuleList* ElementRuleCollector::matchedStyleRuleList() { | 71 StyleRuleList* ElementRuleCollector::matchedStyleRuleList() { |
| 72 ASSERT(m_mode == SelectorChecker::CollectingStyleRules); | 72 DCHECK_EQ(m_mode, SelectorChecker::CollectingStyleRules); |
| 73 return m_styleRuleList.release(); | 73 return m_styleRuleList.release(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 CSSRuleList* ElementRuleCollector::matchedCSSRuleList() { | 76 CSSRuleList* ElementRuleCollector::matchedCSSRuleList() { |
| 77 ASSERT(m_mode == SelectorChecker::CollectingCSSRules); | 77 DCHECK_EQ(m_mode, SelectorChecker::CollectingCSSRules); |
| 78 return m_cssRuleList.release(); | 78 return m_cssRuleList.release(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void ElementRuleCollector::clearMatchedRules() { | 81 void ElementRuleCollector::clearMatchedRules() { |
| 82 m_matchedRules.clear(); | 82 m_matchedRules.clear(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 inline StyleRuleList* ElementRuleCollector::ensureStyleRuleList() { | 85 inline StyleRuleList* ElementRuleCollector::ensureStyleRuleList() { |
| 86 if (!m_styleRuleList) | 86 if (!m_styleRuleList) |
| 87 m_styleRuleList = new StyleRuleList(); | 87 m_styleRuleList = new StyleRuleList(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 INCREMENT_STYLE_STATS_COUNTER(styleEngine, rulesRejected, rejected); | 179 INCREMENT_STYLE_STATS_COUNTER(styleEngine, rulesRejected, rejected); |
| 180 INCREMENT_STYLE_STATS_COUNTER(styleEngine, rulesFastRejected, fastRejected); | 180 INCREMENT_STYLE_STATS_COUNTER(styleEngine, rulesFastRejected, fastRejected); |
| 181 INCREMENT_STYLE_STATS_COUNTER(styleEngine, rulesMatched, matched); | 181 INCREMENT_STYLE_STATS_COUNTER(styleEngine, rulesMatched, matched); |
| 182 } | 182 } |
| 183 | 183 |
| 184 DISABLE_CFI_PERF | 184 DISABLE_CFI_PERF |
| 185 void ElementRuleCollector::collectMatchingRules( | 185 void ElementRuleCollector::collectMatchingRules( |
| 186 const MatchRequest& matchRequest, | 186 const MatchRequest& matchRequest, |
| 187 CascadeOrder cascadeOrder, | 187 CascadeOrder cascadeOrder, |
| 188 bool matchingTreeBoundaryRules) { | 188 bool matchingTreeBoundaryRules) { |
| 189 ASSERT(matchRequest.ruleSet); | 189 DCHECK(matchRequest.ruleSet); |
| 190 ASSERT(m_context.element()); | 190 DCHECK(m_context.element()); |
| 191 | 191 |
| 192 Element& element = *m_context.element(); | 192 Element& element = *m_context.element(); |
| 193 const AtomicString& pseudoId = element.shadowPseudoId(); | 193 const AtomicString& pseudoId = element.shadowPseudoId(); |
| 194 if (!pseudoId.isEmpty()) { | 194 if (!pseudoId.isEmpty()) { |
| 195 ASSERT(element.isStyledElement()); | 195 DCHECK(element.isStyledElement()); |
| 196 collectMatchingRulesForList( | 196 collectMatchingRulesForList( |
| 197 matchRequest.ruleSet->shadowPseudoElementRules(pseudoId), cascadeOrder, | 197 matchRequest.ruleSet->shadowPseudoElementRules(pseudoId), cascadeOrder, |
| 198 matchRequest); | 198 matchRequest); |
| 199 if (pseudoId == "-webkit-input-placeholder") { | 199 if (pseudoId == "-webkit-input-placeholder") { |
| 200 collectMatchingRulesForList( | 200 collectMatchingRulesForList( |
| 201 matchRequest.ruleSet->placeholderPseudoRules(), cascadeOrder, | 201 matchRequest.ruleSet->placeholderPseudoRules(), cascadeOrder, |
| 202 matchRequest); | 202 matchRequest); |
| 203 } | 203 } |
| 204 } | 204 } |
| 205 | 205 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 StyleRule* rule) { | 278 StyleRule* rule) { |
| 279 // |parentStyleSheet| is 0 if and only if the |rule| is coming from User | 279 // |parentStyleSheet| is 0 if and only if the |rule| is coming from User |
| 280 // Agent. In this case, it is safe to create CSSOM wrappers without | 280 // Agent. In this case, it is safe to create CSSOM wrappers without |
| 281 // parentStyleSheets as they will be used only by inspector which will not try | 281 // parentStyleSheets as they will be used only by inspector which will not try |
| 282 // to edit them. | 282 // to edit them. |
| 283 CSSRule* cssRule = nullptr; | 283 CSSRule* cssRule = nullptr; |
| 284 if (parentStyleSheet) | 284 if (parentStyleSheet) |
| 285 cssRule = findStyleRule(parentStyleSheet, rule); | 285 cssRule = findStyleRule(parentStyleSheet, rule); |
| 286 else | 286 else |
| 287 cssRule = rule->createCSSOMWrapper(); | 287 cssRule = rule->createCSSOMWrapper(); |
| 288 ASSERT(!parentStyleSheet || cssRule); | 288 DCHECK(!parentStyleSheet || cssRule); |
| 289 ensureRuleList()->rules().push_back(cssRule); | 289 ensureRuleList()->rules().push_back(cssRule); |
| 290 } | 290 } |
| 291 | 291 |
| 292 void ElementRuleCollector::sortAndTransferMatchedRules() { | 292 void ElementRuleCollector::sortAndTransferMatchedRules() { |
| 293 if (m_matchedRules.isEmpty()) | 293 if (m_matchedRules.isEmpty()) |
| 294 return; | 294 return; |
| 295 | 295 |
| 296 sortMatchedRules(); | 296 sortMatchedRules(); |
| 297 | 297 |
| 298 if (m_mode == SelectorChecker::CollectingStyleRules) { | 298 if (m_mode == SelectorChecker::CollectingStyleRules) { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 | 378 |
| 379 void ElementRuleCollector::addMatchedRulesToTracker( | 379 void ElementRuleCollector::addMatchedRulesToTracker( |
| 380 StyleRuleUsageTracker* tracker) const { | 380 StyleRuleUsageTracker* tracker) const { |
| 381 for (auto matchedRule : m_matchedRules) { | 381 for (auto matchedRule : m_matchedRules) { |
| 382 tracker->track(matchedRule.parentStyleSheet(), | 382 tracker->track(matchedRule.parentStyleSheet(), |
| 383 matchedRule.ruleData()->rule()); | 383 matchedRule.ruleData()->rule()); |
| 384 } | 384 } |
| 385 } | 385 } |
| 386 | 386 |
| 387 } // namespace blink | 387 } // namespace blink |
| OLD | NEW |