diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-01-14 21:31:59 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-01-14 21:45:39 +0100 |
commit | bc29a162854eee3df214a926e4cb57cc950d63f6 (patch) | |
tree | 89a77d7c6856ce9aa15cfbc056e4ef0e37fbf4fb /components/script_layout_interface/wrapper_traits.rs | |
parent | e32d6f6adf0d97b628ed90f1bca72e69a590e281 (diff) | |
download | servo-bc29a162854eee3df214a926e4cb57cc950d63f6.tar.gz servo-bc29a162854eee3df214a926e4cb57cc950d63f6.zip |
layout: Deduplicate Node::fragment_type and FragmentDisplayListBuilding::fragment_type.
Diffstat (limited to 'components/script_layout_interface/wrapper_traits.rs')
-rw-r--r-- | components/script_layout_interface/wrapper_traits.rs | 18 |
1 files changed, 11 insertions, 7 deletions
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 { |