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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutMenuList.cpp

Issue 2361113003: Apply SELECT's style on calculating intrinsic width of menulist SELECTs. (Closed)
Patch Set: Created 4 years, 3 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 | « third_party/WebKit/Source/core/layout/LayoutMenuList.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutMenuList.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutMenuList.cpp b/third_party/WebKit/Source/core/layout/LayoutMenuList.cpp
index 9b7d92eaadc11706d8ac0ddef4a270d23067ea36..23fbc0ca04998e6d7621efd43dd6426f345ad3e5 100644
--- a/third_party/WebKit/Source/core/layout/LayoutMenuList.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutMenuList.cpp
@@ -163,18 +163,14 @@ void LayoutMenuList::updateOptionsWidth() const
String text = option->textIndentedToRespectGroupLabel();
const ComputedStyle* itemStyle = option->computedStyle() ? option->computedStyle() : style();
applyTextTransform(itemStyle, text, ' ');
- TextRun textRun = constructTextRun(itemStyle->font(), text, *itemStyle);
-
- maxOptionWidth = std::max(maxOptionWidth, computeTextWidth(textRun, *itemStyle));
+ // We apply SELECT's style, not OPTION's style because m_optionsWidth is
+ // used to determine intrinsic width of the menulist box.
+ TextRun textRun = constructTextRun(style()->font(), text, *style());
+ maxOptionWidth = std::max(maxOptionWidth, style()->font().width(textRun));
}
m_optionsWidth = static_cast<int>(ceilf(maxOptionWidth));
}
-float LayoutMenuList::computeTextWidth(const TextRun& textRun, const ComputedStyle& computedStyle) const
-{
- return computedStyle.font().width(textRun);
-}
-
void LayoutMenuList::updateFromElement()
{
HTMLSelectElement* select = selectElement();
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutMenuList.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698