1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:47:35 +00:00

LibWeb: Fire "input" and "change" events when editing a text <input>

This isn't entirely on-spec, but will hopefully allow us to make
progress in other areas.
This commit is contained in:
Andreas Kling 2022-02-17 12:59:32 +01:00
parent 4cbce0e34c
commit 5f54b8dd6c
5 changed files with 39 additions and 1 deletions

View file

@ -11,6 +11,7 @@
#include <LibWeb/HTML/BrowsingContextContainer.h>
#include <LibWeb/HTML/EventLoop/EventLoop.h>
#include <LibWeb/HTML/HTMLAnchorElement.h>
#include <LibWeb/HTML/HTMLInputElement.h>
#include <LibWeb/Layout/BreakNode.h>
#include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Layout/TextNode.h>
@ -41,6 +42,12 @@ BrowsingContext::~BrowsingContext()
void BrowsingContext::did_edit(Badge<EditEventHandler>)
{
reset_cursor_blink_cycle();
if (m_cursor_position.node() && is<DOM::Text>(*m_cursor_position.node())) {
auto& text_node = static_cast<DOM::Text&>(*m_cursor_position.node());
if (auto* input_element = text_node.owner_input_element())
input_element->did_edit_text_node({});
}
}
void BrowsingContext::reset_cursor_blink_cycle()