mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Use Servo-specific pseudo element for InlineAbsolute fragment
This commit is contained in:
parent
836e554c30
commit
1677d479f6
5 changed files with 25 additions and 15 deletions
|
@ -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,
|
||||
|
|
|
@ -2582,17 +2582,6 @@ pub fn modify_style_for_text(style: &mut Arc<ComputedValues>) {
|
|||
}
|
||||
}
|
||||
|
||||
/// 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<ComputedValues>) {
|
||||
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) => {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 |
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue