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.isDocumentNode() ? &rootNode : nul lptr; | 125 selectorCheckingContext.scope = &rootNode; |
126 if (selectorCheckingContext.scope) | 126 selectorCheckingContext.scopeContainsLastMatchedElement = true; |
esprehn
2015/08/29 23:55:30
Why do we need scopeContainsLastMatchedElement at
| |
127 selectorCheckingContext.scopeContainsLastMatchedElement = true; | |
128 return selectorChecker.match(selectorCheckingContext); | 127 return selectorChecker.match(selectorCheckingContext); |
129 } | 128 } |
130 | 129 |
131 bool SelectorDataList::matches(Element& targetElement) const | 130 bool SelectorDataList::matches(Element& targetElement) const |
132 { | 131 { |
133 if (m_needsUpdatedDistribution) | 132 if (m_needsUpdatedDistribution) |
134 targetElement.updateDistribution(); | 133 targetElement.updateDistribution(); |
135 | 134 |
136 unsigned selectorCount = m_selectors.size(); | 135 unsigned selectorCount = m_selectors.size(); |
137 for (unsigned i = 0; i < selectorCount; ++i) { | 136 for (unsigned i = 0; i < selectorCount; ++i) { |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
570 | 569 |
571 return m_entries.add(selectors, SelectorQuery::adopt(selectorList)).storedVa lue->value.get(); | 570 return m_entries.add(selectors, SelectorQuery::adopt(selectorList)).storedVa lue->value.get(); |
572 } | 571 } |
573 | 572 |
574 void SelectorQueryCache::invalidate() | 573 void SelectorQueryCache::invalidate() |
575 { | 574 { |
576 m_entries.clear(); | 575 m_entries.clear(); |
577 } | 576 } |
578 | 577 |
579 } | 578 } |
OLD | NEW |