LibWeb: Allow non-HTMLInputElements to have did_edit_text_node() called

HTMLTextAreaElement also needs to be told when its contained text node
has been edited, so let's make this functionality work for anyone who
extends the new EditableTextNodeOwner interface class.
This commit is contained in:
Sam Atkins 2023-08-30 14:38:58 +01:00 committed by Andreas Kling
parent ce556c9566
commit 4897643ffb
Notes: sideshowbarker 2024-07-17 05:18:58 +09:00
5 changed files with 22 additions and 18 deletions

View file

@ -7,6 +7,7 @@
#pragma once
#include <LibWeb/DOM/Text.h>
#include <LibWeb/FileAPI/FileList.h>
#include <LibWeb/HTML/FormAssociatedElement.h>
#include <LibWeb/HTML/HTMLElement.h>
@ -41,7 +42,8 @@ namespace Web::HTML {
class HTMLInputElement final
: public HTMLElement
, public FormAssociatedElement {
, public FormAssociatedElement
, public DOM::EditableTextNodeOwner {
WEB_PLATFORM_OBJECT(HTMLInputElement, HTMLElement);
FORM_ASSOCIATED_ELEMENT(HTMLElement, HTMLInputElement)
@ -83,8 +85,6 @@ public:
bool is_mutable() const { return m_is_mutable; }
void did_edit_text_node(Badge<BrowsingContext>);
JS::GCPtr<FileAPI::FileList> files();
void set_files(JS::GCPtr<FileAPI::FileList>);
@ -101,6 +101,9 @@ public:
WebIDL::ExceptionOr<void> show_picker();
// ^DOM::EditableTextNodeOwner
virtual void did_edit_text_node(Badge<BrowsingContext>) override;
// ^EventTarget
// https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute:the-input-element
virtual bool is_focusable() const override { return m_type != TypeAttributeState::Hidden; }