mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +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(
|
let fragment_info = SpecificFragmentInfo::InlineAbsoluteHypothetical(
|
||||||
InlineAbsoluteHypotheticalFragmentInfo::new(block_flow));
|
InlineAbsoluteHypotheticalFragmentInfo::new(block_flow));
|
||||||
let style_context = self.style_context();
|
let style_context = self.style_context();
|
||||||
let mut style = node.style(style_context);
|
let style = node.style(style_context);
|
||||||
properties::modify_style_for_inline_absolute_hypothetical_fragment(&mut style);
|
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(),
|
let fragment = Fragment::from_opaque_node_and_style(node.opaque(),
|
||||||
PseudoElementType::Normal,
|
PseudoElementType::Normal,
|
||||||
style,
|
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_export]
|
||||||
macro_rules! css_properties_accessors {
|
macro_rules! css_properties_accessors {
|
||||||
($macro_name: ident) => {
|
($macro_name: ident) => {
|
||||||
|
|
|
@ -40,6 +40,7 @@ pub enum PseudoElement {
|
||||||
ServoAnonymousTableCell,
|
ServoAnonymousTableCell,
|
||||||
ServoAnonymousBlock,
|
ServoAnonymousBlock,
|
||||||
ServoInlineBlockWrapper,
|
ServoInlineBlockWrapper,
|
||||||
|
ServoInlineAbsolute,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToCss for PseudoElement {
|
impl ToCss for PseudoElement {
|
||||||
|
@ -59,6 +60,7 @@ impl ToCss for PseudoElement {
|
||||||
ServoAnonymousTableCell => "::-servo-anonymous-table-cell",
|
ServoAnonymousTableCell => "::-servo-anonymous-table-cell",
|
||||||
ServoAnonymousBlock => "::-servo-anonymous-block",
|
ServoAnonymousBlock => "::-servo-anonymous-block",
|
||||||
ServoInlineBlockWrapper => "::-servo-inline-block-wrapper",
|
ServoInlineBlockWrapper => "::-servo-inline-block-wrapper",
|
||||||
|
ServoInlineAbsolute => "::-servo-inline-absolute",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +94,8 @@ impl PseudoElement {
|
||||||
PseudoElement::ServoAnonymousTableRow |
|
PseudoElement::ServoAnonymousTableRow |
|
||||||
PseudoElement::ServoAnonymousTableCell |
|
PseudoElement::ServoAnonymousTableCell |
|
||||||
PseudoElement::ServoAnonymousBlock |
|
PseudoElement::ServoAnonymousBlock |
|
||||||
PseudoElement::ServoInlineBlockWrapper => PseudoElementCascadeType::Precomputed,
|
PseudoElement::ServoInlineBlockWrapper |
|
||||||
|
PseudoElement::ServoInlineAbsolute => PseudoElementCascadeType::Precomputed,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -329,6 +332,12 @@ impl<'a> ::selectors::Parser for SelectorParser<'a> {
|
||||||
}
|
}
|
||||||
ServoInlineBlockWrapper
|
ServoInlineBlockWrapper
|
||||||
},
|
},
|
||||||
|
"-servo-input-absolute" => {
|
||||||
|
if !self.in_user_agent_stylesheet() {
|
||||||
|
return Err(())
|
||||||
|
}
|
||||||
|
ServoInlineAbsolute
|
||||||
|
},
|
||||||
_ => return Err(())
|
_ => return Err(())
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -368,6 +377,8 @@ impl SelectorImpl {
|
||||||
fun(PseudoElement::ServoAnonymousTableRow);
|
fun(PseudoElement::ServoAnonymousTableRow);
|
||||||
fun(PseudoElement::ServoAnonymousTableCell);
|
fun(PseudoElement::ServoAnonymousTableCell);
|
||||||
fun(PseudoElement::ServoAnonymousBlock);
|
fun(PseudoElement::ServoAnonymousBlock);
|
||||||
|
fun(PseudoElement::ServoInlineBlockWrapper);
|
||||||
|
fun(PseudoElement::ServoInlineAbsolute);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the pseudo-class state flag for selector matching.
|
/// Returns the pseudo-class state flag for selector matching.
|
||||||
|
|
|
@ -399,7 +399,8 @@ impl Stylist {
|
||||||
PseudoElement::ServoAnonymousTableRow |
|
PseudoElement::ServoAnonymousTableRow |
|
||||||
PseudoElement::ServoAnonymousTableWrapper |
|
PseudoElement::ServoAnonymousTableWrapper |
|
||||||
PseudoElement::ServoTableWrapper |
|
PseudoElement::ServoTableWrapper |
|
||||||
PseudoElement::ServoInlineBlockWrapper => true,
|
PseudoElement::ServoInlineBlockWrapper |
|
||||||
|
PseudoElement::ServoInlineAbsolute => true,
|
||||||
PseudoElement::Before |
|
PseudoElement::Before |
|
||||||
PseudoElement::After |
|
PseudoElement::After |
|
||||||
PseudoElement::Selection |
|
PseudoElement::Selection |
|
||||||
|
|
|
@ -222,3 +222,11 @@ svg > * {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 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