diff options
-rw-r--r-- | components/layout/display_list/builder.rs | 9 | ||||
-rw-r--r-- | components/script_layout_interface/wrapper_traits.rs | 18 |
2 files changed, 12 insertions, 15 deletions
diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs index 73affaf07e8..9fd15478ac3 100644 --- a/components/layout/display_list/builder.rs +++ b/components/layout/display_list/builder.rs @@ -45,7 +45,6 @@ use msg::constellation_msg::{BrowsingContextId, PipelineId}; use net_traits::image::base::PixelFormat; use net_traits::image_cache::UsePlaceholder; use range::Range; -use script_layout_interface::wrapper_traits::PseudoElementType; use servo_config::opts; use servo_geometry::max_rect; use std::{cmp, f32}; @@ -2276,13 +2275,7 @@ 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, - } + self.pseudo.fragment_type() } } diff --git a/components/script_layout_interface/wrapper_traits.rs b/components/script_layout_interface/wrapper_traits.rs index d6b8794b9d6..dc1f5db4c54 100644 --- a/components/script_layout_interface/wrapper_traits.rs +++ b/components/script_layout_interface/wrapper_traits.rs @@ -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 { |