OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights
reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights
reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1459 DCHECK(isHTMLFormElement(this) || isHTMLFieldSetElement(this)); | 1459 DCHECK(isHTMLFormElement(this) || isHTMLFieldSetElement(this)); |
1460 CollectionType type = onlyMatchImgElements ? RadioImgNodeListType : RadioNod
eListType; | 1460 CollectionType type = onlyMatchImgElements ? RadioImgNodeListType : RadioNod
eListType; |
1461 return ensureCachedCollection<RadioNodeList>(type, name); | 1461 return ensureCachedCollection<RadioNodeList>(type, name); |
1462 } | 1462 } |
1463 | 1463 |
1464 Element* ContainerNode::getElementById(const AtomicString& id) const | 1464 Element* ContainerNode::getElementById(const AtomicString& id) const |
1465 { | 1465 { |
1466 if (isInTreeScope()) { | 1466 if (isInTreeScope()) { |
1467 // Fast path if we are in a tree scope: call getElementById() on tree sc
ope | 1467 // Fast path if we are in a tree scope: call getElementById() on tree sc
ope |
1468 // and check if the matching element is in our subtree. | 1468 // and check if the matching element is in our subtree. |
1469 Element* element = treeScope().getElementById(id); | 1469 Element* element = rootTreeScope().getElementById(id); |
1470 if (!element) | 1470 if (!element) |
1471 return nullptr; | 1471 return nullptr; |
1472 if (element->isDescendantOf(this)) | 1472 if (element->isDescendantOf(this)) |
1473 return element; | 1473 return element; |
1474 } | 1474 } |
1475 | 1475 |
1476 // Fall back to traversing our subtree. In case of duplicate ids, the first
element found will be returned. | 1476 // Fall back to traversing our subtree. In case of duplicate ids, the first
element found will be returned. |
1477 for (Element& element : ElementTraversal::descendantsOf(*this)) { | 1477 for (Element& element : ElementTraversal::descendantsOf(*this)) { |
1478 if (element.getIdAttribute() == id) | 1478 if (element.getIdAttribute() == id) |
1479 return &element; | 1479 return &element; |
(...skipping 19 matching lines...) Expand all Loading... |
1499 return true; | 1499 return true; |
1500 | 1500 |
1501 if (node->isElementNode() && toElement(node)->shadow()) | 1501 if (node->isElementNode() && toElement(node)->shadow()) |
1502 return true; | 1502 return true; |
1503 | 1503 |
1504 return false; | 1504 return false; |
1505 } | 1505 } |
1506 #endif | 1506 #endif |
1507 | 1507 |
1508 } // namespace blink | 1508 } // namespace blink |
OLD | NEW |