mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +00:00
Ladybird/AppKit: Listen for device pixel ratio changes
This commit is contained in:
parent
7718842829
commit
0574c0e474
6 changed files with 28 additions and 5 deletions
|
@ -34,7 +34,6 @@ WebViewBridge::WebViewBridge(Vector<Gfx::IntRect> screen_rects, float device_pix
|
|||
, m_preferred_color_scheme(preferred_color_scheme)
|
||||
{
|
||||
m_device_pixel_ratio = device_pixel_ratio;
|
||||
m_inverse_device_pixel_ratio = 1.0 / device_pixel_ratio;
|
||||
|
||||
create_client(WebView::EnableCallgrindProfiling::No);
|
||||
|
||||
|
@ -70,6 +69,12 @@ WebViewBridge::WebViewBridge(Vector<Gfx::IntRect> screen_rects, float device_pix
|
|||
|
||||
WebViewBridge::~WebViewBridge() = default;
|
||||
|
||||
void WebViewBridge::set_device_pixel_ratio(float device_pixel_ratio)
|
||||
{
|
||||
m_device_pixel_ratio = device_pixel_ratio;
|
||||
client().async_set_device_pixels_per_css_pixel(device_pixel_ratio);
|
||||
}
|
||||
|
||||
void WebViewBridge::set_system_visibility_state(bool is_visible)
|
||||
{
|
||||
client().async_set_system_visibility_state(is_visible);
|
||||
|
@ -169,7 +174,7 @@ Gfx::IntPoint WebViewBridge::to_content_position(Gfx::IntPoint widget_position)
|
|||
|
||||
Gfx::IntPoint WebViewBridge::to_widget_position(Gfx::IntPoint content_position) const
|
||||
{
|
||||
return scale_for_device(content_position, m_inverse_device_pixel_ratio);
|
||||
return scale_for_device(content_position, inverse_device_pixel_ratio());
|
||||
}
|
||||
|
||||
void WebViewBridge::create_client(WebView::EnableCallgrindProfiling enable_callgrind_profiling)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue