Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1034)

Unified Diff: Source/core/html/HTMLCollection.cpp

Issue 158563004: Make HTMLAllCollection named property getter behave more according to spec (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix linking error Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/html/HTMLCollection.cpp
diff --git a/Source/core/html/HTMLCollection.cpp b/Source/core/html/HTMLCollection.cpp
index 46350053705dcac07eea661a6ea0e57f2e920095..e0bec9f3a86e5dac04dd18d4b60b4d5e008b8438 100644
--- a/Source/core/html/HTMLCollection.cpp
+++ b/Source/core/html/HTMLCollection.cpp
@@ -30,6 +30,7 @@
#include "core/dom/NodeList.h"
#include "core/dom/NodeRareData.h"
#include "core/dom/NodeTraversal.h"
+#include "core/html/HTMLAllCollection.h"
#include "core/html/HTMLElement.h"
#include "core/html/HTMLObjectElement.h"
#include "core/html/HTMLOptionElement.h"
@@ -385,19 +386,6 @@ Element* HTMLCollection::virtualItemAfter(Element*) const
return 0;
}
-static inline bool nameShouldBeVisibleInDocumentAll(const HTMLElement& element)
-{
- // The document.all collection returns only certain types of elements by name,
- // although it returns any type of element by id.
- return element.hasLocalName(appletTag)
- || element.hasLocalName(embedTag)
- || element.hasLocalName(formTag)
- || element.hasLocalName(imgTag)
- || element.hasLocalName(inputTag)
- || element.hasLocalName(objectTag)
- || element.hasLocalName(selectTag);
-}
-
inline Element* firstMatchingChildElement(const HTMLCollection& nodeList, const ContainerNode& root)
{
Element* element = ElementTraversal::firstWithin(root);
@@ -431,7 +419,7 @@ Element* HTMLCollection::traverseToFirstElement(const ContainerNode& root) const
}
}
-inline Element* HTMLCollection::traverseNextElement(Element& previous, const ContainerNode& root) const
+Element* HTMLCollection::traverseNextElement(Element& previous, const ContainerNode& root) const
{
if (overridesItemAfter())
return virtualItemAfter(&previous);
@@ -542,7 +530,7 @@ void HTMLCollection::updateNameCache() const
if (!element->isHTMLElement())
continue;
const AtomicString& nameAttrVal = element->getNameAttribute();
- if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal && (type() != DocAll || nameShouldBeVisibleInDocumentAll(toHTMLElement(*element))))
+ if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal && (type() != DocAll || HTMLAllCollection::elementNameShouldBeVisible(toHTMLElement(*element))))
appendNameCache(nameAttrVal, element);
}
« Source/core/html/HTMLAllCollection.cpp ('K') | « Source/core/html/HTMLCollection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698