| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 if (!disallowPseudoClasses) | 101 if (!disallowPseudoClasses) |
| 102 continue; | 102 continue; |
| 103 for (const CSSSelector* subSelector = selector; subSelector; subSelector
= subSelector->tagHistory()) { | 103 for (const CSSSelector* subSelector = selector; subSelector; subSelector
= subSelector->tagHistory()) { |
| 104 if (subSelector->m_match == CSSSelector::PseudoClass) | 104 if (subSelector->m_match == CSSSelector::PseudoClass) |
| 105 return false; | 105 return false; |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 return true; | 108 return true; |
| 109 } | 109 } |
| 110 | 110 |
| 111 static inline bool checkOneSelector(const CSSSelector& selector, const Vector<No
de*, 32>& siblings, int nth) | 111 static inline bool checkOneSelector(const CSSSelector& selector, const WillBeHea
pVector<RawPtrWillBeMember<Node>, 32>& siblings, int nth) |
| 112 { | 112 { |
| 113 Element* element = toElement(siblings[nth]); | 113 Element* element = toElement(siblings[nth]); |
| 114 SelectorChecker selectorChecker(element->document(), SelectorChecker::Collec
tingCSSRules); | 114 SelectorChecker selectorChecker(element->document(), SelectorChecker::Collec
tingCSSRules); |
| 115 SelectorChecker::SelectorCheckingContext context(selector, element, Selector
Checker::VisitedMatchEnabled); | 115 SelectorChecker::SelectorCheckingContext context(selector, element, Selector
Checker::VisitedMatchEnabled); |
| 116 ShadowDOMSiblingTraversalStrategy strategy(siblings, nth); | 116 ShadowDOMSiblingTraversalStrategy strategy(siblings, nth); |
| 117 return selectorChecker.match(context, strategy) == SelectorChecker::Selector
Matches; | 117 return selectorChecker.match(context, strategy) == SelectorChecker::Selector
Matches; |
| 118 } | 118 } |
| 119 | 119 |
| 120 bool HTMLContentElement::matchSelector(const Vector<Node*, 32>& siblings, int nt
h) const | 120 bool HTMLContentElement::matchSelector(const WillBeHeapVector<RawPtrWillBeMember
<Node>, 32>& siblings, int nth) const |
| 121 { | 121 { |
| 122 for (const CSSSelector* selector = selectorList().first(); selector; selecto
r = CSSSelectorList::next(*selector)) { | 122 for (const CSSSelector* selector = selectorList().first(); selector; selecto
r = CSSSelectorList::next(*selector)) { |
| 123 if (checkOneSelector(*selector, siblings, nth)) | 123 if (checkOneSelector(*selector, siblings, nth)) |
| 124 return true; | 124 return true; |
| 125 } | 125 } |
| 126 return false; | 126 return false; |
| 127 } | 127 } |
| 128 | 128 |
| 129 } | 129 } |
| OLD | NEW |