diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2014-11-18 15:37:53 -0800 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2014-12-03 14:17:16 -0800 |
commit | 1c1c507c03757a3e4b76ca799b866b047d69a7b5 (patch) | |
tree | 19ba94ff619ff8cc32a9ffaf9fe73bb0afdaf948 /components/layout/inline.rs | |
parent | 873ca6cadddc1a40bead1f5dd0128bb16cfaa11b (diff) | |
download | servo-1c1c507c03757a3e4b76ca799b866b047d69a7b5.tar.gz servo-1c1c507c03757a3e4b76ca799b866b047d69a7b5.zip |
layout: Implement `opacity` per CSS-COLOR § 3.2.
This adds the infrastructure necessary to support stacking contexts that
are not containing blocks for absolutely-positioned elements. Our
infrastructure did not support that before. This minor revamp actually
ended up simplifying the logic around display list building and
stacking-relative position computation for absolutely-positioned flows,
which was nice.
Diffstat (limited to 'components/layout/inline.rs')
-rw-r--r-- | components/layout/inline.rs | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 73332023d5d..96421f26cff 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -20,7 +20,7 @@ use model::IntrinsicISizesContribution; use text; use collections::{RingBuf}; -use geom::{Rect, Size2D}; +use geom::Size2D; use gfx::display_list::DisplayList; use gfx::font::FontMetrics; use gfx::font_context::FontContext; @@ -1141,9 +1141,10 @@ impl Flow for InlineFlow { let stacking_relative_position = match fragment.specific { InlineBlockFragment(ref mut info) => { let block_flow = info.flow_ref.as_block(); + block_flow.base.absolute_position_info = self.base.absolute_position_info; + // FIXME(#2795): Get the real container size let container_size = Size2D::zero(); - block_flow.base.stacking_relative_position = self.base.stacking_relative_position + fragment.border_box.start.to_physical(self.base.writing_mode, @@ -1152,6 +1153,8 @@ impl Flow for InlineFlow { } InlineAbsoluteHypotheticalFragment(ref mut info) => { let block_flow = info.flow_ref.as_block(); + block_flow.base.absolute_position_info = self.base.absolute_position_info; + // FIXME(#2795): Get the real container size let container_size = Size2D::zero(); block_flow.base.stacking_relative_position = @@ -1184,15 +1187,6 @@ impl Flow for InlineFlow { fn update_late_computed_block_position_if_necessary(&mut self, _: Au) {} fn build_display_list(&mut self, layout_context: &LayoutContext) { - let size = self.base.position.size.to_physical(self.base.writing_mode); - if !Rect(self.base.stacking_relative_position, size).intersects(&layout_context.shared - .dirty) { - debug!("inline block (stacking relative pos {}, size {}) didn't intersect dirty rect", - self.base.stacking_relative_position, - size); - return - } - // TODO(#228): Once we form lines and have their cached bounds, we can be smarter and // not recurse on a line if nothing in it can intersect the dirty region. debug!("Flow: building display list for {:u} inline fragments", self.fragments.len()); @@ -1211,6 +1205,11 @@ impl Flow for InlineFlow { flow::mut_base(block_flow).display_list_building_result .add_to(&mut *display_list) } + InlineAbsoluteHypotheticalFragment(ref mut block_flow) => { + let block_flow = block_flow.flow_ref.deref_mut(); + flow::mut_base(block_flow).display_list_building_result + .add_to(&mut *display_list) + } _ => {} } } |