| 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 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1334 DCHECK(isHTMLFormElement(this) || isHTMLFieldSetElement(this)); | 1334 DCHECK(isHTMLFormElement(this) || isHTMLFieldSetElement(this)); |
| 1335 CollectionType type = onlyMatchImgElements ? RadioImgNodeListType : RadioNod
eListType; | 1335 CollectionType type = onlyMatchImgElements ? RadioImgNodeListType : RadioNod
eListType; |
| 1336 return ensureCachedCollection<RadioNodeList>(type, name); | 1336 return ensureCachedCollection<RadioNodeList>(type, name); |
| 1337 } | 1337 } |
| 1338 | 1338 |
| 1339 Element* ContainerNode::getElementById(const AtomicString& id) const | 1339 Element* ContainerNode::getElementById(const AtomicString& id) const |
| 1340 { | 1340 { |
| 1341 if (isInTreeScope()) { | 1341 if (isInTreeScope()) { |
| 1342 // Fast path if we are in a tree scope: call getElementById() on tree sc
ope | 1342 // Fast path if we are in a tree scope: call getElementById() on tree sc
ope |
| 1343 // and check if the matching element is in our subtree. | 1343 // and check if the matching element is in our subtree. |
| 1344 Element* element = treeScope().getElementById(id); | 1344 Element* element = rootTreeScope().getElementById(id); |
| 1345 if (!element) | 1345 if (!element) |
| 1346 return nullptr; | 1346 return nullptr; |
| 1347 if (element->isDescendantOf(this)) | 1347 if (element->isDescendantOf(this)) |
| 1348 return element; | 1348 return element; |
| 1349 } | 1349 } |
| 1350 | 1350 |
| 1351 // Fall back to traversing our subtree. In case of duplicate ids, the first
element found will be returned. | 1351 // Fall back to traversing our subtree. In case of duplicate ids, the first
element found will be returned. |
| 1352 for (Element& element : ElementTraversal::descendantsOf(*this)) { | 1352 for (Element& element : ElementTraversal::descendantsOf(*this)) { |
| 1353 if (element.getIdAttribute() == id) | 1353 if (element.getIdAttribute() == id) |
| 1354 return &element; | 1354 return &element; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1374 return true; | 1374 return true; |
| 1375 | 1375 |
| 1376 if (node->isElementNode() && toElement(node)->shadow()) | 1376 if (node->isElementNode() && toElement(node)->shadow()) |
| 1377 return true; | 1377 return true; |
| 1378 | 1378 |
| 1379 return false; | 1379 return false; |
| 1380 } | 1380 } |
| 1381 #endif | 1381 #endif |
| 1382 | 1382 |
| 1383 } // namespace blink | 1383 } // namespace blink |
| OLD | NEW |