mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:18:12 +00:00
LibWeb: Change viewport ownership from BrowsingContext
to Navigable
This commit is contained in:
parent
4356d37b2c
commit
dd7bba66ed
23 changed files with 196 additions and 129 deletions
|
@ -517,7 +517,7 @@ bool EventHandler::handle_mousemove(CSSPixelPoint position, CSSPixelPoint screen
|
|||
else
|
||||
(void)selection->set_base_and_extent(*hit->paintable->dom_node(), hit->index_in_node, *hit->paintable->dom_node(), hit->index_in_node);
|
||||
}
|
||||
m_browsing_context->set_needs_display();
|
||||
document.navigable()->set_needs_display();
|
||||
}
|
||||
if (auto* page = m_browsing_context->page())
|
||||
page->client().page_did_change_selection();
|
||||
|
@ -822,7 +822,7 @@ CSSPixelPoint EventHandler::compute_mouse_event_client_offset(CSSPixelPoint even
|
|||
// https://w3c.github.io/csswg-drafts/cssom-view/#dom-mouseevent-clientx
|
||||
// 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();
|
||||
auto scroll_offset = m_browsing_context->active_document()->navigable()->viewport_scroll_offset();
|
||||
return event_page_position.translated(-scroll_offset);
|
||||
}
|
||||
|
||||
|
@ -832,7 +832,7 @@ CSSPixelPoint EventHandler::compute_mouse_event_page_offset(CSSPixelPoint event_
|
|||
// FIXME: 1. If the event’s dispatch flag is set, return the horizontal coordinate of the position where the event occurred relative to the origin of the initial containing block and terminate these steps.
|
||||
|
||||
// 2. Let offset be the value of the scrollX attribute of the event’s associated Window object, if there is one, or zero otherwise.
|
||||
auto scroll_offset = m_browsing_context->viewport_scroll_offset();
|
||||
auto scroll_offset = m_browsing_context->active_document()->navigable()->viewport_scroll_offset();
|
||||
|
||||
// 3. Return the sum of offset and the value of the event’s clientX attribute.
|
||||
return event_client_offset.translated(scroll_offset);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue