mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
layout: Deduplicate Node::fragment_type and FragmentDisplayListBuilding::fragment_type.
This commit is contained in:
parent
e32d6f6adf
commit
bc29a16285
2 changed files with 12 additions and 15 deletions
|
@ -45,7 +45,6 @@ use msg::constellation_msg::{BrowsingContextId, PipelineId};
|
||||||
use net_traits::image::base::PixelFormat;
|
use net_traits::image::base::PixelFormat;
|
||||||
use net_traits::image_cache::UsePlaceholder;
|
use net_traits::image_cache::UsePlaceholder;
|
||||||
use range::Range;
|
use range::Range;
|
||||||
use script_layout_interface::wrapper_traits::PseudoElementType;
|
|
||||||
use servo_config::opts;
|
use servo_config::opts;
|
||||||
use servo_geometry::max_rect;
|
use servo_geometry::max_rect;
|
||||||
use std::{cmp, f32};
|
use std::{cmp, f32};
|
||||||
|
@ -2276,13 +2275,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fragment_type(&self) -> FragmentType {
|
fn fragment_type(&self) -> FragmentType {
|
||||||
match self.pseudo {
|
self.pseudo.fragment_type()
|
||||||
PseudoElementType::Normal => FragmentType::FragmentBody,
|
|
||||||
PseudoElementType::Before => FragmentType::BeforePseudoContent,
|
|
||||||
PseudoElementType::After => FragmentType::AfterPseudoContent,
|
|
||||||
PseudoElementType::DetailsSummary => FragmentType::FragmentBody,
|
|
||||||
PseudoElementType::DetailsContent => FragmentType::FragmentBody,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,16 @@ pub enum PseudoElementType {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl 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 {
|
pub fn is_before(&self) -> bool {
|
||||||
match *self {
|
match *self {
|
||||||
PseudoElementType::Before => true,
|
PseudoElementType::Before => true,
|
||||||
|
@ -254,13 +264,7 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + Debug + GetLayoutData + NodeInfo
|
||||||
fn get_rowspan(&self) -> u32;
|
fn get_rowspan(&self) -> u32;
|
||||||
|
|
||||||
fn fragment_type(&self) -> FragmentType {
|
fn fragment_type(&self) -> FragmentType {
|
||||||
match self.get_pseudo_element_type() {
|
self.get_pseudo_element_type().fragment_type()
|
||||||
PseudoElementType::Normal => FragmentType::FragmentBody,
|
|
||||||
PseudoElementType::Before => FragmentType::BeforePseudoContent,
|
|
||||||
PseudoElementType::After => FragmentType::AfterPseudoContent,
|
|
||||||
PseudoElementType::DetailsSummary => FragmentType::FragmentBody,
|
|
||||||
PseudoElementType::DetailsContent => FragmentType::FragmentBody,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn generate_scroll_root_id(&self, pipeline_id: PipelineId) -> ClipId {
|
fn generate_scroll_root_id(&self, pipeline_id: PipelineId) -> ClipId {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue