mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 15:49:11 +00:00
LibWeb: Fire resize event at VisualViewport in the resize steps
Used on x.com to determine the layout to use on resize.
This commit is contained in:
parent
d21bac8028
commit
18b75afef8
Notes:
github-actions[bot]
2025-01-29 08:24:46 +00:00
Author: https://github.com/Lubrsi
Commit: 18b75afef8
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3382
1 changed files with 6 additions and 0 deletions
|
@ -3191,6 +3191,8 @@ void Document::run_the_resize_steps()
|
||||||
// (e.g. as a result of the user resizing the browser window, or changing the page zoom scale factor,
|
// (e.g. as a result of the user resizing the browser window, or changing the page zoom scale factor,
|
||||||
// or an iframe element’s dimensions are changed) since the last time these steps were run,
|
// or an iframe element’s dimensions are changed) since the last time these steps were run,
|
||||||
// fire an event named resize at the Window object associated with doc.
|
// fire an event named resize at the Window object associated with doc.
|
||||||
|
// 2. If the VisualViewport associated with doc has had its scale, width, or height properties changed
|
||||||
|
// since the last time these steps were run, fire an event named resize at the VisualViewport.
|
||||||
|
|
||||||
auto viewport_size = viewport_rect().size().to_type<int>();
|
auto viewport_size = viewport_rect().size().to_type<int>();
|
||||||
bool is_initial_size = !m_last_viewport_size.has_value();
|
bool is_initial_size = !m_last_viewport_size.has_value();
|
||||||
|
@ -3203,6 +3205,10 @@ void Document::run_the_resize_steps()
|
||||||
auto window_resize_event = DOM::Event::create(realm(), UIEvents::EventNames::resize);
|
auto window_resize_event = DOM::Event::create(realm(), UIEvents::EventNames::resize);
|
||||||
window_resize_event->set_is_trusted(true);
|
window_resize_event->set_is_trusted(true);
|
||||||
window()->dispatch_event(window_resize_event);
|
window()->dispatch_event(window_resize_event);
|
||||||
|
|
||||||
|
auto visual_viewport_resize_event = DOM::Event::create(realm(), UIEvents::EventNames::resize);
|
||||||
|
visual_viewport_resize_event->set_is_trusted(true);
|
||||||
|
visual_viewport()->dispatch_event(visual_viewport_resize_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
schedule_layout_update();
|
schedule_layout_update();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue