1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 20:27:34 +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:
Sam Atkins 2022-11-03 12:49:54 +00:00 committed by Linus Groh
parent 8fb7c32ec3
commit affc8a22ca
23 changed files with 68 additions and 70 deletions

View file

@ -799,7 +799,7 @@ CSSPixelPoint EventHandler::compute_mouse_event_client_offset(CSSPixelPoint even
// The clientX attribute must return the x-coordinate of the position where the event occurred relative to the origin of the viewport.
auto scroll_offset = m_browsing_context.viewport_scroll_offset();
return event_page_position.translated(-scroll_offset.to_rounded<CSSPixels>());
return event_page_position.translated(-scroll_offset);
}
CSSPixelPoint EventHandler::compute_mouse_event_page_offset(CSSPixelPoint event_client_offset) const
@ -811,6 +811,6 @@ CSSPixelPoint EventHandler::compute_mouse_event_page_offset(CSSPixelPoint event_
auto scroll_offset = m_browsing_context.viewport_scroll_offset();
// 3. Return the sum of offset and the value of the events clientX attribute.
return event_client_offset.translated(scroll_offset.to_rounded<CSSPixels>());
return event_client_offset.translated(scroll_offset);
}
}

View file

@ -87,11 +87,11 @@ public:
bool is_webdriver_active() const { return m_is_webdriver_active; }
void set_is_webdriver_active(bool b) { m_is_webdriver_active = b; }
Gfx::IntPoint window_position() const { return m_window_position; }
void set_window_position(Gfx::IntPoint position) { m_window_position = position; }
DevicePixelPoint window_position() const { return m_window_position; }
void set_window_position(DevicePixelPoint position) { m_window_position = position; }
Gfx::IntSize window_size() const { return m_window_size; }
void set_window_size(Gfx::IntSize size) { m_window_size = size; }
DevicePixelSize window_size() const { return m_window_size; }
void set_window_size(DevicePixelSize size) { m_window_size = size; }
void did_request_alert(DeprecatedString const& message);
void alert_closed();
@ -131,8 +131,8 @@ private:
// The webdriver-active flag is set to true when the user agent is under remote control. It is initially false.
bool m_is_webdriver_active { false };
Gfx::IntPoint m_window_position {};
Gfx::IntSize m_window_size {};
DevicePixelPoint m_window_position {};
DevicePixelSize m_window_size {};
PendingDialog m_pending_dialog { PendingDialog::None };
Optional<DeprecatedString> m_pending_dialog_text;