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

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

Issue 195813003: Use new is*Element() helper functions further more in HTML code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix bad assertion Created 6 years, 9 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/HTMLOptionElement.cpp
diff --git a/Source/core/html/HTMLOptionElement.cpp b/Source/core/html/HTMLOptionElement.cpp
index a1f4e511a2557740fdbbc2c63a1f80c3540ee836..c0b02f12ef71b46fdeb0ba02b6d1e17bed4813ba 100644
--- a/Source/core/html/HTMLOptionElement.cpp
+++ b/Source/core/html/HTMLOptionElement.cpp
@@ -165,7 +165,7 @@ int HTMLOptionElement::index() const
const Vector<HTMLElement*>& items = selectElement->listItems();
size_t length = items.size();
for (size_t i = 0; i < length; ++i) {
- if (!items[i]->hasTagName(optionTag))
+ if (!isHTMLOptionElement(*items[i]))
continue;
if (items[i] == this)
return optionIndex;
@@ -260,7 +260,7 @@ void HTMLOptionElement::childrenChanged(bool changedByParser, Node* beforeChange
HTMLDataListElement* HTMLOptionElement::ownerDataListElement() const
{
for (ContainerNode* parent = parentNode(); parent ; parent = parent->parentNode()) {
- if (parent->hasTagName(datalistTag))
+ if (isHTMLDataListElement(*parent))
return toHTMLDataListElement(parent);
}
return 0;
@@ -269,7 +269,7 @@ HTMLDataListElement* HTMLOptionElement::ownerDataListElement() const
HTMLSelectElement* HTMLOptionElement::ownerSelectElement() const
{
ContainerNode* select = parentNode();
- while (select && !select->hasTagName(selectTag))
+ while (select && !isHTMLSelectElement(*select))
select = select->parentNode();
if (!select)
@@ -322,7 +322,7 @@ void HTMLOptionElement::didRecalcStyle(StyleRecalcChange change)
String HTMLOptionElement::textIndentedToRespectGroupLabel() const
{
ContainerNode* parent = parentNode();
- if (parent && parent->hasTagName(optgroupTag))
+ if (parent && isHTMLOptGroupElement(*parent))
return " " + text();
return text();
}
@@ -332,7 +332,7 @@ bool HTMLOptionElement::isDisabledFormControl() const
if (ownElementDisabled())
return true;
if (Element* parent = parentElement())
- return parent->hasTagName(optgroupTag) && parent->isDisabledFormControl();
+ return isHTMLOptGroupElement(*parent) && parent->isDisabledFormControl();
return false;
}

Powered by Google App Engine
This is Rietveld 408576698