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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 m_crossesTreeBoundary |= selectorList.selectorCrossesTreeScopes(index); | 115 m_crossesTreeBoundary |= selectorList.selectorCrossesTreeScopes(index); |
116 m_needsUpdatedDistribution |= selectorList.selectorNeedsUpdatedDistribut
ion(index); | 116 m_needsUpdatedDistribution |= selectorList.selectorNeedsUpdatedDistribut
ion(index); |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 inline bool SelectorDataList::selectorMatches(const CSSSelector& selector, Eleme
nt& element, const ContainerNode& rootNode) const | 120 inline bool SelectorDataList::selectorMatches(const CSSSelector& selector, Eleme
nt& element, const ContainerNode& rootNode) const |
121 { | 121 { |
122 SelectorChecker selectorChecker(SelectorChecker::QueryingRules); | 122 SelectorChecker selectorChecker(SelectorChecker::QueryingRules); |
123 SelectorChecker::SelectorCheckingContext selectorCheckingContext(&element, S
electorChecker::VisitedMatchDisabled); | 123 SelectorChecker::SelectorCheckingContext selectorCheckingContext(&element, S
electorChecker::VisitedMatchDisabled); |
124 selectorCheckingContext.selector = &selector; | 124 selectorCheckingContext.selector = &selector; |
125 selectorCheckingContext.scope = &rootNode; | 125 selectorCheckingContext.scope = !rootNode.isDocumentNode() ? &rootNode : nul
lptr; |
126 selectorCheckingContext.scopeContainsLastMatchedElement = true; | 126 if (selectorCheckingContext.scope) |
| 127 selectorCheckingContext.scopeContainsLastMatchedElement = true; |
127 return selectorChecker.match(selectorCheckingContext); | 128 return selectorChecker.match(selectorCheckingContext); |
128 } | 129 } |
129 | 130 |
130 bool SelectorDataList::matches(Element& targetElement) const | 131 bool SelectorDataList::matches(Element& targetElement) const |
131 { | 132 { |
132 if (m_needsUpdatedDistribution) | 133 if (m_needsUpdatedDistribution) |
133 targetElement.updateDistribution(); | 134 targetElement.updateDistribution(); |
134 | 135 |
135 unsigned selectorCount = m_selectors.size(); | 136 unsigned selectorCount = m_selectors.size(); |
136 for (unsigned i = 0; i < selectorCount; ++i) { | 137 for (unsigned i = 0; i < selectorCount; ++i) { |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 | 570 |
570 return m_entries.add(selectors, SelectorQuery::adopt(selectorList)).storedVa
lue->value.get(); | 571 return m_entries.add(selectors, SelectorQuery::adopt(selectorList)).storedVa
lue->value.get(); |
571 } | 572 } |
572 | 573 |
573 void SelectorQueryCache::invalidate() | 574 void SelectorQueryCache::invalidate() |
574 { | 575 { |
575 m_entries.clear(); | 576 m_entries.clear(); |
576 } | 577 } |
577 | 578 |
578 } | 579 } |
OLD | NEW |