mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:27:45 +00:00
LibWeb+WebContent: Convert BrowsingContext to new pixel units
This fixes a few glitches. We no longer give the page double the width it should have, and we mark the correct area of the page as needing repainting.
This commit is contained in:
parent
8fb7c32ec3
commit
affc8a22ca
23 changed files with 68 additions and 70 deletions
|
@ -112,7 +112,7 @@ void ConnectionFromClient::load_html(DeprecatedString const& html, const URL& ur
|
|||
void ConnectionFromClient::set_viewport_rect(Gfx::IntRect const& rect)
|
||||
{
|
||||
dbgln_if(SPAM_DEBUG, "handle: WebContentServer::SetViewportRect: rect={}", rect);
|
||||
m_page_host->set_viewport_rect(rect);
|
||||
m_page_host->set_viewport_rect(rect.to_type<Web::DevicePixels>());
|
||||
}
|
||||
|
||||
void ConnectionFromClient::add_backing_store(i32 backing_store_id, Gfx::ShareableBitmap const& bitmap)
|
||||
|
@ -532,12 +532,12 @@ void ConnectionFromClient::set_is_scripting_enabled(bool is_scripting_enabled)
|
|||
|
||||
void ConnectionFromClient::set_window_position(Gfx::IntPoint position)
|
||||
{
|
||||
m_page_host->set_window_position(position);
|
||||
m_page_host->set_window_position(position.to_type<Web::DevicePixels>());
|
||||
}
|
||||
|
||||
void ConnectionFromClient::set_window_size(Gfx::IntSize size)
|
||||
{
|
||||
m_page_host->set_window_size(size);
|
||||
m_page_host->set_window_size(size.to_type<Web::DevicePixels>());
|
||||
}
|
||||
|
||||
Messages::WebContentServer::GetLocalStorageEntriesResponse ConnectionFromClient::get_local_storage_entries()
|
||||
|
|
|
@ -79,12 +79,12 @@ void PageHost::set_is_scripting_enabled(bool is_scripting_enabled)
|
|||
page().set_is_scripting_enabled(is_scripting_enabled);
|
||||
}
|
||||
|
||||
void PageHost::set_window_position(Gfx::IntPoint position)
|
||||
void PageHost::set_window_position(Web::DevicePixelPoint position)
|
||||
{
|
||||
page().set_window_position(position);
|
||||
}
|
||||
|
||||
void PageHost::set_window_size(Gfx::IntSize size)
|
||||
void PageHost::set_window_size(Web::DevicePixelSize size)
|
||||
{
|
||||
page().set_window_size(size);
|
||||
}
|
||||
|
@ -125,9 +125,9 @@ void PageHost::paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap& targ
|
|||
layout_root->paint_all_phases(context);
|
||||
}
|
||||
|
||||
void PageHost::set_viewport_rect(Gfx::IntRect const& rect)
|
||||
void PageHost::set_viewport_rect(Web::DevicePixelRect const& rect)
|
||||
{
|
||||
page().top_level_browsing_context().set_viewport_rect(rect);
|
||||
page().top_level_browsing_context().set_viewport_rect(page().device_to_css_rect(rect));
|
||||
}
|
||||
|
||||
void PageHost::page_did_invalidate(Web::CSSPixelRect const& content_rect)
|
||||
|
|
|
@ -30,15 +30,15 @@ public:
|
|||
virtual void paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap&) override;
|
||||
|
||||
void set_palette_impl(Gfx::PaletteImpl const&);
|
||||
void set_viewport_rect(Gfx::IntRect const&);
|
||||
void set_viewport_rect(Web::DevicePixelRect const&);
|
||||
void set_screen_rects(Vector<Gfx::IntRect, 4> const& rects, size_t main_screen_index) { m_screen_rect = rects[main_screen_index].to_type<Web::DevicePixels>(); }
|
||||
void set_screen_display_scale(float device_pixels_per_css_pixel) { m_screen_display_scale = device_pixels_per_css_pixel; }
|
||||
void set_preferred_color_scheme(Web::CSS::PreferredColorScheme);
|
||||
void set_should_show_line_box_borders(bool b) { m_should_show_line_box_borders = b; }
|
||||
void set_has_focus(bool);
|
||||
void set_is_scripting_enabled(bool);
|
||||
void set_window_position(Gfx::IntPoint);
|
||||
void set_window_size(Gfx::IntSize);
|
||||
void set_window_position(Web::DevicePixelPoint);
|
||||
void set_window_size(Web::DevicePixelSize);
|
||||
|
||||
Web::DevicePixelSize content_size() const { return m_content_size; }
|
||||
|
||||
|
|
|
@ -606,7 +606,7 @@ Messages::WebDriverClient::SetWindowRectResponse WebDriverConnection::set_window
|
|||
auto size = m_page_client.page_did_request_resize_window({ *width, *height });
|
||||
window_rect.set_size(size);
|
||||
} else {
|
||||
window_rect.set_size(m_page_client.page().window_size());
|
||||
window_rect.set_size(m_page_client.page().window_size().to_type<int>());
|
||||
}
|
||||
|
||||
// 12. If x and y are not null:
|
||||
|
@ -615,7 +615,7 @@ Messages::WebDriverClient::SetWindowRectResponse WebDriverConnection::set_window
|
|||
auto position = m_page_client.page_did_request_reposition_window({ *x, *y });
|
||||
window_rect.set_location(position);
|
||||
} else {
|
||||
window_rect.set_location(m_page_client.page().window_position());
|
||||
window_rect.set_location(m_page_client.page().window_position().to_type<int>());
|
||||
}
|
||||
|
||||
// 14. Return success with data set to the WindowRect object for the current top-level browsing context.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue