LibWeb: Improve display of input elements

* Display input[type=reset] as a button
* Display allother input elements as text entry boxes
* Set overflow: hidden on input elements
This commit is contained in:
Adam Hodgen 2022-02-17 21:44:50 +00:00 committed by Andreas Kling
parent 8edade071d
commit 240068a48c
Notes: sideshowbarker 2024-07-17 18:36:58 +09:00
2 changed files with 15 additions and 4 deletions

View file

@ -211,10 +211,21 @@ ol ol ul {
}
/* FIXME: This is a temporary hack until we can render a native-looking frame for these. */
input[type=text] {
input {
border: 1px solid black;
min-width: 80px;
min-height: 16px;
width: 120px;
cursor: text;
overflow: hidden;
}
input[type=submit], input[type=button], input[type=reset], input[type=checkbox], input[type=radio] {
border: none;
min-width: unset;
min-height: unset;
width: unset;
cursor: unset;
}
option {

View file

@ -34,7 +34,7 @@ void HTMLInputElement::did_click_button(Badge<Layout::ButtonBox>)
// FIXME: This should be a PointerEvent.
dispatch_event(DOM::Event::create(EventNames::click));
if (type().equals_ignoring_case("submit")) {
if (type() == "submit") {
if (auto* form = first_ancestor_of_type<HTMLFormElement>()) {
form->submit_form(this);
}
@ -55,7 +55,7 @@ RefPtr<Layout::Node> HTMLInputElement::create_layout_node(NonnullRefPtr<CSS::Sty
if (type() == "hidden")
return nullptr;
if (type().equals_ignoring_case("submit") || type().equals_ignoring_case("button"))
if (type() == "submit" || type() == "button" || type() == "reset")
return adopt_ref(*new Layout::ButtonBox(document(), *this, move(style)));
if (type() == "checkbox")
@ -101,7 +101,7 @@ void HTMLInputElement::run_activation_behavior()
// https://html.spec.whatwg.org/multipage/input.html#input-activation-behavior
void HTMLInputElement::run_input_activation_behavior()
{
if (type().equals_ignoring_case("checkbox")) {
if (type() == "checkbox") {
// 1. If the element is not connected, then return.
if (!is_connected())
return;