Use Servo-specific pseudo element for InlineBlock fragment

This commit is contained in:
Pu Xingyu 2017-03-21 01:39:54 +08:00
parent 54e2b7b2d5
commit 836e554c30
5 changed files with 24 additions and 15 deletions

View file

@ -39,6 +39,7 @@ pub enum PseudoElement {
ServoAnonymousTableRow,
ServoAnonymousTableCell,
ServoAnonymousBlock,
ServoInlineBlockWrapper,
}
impl ToCss for PseudoElement {
@ -57,6 +58,7 @@ impl ToCss for PseudoElement {
ServoAnonymousTableRow => "::-servo-anonymous-table-row",
ServoAnonymousTableCell => "::-servo-anonymous-table-cell",
ServoAnonymousBlock => "::-servo-anonymous-block",
ServoInlineBlockWrapper => "::-servo-inline-block-wrapper",
})
}
}
@ -89,7 +91,8 @@ impl PseudoElement {
PseudoElement::ServoAnonymousTable |
PseudoElement::ServoAnonymousTableRow |
PseudoElement::ServoAnonymousTableCell |
PseudoElement::ServoAnonymousBlock => PseudoElementCascadeType::Precomputed,
PseudoElement::ServoAnonymousBlock |
PseudoElement::ServoInlineBlockWrapper => PseudoElementCascadeType::Precomputed,
}
}
}
@ -320,6 +323,12 @@ impl<'a> ::selectors::Parser for SelectorParser<'a> {
}
ServoAnonymousBlock
},
"-servo-inline-block-wrapper" => {
if !self.in_user_agent_stylesheet() {
return Err(())
}
ServoInlineBlockWrapper
},
_ => return Err(())
};