OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2013 Apple Inc. All rights reserved. |
3 * Copyright (C) 2014 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2014 Samsung Electronics. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 for (const CSSSelector* selector = selectorList.first(); selector; selector
= CSSSelectorList::next(*selector), ++index) { | 112 for (const CSSSelector* selector = selectorList.first(); selector; selector
= CSSSelectorList::next(*selector), ++index) { |
113 m_selectors.uncheckedAppend(selector); | 113 m_selectors.uncheckedAppend(selector); |
114 m_crossesTreeBoundary |= selectorList.selectorCrossesTreeScopes(index); | 114 m_crossesTreeBoundary |= selectorList.selectorCrossesTreeScopes(index); |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 inline bool SelectorDataList::selectorMatches(const CSSSelector& selector, Eleme
nt& element, const ContainerNode& rootNode) const | 118 inline bool SelectorDataList::selectorMatches(const CSSSelector& selector, Eleme
nt& element, const ContainerNode& rootNode) const |
119 { | 119 { |
120 SelectorChecker selectorChecker(element.document(), SelectorChecker::Queryin
gRules); | 120 SelectorChecker selectorChecker(element.document(), SelectorChecker::Queryin
gRules); |
121 SelectorChecker::SelectorCheckingContext selectorCheckingContext(selector, &
element, SelectorChecker::VisitedMatchDisabled); | 121 SelectorChecker::SelectorCheckingContext selectorCheckingContext(selector, &
element, SelectorChecker::VisitedMatchDisabled); |
122 selectorCheckingContext.behaviorAtBoundary = SelectorChecker::StaysWithinTre
eScope; | |
123 selectorCheckingContext.scope = !rootNode.isDocumentNode() ? &rootNode : 0; | 122 selectorCheckingContext.scope = !rootNode.isDocumentNode() ? &rootNode : 0; |
124 return selectorChecker.match(selectorCheckingContext, DOMSiblingTraversalStr
ategy()) == SelectorChecker::SelectorMatches; | 123 return selectorChecker.match(selectorCheckingContext, DOMSiblingTraversalStr
ategy()) == SelectorChecker::SelectorMatches; |
125 } | 124 } |
126 | 125 |
127 bool SelectorDataList::matches(Element& targetElement) const | 126 bool SelectorDataList::matches(Element& targetElement) const |
128 { | 127 { |
129 unsigned selectorCount = m_selectors.size(); | 128 unsigned selectorCount = m_selectors.size(); |
130 for (unsigned i = 0; i < selectorCount; ++i) { | 129 for (unsigned i = 0; i < selectorCount; ++i) { |
131 if (selectorMatches(*m_selectors[i], targetElement, targetElement)) | 130 if (selectorMatches(*m_selectors[i], targetElement, targetElement)) |
132 return true; | 131 return true; |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 | 517 |
519 return m_entries.add(selectors, SelectorQuery::adopt(selectorList)).storedVa
lue->value.get(); | 518 return m_entries.add(selectors, SelectorQuery::adopt(selectorList)).storedVa
lue->value.get(); |
520 } | 519 } |
521 | 520 |
522 void SelectorQueryCache::invalidate() | 521 void SelectorQueryCache::invalidate() |
523 { | 522 { |
524 m_entries.clear(); | 523 m_entries.clear(); |
525 } | 524 } |
526 | 525 |
527 } | 526 } |
OLD | NEW |