Commit 235eeefa authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Don't EnsureComputedStyle in LayoutTextControlSingleLine.

We do have a LayoutObject for the spinner which means we have a
ComputedStyle already.

Also added some documentation to EnsureComputedStyle for <area>.

Bug: 895894
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ie0ee5c75fae0f699721a30f3072eec526c50083e
Reviewed-on: https://chromium-review.googlesource.com/c/1286412
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600600}
parent 94c429b1
......@@ -244,10 +244,10 @@ LayoutUnit LayoutTextControlSingleLine::PreferredContentLogicalWidth(
if (LayoutBox* spin_layout_object =
spin_button ? spin_button->GetLayoutBox() : nullptr) {
result += spin_layout_object->BorderAndPaddingLogicalWidth();
// Since the width of spinLayoutObject is not calculated yet,
// spinLayoutObject->logicalWidth() returns 0.
// So ensureComputedStyle()->logicalWidth() is used instead.
result += spin_button->EnsureComputedStyle()->LogicalWidth().Value();
// Since the width of spin_layout_object is not calculated yet,
// spin_layout_object->LogicalWidth() returns 0. Use the computed logical
// width instead.
result += spin_layout_object->StyleRef().LogicalWidth().Value();
}
}
......
......@@ -52,6 +52,8 @@ void ImagePainter::PaintAreaElementFocusRing(const PaintInfo& paint_info) {
// do it for an area within an image, so we don't call
// LayoutTheme::themeDrawsFocusRing here.
// We use EnsureComputedStyle() instead of GetComputedStyle() here because
// <area> is used and its style applied even if it has display:none.
const ComputedStyle& area_element_style = *area_element.EnsureComputedStyle();
// If the outline width is 0 we want to avoid drawing anything even if we
// don't use the value directly.
......
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