mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Rework CB management during stacking context tree construction
Manage containing blocks and WebRender SpaceAndClip during stacking context tree constuction using the ContainingBlockInfo data structure. This will allow us to reuse this data structure whenever we traverse the fragment tree. In addition, StackingContextBuilder is no longer necessary at all. This change also fixes some bugs where fixed position fragments were not placed in the correct spatial node. Unfortunately, these fixes are difficult to test because of #29659.
This commit is contained in:
parent
0cffe557c2
commit
0c13fcb9f2
10 changed files with 466 additions and 322 deletions
|
@ -19,7 +19,6 @@ use serde::ser::{Serialize, Serializer};
|
|||
use servo_arc::Arc as ServoArc;
|
||||
use std::sync::Arc;
|
||||
use style::computed_values::overflow_x::T as ComputedOverflow;
|
||||
use style::computed_values::position::T as ComputedPosition;
|
||||
use style::dom::OpaqueNode;
|
||||
use style::logical_geometry::WritingMode;
|
||||
use style::properties::ComputedValues;
|
||||
|
@ -68,18 +67,19 @@ impl Tag {
|
|||
pub(crate) enum Fragment {
|
||||
Box(BoxFragment),
|
||||
Anonymous(AnonymousFragment),
|
||||
AbsoluteOrFixedPositioned(AbsoluteOrFixedPositionedFragment),
|
||||
/// Absolute and fixed position fragments are hoisted up so that they
|
||||
/// are children of the BoxFragment that establishes their containing
|
||||
/// blocks, so that they can be laid out properly. When this happens
|
||||
/// an `AbsoluteOrFixedPositioned` fragment is left at the original tree
|
||||
/// position. This allows these hoisted fragments to be painted with
|
||||
/// regard to their original tree order during stacking context tree /
|
||||
/// display list construction.
|
||||
AbsoluteOrFixedPositioned(ArcRefCell<HoistedSharedFragment>),
|
||||
Text(TextFragment),
|
||||
Image(ImageFragment),
|
||||
IFrame(IFrameFragment),
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub(crate) struct AbsoluteOrFixedPositionedFragment {
|
||||
pub position: ComputedPosition,
|
||||
pub hoisted_fragment: ArcRefCell<HoistedSharedFragment>,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub(crate) struct BoxFragment {
|
||||
pub tag: Tag,
|
||||
|
@ -214,7 +214,9 @@ impl Fragment {
|
|||
pub fn print(&self, tree: &mut PrintTree) {
|
||||
match self {
|
||||
Fragment::Box(fragment) => fragment.print(tree),
|
||||
Fragment::AbsoluteOrFixedPositioned(fragment) => fragment.print(tree),
|
||||
Fragment::AbsoluteOrFixedPositioned(_) => {
|
||||
tree.add_item("AbsoluteOrFixedPositioned".to_string());
|
||||
},
|
||||
Fragment::Anonymous(fragment) => fragment.print(tree),
|
||||
Fragment::Text(fragment) => fragment.print(tree),
|
||||
Fragment::Image(fragment) => fragment.print(tree),
|
||||
|
@ -280,12 +282,6 @@ impl Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
impl AbsoluteOrFixedPositionedFragment {
|
||||
pub fn print(&self, tree: &mut PrintTree) {
|
||||
tree.add_item(format!("AbsoluteOrFixedPositionedFragment"));
|
||||
}
|
||||
}
|
||||
|
||||
impl AnonymousFragment {
|
||||
pub fn no_op(mode: WritingMode) -> Self {
|
||||
Self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue