mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
`PositioningContext` held two vectors, one inside an `Option`, to differentiate between the version used for a containing block for all descendants (including `position: absolute` and `position: fixed`) or only for `position: absolute` descendants. This distinction was really hard to reason about and required a lot of bookkeeping about what kind of `PositioningContext` a layout box's parent expected. In addition, it led to a lot of mistakes. This change simplifies things so that `PositioningContext` only holds a single vector. When it comes time to lay out hoisted absolutely positioned fragments, the code then: - lays out all of them (in the case of a `PositioningContext` for all descendants), or - only lays out the `position: absolute` descendants and preserves the `position: fixed` descendants (in the case the `PositioningContext` is only for `position: absolute`.), or - lays out none of them if the `PositioningContext` was created for box that did not establish a containing block for absolutes. It's possible that this way of dealing with hoisted absolutes is a bit less efficient, but, the number of these descendants is typically quite small, so it should not be significant. In addition, this decreases the size in memory of all `PositioningContexts` which are created in more situations as time goes on. Testing: There is a new WPT test with this change. Fixes: #36696. Signed-off-by: Martin Robinson <mrobinson@igalia.com> |
||
---|---|---|
.. | ||
display_list | ||
flexbox | ||
flow | ||
fragment_tree | ||
table | ||
taffy | ||
tests | ||
Cargo.toml | ||
cell.rs | ||
construct_modern.rs | ||
context.rs | ||
dom.rs | ||
dom_traversal.rs | ||
formatting_contexts.rs | ||
geom.rs | ||
layout_box_base.rs | ||
layout_impl.rs | ||
lib.rs | ||
lists.rs | ||
positioned.rs | ||
query.rs | ||
quotes.rs | ||
replaced.rs | ||
sizing.rs | ||
style_ext.rs | ||
traversal.rs |