Place floats in layout 2020, but don't flow text around the floats yet.

This commit puts floats behind the `layout.floats.enabled` pref, because of the
following issues and unimplemented features:

* Inline formatting contexts don't take floats into account, so text doesn't
  flow around the floats yet.

* Non-floated block formatting contexts don't take floats into account, so BFCs
  can overlap floats.

* Block formatting contexts that contain floats don't expand vertically to
  contain all the floats. That is, floats can stick out the bottom of BFCs,
  contra spec.
This commit is contained in:
Patrick Walton 2020-07-22 10:52:11 -07:00 committed by Oriol Brufau
parent 053a0aa4fd
commit cdec48328e
235 changed files with 1018 additions and 623 deletions

View file

@ -66,8 +66,8 @@ ${helpers.predefined_type(
"Float",
"computed::Float::None",
engines="gecko servo-2013 servo-2020",
servo_2020_pref="layout.2020.unimplemented",
initial_specified_value="specified::Float::None",
servo_2020_pref="layout.floats.enabled",
spec="https://drafts.csswg.org/css-box/#propdef-float",
animation_value_type="discrete",
servo_restyle_damage="rebuild_and_reflow",
@ -78,7 +78,8 @@ ${helpers.predefined_type(
"clear",
"Clear",
"computed::Clear::None",
engines="gecko servo-2013",
engines="gecko servo-2013 servo-2020",
servo_2020_pref="layout.floats.enabled",
animation_value_type="discrete",
gecko_ffi_name="mBreakType",
spec="https://drafts.csswg.org/css-box/#propdef-clear",

View file

@ -18,7 +18,7 @@ use crate::values::{specified, CSSFloat};
use crate::Zero;
use app_units::Au;
use std::fmt::{self, Write};
use std::ops::{Add, AddAssign, Div, Mul, MulAssign, Neg, Sub};
use std::ops::{Add, AddAssign, Div, Mul, MulAssign, Neg, Sub, SubAssign};
use style_traits::{CSSPixel, CssWriter, ToCss};
pub use super::image::Image;
@ -399,6 +399,13 @@ impl Sub for CSSPixelLength {
}
}
impl SubAssign for CSSPixelLength {
#[inline]
fn sub_assign(&mut self, other: Self) {
self.0 -= other.0;
}
}
impl From<CSSPixelLength> for Au {
#[inline]
fn from(len: CSSPixelLength) -> Self {