aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/flow.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/layout/flow.rs')
-rw-r--r--components/layout/flow.rs65
1 files changed, 25 insertions, 40 deletions
diff --git a/components/layout/flow.rs b/components/layout/flow.rs
index 945943a27c5..372d76a404c 100644
--- a/components/layout/flow.rs
+++ b/components/layout/flow.rs
@@ -29,13 +29,12 @@ use app_units::Au;
use block::{BlockFlow, FormattingContextType};
use context::LayoutContext;
use display_list_builder::DisplayListBuildState;
-use euclid::{Matrix4D, Point2D, Size2D};
+use euclid::{Matrix4D, Point2D, Rect, Size2D};
use flex::FlexFlow;
use floats::{Floats, SpeculatedFloatPlacement};
use flow_list::{FlowList, MutFlowListIterator};
use flow_ref::{FlowRef, WeakFlowRef};
-use fragment::{Fragment, FragmentBorderBoxIterator, Overflow};
-use gfx::display_list::ClippingRegion;
+use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow};
use gfx_traits::{ScrollRootId, StackingContextId};
use gfx_traits::print_tree::PrintTree;
use inline::InlineFlow;
@@ -43,7 +42,7 @@ use model::{CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo};
use multicol::MulticolFlow;
use parallel::FlowParallelInfo;
use serde::ser::{Serialize, SerializeStruct, Serializer};
-use servo_geometry::{au_rect_to_f32_rect, f32_rect_to_au_rect};
+use servo_geometry::{au_rect_to_f32_rect, f32_rect_to_au_rect, max_rect};
use std::{fmt, mem, raw};
use std::iter::Zip;
use std::slice::IterMut;
@@ -264,6 +263,24 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
}
}
+ let border_box = self.as_block().fragment.stacking_relative_border_box(
+ &base(self).stacking_relative_position,
+ &base(self).early_absolute_position_info.relative_containing_block_size,
+ base(self).early_absolute_position_info.relative_containing_block_mode,
+ CoordinateSystem::Own);
+ if overflow_x::T::visible != self.as_block().fragment.style.get_box().overflow_x {
+ overflow.paint.origin.x = Au(0);
+ overflow.paint.size.width = border_box.size.width;
+ overflow.scroll.origin.x = Au(0);
+ overflow.scroll.size.width = border_box.size.width;
+ }
+ if overflow_x::T::visible != self.as_block().fragment.style.get_box().overflow_y.0 {
+ overflow.paint.origin.y = Au(0);
+ overflow.paint.size.height = border_box.size.height;
+ overflow.scroll.origin.y = Au(0);
+ overflow.scroll.size.height = border_box.size.height;
+ }
+
if !self.as_block().fragment.establishes_stacking_context() ||
self.as_block().fragment.style.get_box().transform.0.is_none() {
overflow.translate(&position.origin);
@@ -311,40 +328,8 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
FlowClass::Block |
FlowClass::TableCaption |
FlowClass::TableCell => {
- let overflow_x = self.as_block().fragment.style.get_box().overflow_x;
- let overflow_y = self.as_block().fragment.style.get_box().overflow_y;
-
for kid in mut_base(self).children.iter_mut() {
- let mut kid_overflow = kid.get_overflow_in_parent_coordinates();
-
- // If the overflow for this flow is hidden on a given axis, just
- // put the existing overflow in the kid rect, so that the union
- // has no effect on this axis.
- match overflow_x {
- overflow_x::T::hidden => {
- kid_overflow.paint.origin.x = overflow.paint.origin.x;
- kid_overflow.paint.size.width = overflow.paint.size.width;
- kid_overflow.scroll.origin.x = overflow.scroll.origin.x;
- kid_overflow.scroll.size.width = overflow.scroll.size.width;
- }
- overflow_x::T::scroll |
- overflow_x::T::auto |
- overflow_x::T::visible => {}
- }
-
- match overflow_y.0 {
- overflow_x::T::hidden => {
- kid_overflow.paint.origin.y = overflow.paint.origin.y;
- kid_overflow.paint.size.height = overflow.paint.size.height;
- kid_overflow.scroll.origin.y = overflow.scroll.origin.y;
- kid_overflow.scroll.size.height = overflow.scroll.size.height;
- }
- overflow_x::T::scroll |
- overflow_x::T::auto |
- overflow_x::T::visible => {}
- }
-
- overflow.union(&kid_overflow)
+ overflow.union(&kid.get_overflow_in_parent_coordinates());
}
}
_ => {}
@@ -957,10 +942,10 @@ pub struct BaseFlow {
/// assignment.
pub late_absolute_position_info: LateAbsolutePositionInfo,
- /// The clipping region for this flow and its descendants, in the coordinate system of the
+ /// The clipping rectangle for this flow and its descendants, in the coordinate system of the
/// nearest ancestor stacking context. If this flow itself represents a stacking context, then
/// this is in the flow's own coordinate system.
- pub clip: ClippingRegion,
+ pub clip: Rect<Au>,
/// The writing mode for this flow.
pub writing_mode: WritingMode,
@@ -1115,7 +1100,7 @@ impl BaseFlow {
absolute_cb: ContainingBlockLink::new(),
early_absolute_position_info: EarlyAbsolutePositionInfo::new(writing_mode),
late_absolute_position_info: LateAbsolutePositionInfo::new(),
- clip: ClippingRegion::max(),
+ clip: max_rect(),
flags: flags,
writing_mode: writing_mode,
thread_id: 0,