diff options
author | Srikavin Ramkumar <srikavinramkumar@gmail.com> | 2023-03-20 04:34:43 -0400 |
---|---|---|
committer | Sam Atkins <atkinssj@gmail.com> | 2023-03-20 10:15:58 +0000 |
commit | d177d83b44b7ad354cdd776ea1e3e9a165b6ed98 (patch) | |
tree | ff0efe8804aa20e6e5d11d1193ff6f72c9efacf3 /Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp | |
parent | aad4051885c68b1ae353fe29a917732863e9fd94 (diff) | |
download | serenity-d177d83b44b7ad354cdd776ea1e3e9a165b6ed98.zip |
LibWeb: Implement indeterminate IDL attribute in HTMLInputElement
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index 4ac1c0e4da..1cbb2757b6 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -107,6 +107,13 @@ void HTMLInputElement::set_checked_binding(bool checked) } } +// https://html.spec.whatwg.org/multipage/input.html#dom-input-indeterminate +void HTMLInputElement::set_indeterminate(bool value) +{ + // On setting, it must be set to the new value. It has no effect except for changing the appearance of checkbox controls. + m_indeterminate = value; +} + // https://html.spec.whatwg.org/multipage/input.html#dom-input-files JS::GCPtr<FileAPI::FileList> HTMLInputElement::files() { @@ -797,14 +804,15 @@ void HTMLInputElement::set_checked_within_group() void HTMLInputElement::legacy_pre_activation_behavior() { m_before_legacy_pre_activation_behavior_checked = checked(); + m_before_legacy_pre_activation_behavior_indeterminate = indeterminate(); // 1. If this element's type attribute is in the Checkbox state, then set // this element's checkedness to its opposite value (i.e. true if it is // false, false if it is true) and set this element's indeterminate IDL // attribute to false. - // FIXME: Set indeterminate to false when that exists. if (type_state() == TypeAttributeState::Checkbox) { set_checked(!checked(), ChangeSource::User); + set_indeterminate(false); } // 2. If this element's type attribute is in the Radio Button state, then @@ -834,6 +842,7 @@ void HTMLInputElement::legacy_cancelled_activation_behavior() // to the values they had before the legacy-pre-activation behavior was run. if (type_state() == TypeAttributeState::Checkbox) { set_checked(m_before_legacy_pre_activation_behavior_checked, ChangeSource::Programmatic); + set_indeterminate(m_before_legacy_pre_activation_behavior_indeterminate); } // 2. If this element 's type attribute is in the Radio Button state, then |