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

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

Issue 315473002: Stop having HTMLNameCollection override HTMLCollection::virtualItemAfter() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 7 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/WindowNameCollection.cpp
diff --git a/Source/core/html/WindowNameCollection.cpp b/Source/core/html/WindowNameCollection.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..7321f853f292cc426b718476b70af09862d436a3
--- /dev/null
+++ b/Source/core/html/WindowNameCollection.cpp
@@ -0,0 +1,32 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/html/WindowNameCollection.h"
+
+#include "core/html/HTMLImageElement.h"
+
+namespace WebCore {
+
+WindowNameCollection::WindowNameCollection(ContainerNode& document, const AtomicString& name)
+ : HTMLNameCollection(document, WindowNamedItems, name)
+{
+}
+
+bool WindowNameCollection::elementMatches(const Element& element) const
+{
+ // Match only images, forms, applets, embeds and objects by name,
+ // but anything by id
+ if (isHTMLImageElement(element)
+ || isHTMLFormElement(element)
+ || isHTMLAppletElement(element)
+ || isHTMLEmbedElement(element)
+ || isHTMLObjectElement(element)) {
+ if (element.getNameAttribute() == m_name)
+ return true;
+ }
+ return element.getIdAttribute() == m_name;
+}
+
+} // namespace WebCore
« Source/core/html/DocumentNameCollection.h ('K') | « Source/core/html/WindowNameCollection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698