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/fragment_tree | |
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/fragment_tree')
-rw-r--r-- | components/layout_2020/fragment_tree/base_fragment.rs | 3 | ||||
-rw-r--r-- | components/layout_2020/fragment_tree/fragment.rs | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/components/layout_2020/fragment_tree/base_fragment.rs b/components/layout_2020/fragment_tree/base_fragment.rs index ac29bcc976d..b5e7fb3fbc5 100644 --- a/components/layout_2020/fragment_tree/base_fragment.rs +++ b/components/layout_2020/fragment_tree/base_fragment.rs @@ -88,6 +88,9 @@ bitflags! { const IS_BODY_ELEMENT_OF_HTML_ELEMENT_ROOT = 0b00000001; /// Whether or not the node that created this Fragment is a `<br>` element. const IS_BR_ELEMENT = 0b00000010; + /// Whether or not this Fragment was created to contain a replaced element or is + /// a replaced element. + const IS_REPLACED = 0b00000100; } } diff --git a/components/layout_2020/fragment_tree/fragment.rs b/components/layout_2020/fragment_tree/fragment.rs index 151a004aa13..b13fab0ddd4 100644 --- a/components/layout_2020/fragment_tree/fragment.rs +++ b/components/layout_2020/fragment_tree/fragment.rs @@ -192,12 +192,12 @@ impl Fragment { .translate(containing_block.origin.to_vector()); let new_manager = if fragment .style - .establishes_containing_block_for_all_descendants() + .establishes_containing_block_for_all_descendants(fragment.base.flags) { manager.new_for_absolute_and_fixed_descendants(&content_rect, &padding_rect) } else if fragment .style - .establishes_containing_block_for_absolute_descendants() + .establishes_containing_block_for_absolute_descendants(fragment.base.flags) { manager.new_for_absolute_descendants(&content_rect, &padding_rect) } else { |