diff options
author | Timothy Flynn <trflynn89@pm.me> | 2023-04-10 06:56:22 -0400 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2023-04-10 10:15:48 -0400 |
commit | d0e18b8a17f28f14b940dd6b85c46f09567f0ced (patch) | |
tree | 95aa4caaf1ca9921a953f35b8cd7d5f412636de9 /Userland | |
parent | d05d938e738fa2b0de0b5e1412384a0b843b4863 (diff) | |
download | serenity-d0e18b8a17f28f14b940dd6b85c46f09567f0ced.zip |
LibWeb: Convert video control dimensions from CSSPixels to DevicePixels
Rather than storing static DevicePixels dimensions, treat the desired
pixel sizes as CSSPixels and convert them to DevicePixels.
This was originally developed on a mac with a device-to-CSS-pixel ratio
of 2. Running it on another machine with a ratio of 1 made the controls
appear huge.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibWeb/Painting/VideoPaintable.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Libraries/LibWeb/Painting/VideoPaintable.cpp b/Userland/Libraries/LibWeb/Painting/VideoPaintable.cpp index 9d3e12f69c..b516272d42 100644 --- a/Userland/Libraries/LibWeb/Painting/VideoPaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/VideoPaintable.cpp @@ -86,9 +86,9 @@ void VideoPaintable::paint(PaintContext& context, PaintPhase phase) const void VideoPaintable::paint_loaded_video_controls(PaintContext& context, HTML::HTMLVideoElement const& video_element, DevicePixelRect video_rect, Optional<DevicePixelPoint> const& mouse_position) const { - static constexpr DevicePixels maximum_control_box_size = 60; - static constexpr DevicePixels maximum_playback_button_size = 30; - static constexpr DevicePixels maximum_playback_button_offset_x = 30; + auto maximum_control_box_size = context.rounded_device_pixels(30); + auto maximum_playback_button_size = context.rounded_device_pixels(15); + auto maximum_playback_button_offset_x = context.rounded_device_pixels(15); auto is_hovered = document().hovered_node() == &video_element; auto is_paused = video_element.paused(); @@ -141,8 +141,8 @@ void VideoPaintable::paint_loaded_video_controls(PaintContext& context, HTML::HT void VideoPaintable::paint_placeholder_video_controls(PaintContext& context, DevicePixelRect video_rect, Optional<DevicePixelPoint> const& mouse_position) const { - static constexpr DevicePixels maximum_control_box_size = 200; - static constexpr DevicePixels maximum_playback_button_size = 80; + auto maximum_control_box_size = context.rounded_device_pixels(100); + auto maximum_playback_button_size = context.rounded_device_pixels(40); auto center = video_rect.center(); |