mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:47:45 +00:00
LibWeb: Retreive CSS cursor before changing hovered node
This fixes an elusive issue where changing the hovered node would cause a JS event handler to run, changing the shape of the paint tree before we had a chance to get the cursor. A more robust fix here will be to let paintables own their used/computed values (so they don't have to look into the layout tree for them) but that's a much bigger change.
This commit is contained in:
parent
8118ea764f
commit
81daf1752b
1 changed files with 1 additions and 2 deletions
|
@ -465,6 +465,7 @@ bool EventHandler::handle_mousemove(CSSPixelPoint position, CSSPixelPoint screen
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto const cursor = paintable->computed_values().cursor();
|
||||||
auto pointer_events = paintable->computed_values().pointer_events();
|
auto pointer_events = paintable->computed_values().pointer_events();
|
||||||
// FIXME: Handle other values for pointer-events.
|
// FIXME: Handle other values for pointer-events.
|
||||||
VERIFY(pointer_events != CSS::PointerEvents::None);
|
VERIFY(pointer_events != CSS::PointerEvents::None);
|
||||||
|
@ -482,13 +483,11 @@ bool EventHandler::handle_mousemove(CSSPixelPoint position, CSSPixelPoint screen
|
||||||
is_hovering_link = true;
|
is_hovering_link = true;
|
||||||
|
|
||||||
if (node->is_text()) {
|
if (node->is_text()) {
|
||||||
auto cursor = paintable->computed_values().cursor();
|
|
||||||
if (cursor == CSS::Cursor::Auto)
|
if (cursor == CSS::Cursor::Auto)
|
||||||
hovered_node_cursor = Gfx::StandardCursor::IBeam;
|
hovered_node_cursor = Gfx::StandardCursor::IBeam;
|
||||||
else
|
else
|
||||||
hovered_node_cursor = cursor_css_to_gfx(cursor);
|
hovered_node_cursor = cursor_css_to_gfx(cursor);
|
||||||
} else if (node->is_element()) {
|
} else if (node->is_element()) {
|
||||||
auto cursor = paintable->computed_values().cursor();
|
|
||||||
if (cursor == CSS::Cursor::Auto)
|
if (cursor == CSS::Cursor::Auto)
|
||||||
hovered_node_cursor = Gfx::StandardCursor::Arrow;
|
hovered_node_cursor = Gfx::StandardCursor::Arrow;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue