mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
layout: Remove type parameter from PseudoElementType.
Everyone uses () now.
This commit is contained in:
parent
cb2bba8777
commit
e32d6f6adf
7 changed files with 60 additions and 69 deletions
|
@ -109,7 +109,10 @@ pub enum ConstructionItem {
|
||||||
/// Inline fragments and associated {ib} splits that have not yet found flows.
|
/// Inline fragments and associated {ib} splits that have not yet found flows.
|
||||||
InlineFragments(InlineFragmentsConstructionResult),
|
InlineFragments(InlineFragmentsConstructionResult),
|
||||||
/// Potentially ignorable whitespace.
|
/// Potentially ignorable whitespace.
|
||||||
Whitespace(OpaqueNode, PseudoElementType<()>, ServoArc<ComputedValues>, RestyleDamage),
|
///
|
||||||
|
/// FIXME(emilio): How could whitespace have any PseudoElementType other
|
||||||
|
/// than Normal?
|
||||||
|
Whitespace(OpaqueNode, PseudoElementType, ServoArc<ComputedValues>, RestyleDamage),
|
||||||
/// TableColumn Fragment
|
/// TableColumn Fragment
|
||||||
TableColumnFragment(Fragment),
|
TableColumnFragment(Fragment),
|
||||||
}
|
}
|
||||||
|
@ -257,7 +260,7 @@ impl InlineFragmentsAccumulator {
|
||||||
fragments: IntermediateInlineFragments::new(),
|
fragments: IntermediateInlineFragments::new(),
|
||||||
enclosing_node: Some(InlineFragmentNodeInfo {
|
enclosing_node: Some(InlineFragmentNodeInfo {
|
||||||
address: node.opaque(),
|
address: node.opaque(),
|
||||||
pseudo: node.get_pseudo_element_type().strip(),
|
pseudo: node.get_pseudo_element_type(),
|
||||||
style: node.style(style_context),
|
style: node.style(style_context),
|
||||||
selected_style: node.selected_style(),
|
selected_style: node.selected_style(),
|
||||||
flags: InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT |
|
flags: InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT |
|
||||||
|
@ -695,7 +698,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
let specific_fragment_info = SpecificFragmentInfo::UnscannedText(info);
|
let specific_fragment_info = SpecificFragmentInfo::UnscannedText(info);
|
||||||
fragments.fragments.push_back(Fragment::from_opaque_node_and_style(
|
fragments.fragments.push_back(Fragment::from_opaque_node_and_style(
|
||||||
node.opaque(),
|
node.opaque(),
|
||||||
node.get_pseudo_element_type().strip(),
|
node.get_pseudo_element_type(),
|
||||||
style,
|
style,
|
||||||
selected_style,
|
selected_style,
|
||||||
node.restyle_damage(),
|
node.restyle_damage(),
|
||||||
|
@ -715,7 +718,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
};
|
};
|
||||||
fragments.fragments.push_back(Fragment::from_opaque_node_and_style(
|
fragments.fragments.push_back(Fragment::from_opaque_node_and_style(
|
||||||
node.opaque(),
|
node.opaque(),
|
||||||
node.get_pseudo_element_type().strip(),
|
node.get_pseudo_element_type(),
|
||||||
style.clone(),
|
style.clone(),
|
||||||
selected_style.clone(),
|
selected_style.clone(),
|
||||||
node.restyle_damage(),
|
node.restyle_damage(),
|
||||||
|
@ -851,7 +854,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
Box::new(UnscannedTextFragmentInfo::new(String::new(), None))
|
Box::new(UnscannedTextFragmentInfo::new(String::new(), None))
|
||||||
);
|
);
|
||||||
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(),
|
||||||
node_style.clone(),
|
node_style.clone(),
|
||||||
node.selected_style(),
|
node.selected_style(),
|
||||||
node.restyle_damage(),
|
node.restyle_damage(),
|
||||||
|
@ -898,7 +901,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
if node.is_ignorable_whitespace(context) {
|
if node.is_ignorable_whitespace(context) {
|
||||||
return ConstructionResult::ConstructionItem(ConstructionItem::Whitespace(
|
return ConstructionResult::ConstructionItem(ConstructionItem::Whitespace(
|
||||||
node.opaque(),
|
node.opaque(),
|
||||||
node.get_pseudo_element_type().strip(),
|
node.get_pseudo_element_type(),
|
||||||
context.stylist.style_for_anonymous(
|
context.stylist.style_for_anonymous(
|
||||||
&context.guards, &PseudoElement::ServoText, &style),
|
&context.guards, &PseudoElement::ServoText, &style),
|
||||||
node.restyle_damage()))
|
node.restyle_damage()))
|
||||||
|
@ -951,7 +954,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
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(),
|
||||||
style,
|
style,
|
||||||
node.selected_style(),
|
node.selected_style(),
|
||||||
node.restyle_damage(),
|
node.restyle_damage(),
|
||||||
|
@ -1392,7 +1395,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
|
||||||
if fragment.node != node.opaque() {
|
if fragment.node != node.opaque() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if fragment.pseudo != node.get_pseudo_element_type().strip() {
|
if fragment.pseudo != node.get_pseudo_element_type() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1641,10 +1644,10 @@ impl<ConcreteThreadSafeLayoutNode> NodeUtils for ConcreteThreadSafeLayoutNode
|
||||||
|
|
||||||
fn construction_result_mut(self, data: &mut LayoutData) -> &mut ConstructionResult {
|
fn construction_result_mut(self, data: &mut LayoutData) -> &mut ConstructionResult {
|
||||||
match self.get_pseudo_element_type() {
|
match self.get_pseudo_element_type() {
|
||||||
PseudoElementType::Before(_) => &mut data.before_flow_construction_result,
|
PseudoElementType::Before => &mut data.before_flow_construction_result,
|
||||||
PseudoElementType::After(_) => &mut data.after_flow_construction_result,
|
PseudoElementType::After => &mut data.after_flow_construction_result,
|
||||||
PseudoElementType::DetailsSummary(_) => &mut data.details_summary_flow_construction_result,
|
PseudoElementType::DetailsSummary => &mut data.details_summary_flow_construction_result,
|
||||||
PseudoElementType::DetailsContent(_) => &mut data.details_content_flow_construction_result,
|
PseudoElementType::DetailsContent => &mut data.details_content_flow_construction_result,
|
||||||
PseudoElementType::Normal => &mut data.flow_construction_result,
|
PseudoElementType::Normal => &mut data.flow_construction_result,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2278,10 +2278,10 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
fn fragment_type(&self) -> FragmentType {
|
fn fragment_type(&self) -> FragmentType {
|
||||||
match self.pseudo {
|
match self.pseudo {
|
||||||
PseudoElementType::Normal => FragmentType::FragmentBody,
|
PseudoElementType::Normal => FragmentType::FragmentBody,
|
||||||
PseudoElementType::Before(_) => FragmentType::BeforePseudoContent,
|
PseudoElementType::Before => FragmentType::BeforePseudoContent,
|
||||||
PseudoElementType::After(_) => FragmentType::AfterPseudoContent,
|
PseudoElementType::After => FragmentType::AfterPseudoContent,
|
||||||
PseudoElementType::DetailsSummary(_) => FragmentType::FragmentBody,
|
PseudoElementType::DetailsSummary => FragmentType::FragmentBody,
|
||||||
PseudoElementType::DetailsContent(_) => FragmentType::FragmentBody,
|
PseudoElementType::DetailsContent => FragmentType::FragmentBody,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,7 +138,7 @@ pub struct Fragment {
|
||||||
pub restyle_damage: RestyleDamage,
|
pub restyle_damage: RestyleDamage,
|
||||||
|
|
||||||
/// The pseudo-element that this fragment represents.
|
/// The pseudo-element that this fragment represents.
|
||||||
pub pseudo: PseudoElementType<()>,
|
pub pseudo: PseudoElementType,
|
||||||
|
|
||||||
/// Various flags for this fragment.
|
/// Various flags for this fragment.
|
||||||
pub flags: FragmentFlags,
|
pub flags: FragmentFlags,
|
||||||
|
@ -622,7 +622,7 @@ impl Fragment {
|
||||||
margin: LogicalMargin::zero(writing_mode),
|
margin: LogicalMargin::zero(writing_mode),
|
||||||
specific: specific,
|
specific: specific,
|
||||||
inline_context: None,
|
inline_context: None,
|
||||||
pseudo: node.get_pseudo_element_type().strip(),
|
pseudo: node.get_pseudo_element_type(),
|
||||||
flags: FragmentFlags::empty(),
|
flags: FragmentFlags::empty(),
|
||||||
debug_id: DebugId::new(),
|
debug_id: DebugId::new(),
|
||||||
stacking_context_id: StackingContextId::root(),
|
stacking_context_id: StackingContextId::root(),
|
||||||
|
@ -631,7 +631,7 @@ impl Fragment {
|
||||||
|
|
||||||
/// Constructs a new `Fragment` instance from an opaque node.
|
/// Constructs a new `Fragment` instance from an opaque node.
|
||||||
pub fn from_opaque_node_and_style(node: OpaqueNode,
|
pub fn from_opaque_node_and_style(node: OpaqueNode,
|
||||||
pseudo: PseudoElementType<()>,
|
pseudo: PseudoElementType,
|
||||||
style: ServoArc<ComputedValues>,
|
style: ServoArc<ComputedValues>,
|
||||||
selected_style: ServoArc<ComputedValues>,
|
selected_style: ServoArc<ComputedValues>,
|
||||||
mut restyle_damage: RestyleDamage,
|
mut restyle_damage: RestyleDamage,
|
||||||
|
|
|
@ -368,7 +368,7 @@ impl Counter {
|
||||||
fn render(&self,
|
fn render(&self,
|
||||||
layout_context: &LayoutContext,
|
layout_context: &LayoutContext,
|
||||||
node: OpaqueNode,
|
node: OpaqueNode,
|
||||||
pseudo: PseudoElementType<()>,
|
pseudo: PseudoElementType,
|
||||||
style: ::ServoArc<ComputedValues>,
|
style: ::ServoArc<ComputedValues>,
|
||||||
list_style_type: ListStyleType,
|
list_style_type: ListStyleType,
|
||||||
mode: RenderingMode)
|
mode: RenderingMode)
|
||||||
|
@ -431,7 +431,7 @@ struct CounterValue {
|
||||||
/// Creates fragment info for a literal string.
|
/// Creates fragment info for a literal string.
|
||||||
fn render_text(layout_context: &LayoutContext,
|
fn render_text(layout_context: &LayoutContext,
|
||||||
node: OpaqueNode,
|
node: OpaqueNode,
|
||||||
pseudo: PseudoElementType<()>,
|
pseudo: PseudoElementType,
|
||||||
style: ::ServoArc<ComputedValues>,
|
style: ::ServoArc<ComputedValues>,
|
||||||
string: String)
|
string: String)
|
||||||
-> Option<SpecificFragmentInfo> {
|
-> Option<SpecificFragmentInfo> {
|
||||||
|
|
|
@ -1766,7 +1766,7 @@ pub struct InlineFragmentNodeInfo {
|
||||||
pub address: OpaqueNode,
|
pub address: OpaqueNode,
|
||||||
pub style: ServoArc<ComputedValues>,
|
pub style: ServoArc<ComputedValues>,
|
||||||
pub selected_style: ServoArc<ComputedValues>,
|
pub selected_style: ServoArc<ComputedValues>,
|
||||||
pub pseudo: PseudoElementType<()>,
|
pub pseudo: PseudoElementType,
|
||||||
pub flags: InlineFragmentNodeFlags,
|
pub flags: InlineFragmentNodeFlags,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -803,7 +803,7 @@ pub struct ServoThreadSafeLayoutNode<'ln> {
|
||||||
|
|
||||||
/// The pseudo-element type, with (optionally)
|
/// The pseudo-element type, with (optionally)
|
||||||
/// a specified display value to override the stylesheet.
|
/// a specified display value to override the stylesheet.
|
||||||
pseudo: PseudoElementType<()>,
|
pseudo: PseudoElementType,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> PartialEq for ServoThreadSafeLayoutNode<'a> {
|
impl<'a> PartialEq for ServoThreadSafeLayoutNode<'a> {
|
||||||
|
@ -993,7 +993,7 @@ impl<ConcreteNode> ThreadSafeLayoutNodeChildrenIterator<ConcreteNode>
|
||||||
unsafe { parent.dangerous_first_child() }
|
unsafe { parent.dangerous_first_child() }
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
PseudoElementType::DetailsContent(_) | PseudoElementType::DetailsSummary(_) => {
|
PseudoElementType::DetailsContent | PseudoElementType::DetailsSummary => {
|
||||||
unsafe { parent.dangerous_first_child() }
|
unsafe { parent.dangerous_first_child() }
|
||||||
},
|
},
|
||||||
_ => None,
|
_ => None,
|
||||||
|
@ -1011,9 +1011,9 @@ impl<ConcreteNode> Iterator for ThreadSafeLayoutNodeChildrenIterator<ConcreteNod
|
||||||
fn next(&mut self) -> Option<ConcreteNode> {
|
fn next(&mut self) -> Option<ConcreteNode> {
|
||||||
use ::selectors::Element;
|
use ::selectors::Element;
|
||||||
match self.parent_node.get_pseudo_element_type() {
|
match self.parent_node.get_pseudo_element_type() {
|
||||||
PseudoElementType::Before(_) | PseudoElementType::After(_) => None,
|
PseudoElementType::Before | PseudoElementType::After => None,
|
||||||
|
|
||||||
PseudoElementType::DetailsSummary(_) => {
|
PseudoElementType::DetailsSummary => {
|
||||||
let mut current_node = self.current_node.clone();
|
let mut current_node = self.current_node.clone();
|
||||||
loop {
|
loop {
|
||||||
let next_node = if let Some(ref node) = current_node {
|
let next_node = if let Some(ref node) = current_node {
|
||||||
|
@ -1033,7 +1033,7 @@ impl<ConcreteNode> Iterator for ThreadSafeLayoutNodeChildrenIterator<ConcreteNod
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PseudoElementType::DetailsContent(_) => {
|
PseudoElementType::DetailsContent => {
|
||||||
let node = self.current_node.clone();
|
let node = self.current_node.clone();
|
||||||
let node = node.and_then(|node| {
|
let node = node.and_then(|node| {
|
||||||
if node.is_element() &&
|
if node.is_element() &&
|
||||||
|
@ -1052,7 +1052,7 @@ impl<ConcreteNode> Iterator for ThreadSafeLayoutNodeChildrenIterator<ConcreteNod
|
||||||
let node = self.current_node.clone();
|
let node = self.current_node.clone();
|
||||||
if let Some(ref node) = node {
|
if let Some(ref node) = node {
|
||||||
self.current_node = match node.get_pseudo_element_type() {
|
self.current_node = match node.get_pseudo_element_type() {
|
||||||
PseudoElementType::Before(_) => {
|
PseudoElementType::Before => {
|
||||||
self.parent_node.get_details_summary_pseudo()
|
self.parent_node.get_details_summary_pseudo()
|
||||||
.or_else(|| unsafe { self.parent_node.dangerous_first_child() })
|
.or_else(|| unsafe { self.parent_node.dangerous_first_child() })
|
||||||
.or_else(|| self.parent_node.get_after_pseudo())
|
.or_else(|| self.parent_node.get_after_pseudo())
|
||||||
|
@ -1060,11 +1060,9 @@ impl<ConcreteNode> Iterator for ThreadSafeLayoutNodeChildrenIterator<ConcreteNod
|
||||||
PseudoElementType::Normal => {
|
PseudoElementType::Normal => {
|
||||||
unsafe { node.dangerous_next_sibling() }.or_else(|| self.parent_node.get_after_pseudo())
|
unsafe { node.dangerous_next_sibling() }.or_else(|| self.parent_node.get_after_pseudo())
|
||||||
},
|
},
|
||||||
PseudoElementType::DetailsSummary(_) => self.parent_node.get_details_content_pseudo(),
|
PseudoElementType::DetailsSummary => self.parent_node.get_details_content_pseudo(),
|
||||||
PseudoElementType::DetailsContent(_) => self.parent_node.get_after_pseudo(),
|
PseudoElementType::DetailsContent => self.parent_node.get_after_pseudo(),
|
||||||
PseudoElementType::After(_) => {
|
PseudoElementType::After => None,
|
||||||
None
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
node
|
node
|
||||||
|
@ -1082,7 +1080,7 @@ pub struct ServoThreadSafeLayoutElement<'le> {
|
||||||
|
|
||||||
/// The pseudo-element type, with (optionally)
|
/// The pseudo-element type, with (optionally)
|
||||||
/// a specified display value to override the stylesheet.
|
/// a specified display value to override the stylesheet.
|
||||||
pseudo: PseudoElementType<()>,
|
pseudo: PseudoElementType,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'le> ThreadSafeLayoutElement for ServoThreadSafeLayoutElement<'le> {
|
impl<'le> ThreadSafeLayoutElement for ServoThreadSafeLayoutElement<'le> {
|
||||||
|
@ -1095,11 +1093,11 @@ impl<'le> ThreadSafeLayoutElement for ServoThreadSafeLayoutElement<'le> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_pseudo_element_type(&self) -> PseudoElementType<()> {
|
fn get_pseudo_element_type(&self) -> PseudoElementType {
|
||||||
self.pseudo
|
self.pseudo
|
||||||
}
|
}
|
||||||
|
|
||||||
fn with_pseudo(&self, pseudo: PseudoElementType<()>) -> Self {
|
fn with_pseudo(&self, pseudo: PseudoElementType) -> Self {
|
||||||
ServoThreadSafeLayoutElement {
|
ServoThreadSafeLayoutElement {
|
||||||
element: self.element.clone(),
|
element: self.element.clone(),
|
||||||
pseudo,
|
pseudo,
|
||||||
|
|
|
@ -28,46 +28,36 @@ use style::stylist::RuleInclusion;
|
||||||
use webrender_api::ClipId;
|
use webrender_api::ClipId;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
pub enum PseudoElementType<T> {
|
pub enum PseudoElementType {
|
||||||
Normal,
|
Normal,
|
||||||
Before(T),
|
Before,
|
||||||
After(T),
|
After,
|
||||||
DetailsSummary(T),
|
DetailsSummary,
|
||||||
DetailsContent(T),
|
DetailsContent,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> PseudoElementType<T> {
|
impl PseudoElementType {
|
||||||
pub fn is_before(&self) -> bool {
|
pub fn is_before(&self) -> bool {
|
||||||
match *self {
|
match *self {
|
||||||
PseudoElementType::Before(_) => true,
|
PseudoElementType::Before => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_replaced_content(&self) -> bool {
|
pub fn is_replaced_content(&self) -> bool {
|
||||||
match *self {
|
match *self {
|
||||||
PseudoElementType::Before(_) | PseudoElementType::After(_) => true,
|
PseudoElementType::Before | PseudoElementType::After => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn strip(&self) -> PseudoElementType<()> {
|
|
||||||
match *self {
|
|
||||||
PseudoElementType::Normal => PseudoElementType::Normal,
|
|
||||||
PseudoElementType::Before(_) => PseudoElementType::Before(()),
|
|
||||||
PseudoElementType::After(_) => PseudoElementType::After(()),
|
|
||||||
PseudoElementType::DetailsSummary(_) => PseudoElementType::DetailsSummary(()),
|
|
||||||
PseudoElementType::DetailsContent(_) => PseudoElementType::DetailsContent(()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn style_pseudo_element(&self) -> PseudoElement {
|
pub fn style_pseudo_element(&self) -> PseudoElement {
|
||||||
match *self {
|
match *self {
|
||||||
PseudoElementType::Normal => unreachable!("style_pseudo_element called with PseudoElementType::Normal"),
|
PseudoElementType::Normal => unreachable!("style_pseudo_element called with PseudoElementType::Normal"),
|
||||||
PseudoElementType::Before(_) => PseudoElement::Before,
|
PseudoElementType::Before => PseudoElement::Before,
|
||||||
PseudoElementType::After(_) => PseudoElement::After,
|
PseudoElementType::After => PseudoElement::After,
|
||||||
PseudoElementType::DetailsSummary(_) => PseudoElement::DetailsSummary,
|
PseudoElementType::DetailsSummary => PseudoElement::DetailsSummary,
|
||||||
PseudoElementType::DetailsContent(_) => PseudoElement::DetailsContent,
|
PseudoElementType::DetailsContent => PseudoElement::DetailsContent,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -196,7 +186,7 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + Debug + GetLayoutData + NodeInfo
|
||||||
fn as_element(&self) -> Option<Self::ConcreteThreadSafeLayoutElement>;
|
fn as_element(&self) -> Option<Self::ConcreteThreadSafeLayoutElement>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_pseudo_element_type(&self) -> PseudoElementType<()> {
|
fn get_pseudo_element_type(&self) -> PseudoElementType {
|
||||||
self.as_element().map_or(PseudoElementType::Normal, |el| el.get_pseudo_element_type())
|
self.as_element().map_or(PseudoElementType::Normal, |el| el.get_pseudo_element_type())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,10 +256,10 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + Debug + GetLayoutData + NodeInfo
|
||||||
fn fragment_type(&self) -> FragmentType {
|
fn fragment_type(&self) -> FragmentType {
|
||||||
match self.get_pseudo_element_type() {
|
match self.get_pseudo_element_type() {
|
||||||
PseudoElementType::Normal => FragmentType::FragmentBody,
|
PseudoElementType::Normal => FragmentType::FragmentBody,
|
||||||
PseudoElementType::Before(_) => FragmentType::BeforePseudoContent,
|
PseudoElementType::Before => FragmentType::BeforePseudoContent,
|
||||||
PseudoElementType::After(_) => FragmentType::AfterPseudoContent,
|
PseudoElementType::After => FragmentType::AfterPseudoContent,
|
||||||
PseudoElementType::DetailsSummary(_) => FragmentType::FragmentBody,
|
PseudoElementType::DetailsSummary => FragmentType::FragmentBody,
|
||||||
PseudoElementType::DetailsContent(_) => FragmentType::FragmentBody,
|
PseudoElementType::DetailsContent => FragmentType::FragmentBody,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,7 +291,7 @@ pub trait ThreadSafeLayoutElement
|
||||||
|
|
||||||
/// Creates a new `ThreadSafeLayoutElement` for the same `LayoutElement`
|
/// Creates a new `ThreadSafeLayoutElement` for the same `LayoutElement`
|
||||||
/// with a different pseudo-element type.
|
/// with a different pseudo-element type.
|
||||||
fn with_pseudo(&self, pseudo: PseudoElementType<()>) -> Self;
|
fn with_pseudo(&self, pseudo: PseudoElementType) -> Self;
|
||||||
|
|
||||||
/// Returns the type ID of this node.
|
/// Returns the type ID of this node.
|
||||||
/// Returns `None` if this is a pseudo-element; otherwise, returns `Some`.
|
/// Returns `None` if this is a pseudo-element; otherwise, returns `Some`.
|
||||||
|
@ -324,12 +314,12 @@ pub trait ThreadSafeLayoutElement
|
||||||
fn style_data(&self) -> AtomicRef<ElementData>;
|
fn style_data(&self) -> AtomicRef<ElementData>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_pseudo_element_type(&self) -> PseudoElementType<()>;
|
fn get_pseudo_element_type(&self) -> PseudoElementType;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_before_pseudo(&self) -> Option<Self> {
|
fn get_before_pseudo(&self) -> Option<Self> {
|
||||||
if self.style_data().styles.pseudos.get(&PseudoElement::Before).is_some() {
|
if self.style_data().styles.pseudos.get(&PseudoElement::Before).is_some() {
|
||||||
Some(self.with_pseudo(PseudoElementType::Before(())))
|
Some(self.with_pseudo(PseudoElementType::Before))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -338,7 +328,7 @@ pub trait ThreadSafeLayoutElement
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_after_pseudo(&self) -> Option<Self> {
|
fn get_after_pseudo(&self) -> Option<Self> {
|
||||||
if self.style_data().styles.pseudos.get(&PseudoElement::After).is_some() {
|
if self.style_data().styles.pseudos.get(&PseudoElement::After).is_some() {
|
||||||
Some(self.with_pseudo(PseudoElementType::After(())))
|
Some(self.with_pseudo(PseudoElementType::After))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -348,7 +338,7 @@ pub trait ThreadSafeLayoutElement
|
||||||
fn get_details_summary_pseudo(&self) -> Option<Self> {
|
fn get_details_summary_pseudo(&self) -> Option<Self> {
|
||||||
if self.get_local_name() == &local_name!("details") &&
|
if self.get_local_name() == &local_name!("details") &&
|
||||||
self.get_namespace() == &ns!(html) {
|
self.get_namespace() == &ns!(html) {
|
||||||
Some(self.with_pseudo(PseudoElementType::DetailsSummary(())))
|
Some(self.with_pseudo(PseudoElementType::DetailsSummary))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -359,7 +349,7 @@ pub trait ThreadSafeLayoutElement
|
||||||
if self.get_local_name() == &local_name!("details") &&
|
if self.get_local_name() == &local_name!("details") &&
|
||||||
self.get_namespace() == &ns!(html) &&
|
self.get_namespace() == &ns!(html) &&
|
||||||
self.get_attr(&ns!(), &local_name!("open")).is_some() {
|
self.get_attr(&ns!(), &local_name!("open")).is_some() {
|
||||||
Some(self.with_pseudo(PseudoElementType::DetailsContent(())))
|
Some(self.with_pseudo(PseudoElementType::DetailsContent))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue