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

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

Issue 197283025: Use new is*Element() helper functions more in rendering code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
« no previous file with comments | « Source/core/rendering/RenderLayer.cpp ('k') | Source/core/rendering/RenderListItem.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 2e8b3be39cafffe3b4205f1174e05cb6d9c08203..8918b0a8200027dea27a8e0d1087c181f9235315 100644
--- a/Source/core/rendering/RenderListBox.cpp
+++ b/Source/core/rendering/RenderListBox.cpp
@@ -90,7 +90,7 @@ RenderListBox::RenderListBox(Element* element)
{
ASSERT(element);
ASSERT(element->isHTMLElement());
- ASSERT(element->hasTagName(HTMLNames::selectTag));
+ ASSERT(isHTMLSelectElement(element));
if (FrameView* frameView = frame()->view())
frameView->addScrollableArea(this);
@@ -129,10 +129,10 @@ void RenderListBox::updateFromElement()
HTMLElement* element = listItems[i];
String text;
Font itemFont = style()->font();
- if (element->hasTagName(optionTag)) {
- text = toHTMLOptionElement(element)->textIndentedToRespectGroupLabel();
- } else if (element->hasTagName(optgroupTag)) {
- text = toHTMLOptGroupElement(element)->groupLabelText();
+ if (isHTMLOptionElement(*element)) {
+ text = toHTMLOptionElement(*element).textIndentedToRespectGroupLabel();
+ } else if (isHTMLOptGroupElement(*element)) {
+ text = toHTMLOptGroupElement(*element).groupLabelText();
FontDescription d = itemFont.fontDescription();
d.setWeight(d.bolderWeight());
itemFont = Font(d);
@@ -352,7 +352,7 @@ void RenderListBox::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint&
const Vector<HTMLElement*>& listItems = select->listItems();
for (int i = 0; i < size; ++i) {
HTMLElement* element = listItems[i];
- if (element->hasTagName(optionTag) && !element->isDisabledFormControl()) {
+ if (isHTMLOptionElement(*element) && !element->isDisabledFormControl()) {
rects.append(pixelSnappedIntRect(itemBoundingBoxRect(additionalOffset, i)));
return;
}
@@ -418,15 +418,15 @@ void RenderListBox::paintItemForeground(PaintInfo& paintInfo, const LayoutPoint&
return;
String itemText;
- bool isOptionElement = element->hasTagName(optionTag);
+ bool isOptionElement = isHTMLOptionElement(*element);
if (isOptionElement)
- itemText = toHTMLOptionElement(element)->textIndentedToRespectGroupLabel();
- else if (element->hasTagName(optgroupTag))
- itemText = toHTMLOptGroupElement(element)->groupLabelText();
+ itemText = toHTMLOptionElement(*element).textIndentedToRespectGroupLabel();
+ else if (isHTMLOptGroupElement(*element))
+ itemText = toHTMLOptGroupElement(*element).groupLabelText();
applyTextTransform(style(), itemText, ' ');
Color textColor = element->renderStyle() ? resolveColor(element->renderStyle(), CSSPropertyColor) : resolveColor(CSSPropertyColor);
- if (isOptionElement && toHTMLOptionElement(element)->selected()) {
+ if (isOptionElement && toHTMLOptionElement(*element).selected()) {
if (frame()->selection().isFocusedAndActive() && document().focusedElement() == node())
textColor = RenderTheme::theme().activeListBoxSelectionForegroundColor();
// Honor the foreground color for disabled items
@@ -441,7 +441,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);
@@ -460,7 +460,7 @@ void RenderListBox::paintItemBackground(PaintInfo& paintInfo, const LayoutPoint&
HTMLElement* element = listItems[listIndex];
Color backColor;
- if (element->hasTagName(optionTag) && toHTMLOptionElement(element)->selected()) {
+ if (isHTMLOptionElement(*element) && toHTMLOptionElement(*element).selected()) {
if (frame()->selection().isFocusedAndActive() && document().focusedElement() == node())
backColor = RenderTheme::theme().activeListBoxSelectionBackgroundColor();
else
« no previous file with comments | « Source/core/rendering/RenderLayer.cpp ('k') | Source/core/rendering/RenderListItem.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698