| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 // If returns true, traversalRoots has the elements that may match the selector
query. | 240 // If returns true, traversalRoots has the elements that may match the selector
query. |
| 241 // | 241 // |
| 242 // If returns false, traversalRoots has the rootNode parameter or descendants of
rootNode representing | 242 // If returns false, traversalRoots has the rootNode parameter or descendants of
rootNode representing |
| 243 // the subtree for which we can limit the querySelector traversal. | 243 // the subtree for which we can limit the querySelector traversal. |
| 244 // | 244 // |
| 245 // The travseralRoots may be empty, regardless of the returned bool value, if th
is method finds that the selectors won't | 245 // The travseralRoots may be empty, regardless of the returned bool value, if th
is method finds that the selectors won't |
| 246 // match any element. | 246 // match any element. |
| 247 template <typename SelectorQueryTrait> | 247 template <typename SelectorQueryTrait> |
| 248 void SelectorDataList::findTraverseRootsAndExecute(ContainerNode& rootNode, type
name SelectorQueryTrait::OutputType& output) const | 248 void SelectorDataList::findTraverseRootsAndExecute(ContainerNode& rootNode, type
name SelectorQueryTrait::OutputType& output) const |
| 249 { | 249 { |
| 250 // We need to return the matches in document order. To use id lookup while t
here is possiblity of multiple matches | 250 // We need to return the matches in document order. To use id lookup while t
here is possibility of multiple matches |
| 251 // we would need to sort the results. For now, just traverse the document in
that case. | 251 // we would need to sort the results. For now, just traverse the document in
that case. |
| 252 ASSERT(m_selectors.size() == 1); | 252 ASSERT(m_selectors.size() == 1); |
| 253 | 253 |
| 254 bool isRightmostSelector = true; | 254 bool isRightmostSelector = true; |
| 255 bool startFromParent = false; | 255 bool startFromParent = false; |
| 256 | 256 |
| 257 for (const CSSSelector* selector = m_selectors[0]; selector; selector = sele
ctor->tagHistory()) { | 257 for (const CSSSelector* selector = m_selectors[0]; selector; selector = sele
ctor->tagHistory()) { |
| 258 if (selector->match() == CSSSelector::Id && !rootNode.document().contain
sMultipleElementsWithId(selector->value())) { | 258 if (selector->match() == CSSSelector::Id && !rootNode.document().contain
sMultipleElementsWithId(selector->value())) { |
| 259 Element* element = rootNode.treeScope().getElementById(selector->val
ue()); | 259 Element* element = rootNode.treeScope().getElementById(selector->val
ue()); |
| 260 ContainerNode* adjustedNode = &rootNode; | 260 ContainerNode* adjustedNode = &rootNode; |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 | 568 |
| 569 return m_entries.add(selectors, SelectorQuery::adopt(selectorList)).storedVa
lue->value.get(); | 569 return m_entries.add(selectors, SelectorQuery::adopt(selectorList)).storedVa
lue->value.get(); |
| 570 } | 570 } |
| 571 | 571 |
| 572 void SelectorQueryCache::invalidate() | 572 void SelectorQueryCache::invalidate() |
| 573 { | 573 { |
| 574 m_entries.clear(); | 574 m_entries.clear(); |
| 575 } | 575 } |
| 576 | 576 |
| 577 } | 577 } |
| OLD | NEW |