diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2016-02-03 10:51:41 -0800 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2016-02-03 16:06:24 -0800 |
commit | 7c5b2d6cb3ee4f934e529162be368c36a7f590a4 (patch) | |
tree | f4210b9657dd5652aba454d73eb6d72271fed5f9 /components/layout/flow.rs | |
parent | f605c6aa69e34fcd5734350759969bfac2098952 (diff) | |
download | servo-7c5b2d6cb3ee4f934e529162be368c36a7f590a4.tar.gz servo-7c5b2d6cb3ee4f934e529162be368c36a7f590a4.zip |
layout: Separate out overflow-for-scrolling from overflow-for-paint.
Closes #9484.
Diffstat (limited to 'components/layout/flow.rs')
-rw-r--r-- | components/layout/flow.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/components/layout/flow.rs b/components/layout/flow.rs index 215e25bd731..d59d7f38123 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -32,7 +32,7 @@ use euclid::{Point2D, Rect, Size2D}; use floats::Floats; use flow_list::{FlowList, FlowListIterator, MutFlowListIterator}; use flow_ref::{self, FlowRef, WeakFlowRef}; -use fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo}; +use fragment::{Fragment, FragmentBorderBoxIterator, Overflow, SpecificFragmentInfo}; use gfx::display_list::{ClippingRegion, DisplayList}; use gfx_traits::{LayerId, LayerType}; use incremental::{RECONSTRUCT_FLOW, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, RestyleDamage}; @@ -266,15 +266,16 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static { // FIXME(#2795): Get the real container size. let container_size = Size2D::zero(); for kid in mut_base(self).children.iter_mut() { - let kid_overflow = base(kid).overflow; + let mut kid_overflow = base(kid).overflow; let kid_position = base(kid).position.to_physical(base(kid).writing_mode, container_size); - overflow = overflow.union(&kid_overflow.translate(&kid_position.origin)) + kid_overflow.translate(&kid_position.origin); + overflow.union(&kid_overflow) } } _ => {} } - mut_base(self).overflow = overflow; + mut_base(self).overflow = overflow } /// Phase 4 of reflow: computes absolute positions. @@ -286,7 +287,7 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static { fn build_display_list(&mut self, layout_context: &LayoutContext); /// Returns the union of all overflow rects of all of this flow's fragments. - fn compute_overflow(&self) -> Rect<Au>; + fn compute_overflow(&self) -> Overflow; /// Iterates through border boxes of all of this flow's fragments. /// Level provides a zero based index indicating the current @@ -865,7 +866,7 @@ pub struct BaseFlow { /// The amount of overflow of this flow, relative to the containing block. Must include all the /// pixels of all the display list items for correct invalidation. - pub overflow: Rect<Au>, + pub overflow: Overflow, /// Data used during parallel traversals. /// @@ -1078,7 +1079,7 @@ impl BaseFlow { children: FlowList::new(), intrinsic_inline_sizes: IntrinsicISizes::new(), position: LogicalRect::zero(writing_mode), - overflow: Rect::zero(), + overflow: Overflow::new(), parallel: FlowParallelInfo::new(), floats: Floats::new(writing_mode), collapsible_margins: CollapsibleMargins::new(), @@ -1132,7 +1133,7 @@ impl BaseFlow { let container_size = Size2D::zero(); let position_with_overflow = self.position .to_physical(self.writing_mode, container_size) - .union(&self.overflow); + .union(&self.overflow.paint); let bounds = Rect::new(self.stacking_relative_position, position_with_overflow.size); let all_items = match self.display_list_building_result { |