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

Side by Side Diff: Source/core/html/DocumentNameCollection.cpp

Issue 315473002: Stop having HTMLNameCollection override HTMLCollection::virtualItemAfter() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/html/DocumentNameCollection.h"
7
8 #include "core/html/HTMLEmbedElement.h"
9 #include "core/html/HTMLFormElement.h"
10 #include "core/html/HTMLObjectElement.h"
11
12 namespace WebCore {
13
14 DocumentNameCollection::DocumentNameCollection(ContainerNode& document, const At omicString& name)
15 : HTMLNameCollection(document, DocumentNamedItems, name)
16 {
17 }
18
19 bool DocumentNameCollection::elementMatches(const Element& element) const
20 {
21 // Match images, forms, applets, embeds, objects and iframes by name,
22 // applets and object by id, and images by id but only if they have
23 // a name attribute (this very strange rule matches IE)
24 if (isHTMLFormElement(element) || isHTMLIFrameElement(element) || (isHTMLEmb edElement(element) && toHTMLEmbedElement(element).isExposed()))
25 return element.getNameAttribute() == m_name;
26 if (isHTMLAppletElement(element) || (isHTMLObjectElement(element) && toHTMLO bjectElement(element).isExposed()))
27 return element.getNameAttribute() == m_name || element.getIdAttribute() == m_name;
28 if (isHTMLImageElement(element))
29 return element.getNameAttribute() == m_name || (element.getIdAttribute() == m_name && element.hasName());
30 return false;
31 }
32
33 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698