Skip to content

Commit

Permalink
Flow inlines around floats
Browse files Browse the repository at this point in the history
This implements the rest of the bulk of float support. Now inline
element flow around floats and floats can be pushed down by inline
elements before them.

Co-authored-by: Oriol Brufau <obrufau@igalia.com>
  • Loading branch information
mrobinson and Loirooriol committed Aug 30, 2023
1 parent c0898c3 commit 69af0cf
Show file tree
Hide file tree
Showing 64 changed files with 432 additions and 216 deletions.
2 changes: 1 addition & 1 deletion components/layout_2020/flow/float.rs
Expand Up @@ -307,7 +307,7 @@ impl FloatContext {
pub fn new(max_inline_size: Length) -> Self {
let mut bands = FloatBandTree::new();
bands = bands.insert(FloatBand {
top: Length::zero(),
top: Length::new(-f32::INFINITY),
left: None,
right: None,
});
Expand Down
496 changes: 404 additions & 92 deletions components/layout_2020/flow/inline.rs

Large diffs are not rendered by default.

19 changes: 15 additions & 4 deletions components/layout_2020/geom.rs
Expand Up @@ -105,11 +105,11 @@ where
}
}

impl flow_relative::Vec2<Length> {
impl<T: Zero> flow_relative::Vec2<T> {
pub fn zero() -> Self {
Self {
inline: Length::zero(),
block: Length::zero(),
inline: T::zero(),
block: T::zero(),
}
}
}
Expand Down Expand Up @@ -155,7 +155,7 @@ impl flow_relative::Vec2<Option<&'_ LengthPercentage>> {
}
}

impl flow_relative::Rect<Length> {
impl<T: Zero> flow_relative::Rect<T> {
pub fn zero() -> Self {
Self {
start_corner: flow_relative::Vec2::zero(),
Expand Down Expand Up @@ -346,6 +346,17 @@ where
}
}

impl<T: Zero> flow_relative::Sides<T> {
pub(crate) fn zero() -> flow_relative::Sides<T> {
flow_relative::Sides {
inline_start: T::zero(),
inline_end: T::zero(),
block_start: T::zero(),
block_end: T::zero(),
}
}
}

impl<T> flow_relative::Rect<T> {
pub fn max_inline_position(&self) -> T
where
Expand Down
1 change: 1 addition & 0 deletions components/layout_2020/lib.rs
Expand Up @@ -3,6 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */

#![deny(unsafe_code)]
#![feature(once_cell)]

#[macro_use]
extern crate log;
Expand Down
11 changes: 11 additions & 0 deletions components/layout_2020/style_ext.rs
Expand Up @@ -65,6 +65,17 @@ pub(crate) struct PaddingBorderMargin {
pub padding_border_sums: flow_relative::Vec2<Length>,
}

impl PaddingBorderMargin {
pub(crate) fn zero() -> Self {
Self {
padding: flow_relative::Sides::zero(),
border: flow_relative::Sides::zero(),
margin: flow_relative::Sides::zero(),
padding_border_sums: flow_relative::Vec2::zero(),
}
}
}

pub(crate) trait ComputedValuesExt {
fn inline_size_is_length(&self) -> bool;
fn inline_box_offsets_are_both_non_auto(&self) -> bool;
Expand Down
2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/css1/c414-flt-wrap-001.xht.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/css1/c5525-fltblck-000.xht.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/css1/c5525-fltinln-000.xht.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/css1/c5525-fltmrgn-000.xht.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/css1/c5525-fltwidth-001.xht.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/css1/c5526-fltclr-000.xht.ini

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/floats-clear/clear-inline-001.xht.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/floats-clear/floats-029.xht.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/floats-clear/floats-030.xht.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/floats-clear/floats-031.xht.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/floats-clear/floats-036.xht.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/floats-clear/floats-040.xht.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/floats-clear/floats-114.xht.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/floats-clear/floats-122.xht.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/floats-clear/floats-132.xht.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/floats-clear/floats-133.xht.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/floats-clear/floats-134.xht.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/floats-clear/floats-136.xht.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/floats-clear/floats-139.xht.ini

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/floats/float-nowrap-5.html.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/floats/float-nowrap-6.html.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/floats/floats-placement-004.html.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/floats/floats-placement-007.html.ini

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions tests/wpt/meta/css/CSS2/floats/hit-test-floats-001.html.ini

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/normal-flow/inlines-013.xht.ini

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/meta/css/CSS2/text/text-indent-013.xht.ini

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/mozilla/meta/css/content_color.html.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/mozilla/meta/css/floats_inline_margins_a.html.ini

This file was deleted.

2 changes: 0 additions & 2 deletions tests/wpt/mozilla/meta/css/floats_percentage_width_a.html.ini

This file was deleted.

0 comments on commit 69af0cf

Please sign in to comment.