| 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 if (ruleRange.firstRuleIndex == -1) | 329 if (ruleRange.firstRuleIndex == -1) |
| 330 ruleRange.firstRuleIndex = ruleRange.lastRuleIndex; | 330 ruleRange.firstRuleIndex = ruleRange.lastRuleIndex; |
| 331 | 331 |
| 332 // Add this rule to our list of matched rules. | 332 // Add this rule to our list of matched rules. |
| 333 addMatchedRule(&ruleData, result.specificity, cascadeScope, cascadeO
rder, matchRequest.styleSheetIndex, matchRequest.styleSheet); | 333 addMatchedRule(&ruleData, result.specificity, cascadeScope, cascadeO
rder, matchRequest.styleSheetIndex, matchRequest.styleSheet); |
| 334 return; | 334 return; |
| 335 } | 335 } |
| 336 } | 336 } |
| 337 } | 337 } |
| 338 | 338 |
| 339 void ElementRuleCollector::collectMatchingRulesForList(const RuleData* rules, Se
lectorChecker::BehaviorAtBoundary behaviorAtBoundary, CascadeScope cascadeScope,
CascadeOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRan
ge) | |
| 340 { | |
| 341 if (!rules) | |
| 342 return; | |
| 343 while (!rules->isLastInArray()) | |
| 344 collectRuleIfMatches(*rules++, behaviorAtBoundary, cascadeScope, cascade
Order, matchRequest, ruleRange); | |
| 345 collectRuleIfMatches(*rules, behaviorAtBoundary, cascadeScope, cascadeOrder,
matchRequest, ruleRange); | |
| 346 } | |
| 347 | |
| 348 void ElementRuleCollector::collectMatchingRulesForList(const Vector<RuleData>* r
ules, SelectorChecker::BehaviorAtBoundary behaviorAtBoundary, CascadeScope casca
deScope, CascadeOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange&
ruleRange) | |
| 349 { | |
| 350 if (!rules) | |
| 351 return; | |
| 352 unsigned size = rules->size(); | |
| 353 for (unsigned i = 0; i < size; ++i) | |
| 354 collectRuleIfMatches(rules->at(i), behaviorAtBoundary, cascadeScope, cas
cadeOrder, matchRequest, ruleRange); | |
| 355 } | |
| 356 | |
| 357 static inline bool compareRules(const MatchedRule& matchedRule1, const MatchedRu
le& matchedRule2) | 339 static inline bool compareRules(const MatchedRule& matchedRule1, const MatchedRu
le& matchedRule2) |
| 358 { | 340 { |
| 359 if (matchedRule1.cascadeScope() != matchedRule2.cascadeScope()) | 341 if (matchedRule1.cascadeScope() != matchedRule2.cascadeScope()) |
| 360 return matchedRule1.cascadeScope() > matchedRule2.cascadeScope(); | 342 return matchedRule1.cascadeScope() > matchedRule2.cascadeScope(); |
| 361 | 343 |
| 362 unsigned specificity1 = matchedRule1.specificity(); | 344 unsigned specificity1 = matchedRule1.specificity(); |
| 363 unsigned specificity2 = matchedRule2.specificity(); | 345 unsigned specificity2 = matchedRule2.specificity(); |
| 364 if (specificity1 != specificity2) | 346 if (specificity1 != specificity2) |
| 365 return specificity1 < specificity2; | 347 return specificity1 < specificity2; |
| 366 | 348 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 383 // information about "scope". | 365 // information about "scope". |
| 384 int firstRuleIndex = -1, lastRuleIndex = -1; | 366 int firstRuleIndex = -1, lastRuleIndex = -1; |
| 385 RuleRange ruleRange(firstRuleIndex, lastRuleIndex); | 367 RuleRange ruleRange(firstRuleIndex, lastRuleIndex); |
| 386 // FIXME: Verify whether it's ok to ignore CascadeScope here. | 368 // FIXME: Verify whether it's ok to ignore CascadeScope here. |
| 387 collectMatchingRules(MatchRequest(ruleSet), ruleRange, SelectorChecker::Stay
sWithinTreeScope); | 369 collectMatchingRules(MatchRequest(ruleSet), ruleRange, SelectorChecker::Stay
sWithinTreeScope); |
| 388 | 370 |
| 389 return m_matchedRules && !m_matchedRules->isEmpty(); | 371 return m_matchedRules && !m_matchedRules->isEmpty(); |
| 390 } | 372 } |
| 391 | 373 |
| 392 } // namespace WebCore | 374 } // namespace WebCore |
| OLD | NEW |