aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/fragments.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/layout_2020/fragments.rs')
-rw-r--r--components/layout_2020/fragments.rs26
1 files changed, 11 insertions, 15 deletions
diff --git a/components/layout_2020/fragments.rs b/components/layout_2020/fragments.rs
index b54fa90a52b..687bdbe083e 100644
--- a/components/layout_2020/fragments.rs
+++ b/components/layout_2020/fragments.rs
@@ -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,19 +67,20 @@ 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,
pub debug_id: DebugId,
@@ -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 {