diff options
author | Martin Robinson <mrobinson@igalia.com> | 2024-03-27 12:57:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-27 11:57:27 +0000 |
commit | b8c82c1ab00dc8d3738523b60afd9cdcf548e83c (patch) | |
tree | c4ba2c6921474efc91be5b86c39840b458700e18 /components/layout_2020/positioned.rs | |
parent | 15cb9dd5fcdee81c80c5c19b12bb50504754c2ad (diff) | |
download | servo-b8c82c1ab00dc8d3738523b60afd9cdcf548e83c.tar.gz servo-b8c82c1ab00dc8d3738523b60afd9cdcf548e83c.zip |
layout: Allow transforming inline replaced elements (#31833)
This requires passing through information about whether or not the
element in question is replaced when checking to see if it's
transformable and transitively all functions that make decisions about
containing blocks. A new FragmentFlag is added to help track this -- it
will be set on both the replaced items BoxFragment container as well as
the Fragment for the replaced item itself.
Fixes #31806.
Diffstat (limited to 'components/layout_2020/positioned.rs')
-rw-r--r-- | components/layout_2020/positioned.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/components/layout_2020/positioned.rs b/components/layout_2020/positioned.rs index 024f1ed5399..0b26e8638dd 100644 --- a/components/layout_2020/positioned.rs +++ b/components/layout_2020/positioned.rs @@ -18,7 +18,8 @@ use crate::dom::NodeExt; use crate::dom_traversal::{Contents, NodeAndStyleInfo}; use crate::formatting_contexts::IndependentFormattingContext; use crate::fragment_tree::{ - AbsoluteBoxOffsets, BoxFragment, CollapsedBlockMargins, Fragment, HoistedSharedFragment, + AbsoluteBoxOffsets, BoxFragment, CollapsedBlockMargins, Fragment, FragmentFlags, + HoistedSharedFragment, }; use crate::geom::{ AuOrAuto, LengthOrAuto, LengthPercentageOrAuto, LogicalRect, LogicalSides, LogicalVec2, @@ -144,9 +145,13 @@ impl PositioningContext { } pub(crate) fn new_for_style(style: &ComputedValues) -> Option<Self> { - if style.establishes_containing_block_for_all_descendants() { + // NB: We never make PositioningContexts for replaced elements, which is why we always + // pass false here. + if style.establishes_containing_block_for_all_descendants(FragmentFlags::empty()) { Some(Self::new_for_containing_block_for_all_descendants()) - } else if style.establishes_containing_block_for_absolute_descendants() { + } else if style + .establishes_containing_block_for_absolute_descendants(FragmentFlags::empty()) + { Some(Self { for_nearest_positioned_ancestor: Some(Vec::new()), for_nearest_containing_block_for_all_descendants: Vec::new(), |