mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Implement :valid :invalid pseudo classes (#26729)
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
2b67392fd5
commit
5f2c6c09cd
30 changed files with 324 additions and 241 deletions
|
@ -323,22 +323,26 @@ impl HTMLTextAreaElementMethods for HTMLTextAreaElement {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-textarea-value
|
||||
fn SetValue(&self, value: DOMString) {
|
||||
let mut textinput = self.textinput.borrow_mut();
|
||||
{
|
||||
let mut textinput = self.textinput.borrow_mut();
|
||||
|
||||
// Step 1
|
||||
let old_value = textinput.get_content();
|
||||
// Step 1
|
||||
let old_value = textinput.get_content();
|
||||
|
||||
// Step 2
|
||||
textinput.set_content(value);
|
||||
// Step 2
|
||||
textinput.set_content(value);
|
||||
|
||||
// Step 3
|
||||
self.value_dirty.set(true);
|
||||
// Step 3
|
||||
self.value_dirty.set(true);
|
||||
|
||||
if old_value != textinput.get_content() {
|
||||
// Step 4
|
||||
textinput.clear_selection_to_limit(Direction::Forward);
|
||||
if old_value != textinput.get_content() {
|
||||
// Step 4
|
||||
textinput.clear_selection_to_limit(Direction::Forward);
|
||||
}
|
||||
}
|
||||
|
||||
self.validity_state()
|
||||
.perform_validation_and_update(ValidationFlags::all());
|
||||
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
|
||||
}
|
||||
|
||||
|
@ -533,6 +537,9 @@ impl VirtualMethods for HTMLTextAreaElement {
|
|||
},
|
||||
_ => {},
|
||||
}
|
||||
|
||||
self.validity_state()
|
||||
.perform_validation_and_update(ValidationFlags::all());
|
||||
}
|
||||
|
||||
fn bind_to_tree(&self, context: &BindContext) {
|
||||
|
@ -542,6 +549,9 @@ impl VirtualMethods for HTMLTextAreaElement {
|
|||
|
||||
self.upcast::<Element>()
|
||||
.check_ancestors_disabled_state_for_form_control();
|
||||
|
||||
self.validity_state()
|
||||
.perform_validation_and_update(ValidationFlags::all());
|
||||
}
|
||||
|
||||
fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue {
|
||||
|
@ -574,6 +584,9 @@ impl VirtualMethods for HTMLTextAreaElement {
|
|||
} else {
|
||||
el.check_disabled_attribute();
|
||||
}
|
||||
|
||||
self.validity_state()
|
||||
.perform_validation_and_update(ValidationFlags::all());
|
||||
}
|
||||
|
||||
// The cloning steps for textarea elements must propagate the raw value
|
||||
|
@ -589,8 +602,12 @@ impl VirtualMethods for HTMLTextAreaElement {
|
|||
}
|
||||
let el = copy.downcast::<HTMLTextAreaElement>().unwrap();
|
||||
el.value_dirty.set(self.value_dirty.get());
|
||||
let mut textinput = el.textinput.borrow_mut();
|
||||
textinput.set_content(self.textinput.borrow().get_content());
|
||||
{
|
||||
let mut textinput = el.textinput.borrow_mut();
|
||||
textinput.set_content(self.textinput.borrow().get_content());
|
||||
}
|
||||
el.validity_state()
|
||||
.perform_validation_and_update(ValidationFlags::all());
|
||||
}
|
||||
|
||||
fn children_changed(&self, mutation: &ChildrenMutation) {
|
||||
|
@ -661,6 +678,9 @@ impl VirtualMethods for HTMLTextAreaElement {
|
|||
event.mark_as_handled();
|
||||
}
|
||||
}
|
||||
|
||||
self.validity_state()
|
||||
.perform_validation_and_update(ValidationFlags::all());
|
||||
}
|
||||
|
||||
fn pop(&self) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue