mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Simplify stacking context creation
Have Fragment::create_stacking_context understand which stacking contexts need layers and which do not. This simplifies the way it is called and eliminates a bunch of code.
This commit is contained in:
parent
fb6d0946cb
commit
1a494b1a73
3 changed files with 67 additions and 94 deletions
|
@ -22,6 +22,7 @@ use inline::{InlineMetrics, LAST_FRAGMENT_OF_ELEMENT};
|
|||
use ipc_channel::ipc::IpcSender;
|
||||
use layout_debug;
|
||||
use model::{self, IntrinsicISizes, IntrinsicISizesContribution, MaybeAuto, specified};
|
||||
use msg::compositor_msg::{LayerId, LayerType};
|
||||
use msg::constellation_msg::{PipelineId, SubpageId};
|
||||
use net_traits::image::base::Image;
|
||||
use net_traits::image_cache_task::UsePlaceholder;
|
||||
|
@ -2423,6 +2424,19 @@ impl Fragment {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn layer_id(&self) -> LayerId {
|
||||
let layer_type = match self.pseudo {
|
||||
PseudoElementType::Normal => LayerType::FragmentBody,
|
||||
PseudoElementType::Before(_) => LayerType::BeforePseudoContent,
|
||||
PseudoElementType::After(_) => LayerType::AfterPseudoContent
|
||||
};
|
||||
LayerId::new_of_type(layer_type, self.node.id() as usize)
|
||||
}
|
||||
|
||||
pub fn layer_id_for_overflow_scroll(&self) -> LayerId {
|
||||
LayerId::new_of_type(LayerType::OverflowScroll, self.node.id() as usize)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for Fragment {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue