script: Use TextInputWidget to implement <textarea> shadow DOM (#43770)

In addition to making it so that textual `<input>` and `<textarea>`
share a common shadow DOM structure, this allows styling the
`<textarea>` placeholder. It is now properly shown in grey.

Testing: This fixes a few WPT tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson
2026-04-01 13:41:28 +02:00
committed by GitHub
parent c121a46c4f
commit 9cb65e242e
10 changed files with 112 additions and 103 deletions

View File

@@ -905,10 +905,6 @@ impl HTMLInputElement {
fn textinput_mut(&self) -> RefMut<'_, TextInput<EmbedderClipboardProvider>> {
self.textinput.borrow_mut()
}
fn placeholder(&self) -> Ref<'_, DOMString> {
self.placeholder.borrow()
}
}
pub(crate) trait LayoutHTMLInputElementHelpers<'dom> {
@@ -993,6 +989,18 @@ impl TextControlElement for HTMLInputElement {
};
self.owner_window().layout().set_needs_new_display_list();
}
fn is_password_field(&self) -> bool {
matches!(*self.input_type(), InputType::Password(_))
}
fn placeholder_text<'a>(&'a self) -> Ref<'a, DOMString> {
self.placeholder.borrow()
}
fn value_text(&self) -> DOMString {
self.Value()
}
}
impl HTMLInputElementMethods<crate::DomTypeHolder> for HTMLInputElement {