Commit cf07c839 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

Avoid FragmentData::VisualRect() in ThemePainter

Bug: 1104064
Change-Id: Idae3d296992c08ed9c2af032e345e57795b8fe34
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2309753
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#790627}
parent 9558a61e
......@@ -339,13 +339,8 @@ void ThemePainter::PaintSliderTicks(const LayoutObject& o,
input->UserAgentShadowRoot()
->getElementById(shadow_element_names::SliderThumb())
->GetLayoutObject();
if (thumb_layout_object) {
const ComputedStyle& thumb_style = thumb_layout_object->StyleRef();
int thumb_width = thumb_style.Width().IntValue();
int thumb_height = thumb_style.Height().IntValue();
thumb_size.SetWidth(is_horizontal ? thumb_width : thumb_height);
thumb_size.SetHeight(is_horizontal ? thumb_height : thumb_width);
}
if (thumb_layout_object && thumb_layout_object->IsBox())
thumb_size = FlooredIntSize(ToLayoutBox(thumb_layout_object)->Size());
IntSize tick_size = LayoutTheme::GetTheme().SliderTickSize();
float zoom_factor = o.StyleRef().EffectiveZoom();
......@@ -357,8 +352,11 @@ void ThemePainter::PaintSliderTicks(const LayoutObject& o,
input->UserAgentShadowRoot()
->getElementById(shadow_element_names::SliderTrack())
->GetLayoutObject();
if (track_layout_object)
track_bounds = track_layout_object->FirstFragment().VisualRect();
if (track_layout_object && track_layout_object->IsBox()) {
track_bounds = IntRect(
CeiledIntPoint(track_layout_object->FirstFragment().PaintOffset()),
FlooredIntSize(ToLayoutBox(track_layout_object)->Size()));
}
if (is_horizontal) {
tick_rect.SetWidth(floor(tick_size.Width() * zoom_factor));
......@@ -380,8 +378,8 @@ void ThemePainter::PaintSliderTicks(const LayoutObject& o,
zoom_factor));
tick_region_side_margin =
track_bounds.Y() +
(thumb_size.Width() - tick_size.Width() * zoom_factor) / 2.0;
tick_region_width = track_bounds.Height() - thumb_size.Width();
(thumb_size.Height() - tick_size.Width() * zoom_factor) / 2.0;
tick_region_width = track_bounds.Height() - thumb_size.Height();
}
HTMLDataListOptionsCollection* options = data_list->options();
for (unsigned i = 0; HTMLOptionElement* option_element = options->Item(i);
......
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