mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Use Servo-specific pseudo element for InlineBlock fragment
This commit is contained in:
parent
54e2b7b2d5
commit
836e554c30
5 changed files with 24 additions and 15 deletions
|
@ -950,13 +950,15 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
_ => unreachable!()
|
_ => unreachable!()
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut modified_style = node.style(self.style_context());
|
let context = self.style_context();
|
||||||
properties::modify_style_for_outer_inline_block_fragment(&mut modified_style);
|
let style = node.style(context);
|
||||||
|
let style = context.stylist.style_for_anonymous_box(
|
||||||
|
&context.guards, &PseudoElement::ServoInlineBlockWrapper, &style);
|
||||||
let fragment_info = SpecificFragmentInfo::InlineBlock(InlineBlockFragmentInfo::new(
|
let fragment_info = SpecificFragmentInfo::InlineBlock(InlineBlockFragmentInfo::new(
|
||||||
block_flow));
|
block_flow));
|
||||||
let fragment = Fragment::from_opaque_node_and_style(node.opaque(),
|
let fragment = Fragment::from_opaque_node_and_style(node.opaque(),
|
||||||
node.get_pseudo_element_type().strip(),
|
node.get_pseudo_element_type().strip(),
|
||||||
modified_style,
|
style,
|
||||||
node.selected_style(),
|
node.selected_style(),
|
||||||
node.restyle_damage(),
|
node.restyle_damage(),
|
||||||
fragment_info);
|
fragment_info);
|
||||||
|
|
|
@ -2544,16 +2544,6 @@ pub fn modify_border_style_for_inline_sides(style: &mut Arc<ComputedValues>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adjusts the `position` property as necessary for the outer fragment wrapper
|
|
||||||
/// of an inline-block.
|
|
||||||
#[cfg(feature = "servo")]
|
|
||||||
#[inline]
|
|
||||||
pub fn modify_style_for_outer_inline_block_fragment(style: &mut Arc<ComputedValues>) {
|
|
||||||
let mut style = Arc::make_mut(style);
|
|
||||||
let box_style = Arc::make_mut(&mut style.box_);
|
|
||||||
box_style.position = longhands::position::computed_value::T::static_
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Adjusts the `position` and `padding` properties as necessary to account for
|
/// Adjusts the `position` and `padding` properties as necessary to account for
|
||||||
/// text.
|
/// text.
|
||||||
///
|
///
|
||||||
|
|
|
@ -39,6 +39,7 @@ pub enum PseudoElement {
|
||||||
ServoAnonymousTableRow,
|
ServoAnonymousTableRow,
|
||||||
ServoAnonymousTableCell,
|
ServoAnonymousTableCell,
|
||||||
ServoAnonymousBlock,
|
ServoAnonymousBlock,
|
||||||
|
ServoInlineBlockWrapper,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToCss for PseudoElement {
|
impl ToCss for PseudoElement {
|
||||||
|
@ -57,6 +58,7 @@ impl ToCss for PseudoElement {
|
||||||
ServoAnonymousTableRow => "::-servo-anonymous-table-row",
|
ServoAnonymousTableRow => "::-servo-anonymous-table-row",
|
||||||
ServoAnonymousTableCell => "::-servo-anonymous-table-cell",
|
ServoAnonymousTableCell => "::-servo-anonymous-table-cell",
|
||||||
ServoAnonymousBlock => "::-servo-anonymous-block",
|
ServoAnonymousBlock => "::-servo-anonymous-block",
|
||||||
|
ServoInlineBlockWrapper => "::-servo-inline-block-wrapper",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,7 +91,8 @@ impl PseudoElement {
|
||||||
PseudoElement::ServoAnonymousTable |
|
PseudoElement::ServoAnonymousTable |
|
||||||
PseudoElement::ServoAnonymousTableRow |
|
PseudoElement::ServoAnonymousTableRow |
|
||||||
PseudoElement::ServoAnonymousTableCell |
|
PseudoElement::ServoAnonymousTableCell |
|
||||||
PseudoElement::ServoAnonymousBlock => PseudoElementCascadeType::Precomputed,
|
PseudoElement::ServoAnonymousBlock |
|
||||||
|
PseudoElement::ServoInlineBlockWrapper => PseudoElementCascadeType::Precomputed,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -320,6 +323,12 @@ impl<'a> ::selectors::Parser for SelectorParser<'a> {
|
||||||
}
|
}
|
||||||
ServoAnonymousBlock
|
ServoAnonymousBlock
|
||||||
},
|
},
|
||||||
|
"-servo-inline-block-wrapper" => {
|
||||||
|
if !self.in_user_agent_stylesheet() {
|
||||||
|
return Err(())
|
||||||
|
}
|
||||||
|
ServoInlineBlockWrapper
|
||||||
|
},
|
||||||
_ => return Err(())
|
_ => return Err(())
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -398,7 +398,8 @@ impl Stylist {
|
||||||
PseudoElement::ServoAnonymousTableCell |
|
PseudoElement::ServoAnonymousTableCell |
|
||||||
PseudoElement::ServoAnonymousTableRow |
|
PseudoElement::ServoAnonymousTableRow |
|
||||||
PseudoElement::ServoAnonymousTableWrapper |
|
PseudoElement::ServoAnonymousTableWrapper |
|
||||||
PseudoElement::ServoTableWrapper => true,
|
PseudoElement::ServoTableWrapper |
|
||||||
|
PseudoElement::ServoInlineBlockWrapper => true,
|
||||||
PseudoElement::Before |
|
PseudoElement::Before |
|
||||||
PseudoElement::After |
|
PseudoElement::After |
|
||||||
PseudoElement::Selection |
|
PseudoElement::Selection |
|
||||||
|
|
|
@ -215,3 +215,10 @@ svg > * {
|
||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The outer fragment wrapper of an inline-block. */
|
||||||
|
*|*::-servo-inline-block-wrapper {
|
||||||
|
position: static;
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue