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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 void SelectorDataList::findTraverseRootsAndExecute(ContainerNode& rootNode, type
name SelectorQueryTrait::OutputType& output) const | 254 void SelectorDataList::findTraverseRootsAndExecute(ContainerNode& rootNode, type
name SelectorQueryTrait::OutputType& output) const |
255 { | 255 { |
256 // We need to return the matches in document order. To use id lookup while t
here is possiblity of multiple matches | 256 // We need to return the matches in document order. To use id lookup while t
here is possiblity of multiple matches |
257 // we would need to sort the results. For now, just traverse the document in
that case. | 257 // we would need to sort the results. For now, just traverse the document in
that case. |
258 DCHECK_EQ(m_selectors.size(), 1u); | 258 DCHECK_EQ(m_selectors.size(), 1u); |
259 | 259 |
260 bool isRightmostSelector = true; | 260 bool isRightmostSelector = true; |
261 bool startFromParent = false; | 261 bool startFromParent = false; |
262 | 262 |
263 for (const CSSSelector* selector = m_selectors[0]; selector; selector = sele
ctor->tagHistory()) { | 263 for (const CSSSelector* selector = m_selectors[0]; selector; selector = sele
ctor->tagHistory()) { |
264 if (selector->match() == CSSSelector::Id && !rootNode.document().contain
sMultipleElementsWithId(selector->value())) { | 264 if (selector->match() == CSSSelector::Id && !rootNode.treeScope().contai
nsMultipleElementsWithId(selector->value())) { |
265 Element* element = rootNode.treeScope().getElementById(selector->val
ue()); | 265 Element* element = rootNode.treeScope().getElementById(selector->val
ue()); |
266 ContainerNode* adjustedNode = &rootNode; | 266 ContainerNode* adjustedNode = &rootNode; |
267 if (element && (isTreeScopeRoot(rootNode) || element->isDescendantOf
(&rootNode))) | 267 if (element && (isTreeScopeRoot(rootNode) || element->isDescendantOf
(&rootNode))) |
268 adjustedNode = element; | 268 adjustedNode = element; |
269 else if (!element || isRightmostSelector) | 269 else if (!element || isRightmostSelector) |
270 adjustedNode = nullptr; | 270 adjustedNode = nullptr; |
271 if (isRightmostSelector) { | 271 if (isRightmostSelector) { |
272 executeForTraverseRoot<SelectorQueryTrait>(*m_selectors[0], adju
stedNode, MatchesTraverseRoots, rootNode, output); | 272 executeForTraverseRoot<SelectorQueryTrait>(*m_selectors[0], adju
stedNode, MatchesTraverseRoots, rootNode, output); |
273 return; | 273 return; |
274 } | 274 } |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 | 570 |
571 return m_entries.add(selectors, SelectorQuery::adopt(std::move(selectorList)
)).storedValue->value.get(); | 571 return m_entries.add(selectors, SelectorQuery::adopt(std::move(selectorList)
)).storedValue->value.get(); |
572 } | 572 } |
573 | 573 |
574 void SelectorQueryCache::invalidate() | 574 void SelectorQueryCache::invalidate() |
575 { | 575 { |
576 m_entries.clear(); | 576 m_entries.clear(); |
577 } | 577 } |
578 | 578 |
579 } // namespace blink | 579 } // namespace blink |
OLD | NEW |