Commit 29a56c3a authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

[Squad] Use SetOverrideLogicalWidth for single line placeholder.

We need the special-cased width because of some icon taking up space
for input type="search". However, we should not modify computed style
to do so. Instead use SetOverrideLogicalWidth().

Gets rid of MutableStyleRef() access.

TEST=fast/forms/placeholder-position.html

Bug: 813068
Change-Id: I93886bc8c53ff84b3c37a0cc543ab7dc274a758f
Reviewed-on: https://chromium-review.googlesource.com/1041932
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555729}
parent 34914994
......@@ -131,13 +131,11 @@ void LayoutTextControlSingleLine::UpdateLayout() {
HTMLElement* placeholder_element = InputElement()->PlaceholderElement();
if (LayoutBox* placeholder_box =
placeholder_element ? placeholder_element->GetLayoutBox() : nullptr) {
LayoutSize inner_editor_size;
LayoutUnit inner_editor_logical_width;
if (inner_editor_layout_object)
inner_editor_size = inner_editor_layout_object->Size();
placeholder_box->MutableStyleRef().SetWidth(Length(
inner_editor_size.Width() - placeholder_box->BorderAndPaddingWidth(),
kFixed));
inner_editor_logical_width = inner_editor_layout_object->LogicalWidth();
placeholder_box->SetOverrideLogicalWidth(inner_editor_logical_width);
bool needed_layout = placeholder_box->NeedsLayout();
placeholder_box->LayoutIfNeeded();
LayoutPoint text_offset;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment