diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2013-11-09 21:39:39 -0800 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2013-11-18 11:24:11 -0800 |
commit | 155befe10dc56cfb2dfbf0cca7b652293dba9753 (patch) | |
tree | 43c3e51689cd42a3fb623eda84740f49dd667f5e /src/components/main/layout/float_context.rs | |
parent | 37f9427b6c53b90234e82d219217a97c10811243 (diff) | |
download | servo-155befe10dc56cfb2dfbf0cca7b652293dba9753.tar.gz servo-155befe10dc56cfb2dfbf0cca7b652293dba9753.zip |
Rewrite flow construction to be incrementalizable and parallelizable.
This replaces flow construction with a strict bottom-up tree traversal,
allowing for parallelism. Each step of the traversal creates a flow or
a `ConstructionItem`, similar to how Gecko works. {ib} splits are
handled by not creating `InlineFlow`s until the containing block is
reached.
This should be able to be incrementalized by storing the `Flow` from
layout to layout, and performing fixups during flow construction
and/or wiping containing blocks in a previous pass.
Diffstat (limited to 'src/components/main/layout/float_context.rs')
-rw-r--r-- | src/components/main/layout/float_context.rs | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/components/main/layout/float_context.rs b/src/components/main/layout/float_context.rs index 45e142b24b9..7a92554401c 100644 --- a/src/components/main/layout/float_context.rs +++ b/src/components/main/layout/float_context.rs @@ -3,12 +3,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use geom::point::Point2D; -use geom::size::Size2D; use geom::rect::Rect; +use geom::size::Size2D; use servo_util::geometry::{Au, max, min}; +use std::i32::max_value; use std::util::replace; use std::vec; -use std::i32::max_value; +use style::computed_values::float; #[deriving(Clone)] pub enum FloatType { @@ -16,6 +17,16 @@ pub enum FloatType { FloatRight } +impl FloatType { + pub fn from_property(property: float::T) -> FloatType { + match property { + float::none => fail!("can't create a float type from an unfloated property"), + float::left => FloatLeft, + float::right => FloatRight, + } + } +} + pub enum ClearType { ClearLeft, ClearRight, @@ -31,13 +42,13 @@ struct FloatContextBase { } #[deriving(Clone)] -struct FloatData{ +struct FloatData { bounds: Rect<Au>, f_type: FloatType } /// All information necessary to place a float -pub struct PlacementInfo{ +pub struct PlacementInfo { width: Au, // The dimensions of the float height: Au, ceiling: Au, // The minimum top of the float, as determined by earlier elements @@ -126,7 +137,7 @@ impl FloatContext { } } -impl FloatContextBase{ +impl FloatContextBase { fn new(num_floats: uint) -> FloatContextBase { debug!("Creating float context of size {}", num_floats); FloatContextBase { @@ -335,7 +346,7 @@ impl FloatContextBase{ match maybe_location { // If there are no floats blocking us, return the current location - // TODO(eatknson): integrate with overflow + // TODO(eatkinson): integrate with overflow None => return match info.f_type { FloatLeft => Rect(Point2D(Au(0), float_y), Size2D(info.max_width, Au(max_value))), |