LibWeb: Update layout after dispatching initial mouse events

Since #8182, we've been verifying "is the layout up to date" in more
places. After dispatching mouseup/pointerup, the layout could have been
changed again and we need to update it before trying to run activation
behaviors.

Fixes opening/closing an email's details in Roundcube webmail.
This commit is contained in:
Jelle Raaijmakers
2026-03-02 12:38:19 +01:00
committed by Andreas Kling
parent e99ff65a58
commit d73b268445
Notes: github-actions[bot] 2026-03-02 16:55:36 +00:00
2 changed files with 17 additions and 0 deletions

View File

@@ -733,6 +733,9 @@ EventResult EventHandler::handle_mouseup(CSSPixelPoint visual_viewport_position,
// then step 8 of this algorithm needs to be implemented in Navigable::choose_a_navigable:
// https://html.spec.whatwg.org/multipage/document-sequences.html#the-rules-for-choosing-a-navigable
// NOTE: Event dispatches above may have run JS that invalidated layout.
m_navigable->active_document()->update_layout(DOM::UpdateLayoutReason::EventHandlerHandleMouseUp);
auto top_level_viewport_position = m_navigable->to_top_level_position(viewport_position);
if (GC::Ptr<HTML::HTMLAnchorElement const> link = node->enclosing_link_element()) {
GC::Ref<DOM::Document> document = *m_navigable->active_document();