mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
layout: Don't call establishes_stacking_context()
so much.
That function is expensive because it has to check a lot.
This commit is contained in:
parent
dd5c574d7f
commit
72a52e23e0
2 changed files with 25 additions and 11 deletions
|
@ -1622,14 +1622,18 @@ impl BlockFlow {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn establishes_pseudo_stacking_context(&self) -> bool {
|
||||
pub fn block_stacking_context_type(&self) -> BlockStackingContextType {
|
||||
if self.fragment.establishes_stacking_context() {
|
||||
return false;
|
||||
return BlockStackingContextType::StackingContext
|
||||
}
|
||||
|
||||
self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) ||
|
||||
self.fragment.style.get_box().position != position::T::static_ ||
|
||||
self.base.flags.is_float()
|
||||
if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) ||
|
||||
self.fragment.style.get_box().position != position::T::static_ ||
|
||||
self.base.flags.is_float() {
|
||||
BlockStackingContextType::PseudoStackingContext
|
||||
} else {
|
||||
BlockStackingContextType::NonstackingContext
|
||||
}
|
||||
}
|
||||
|
||||
pub fn has_scrolling_overflow(&self) -> bool {
|
||||
|
@ -3037,3 +3041,12 @@ impl ISizeAndMarginsComputer for InlineBlockReplaced {
|
|||
MaybeAuto::Specified(fragment.content_inline_size())
|
||||
}
|
||||
}
|
||||
|
||||
/// A stacking context, a pseudo-stacking context, or a non-stacking context.
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub enum BlockStackingContextType {
|
||||
NonstackingContext,
|
||||
PseudoStackingContext,
|
||||
StackingContext,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue