| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 : m_isLeftPage(isLeftPage(rootElementStyle, pageIndex)) | 66 : m_isLeftPage(isLeftPage(rootElementStyle, pageIndex)) |
| 67 , m_isFirstPage(isFirstPage(pageIndex)) | 67 , m_isFirstPage(isFirstPage(pageIndex)) |
| 68 , m_pageName(pageName(pageIndex)) { } | 68 , m_pageName(pageName(pageIndex)) { } |
| 69 | 69 |
| 70 void PageRuleCollector::matchPageRules(RuleSet* rules) | 70 void PageRuleCollector::matchPageRules(RuleSet* rules) |
| 71 { | 71 { |
| 72 if (!rules) | 72 if (!rules) |
| 73 return; | 73 return; |
| 74 | 74 |
| 75 rules->compactRulesIfNeeded(); | 75 rules->compactRulesIfNeeded(); |
| 76 WillBeHeapVector<RawPtrWillBeMember<StyleRulePage>> matchedPageRules; | 76 HeapVector<Member<StyleRulePage>> matchedPageRules; |
| 77 matchPageRulesForList(matchedPageRules, rules->pageRules(), m_isLeftPage, m_
isFirstPage, m_pageName); | 77 matchPageRulesForList(matchedPageRules, rules->pageRules(), m_isLeftPage, m_
isFirstPage, m_pageName); |
| 78 if (matchedPageRules.isEmpty()) | 78 if (matchedPageRules.isEmpty()) |
| 79 return; | 79 return; |
| 80 | 80 |
| 81 std::stable_sort(matchedPageRules.begin(), matchedPageRules.end(), comparePa
geRules); | 81 std::stable_sort(matchedPageRules.begin(), matchedPageRules.end(), comparePa
geRules); |
| 82 | 82 |
| 83 for (unsigned i = 0; i < matchedPageRules.size(); i++) | 83 for (unsigned i = 0; i < matchedPageRules.size(); i++) |
| 84 m_result.addMatchedProperties(&matchedPageRules[i]->properties()); | 84 m_result.addMatchedProperties(&matchedPageRules[i]->properties()); |
| 85 } | 85 } |
| 86 | 86 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 97 if ((pseudoType == CSSSelector::PseudoLeftPage && !isLeftPage) | 97 if ((pseudoType == CSSSelector::PseudoLeftPage && !isLeftPage) |
| 98 || (pseudoType == CSSSelector::PseudoRightPage && isLeftPage) | 98 || (pseudoType == CSSSelector::PseudoRightPage && isLeftPage) |
| 99 || (pseudoType == CSSSelector::PseudoFirstPage && !isFirstPage)) | 99 || (pseudoType == CSSSelector::PseudoFirstPage && !isFirstPage)) |
| 100 { | 100 { |
| 101 return false; | 101 return false; |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 return true; | 104 return true; |
| 105 } | 105 } |
| 106 | 106 |
| 107 void PageRuleCollector::matchPageRulesForList(WillBeHeapVector<RawPtrWillBeMembe
r<StyleRulePage>>& matchedRules, const WillBeHeapVector<RawPtrWillBeMember<Style
RulePage>>& rules, bool isLeftPage, bool isFirstPage, const String& pageName) | 107 void PageRuleCollector::matchPageRulesForList(HeapVector<Member<StyleRulePage>>&
matchedRules, const HeapVector<Member<StyleRulePage>>& rules, bool isLeftPage,
bool isFirstPage, const String& pageName) |
| 108 { | 108 { |
| 109 for (unsigned i = 0; i < rules.size(); ++i) { | 109 for (unsigned i = 0; i < rules.size(); ++i) { |
| 110 StyleRulePage* rule = rules[i]; | 110 StyleRulePage* rule = rules[i]; |
| 111 | 111 |
| 112 if (!checkPageSelectorComponents(rule->selector(), isLeftPage, isFirstPa
ge, pageName)) | 112 if (!checkPageSelectorComponents(rule->selector(), isLeftPage, isFirstPa
ge, pageName)) |
| 113 continue; | 113 continue; |
| 114 | 114 |
| 115 // If the rule has no properties to apply, then ignore it. | 115 // If the rule has no properties to apply, then ignore it. |
| 116 const StylePropertySet& properties = rule->properties(); | 116 const StylePropertySet& properties = rule->properties(); |
| 117 if (properties.isEmpty()) | 117 if (properties.isEmpty()) |
| 118 continue; | 118 continue; |
| 119 | 119 |
| 120 // Add this rule to our list of matched rules. | 120 // Add this rule to our list of matched rules. |
| 121 matchedRules.append(rule); | 121 matchedRules.append(rule); |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 | 124 |
| 125 } // namespace blink | 125 } // namespace blink |
| OLD | NEW |