Skip to content

Commit

Permalink
WebContent: Add IPC for setting 'device pixels per CSS pixel'
Browse files Browse the repository at this point in the history
  • Loading branch information
linusg committed Jan 12, 2023
1 parent 075b4ca commit f3b6b50
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion Userland/Services/WebContent/ConnectionFromClient.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2020-2022, Andreas Kling <[email protected]>
* Copyright (c) 2021, Sam Atkins <[email protected]>
* Copyright (c) 2021-2022, Linus Groh <[email protected]>
* Copyright (c) 2021-2023, Linus Groh <[email protected]>
* Copyright (c) 2022, Tobias Christiansen <[email protected]>
* Copyright (c) 2022, Tim Flynn <[email protected]>
*
Expand Down Expand Up @@ -530,6 +530,11 @@ void ConnectionFromClient::set_is_scripting_enabled(bool is_scripting_enabled)
m_page_host->set_is_scripting_enabled(is_scripting_enabled);
}

void ConnectionFromClient::set_device_pixels_per_css_pixel(float device_pixels_per_css_pixel)
{
m_page_host->set_device_pixels_per_css_pixel(device_pixels_per_css_pixel);
}

void ConnectionFromClient::set_window_position(Gfx::IntPoint position)
{
m_page_host->set_window_position(position.to_type<Web::DevicePixels>());
Expand Down
3 changes: 2 additions & 1 deletion Userland/Services/WebContent/ConnectionFromClient.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2018-2021, Andreas Kling <[email protected]>
* Copyright (c) 2021-2022, Linus Groh <[email protected]>
* Copyright (c) 2021-2023, Linus Groh <[email protected]>
* Copyright (c) 2022, Tim Flynn <[email protected]>
*
* SPDX-License-Identifier: BSD-2-Clause
Expand Down Expand Up @@ -76,6 +76,7 @@ class ConnectionFromClient final
virtual void set_preferred_color_scheme(Web::CSS::PreferredColorScheme const&) override;
virtual void set_has_focus(bool) override;
virtual void set_is_scripting_enabled(bool) override;
virtual void set_device_pixels_per_css_pixel(float) override;
virtual void set_window_position(Gfx::IntPoint) override;
virtual void set_window_size(Gfx::IntSize) override;
virtual void handle_file_return(i32 error, Optional<IPC::File> const& file, i32 request_id) override;
Expand Down
1 change: 0 additions & 1 deletion Userland/Services/WebContent/PageHost.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ class PageHost final : public Web::PageClient {
RefPtr<Gfx::PaletteImpl> m_palette_impl;
Web::DevicePixelRect m_screen_rect;
Web::DevicePixelSize m_content_size;
// FIXME: Actually set this based on the device's pixel ratio.
float m_device_pixels_per_css_pixel { 1.0f };
bool m_should_show_line_box_borders { false };
bool m_has_focus { false };
Expand Down
1 change: 1 addition & 0 deletions Userland/Services/WebContent/WebContentServer.ipc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ endpoint WebContentServer
set_preferred_color_scheme(Web::CSS::PreferredColorScheme color_scheme) =|
set_has_focus(bool has_focus) =|
set_is_scripting_enabled(bool is_scripting_enabled) =|
set_device_pixels_per_css_pixel(float device_pixels_per_css_pixel) =|

set_window_position(Gfx::IntPoint position) =|
set_window_size(Gfx::IntSize size) =|
Expand Down

0 comments on commit f3b6b50

Please sign in to comment.