mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Implement :placeholder-shown (fixes #10561)
This commit is contained in:
parent
6c5f5d35f5
commit
ff899dc703
7 changed files with 52 additions and 12 deletions
|
@ -2223,7 +2223,8 @@ impl<'a> ::selectors::Element for Root<Element> {
|
|||
NonTSPseudoClass::Disabled |
|
||||
NonTSPseudoClass::Checked |
|
||||
NonTSPseudoClass::Indeterminate |
|
||||
NonTSPseudoClass::ReadWrite =>
|
||||
NonTSPseudoClass::ReadWrite |
|
||||
NonTSPseudoClass::PlaceholderShown =>
|
||||
Element::state(self).contains(pseudo_class.state_flag()),
|
||||
}
|
||||
}
|
||||
|
@ -2494,6 +2495,17 @@ impl Element {
|
|||
pub fn set_read_write_state(&self, value: bool) {
|
||||
self.set_state(IN_READ_WRITE_STATE, value)
|
||||
}
|
||||
|
||||
pub fn placeholder_shown_state(&self) -> bool {
|
||||
self.state.get().contains(IN_PLACEHOLDER_SHOWN_STATE)
|
||||
}
|
||||
|
||||
pub fn set_placeholder_shown_state(&self, value: bool) {
|
||||
if self.placeholder_shown_state() != value {
|
||||
self.set_state(IN_PLACEHOLDER_SHOWN_STATE, value);
|
||||
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Element {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue