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

Unified Diff: Source/core/rendering/RenderListBox.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/html/parser/HTMLTreeBuilder.cpp ('k') | Source/core/rendering/RenderMenuList.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderListBox.cpp
diff --git a/Source/core/rendering/RenderListBox.cpp b/Source/core/rendering/RenderListBox.cpp
index 6ebf5ef11adc88b1d929470a72ab6eb3e649c998..38416759cc42aa22b9cebff8b9deddcae5184200 100644
--- a/Source/core/rendering/RenderListBox.cpp
+++ b/Source/core/rendering/RenderListBox.cpp
@@ -121,10 +121,10 @@ void RenderListBox::updateFromElement()
HTMLElement* element = listItems[i];
String text;
Font itemFont = style()->font();
- if (element->hasTagName(optionTag))
+ if (element->hasTagName(optionTag)) {
text = toHTMLOptionElement(element)->textIndentedToRespectGroupLabel();
- else if (element->hasTagName(optgroupTag)) {
- text = static_cast<const HTMLOptGroupElement*>(element)->groupLabelText();
+ } else if (isHTMLOptGroupElement(element)) {
+ text = toHTMLOptGroupElement(element)->groupLabelText();
FontDescription d = itemFont.fontDescription();
d.setWeight(d.bolderWeight());
itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacing());
@@ -403,8 +403,8 @@ void RenderListBox::paintItemForeground(PaintInfo& paintInfo, const LayoutPoint&
bool isOptionElement = element->hasTagName(optionTag);
if (isOptionElement)
itemText = toHTMLOptionElement(element)->textIndentedToRespectGroupLabel();
- else if (element->hasTagName(optgroupTag))
- itemText = static_cast<const HTMLOptGroupElement*>(element)->groupLabelText();
+ else if (isHTMLOptGroupElement(element))
+ itemText = toHTMLOptGroupElement(element)->groupLabelText();
applyTextTransform(style(), itemText, ' ');
Color textColor = element->renderStyle() ? element->renderStyle()->visitedDependentColor(CSSPropertyColor) : style()->visitedDependentColor(CSSPropertyColor);
@@ -423,7 +423,7 @@ void RenderListBox::paintItemForeground(PaintInfo& paintInfo, const LayoutPoint&
LayoutRect r = itemBoundingBoxRect(paintOffset, listIndex);
r.move(itemOffsetForAlignment(textRun, itemStyle, itemFont, r));
- if (element->hasTagName(optgroupTag)) {
+ if (isHTMLOptGroupElement(element)) {
FontDescription d = itemFont.fontDescription();
d.setWeight(d.bolderWeight());
itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacing());
« no previous file with comments | « Source/core/html/parser/HTMLTreeBuilder.cpp ('k') | Source/core/rendering/RenderMenuList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698