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

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

Issue 475613003: Use tighter typing in RadioNodeList::elementMatches() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 Motorola Mobility, Inc. All rights reserved. 2 * Copyright (c) 2012 Motorola Mobility, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 12 matching lines...) Expand all
23 * THE POSSIBILITY OF SUCH DAMAGE. 23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "core/html/RadioNodeList.h" 27 #include "core/html/RadioNodeList.h"
28 28
29 #include "core/HTMLNames.h" 29 #include "core/HTMLNames.h"
30 #include "core/dom/Element.h" 30 #include "core/dom/Element.h"
31 #include "core/dom/NodeRareData.h" 31 #include "core/dom/NodeRareData.h"
32 #include "core/html/HTMLFormElement.h" 32 #include "core/html/HTMLFormElement.h"
33 #include "core/html/HTMLImageElement.h"
33 #include "core/html/HTMLInputElement.h" 34 #include "core/html/HTMLInputElement.h"
34 #include "core/html/HTMLObjectElement.h" 35 #include "core/html/HTMLObjectElement.h"
35 36
36 namespace blink { 37 namespace blink {
37 38
38 using namespace HTMLNames; 39 using namespace HTMLNames;
39 40
40 RadioNodeList::RadioNodeList(ContainerNode& rootNode, const AtomicString& name, CollectionType type) 41 RadioNodeList::RadioNodeList(ContainerNode& rootNode, const AtomicString& name, CollectionType type)
41 : LiveNodeList(rootNode, type, InvalidateForFormControls, isHTMLFormElement( rootNode) ? NodeListIsRootedAtDocument : NodeListIsRootedAtNode) 42 : LiveNodeList(rootNode, type, InvalidateForFormControls, isHTMLFormElement( rootNode) ? NodeListIsRootedAtDocument : NodeListIsRootedAtNode)
42 , m_name(name) 43 , m_name(name)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 108
108 return matchesByIdOrName(testElement); 109 return matchesByIdOrName(testElement);
109 } 110 }
110 111
111 bool RadioNodeList::elementMatches(const Element& element) const 112 bool RadioNodeList::elementMatches(const Element& element) const
112 { 113 {
113 if (m_onlyMatchImgElements) { 114 if (m_onlyMatchImgElements) {
114 if (!isHTMLImageElement(element)) 115 if (!isHTMLImageElement(element))
115 return false; 116 return false;
116 117
117 if (toHTMLElement(element).formOwner() != ownerNode()) 118 if (toHTMLImageElement(element).formOwner() != ownerNode())
118 return false; 119 return false;
119 120
120 return matchesByIdOrName(element); 121 return matchesByIdOrName(element);
121 } 122 }
122 123
123 if (!isHTMLObjectElement(element) && !element.isFormControlElement()) 124 if (!isHTMLObjectElement(element) && !element.isFormControlElement())
124 return false; 125 return false;
125 126
126 if (isHTMLInputElement(element) && toHTMLInputElement(element).isImageButton ()) 127 if (isHTMLInputElement(element) && toHTMLInputElement(element).isImageButton ())
127 return false; 128 return false;
128 129
129 return checkElementMatchesRadioNodeListFilter(element); 130 return checkElementMatchesRadioNodeListFilter(element);
130 } 131 }
131 132
132 } // namespace 133 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698