mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 23:30:20 +00:00
LibWeb: Remember page's cursor and request change only when it changes
Before, on *every* mouse-move event, `page_did_request_cursor_change()` virtual function would get called, requesting to change cursor to the event's mouse position's cursor. Now, the page keeps track of the last cursor change that was requested ("page's current cursor") and only requests cursor change again if and only if the current cursor is not already the one that is required.
This commit is contained in:
parent
ac6fe2e211
commit
318fc62b53
Notes:
github-actions[bot]
2024-12-10 13:30:54 +00:00
Author: https://github.com/ronak69
Commit: 318fc62b53
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1411
2 changed files with 9 additions and 1 deletions
|
@ -619,7 +619,10 @@ EventResult EventHandler::handle_mousemove(CSSPixelPoint viewport_position, CSSP
|
|||
|
||||
auto& page = m_navigable->page();
|
||||
|
||||
page.client().page_did_request_cursor_change(hovered_node_cursor);
|
||||
if (page.current_cursor() != hovered_node_cursor) {
|
||||
page.set_current_cursor(hovered_node_cursor);
|
||||
page.client().page_did_request_cursor_change(hovered_node_cursor);
|
||||
}
|
||||
|
||||
if (hovered_node_changed) {
|
||||
GC::Ptr<HTML::HTMLElement const> hovered_html_element = document.hovered_node() ? document.hovered_node()->enclosing_html_element_with_attribute(HTML::AttributeNames::title) : nullptr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue