layout: Remove type parameter from PseudoElementType.

Everyone uses () now.
This commit is contained in:
Emilio Cobos Álvarez 2018-01-14 21:28:50 +01:00
parent cb2bba8777
commit e32d6f6adf
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
7 changed files with 60 additions and 69 deletions

View file

@ -109,7 +109,10 @@ pub enum ConstructionItem {
/// Inline fragments and associated {ib} splits that have not yet found flows.
InlineFragments(InlineFragmentsConstructionResult),
/// 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
TableColumnFragment(Fragment),
}
@ -257,7 +260,7 @@ impl InlineFragmentsAccumulator {
fragments: IntermediateInlineFragments::new(),
enclosing_node: Some(InlineFragmentNodeInfo {
address: node.opaque(),
pseudo: node.get_pseudo_element_type().strip(),
pseudo: node.get_pseudo_element_type(),
style: node.style(style_context),
selected_style: node.selected_style(),
flags: InlineFragmentNodeFlags::FIRST_FRAGMENT_OF_ELEMENT |
@ -695,7 +698,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
let specific_fragment_info = SpecificFragmentInfo::UnscannedText(info);
fragments.fragments.push_back(Fragment::from_opaque_node_and_style(
node.opaque(),
node.get_pseudo_element_type().strip(),
node.get_pseudo_element_type(),
style,
selected_style,
node.restyle_damage(),
@ -715,7 +718,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
};
fragments.fragments.push_back(Fragment::from_opaque_node_and_style(
node.opaque(),
node.get_pseudo_element_type().strip(),
node.get_pseudo_element_type(),
style.clone(),
selected_style.clone(),
node.restyle_damage(),
@ -851,7 +854,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
Box::new(UnscannedTextFragmentInfo::new(String::new(), None))
);
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.selected_style(),
node.restyle_damage(),
@ -898,7 +901,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
if node.is_ignorable_whitespace(context) {
return ConstructionResult::ConstructionItem(ConstructionItem::Whitespace(
node.opaque(),
node.get_pseudo_element_type().strip(),
node.get_pseudo_element_type(),
context.stylist.style_for_anonymous(
&context.guards, &PseudoElement::ServoText, &style),
node.restyle_damage()))
@ -951,7 +954,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
let fragment_info = SpecificFragmentInfo::InlineBlock(InlineBlockFragmentInfo::new(
block_flow));
let fragment = Fragment::from_opaque_node_and_style(node.opaque(),
node.get_pseudo_element_type().strip(),
node.get_pseudo_element_type(),
style,
node.selected_style(),
node.restyle_damage(),
@ -1392,7 +1395,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
if fragment.node != node.opaque() {
continue
}
if fragment.pseudo != node.get_pseudo_element_type().strip() {
if fragment.pseudo != node.get_pseudo_element_type() {
continue
}
@ -1641,10 +1644,10 @@ impl<ConcreteThreadSafeLayoutNode> NodeUtils for ConcreteThreadSafeLayoutNode
fn construction_result_mut(self, data: &mut LayoutData) -> &mut ConstructionResult {
match self.get_pseudo_element_type() {
PseudoElementType::Before(_) => &mut data.before_flow_construction_result,
PseudoElementType::After(_) => &mut data.after_flow_construction_result,
PseudoElementType::DetailsSummary(_) => &mut data.details_summary_flow_construction_result,
PseudoElementType::DetailsContent(_) => &mut data.details_content_flow_construction_result,
PseudoElementType::Before => &mut data.before_flow_construction_result,
PseudoElementType::After => &mut data.after_flow_construction_result,
PseudoElementType::DetailsSummary => &mut data.details_summary_flow_construction_result,
PseudoElementType::DetailsContent => &mut data.details_content_flow_construction_result,
PseudoElementType::Normal => &mut data.flow_construction_result,
}
}

View file

@ -2278,10 +2278,10 @@ impl FragmentDisplayListBuilding for Fragment {
fn fragment_type(&self) -> FragmentType {
match self.pseudo {
PseudoElementType::Normal => FragmentType::FragmentBody,
PseudoElementType::Before(_) => FragmentType::BeforePseudoContent,
PseudoElementType::After(_) => FragmentType::AfterPseudoContent,
PseudoElementType::DetailsSummary(_) => FragmentType::FragmentBody,
PseudoElementType::DetailsContent(_) => FragmentType::FragmentBody,
PseudoElementType::Before => FragmentType::BeforePseudoContent,
PseudoElementType::After => FragmentType::AfterPseudoContent,
PseudoElementType::DetailsSummary => FragmentType::FragmentBody,
PseudoElementType::DetailsContent => FragmentType::FragmentBody,
}
}
}

View file

@ -138,7 +138,7 @@ pub struct Fragment {
pub restyle_damage: RestyleDamage,
/// The pseudo-element that this fragment represents.
pub pseudo: PseudoElementType<()>,
pub pseudo: PseudoElementType,
/// Various flags for this fragment.
pub flags: FragmentFlags,
@ -622,7 +622,7 @@ impl Fragment {
margin: LogicalMargin::zero(writing_mode),
specific: specific,
inline_context: None,
pseudo: node.get_pseudo_element_type().strip(),
pseudo: node.get_pseudo_element_type(),
flags: FragmentFlags::empty(),
debug_id: DebugId::new(),
stacking_context_id: StackingContextId::root(),
@ -631,7 +631,7 @@ impl Fragment {
/// Constructs a new `Fragment` instance from an opaque node.
pub fn from_opaque_node_and_style(node: OpaqueNode,
pseudo: PseudoElementType<()>,
pseudo: PseudoElementType,
style: ServoArc<ComputedValues>,
selected_style: ServoArc<ComputedValues>,
mut restyle_damage: RestyleDamage,

View file

@ -368,7 +368,7 @@ impl Counter {
fn render(&self,
layout_context: &LayoutContext,
node: OpaqueNode,
pseudo: PseudoElementType<()>,
pseudo: PseudoElementType,
style: ::ServoArc<ComputedValues>,
list_style_type: ListStyleType,
mode: RenderingMode)
@ -431,7 +431,7 @@ struct CounterValue {
/// Creates fragment info for a literal string.
fn render_text(layout_context: &LayoutContext,
node: OpaqueNode,
pseudo: PseudoElementType<()>,
pseudo: PseudoElementType,
style: ::ServoArc<ComputedValues>,
string: String)
-> Option<SpecificFragmentInfo> {

View file

@ -1766,7 +1766,7 @@ pub struct InlineFragmentNodeInfo {
pub address: OpaqueNode,
pub style: ServoArc<ComputedValues>,
pub selected_style: ServoArc<ComputedValues>,
pub pseudo: PseudoElementType<()>,
pub pseudo: PseudoElementType,
pub flags: InlineFragmentNodeFlags,
}