mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Implements the :checked pseudo-class for inputs
Relevant spec: https://html.spec.whatwg.org/multipage/scripting.html#selector-checked Also modifies HTMLInputElement::SetChecked to no longer modify its checked content value, instead making use of its internal checkedness state now that we can match `:checked` properly.
This commit is contained in:
parent
9ac817523c
commit
1b84bd22b8
7 changed files with 47 additions and 4 deletions
|
@ -125,6 +125,7 @@ pub trait LayoutHTMLInputElementHelpers {
|
|||
}
|
||||
|
||||
pub trait RawLayoutHTMLInputElementHelpers {
|
||||
unsafe fn get_checked_state_for_layout(&self) -> bool;
|
||||
unsafe fn get_size_for_layout(&self) -> u32;
|
||||
}
|
||||
|
||||
|
@ -162,6 +163,11 @@ impl LayoutHTMLInputElementHelpers for JS<HTMLInputElement> {
|
|||
}
|
||||
|
||||
impl RawLayoutHTMLInputElementHelpers for HTMLInputElement {
|
||||
#[allow(unrooted_must_root)]
|
||||
unsafe fn get_checked_state_for_layout(&self) -> bool {
|
||||
self.checked.get()
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
unsafe fn get_size_for_layout(&self) -> u32 {
|
||||
self.size.get()
|
||||
|
@ -181,7 +187,9 @@ impl<'a> HTMLInputElementMethods for JSRef<'a, HTMLInputElement> {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#dom-input-checked
|
||||
make_bool_setter!(SetChecked, "checked")
|
||||
fn SetChecked(self, checked: bool) {
|
||||
self.update_checked_state(checked);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#dom-input-readonly
|
||||
make_bool_getter!(ReadOnly)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue