1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:48:11 +00:00

LibWeb: Improving cursor behavior in editable DOM nodes

This patch makes two modifications to improve the behavior of cursors in
editable DOM nodes, such as HTML tags with the contenteditable
attribute.

When the cursor blink cycle is reset in an editable DOM node, a repaint
should be initiated. For this, set_needs_display() needs to be called on
the layout node. Previously, the cursor blink cycle would not reset
properly and moving the cursor with the arrow keys did not feel
intuitive.

Furthermore, this modifies one of the conditions necessary to actually
paint the cursor, which previously prevented it from being painted when
at the end of a text node, after all the text present.
This commit is contained in:
Max Wipfli 2021-05-18 21:56:20 +02:00 committed by Andreas Kling
parent d7df6de6a6
commit 08d09c4afb
2 changed files with 3 additions and 1 deletions

View file

@ -62,6 +62,7 @@ void Frame::reset_cursor_blink_cycle()
{
m_cursor_blink_state = true;
m_cursor_blink_timer->restart();
m_cursor_position.node()->layout_node()->set_needs_display();
}
bool Frame::is_focused_frame() const