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

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

Issue 889563002: Make RenderObject::style() return a const object (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Blind fix for Mac. Created 5 years, 11 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/rendering/RenderMenuList.cpp
diff --git a/Source/core/rendering/RenderMenuList.cpp b/Source/core/rendering/RenderMenuList.cpp
index ea821c5f7b406677c36fde93707f1bbf63a75bf6..c453ca6b30b70fdd80d6d24a3a5f8eb809d95f28 100644
--- a/Source/core/rendering/RenderMenuList.cpp
+++ b/Source/core/rendering/RenderMenuList.cpp
@@ -86,7 +86,7 @@ void RenderMenuList::trace(Visitor* visitor)
// FIXME: Instead of this hack we should add a ShadowRoot to <select> with no insertion point
// to prevent children from rendering.
-bool RenderMenuList::isChildAllowed(RenderObject* object, RenderStyle*) const
+bool RenderMenuList::isChildAllowed(RenderObject* object, const RenderStyle*) const
{
return object->isAnonymous() && !object->isRenderFullScreen();
}
@@ -108,7 +108,7 @@ void RenderMenuList::createInnerBlock()
void RenderMenuList::adjustInnerStyle()
{
- RenderStyle* innerStyle = m_innerBlock->style();
+ RenderStyle* innerStyle = m_innerBlock->deprecatedMutableStyle();
innerStyle->setFlexGrow(1);
innerStyle->setFlexShrink(1);
// Use margin:auto instead of align-items:center to get safe centering, i.e.
@@ -120,10 +120,10 @@ void RenderMenuList::adjustInnerStyle()
innerStyle->setAlignSelf(ItemPositionFlexStart);
}
- innerStyle->setPaddingLeft(Length(LayoutTheme::theme().popupInternalPaddingLeft(style()), Fixed));
- innerStyle->setPaddingRight(Length(LayoutTheme::theme().popupInternalPaddingRight(style()), Fixed));
- innerStyle->setPaddingTop(Length(LayoutTheme::theme().popupInternalPaddingTop(style()), Fixed));
- innerStyle->setPaddingBottom(Length(LayoutTheme::theme().popupInternalPaddingBottom(style()), Fixed));
+ innerStyle->setPaddingLeft(Length(LayoutTheme::theme().popupInternalPaddingLeft(deprecatedMutableStyle()), Fixed));
+ innerStyle->setPaddingRight(Length(LayoutTheme::theme().popupInternalPaddingRight(deprecatedMutableStyle()), Fixed));
+ innerStyle->setPaddingTop(Length(LayoutTheme::theme().popupInternalPaddingTop(deprecatedMutableStyle()), Fixed));
+ innerStyle->setPaddingBottom(Length(LayoutTheme::theme().popupInternalPaddingBottom(deprecatedMutableStyle()), Fixed));
if (m_optionStyle) {
if ((m_optionStyle->direction() != innerStyle->direction() || m_optionStyle->unicodeBidi() != innerStyle->unicodeBidi()))
@@ -163,7 +163,7 @@ void RenderMenuList::styleDidChange(StyleDifference diff, const RenderStyle* old
RenderBlock::styleDidChange(diff, oldStyle);
if (m_buttonText)
- m_buttonText->setStyle(style());
+ m_buttonText->setStyle(deprecatedMutableStyle());
if (m_innerBlock) // RenderBlock handled updating the anonymous block's style.
adjustInnerStyle();
@@ -188,7 +188,7 @@ void RenderMenuList::updateOptionsWidth()
if (LayoutTheme::theme().popupOptionSupportsTextIndent()) {
// Add in the option's text indent. We can't calculate percentage values for now.
float optionWidth = 0;
- if (RenderStyle* optionStyle = element->renderStyle())
+ if (const RenderStyle* optionStyle = element->renderStyle())
optionWidth += minimumValueForLength(optionStyle->textIndent(), 0);
if (!text.isEmpty())
optionWidth += style()->font().width(text);
@@ -252,7 +252,7 @@ void RenderMenuList::setTextFromOption(int optionIndex)
HTMLOptionElement* selectedOptionElement = toHTMLOptionElement(listItems[firstSelectedIndex]);
ASSERT(selectedOptionElement->selected());
text = selectedOptionElement->textIndentedToRespectGroupLabel();
- m_optionStyle = selectedOptionElement->renderStyle();
+ m_optionStyle = selectedOptionElement->mutableRenderStyle();
} else {
Locale& locale = select->locale();
String localizedNumberString = locale.convertToLocalizedNumber(String::number(selectedCount));
@@ -265,7 +265,7 @@ void RenderMenuList::setTextFromOption(int optionIndex)
Element* element = listItems[i];
if (isHTMLOptionElement(*element)) {
text = toHTMLOptionElement(element)->textIndentedToRespectGroupLabel();
- m_optionStyle = element->renderStyle();
+ m_optionStyle = element->mutableRenderStyle();
}
}
}
@@ -285,7 +285,7 @@ void RenderMenuList::setText(const String& s)
if (m_buttonText)
m_buttonText->destroy();
m_buttonText = new RenderBR(&document());
- m_buttonText->setStyle(style());
+ m_buttonText->setStyle(deprecatedMutableStyle());
addChild(m_buttonText);
}
} else {
@@ -298,7 +298,7 @@ void RenderMenuList::setText(const String& s)
if (m_buttonText)
m_buttonText->destroy();
m_buttonText = new RenderText(&document(), s.impl());
- m_buttonText->setStyle(style());
+ m_buttonText->setStyle(deprecatedMutableStyle());
// We need to set the text explicitly though it was specified in the
// constructor because RenderText doesn't refer to the text
// specified in the constructor in a case of re-transforming.
@@ -481,7 +481,7 @@ PopupMenuStyle RenderMenuList::itemStyle(unsigned listIndex) const
bool itemHasCustomBackgroundColor;
getItemBackgroundColor(listIndex, itemBackgroundColor, itemHasCustomBackgroundColor);
- RenderStyle* style = element->renderStyle() ? element->renderStyle() : element->computedStyle();
+ const RenderStyle* style = element->renderStyle() ? element->renderStyle() : element->computedStyle();
return style ? PopupMenuStyle(resolveColor(style, CSSPropertyColor), itemBackgroundColor, style->font(), style->visibility() == VISIBLE,
isHTMLOptionElement(*element) ? toHTMLOptionElement(*element).isDisplayNone() : style->display() == NONE,
style->textIndent(), style->direction(), isOverride(style->unicodeBidi()),

Powered by Google App Engine
This is Rietveld 408576698