dom: Textual Input UA Shadow Dom (#37527)

Depend on: 
- https://github.com/servo/servo/pull/37427
- https://github.com/servo/servo/pull/37483

Utilize input `type=text` for the display of all textual input. In
which, consist of
https://html.spec.whatwg.org/#the-input-element-as-a-text-entry-widget
and
https://html.spec.whatwg.org/#the-input-element-as-domain-specific-widgets
inputs.

For `password`, `url`, `tel`, and, `email` input, the appearance of
input container is exactly the same as the `text` input. Other types of
textual input simply extends `text` input by adding extra components
inside the container.

Testing: Servo textual input appearance WPT.

---------

Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
Signed-off-by: Jo Steven Novaryo <jo.steven.novaryo@huawei.com>
This commit is contained in:
Jo Steven Novaryo 2025-07-25 12:38:14 +08:00 committed by GitHub
parent 1d896699a4
commit 6cd8578f8b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 546 additions and 279 deletions

View file

@ -1119,25 +1119,16 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
));
}
// Textual input, specifically text entry and domain specific input has
// a default preferred size.
//
// <https://html.spec.whatwg.org/multipage/#the-input-element-as-a-text-entry-widget>
// <https://html.spec.whatwg.org/multipage/#the-input-element-as-domain-specific-widgets>
let size = if let Some(this) = self.downcast::<HTMLInputElement>() {
// FIXME(pcwalton): More use of atoms, please!
match self.get_attr_val_for_layout(&ns!(), &local_name!("type")) {
// Not text entry widget
Some("hidden") |
Some("date") |
Some("month") |
Some("week") |
Some("time") |
Some("datetime-local") |
Some("number") |
Some("range") |
Some("color") |
Some("checkbox") |
Some("radio") |
Some("file") |
Some("submit") |
Some("image") |
Some("reset") |
Some("hidden") | Some("range") | Some("color") | Some("checkbox") |
Some("radio") | Some("file") | Some("submit") | Some("image") | Some("reset") |
Some("button") => None,
// Others
_ => match this.size_for_layout() {