mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Layout floats as children of their inline ancestors (#30130)
When layout was split into two phases, floats were laid out as direct children of the inline formatting context. This meant that they were positioned properly, but not properly made children of their inline ancestors' stacking contexts. This change maintains the proper positioning of floats, but positions them relatively to their inline ancestors. The big change here is that `text-align` needs to be taken into account before actually laying out LineItems. This has the added benefit of setting inline layout for the implementation of `text-align: full`. Now all line items are laid out at the real final position and we can adjust the `start_corner` property of float `BoxFragments` when their ancestors are laid out.
This commit is contained in:
parent
1c41ed93ff
commit
bd285f543e
10 changed files with 314 additions and 108 deletions
|
@ -131,19 +131,6 @@ pub(crate) struct IFrameFragment {
|
|||
}
|
||||
|
||||
impl Fragment {
|
||||
pub fn offset_inline(&mut self, offset: &Length) {
|
||||
let position = match self {
|
||||
Fragment::Box(f) => &mut f.content_rect.start_corner,
|
||||
Fragment::Float(_) | Fragment::AbsoluteOrFixedPositioned(_) => return,
|
||||
Fragment::Anonymous(f) => &mut f.rect.start_corner,
|
||||
Fragment::Text(f) => &mut f.rect.start_corner,
|
||||
Fragment::Image(f) => &mut f.rect.start_corner,
|
||||
Fragment::IFrame(f) => &mut f.rect.start_corner,
|
||||
};
|
||||
|
||||
position.inline += *offset;
|
||||
}
|
||||
|
||||
pub fn base(&self) -> Option<&BaseFragment> {
|
||||
Some(match self {
|
||||
Fragment::Box(fragment) => &fragment.base,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue