mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 14:25:08 +00:00
LibWeb: Move fragment link handling to Frame
Activating a "#foo" fragment link will now be handled internally by the Frame instead of involving the widget layer. If the viewport needs to be scrolled as a result, we will simply ask the PageClient to scroll a new rect into view.
This commit is contained in:
parent
2b80a45f82
commit
56d14d5701
7 changed files with 39 additions and 49 deletions
|
@ -131,6 +131,9 @@ bool EventHandler::handle_mousedown(const Gfx::IntPoint& position, unsigned butt
|
|||
auto href = link->href();
|
||||
if (href.starts_with("javascript:")) {
|
||||
document.run_javascript(href.substring_view(11, href.length() - 11));
|
||||
} else if (href.starts_with('#')) {
|
||||
auto anchor = href.substring_view(1, href.length() - 1);
|
||||
m_frame.scroll_to_anchor(anchor);
|
||||
} else {
|
||||
if (m_frame.is_main_frame()) {
|
||||
page_client.page_did_click_link(link->href(), link->target(), modifiers);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue