layout: Deduplicate Node::fragment_type and FragmentDisplayListBuilding::fragment_type.

This commit is contained in:
Emilio Cobos Álvarez 2018-01-14 21:31:59 +01:00
parent e32d6f6adf
commit bc29a16285
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
2 changed files with 12 additions and 15 deletions

View file

@ -37,6 +37,16 @@ pub enum PseudoElementType {
}
impl PseudoElementType {
pub fn fragment_type(&self) -> FragmentType {
match *self {
PseudoElementType::Normal => FragmentType::FragmentBody,
PseudoElementType::Before => FragmentType::BeforePseudoContent,
PseudoElementType::After => FragmentType::AfterPseudoContent,
PseudoElementType::DetailsSummary => FragmentType::FragmentBody,
PseudoElementType::DetailsContent => FragmentType::FragmentBody,
}
}
pub fn is_before(&self) -> bool {
match *self {
PseudoElementType::Before => true,
@ -254,13 +264,7 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + Debug + GetLayoutData + NodeInfo
fn get_rowspan(&self) -> u32;
fn fragment_type(&self) -> FragmentType {
match self.get_pseudo_element_type() {
PseudoElementType::Normal => FragmentType::FragmentBody,
PseudoElementType::Before => FragmentType::BeforePseudoContent,
PseudoElementType::After => FragmentType::AfterPseudoContent,
PseudoElementType::DetailsSummary => FragmentType::FragmentBody,
PseudoElementType::DetailsContent => FragmentType::FragmentBody,
}
self.get_pseudo_element_type().fragment_type()
}
fn generate_scroll_root_id(&self, pipeline_id: PipelineId) -> ClipId {