mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:47:44 +00:00
LibWeb: Make <input type=checkbox> honor the "checked" attribute
Implemented according to spec, although it's very possible that I missed one or two details. :^)
This commit is contained in:
parent
05c9fd962d
commit
8a89a7bd95
4 changed files with 70 additions and 8 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <LibGfx/Painter.h>
|
||||
#include <LibGfx/StylePainter.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/HTMLInputElement.h>
|
||||
#include <LibWeb/Layout/CheckBox.h>
|
||||
#include <LibWeb/Layout/Label.h>
|
||||
|
||||
|
@ -62,7 +63,7 @@ void CheckBox::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& position
|
|||
is_inside_node_or_label = Label::is_inside_associated_label(*this, position);
|
||||
|
||||
if (is_inside_node_or_label)
|
||||
dom_node().set_checked(!dom_node().checked());
|
||||
dom_node().set_checked(!dom_node().checked(), HTML::HTMLInputElement::ChangeSource::User);
|
||||
|
||||
m_being_pressed = false;
|
||||
m_tracking_mouse = false;
|
||||
|
@ -102,7 +103,7 @@ void CheckBox::handle_associated_label_mouseup(Badge<Label>)
|
|||
// NOTE: Changing the checked state of the DOM node may run arbitrary JS, which could disappear this node.
|
||||
NonnullRefPtr protect = *this;
|
||||
|
||||
dom_node().set_checked(!dom_node().checked());
|
||||
dom_node().set_checked(!dom_node().checked(), HTML::HTMLInputElement::ChangeSource::User);
|
||||
m_being_pressed = false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue