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

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

Issue 331863003: Have NodeList::item() overrides return an Element* when appropriate (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/NamedNodesCollection.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/RadioNodeList.cpp
diff --git a/Source/core/html/RadioNodeList.cpp b/Source/core/html/RadioNodeList.cpp
index c36e4c5bb90a8774a51644a694a8015d6ec0d03c..b40398aefb252b2a973dd78e832219b94171982c 100644
--- a/Source/core/html/RadioNodeList.cpp
+++ b/Source/core/html/RadioNodeList.cpp
@@ -52,12 +52,11 @@ RadioNodeList::~RadioNodeList()
#endif
}
-static inline HTMLInputElement* toRadioButtonInputElement(Node& node)
+static inline HTMLInputElement* toRadioButtonInputElement(Element& element)
{
- ASSERT(node.isElementNode());
- if (!isHTMLInputElement(node))
+ if (!isHTMLInputElement(element))
return 0;
- HTMLInputElement& inputElement = toHTMLInputElement(node);
+ HTMLInputElement& inputElement = toHTMLInputElement(element);
if (!inputElement.isRadioButton() || inputElement.value().isEmpty())
return 0;
return &inputElement;
@@ -67,9 +66,9 @@ String RadioNodeList::value() const
{
if (m_onlyMatchImgElements)
return String();
- for (unsigned i = 0; i < length(); ++i) {
- Node* node = item(i);
- const HTMLInputElement* inputElement = toRadioButtonInputElement(*node);
+ unsigned length = this->length();
+ for (unsigned i = 0; i < length; ++i) {
+ const HTMLInputElement* inputElement = toRadioButtonInputElement(*item(i));
if (!inputElement || !inputElement->checked())
continue;
return inputElement->value();
@@ -81,9 +80,9 @@ void RadioNodeList::setValue(const String& value)
{
if (m_onlyMatchImgElements)
return;
- for (unsigned i = 0; i < length(); ++i) {
- Node* node = item(i);
- HTMLInputElement* inputElement = toRadioButtonInputElement(*node);
+ unsigned length = this->length();
+ for (unsigned i = 0; i < length; ++i) {
+ HTMLInputElement* inputElement = toRadioButtonInputElement(*item(i));
if (!inputElement || inputElement->value() != value)
continue;
inputElement->setChecked(true);
« no previous file with comments | « Source/core/dom/NamedNodesCollection.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698