| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 if (SelectorQueryTrait::shouldOnlyMatchFirstElement) | 172 if (SelectorQueryTrait::shouldOnlyMatchFirstElement) |
| 173 return; | 173 return; |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 | 177 |
| 178 template <typename SelectorQueryTrait> | 178 template <typename SelectorQueryTrait> |
| 179 void SelectorDataList::collectElementsByTagName(ContainerNode& rootNode, const Q
ualifiedName& tagName, typename SelectorQueryTrait::OutputType& output) const | 179 void SelectorDataList::collectElementsByTagName(ContainerNode& rootNode, const Q
ualifiedName& tagName, typename SelectorQueryTrait::OutputType& output) const |
| 180 { | 180 { |
| 181 for (Element& element : ElementTraversal::descendantsOf(rootNode)) { | 181 for (Element& element : ElementTraversal::descendantsOf(rootNode)) { |
| 182 if (SelectorChecker::tagMatches(element, tagName)) { | 182 // querySelector*() doesn't allow namespaces and throws before it gets |
| 183 // here so we can ignore them. |
| 184 ASSERT(tagName.namespaceURI() == starAtom); |
| 185 if (tagName == anyQName() || element.hasLocalName(tagName.localName()))
{ |
| 183 SelectorQueryTrait::appendElement(output, element); | 186 SelectorQueryTrait::appendElement(output, element); |
| 184 if (SelectorQueryTrait::shouldOnlyMatchFirstElement) | 187 if (SelectorQueryTrait::shouldOnlyMatchFirstElement) |
| 185 return; | 188 return; |
| 186 } | 189 } |
| 187 } | 190 } |
| 188 } | 191 } |
| 189 | 192 |
| 190 inline bool SelectorDataList::canUseFastQuery(const ContainerNode& rootNode) con
st | 193 inline bool SelectorDataList::canUseFastQuery(const ContainerNode& rootNode) con
st |
| 191 { | 194 { |
| 192 return m_selectors.size() == 1 && !m_crossesTreeBoundary && rootNode.inDocum
ent() && !rootNode.document().inQuirksMode(); | 195 return m_selectors.size() == 1 && !m_crossesTreeBoundary && rootNode.inDocum
ent() && !rootNode.document().inQuirksMode(); |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 | 538 |
| 536 return m_entries.add(selectors, SelectorQuery::adopt(selectorList)).storedVa
lue->value.get(); | 539 return m_entries.add(selectors, SelectorQuery::adopt(selectorList)).storedVa
lue->value.get(); |
| 537 } | 540 } |
| 538 | 541 |
| 539 void SelectorQueryCache::invalidate() | 542 void SelectorQueryCache::invalidate() |
| 540 { | 543 { |
| 541 m_entries.clear(); | 544 m_entries.clear(); |
| 542 } | 545 } |
| 543 | 546 |
| 544 } | 547 } |
| OLD | NEW |