mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #11572 - nox:placeholder-shown, r=SimonSapin
Implement :placeholder-shown (fixes #10561) <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11572) <!-- Reviewable:end -->
This commit is contained in:
commit
0f1f99a4bf
7 changed files with 52 additions and 12 deletions
|
@ -2222,7 +2222,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()),
|
||||
}
|
||||
}
|
||||
|
@ -2493,6 +2494,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