diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2015-04-14 12:13:13 -0700 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2015-04-14 13:00:10 -0700 |
commit | acd08c67c63a9fb4d46e50411e134a1c6667ad89 (patch) | |
tree | 233ccca2b881308bc6b8006dc3667df880e7d542 /components/layout/inline.rs | |
parent | fe81ce942a36b08ece8ef6d58de72624a961eeaa (diff) | |
download | servo-acd08c67c63a9fb4d46e50411e134a1c6667ad89.tar.gz servo-acd08c67c63a9fb4d46e50411e134a1c6667ad89.zip |
layout: Use the same code path for computing static positions of regular
flows and static positions of hypothetical boxes.
Before this change, Servo used one code path that computed the position
of flows with `position: static` or `position: relative` and another
separate code path that computed the position of flows with `position:
absolute` or `position: fixed`. The latter code attempted to duplicate
the former code to determine the static position of hypothetical boxes,
but this was both fragile and incorrect in the case of hypothetical
boxes nested inside floats. In fact, it's impossible to determine the
static position of an absolute flow relative to its containing block at
inline-size assignment time, because that static position could depend
on a float that cannot be placed until block-size assignment!
This patch changes block layout to use the same code path for static
positioning of regular flows and static positioning of absolute flows
where applicable. This both simplifies the code and improves its
efficiency, since it allows the `hypothetical_position` field and
`static_block_offsets` data structure to be removed. Moreover, it
improves correctness in the above case (which the new reftest checks).
This allows the sidebar in Facebook Timeline to be positioned properly.
Diffstat (limited to 'components/layout/inline.rs')
-rw-r--r-- | components/layout/inline.rs | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/components/layout/inline.rs b/components/layout/inline.rs index c04190a36eb..cf42b29577d 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -8,8 +8,7 @@ use css::node_style::StyledNode; use context::LayoutContext; use display_list_builder::{FragmentDisplayListBuilding, InlineFlowDisplayListBuilding}; use floats::{FloatKind, Floats, PlacementInfo}; -use flow::{self, BaseFlow, FlowClass, Flow, MutableFlowUtils, ForceNonfloatedFlag}; -use flow::{IS_ABSOLUTELY_POSITIONED}; +use flow::{self, BaseFlow, FlowClass, Flow, ForceNonfloatedFlag, IS_ABSOLUTELY_POSITIONED}; use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo}; use incremental::{REFLOW, REFLOW_OUT_OF_FLOW, RESOLVE_GENERATED_CONTENT}; use layout_debug; @@ -1184,10 +1183,6 @@ impl Flow for InlineFlow { fn assign_block_size(&mut self, layout_context: &LayoutContext) { let _scope = layout_debug_scope!("inline::assign_block_size {:x}", self.base.debug_id()); - // Collect various offsets needed by absolutely positioned inline-block or hypothetical - // absolute descendants. - (&mut *self as &mut Flow).collect_static_block_offsets_from_children(); - // Divide the fragments into lines. // // TODO(pcwalton, #226): Get the CSS `line-height` property from the style of the |