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, ...@@ -339,13 +339,8 @@ void ThemePainter::PaintSliderTicks(const LayoutObject& o,
input->UserAgentShadowRoot() input->UserAgentShadowRoot()
->getElementById(shadow_element_names::SliderThumb()) ->getElementById(shadow_element_names::SliderThumb())
->GetLayoutObject(); ->GetLayoutObject();
if (thumb_layout_object) { if (thumb_layout_object && thumb_layout_object->IsBox())
const ComputedStyle& thumb_style = thumb_layout_object->StyleRef(); thumb_size = FlooredIntSize(ToLayoutBox(thumb_layout_object)->Size());
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);
}
IntSize tick_size = LayoutTheme::GetTheme().SliderTickSize(); IntSize tick_size = LayoutTheme::GetTheme().SliderTickSize();
float zoom_factor = o.StyleRef().EffectiveZoom(); float zoom_factor = o.StyleRef().EffectiveZoom();
...@@ -357,8 +352,11 @@ void ThemePainter::PaintSliderTicks(const LayoutObject& o, ...@@ -357,8 +352,11 @@ void ThemePainter::PaintSliderTicks(const LayoutObject& o,
input->UserAgentShadowRoot() input->UserAgentShadowRoot()
->getElementById(shadow_element_names::SliderTrack()) ->getElementById(shadow_element_names::SliderTrack())
->GetLayoutObject(); ->GetLayoutObject();
if (track_layout_object) if (track_layout_object && track_layout_object->IsBox()) {
track_bounds = track_layout_object->FirstFragment().VisualRect(); track_bounds = IntRect(
CeiledIntPoint(track_layout_object->FirstFragment().PaintOffset()),
FlooredIntSize(ToLayoutBox(track_layout_object)->Size()));
}
if (is_horizontal) { if (is_horizontal) {
tick_rect.SetWidth(floor(tick_size.Width() * zoom_factor)); tick_rect.SetWidth(floor(tick_size.Width() * zoom_factor));
...@@ -380,8 +378,8 @@ void ThemePainter::PaintSliderTicks(const LayoutObject& o, ...@@ -380,8 +378,8 @@ void ThemePainter::PaintSliderTicks(const LayoutObject& o,
zoom_factor)); zoom_factor));
tick_region_side_margin = tick_region_side_margin =
track_bounds.Y() + track_bounds.Y() +
(thumb_size.Width() - tick_size.Width() * zoom_factor) / 2.0; (thumb_size.Height() - tick_size.Width() * zoom_factor) / 2.0;
tick_region_width = track_bounds.Height() - thumb_size.Width(); tick_region_width = track_bounds.Height() - thumb_size.Height();
} }
HTMLDataListOptionsCollection* options = data_list->options(); HTMLDataListOptionsCollection* options = data_list->options();
for (unsigned i = 0; HTMLOptionElement* option_element = options->Item(i); 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