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

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

Issue 405383003: Add missing id/name check over img-based RadioNodeLists. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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/html/RadioNodeList.h ('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 1c42354c2630ab012012f58457d5371cc0ec574f..e3a4ad92b16429bcc1d3e25c919d7a0360d0336e 100644
--- a/Source/core/html/RadioNodeList.cpp
+++ b/Source/core/html/RadioNodeList.cpp
@@ -90,6 +90,11 @@ void RadioNodeList::setValue(const String& value)
}
}
+bool RadioNodeList::matchesByIdOrName(const Element& testElement) const
+{
+ return testElement.getIdAttribute() == m_name || testElement.getNameAttribute() == m_name;
+}
+
bool RadioNodeList::checkElementMatchesRadioNodeListFilter(const Element& testElement) const
{
ASSERT(!m_onlyMatchImgElements);
@@ -100,7 +105,7 @@ bool RadioNodeList::checkElementMatchesRadioNodeListFilter(const Element& testEl
return false;
}
- return testElement.getIdAttribute() == m_name || testElement.getNameAttribute() == m_name;
+ return matchesByIdOrName(testElement);
}
bool RadioNodeList::elementMatches(const Element& element) const
@@ -108,7 +113,11 @@ bool RadioNodeList::elementMatches(const Element& element) const
if (m_onlyMatchImgElements) {
if (!isHTMLImageElement(element))
return false;
- return toHTMLElement(element).formOwner() == ownerNode();
+
+ if (toHTMLElement(element).formOwner() != ownerNode())
+ return false;
+
+ return matchesByIdOrName(element);
}
if (!isHTMLObjectElement(element) && !element.isFormControlElement())
« no previous file with comments | « Source/core/html/RadioNodeList.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698