diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 5533942e5a05..7dd4da8ada4b 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -989,8 +989,9 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode> let fragment_info = SpecificFragmentInfo::InlineAbsoluteHypothetical( InlineAbsoluteHypotheticalFragmentInfo::new(block_flow)); let style_context = self.style_context(); - let mut style = node.style(style_context); - properties::modify_style_for_inline_absolute_hypothetical_fragment(&mut style); + let style = node.style(style_context); + let style = style_context.stylist.style_for_anonymous_box( + &style_context.guards, &PseudoElement::ServoInlineAbsolute, &style); let fragment = Fragment::from_opaque_node_and_style(node.opaque(), PseudoElementType::Normal, style, diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 0dae0a7172da..319fc9cecfa7 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -2582,17 +2582,6 @@ pub fn modify_style_for_text(style: &mut Arc) { } } -/// Adjusts the `clip` property so that an inline absolute hypothetical fragment -/// doesn't clip its children. -#[cfg(feature = "servo")] -pub fn modify_style_for_inline_absolute_hypothetical_fragment(style: &mut Arc) { - if !style.get_effects().clip.is_auto() { - let mut style = Arc::make_mut(style); - let effects_style = Arc::make_mut(&mut style.effects); - effects_style.clip = Either::auto() - } -} - #[macro_export] macro_rules! css_properties_accessors { ($macro_name: ident) => { diff --git a/components/style/servo/selector_parser.rs b/components/style/servo/selector_parser.rs index 311a15284aaa..563e7b89c441 100644 --- a/components/style/servo/selector_parser.rs +++ b/components/style/servo/selector_parser.rs @@ -40,6 +40,7 @@ pub enum PseudoElement { ServoAnonymousTableCell, ServoAnonymousBlock, ServoInlineBlockWrapper, + ServoInlineAbsolute, } impl ToCss for PseudoElement { @@ -59,6 +60,7 @@ impl ToCss for PseudoElement { ServoAnonymousTableCell => "::-servo-anonymous-table-cell", ServoAnonymousBlock => "::-servo-anonymous-block", ServoInlineBlockWrapper => "::-servo-inline-block-wrapper", + ServoInlineAbsolute => "::-servo-inline-absolute", }) } } @@ -92,7 +94,8 @@ impl PseudoElement { PseudoElement::ServoAnonymousTableRow | PseudoElement::ServoAnonymousTableCell | PseudoElement::ServoAnonymousBlock | - PseudoElement::ServoInlineBlockWrapper => PseudoElementCascadeType::Precomputed, + PseudoElement::ServoInlineBlockWrapper | + PseudoElement::ServoInlineAbsolute => PseudoElementCascadeType::Precomputed, } } } @@ -329,6 +332,12 @@ impl<'a> ::selectors::Parser for SelectorParser<'a> { } ServoInlineBlockWrapper }, + "-servo-input-absolute" => { + if !self.in_user_agent_stylesheet() { + return Err(()) + } + ServoInlineAbsolute + }, _ => return Err(()) }; @@ -368,6 +377,8 @@ impl SelectorImpl { fun(PseudoElement::ServoAnonymousTableRow); fun(PseudoElement::ServoAnonymousTableCell); fun(PseudoElement::ServoAnonymousBlock); + fun(PseudoElement::ServoInlineBlockWrapper); + fun(PseudoElement::ServoInlineAbsolute); } /// Returns the pseudo-class state flag for selector matching. diff --git a/components/style/stylist.rs b/components/style/stylist.rs index 6e2e8632f379..e9533a7cb65f 100644 --- a/components/style/stylist.rs +++ b/components/style/stylist.rs @@ -399,7 +399,8 @@ impl Stylist { PseudoElement::ServoAnonymousTableRow | PseudoElement::ServoAnonymousTableWrapper | PseudoElement::ServoTableWrapper | - PseudoElement::ServoInlineBlockWrapper => true, + PseudoElement::ServoInlineBlockWrapper | + PseudoElement::ServoInlineAbsolute => true, PseudoElement::Before | PseudoElement::After | PseudoElement::Selection | diff --git a/resources/servo.css b/resources/servo.css index 341a5ad077c1..31e3c073e8ec 100644 --- a/resources/servo.css +++ b/resources/servo.css @@ -222,3 +222,11 @@ svg > * { padding: 0; margin: 0; } + +/* The outer fragment wrapper of an inline absolute hypothetical fragment. */ +*|*::-servo-inline-absolute { + clip: auto; + border: none; + padding: 0; + margin: 0; +}