mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:18:11 +00:00
LibWeb: Implement indeterminate IDL attribute in HTMLInputElement
This commit is contained in:
parent
aad4051885
commit
d177d83b44
3 changed files with 18 additions and 1 deletions
|
@ -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
|
// https://html.spec.whatwg.org/multipage/input.html#dom-input-files
|
||||||
JS::GCPtr<FileAPI::FileList> HTMLInputElement::files()
|
JS::GCPtr<FileAPI::FileList> HTMLInputElement::files()
|
||||||
{
|
{
|
||||||
|
@ -797,14 +804,15 @@ void HTMLInputElement::set_checked_within_group()
|
||||||
void HTMLInputElement::legacy_pre_activation_behavior()
|
void HTMLInputElement::legacy_pre_activation_behavior()
|
||||||
{
|
{
|
||||||
m_before_legacy_pre_activation_behavior_checked = checked();
|
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
|
// 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
|
// 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
|
// false, false if it is true) and set this element's indeterminate IDL
|
||||||
// attribute to false.
|
// attribute to false.
|
||||||
// FIXME: Set indeterminate to false when that exists.
|
|
||||||
if (type_state() == TypeAttributeState::Checkbox) {
|
if (type_state() == TypeAttributeState::Checkbox) {
|
||||||
set_checked(!checked(), ChangeSource::User);
|
set_checked(!checked(), ChangeSource::User);
|
||||||
|
set_indeterminate(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. If this element's type attribute is in the Radio Button state, then
|
// 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.
|
// to the values they had before the legacy-pre-activation behavior was run.
|
||||||
if (type_state() == TypeAttributeState::Checkbox) {
|
if (type_state() == TypeAttributeState::Checkbox) {
|
||||||
set_checked(m_before_legacy_pre_activation_behavior_checked, ChangeSource::Programmatic);
|
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
|
// 2. If this element 's type attribute is in the Radio Button state, then
|
||||||
|
|
|
@ -78,6 +78,9 @@ public:
|
||||||
bool checked_binding() const { return checked(); }
|
bool checked_binding() const { return checked(); }
|
||||||
void set_checked_binding(bool);
|
void set_checked_binding(bool);
|
||||||
|
|
||||||
|
bool indeterminate() const { return m_indeterminate; };
|
||||||
|
void set_indeterminate(bool);
|
||||||
|
|
||||||
void did_edit_text_node(Badge<BrowsingContext>);
|
void did_edit_text_node(Badge<BrowsingContext>);
|
||||||
|
|
||||||
JS::GCPtr<FileAPI::FileList> files();
|
JS::GCPtr<FileAPI::FileList> files();
|
||||||
|
@ -156,6 +159,9 @@ private:
|
||||||
JS::GCPtr<DOM::Text> m_text_node;
|
JS::GCPtr<DOM::Text> m_text_node;
|
||||||
bool m_checked { false };
|
bool m_checked { false };
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/input.html#dom-input-indeterminate
|
||||||
|
bool m_indeterminate { false };
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/input.html#concept-input-checked-dirty-flag
|
// https://html.spec.whatwg.org/multipage/input.html#concept-input-checked-dirty-flag
|
||||||
bool m_dirty_checkedness { false };
|
bool m_dirty_checkedness { false };
|
||||||
|
|
||||||
|
@ -164,6 +170,7 @@ private:
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/input.html#the-input-element:legacy-pre-activation-behavior
|
// https://html.spec.whatwg.org/multipage/input.html#the-input-element:legacy-pre-activation-behavior
|
||||||
bool m_before_legacy_pre_activation_behavior_checked { false };
|
bool m_before_legacy_pre_activation_behavior_checked { false };
|
||||||
|
bool m_before_legacy_pre_activation_behavior_indeterminate { false };
|
||||||
JS::GCPtr<HTMLInputElement> m_legacy_pre_activation_behavior_checked_element_in_group;
|
JS::GCPtr<HTMLInputElement> m_legacy_pre_activation_behavior_checked_element_in_group;
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/input.html#concept-input-type-file-selected
|
// https://html.spec.whatwg.org/multipage/input.html#concept-input-type-file-selected
|
||||||
|
|
|
@ -22,6 +22,7 @@ interface HTMLInputElement : HTMLElement {
|
||||||
[Reflect=value] attribute DOMString defaultValue;
|
[Reflect=value] attribute DOMString defaultValue;
|
||||||
|
|
||||||
attribute DOMString type;
|
attribute DOMString type;
|
||||||
|
attribute boolean indeterminate;
|
||||||
|
|
||||||
[LegacyNullToEmptyString] attribute DOMString value;
|
[LegacyNullToEmptyString] attribute DOMString value;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue