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:
bors-servo 2016-06-06 23:44:16 -05:00
commit 0f1f99a4bf
7 changed files with 52 additions and 12 deletions

View file

@ -5,7 +5,7 @@
bitflags! {
#[doc = "Event-based element states."]
#[derive(HeapSizeOf)]
pub flags ElementState: u8 {
pub flags ElementState: u16 {
#[doc = "The mouse is down on this element. \
https://html.spec.whatwg.org/multipage/#selector-active \
FIXME(#7333): set/unset this when appropriate"]
@ -29,5 +29,7 @@ bitflags! {
const IN_INDETERMINATE_STATE = 0x40,
#[doc = "https://html.spec.whatwg.org/multipage/#selector-read-write"]
const IN_READ_WRITE_STATE = 0x80,
#[doc = "https://html.spec.whatwg.org/multipage/#selector-placeholder-shown"]
const IN_PLACEHOLDER_SHOWN_STATE = 0x0100,
}
}

View file

@ -131,7 +131,8 @@ pub enum NonTSPseudoClass {
Indeterminate,
ServoNonZeroBorder,
ReadWrite,
ReadOnly
ReadOnly,
PlaceholderShown,
}
impl NonTSPseudoClass {
@ -147,6 +148,7 @@ impl NonTSPseudoClass {
Checked => IN_CHECKED_STATE,
Indeterminate => IN_INDETERMINATE_STATE,
ReadOnly | ReadWrite => IN_READ_WRITE_STATE,
PlaceholderShown => IN_PLACEHOLDER_SHOWN_STATE,
AnyLink |
Link |
@ -179,6 +181,7 @@ impl SelectorImpl for ServoSelectorImpl {
"indeterminate" => Indeterminate,
"read-write" => ReadWrite,
"read-only" => ReadOnly,
"placeholder-shown" => PlaceholderShown,
"-servo-nonzero-border" => {
if !context.in_user_agent_stylesheet {
return Err(());