mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:07:34 +00:00
LibWeb: Fix crashing after input into empty contenteditable
Change `EventHandler::handle_keydown()` to no longer assume the cursor position's node is always a `DOM::Text`. While this assumption holds for `HTMLInputElement` that has a shadow DOM with a text node, an empty `contenteditable` might not have any children. With this change, `handle_keydown()` creates a new text node if the cursor position's node is not a text node.
This commit is contained in:
parent
5d76fa72e9
commit
906ac71eca
5 changed files with 47 additions and 9 deletions
|
@ -28,6 +28,7 @@ public:
|
|||
|
||||
JS::GCPtr<Node> node() { return m_node; }
|
||||
JS::GCPtr<Node const> node() const { return m_node; }
|
||||
void set_node(JS::NonnullGCPtr<Node> node) { m_node = node; }
|
||||
|
||||
unsigned offset() const { return m_offset; }
|
||||
bool offset_is_at_end_of_node() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue