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

Unified Diff: Source/core/rendering/RenderMenuList.cpp

Issue 18970003: Introduce isHTMLOptGroupElement and toHTMLOptGroupElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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/rendering/RenderListBox.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderMenuList.cpp
diff --git a/Source/core/rendering/RenderMenuList.cpp b/Source/core/rendering/RenderMenuList.cpp
index 6b3d43f69f0debeb1756fe0e37998898a57d0ffe..547b94c5a847893c434abd4200dad56f50a72f8d 100644
--- a/Source/core/rendering/RenderMenuList.cpp
+++ b/Source/core/rendering/RenderMenuList.cpp
@@ -399,8 +399,8 @@ String RenderMenuList::itemText(unsigned listIndex) const
String itemString;
Element* element = listItems[listIndex];
- if (element->hasTagName(optgroupTag))
- itemString = static_cast<const HTMLOptGroupElement*>(element)->groupLabelText();
+ if (isHTMLOptGroupElement(element))
+ itemString = toHTMLOptGroupElement(element)->groupLabelText();
else if (element->hasTagName(optionTag))
itemString = toHTMLOptionElement(element)->textIndentedToRespectGroupLabel();
@@ -446,7 +446,7 @@ bool RenderMenuList::itemIsEnabled(unsigned listIndex) const
bool groupEnabled = true;
if (Element* parentElement = element->parentElement()) {
- if (parentElement->hasTagName(optgroupTag))
+ if (isHTMLOptGroupElement(parentElement))
groupEnabled = !parentElement->isDisabledFormControl();
}
if (!groupEnabled)
@@ -590,7 +590,7 @@ bool RenderMenuList::itemIsSeparator(unsigned listIndex) const
bool RenderMenuList::itemIsLabel(unsigned listIndex) const
{
const Vector<HTMLElement*>& listItems = selectElement()->listItems();
- return listIndex < listItems.size() && listItems[listIndex]->hasTagName(optgroupTag);
+ return listIndex < listItems.size() && isHTMLOptGroupElement(listItems[listIndex]);
}
bool RenderMenuList::itemIsSelected(unsigned listIndex) const
« no previous file with comments | « Source/core/rendering/RenderListBox.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698