diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2014-12-18 18:59:42 -0800 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2015-01-04 17:41:59 -0800 |
commit | 5ea2c6dcfdfc24ce3730f736fcd045a13bcdc5b6 (patch) | |
tree | bd04f1fa5d53a938e91817c8d099456f93b01950 /components/layout/layout_task.rs | |
parent | ba8cf6b0e6145265f9472d4855f078d8b5943fe7 (diff) | |
download | servo-5ea2c6dcfdfc24ce3730f736fcd045a13bcdc5b6.tar.gz servo-5ea2c6dcfdfc24ce3730f736fcd045a13bcdc5b6.zip |
layout: Paint stacking contexts' overflow areas properly.
This was making `box-shadow` not show up in many cases, in particular,
but the effects were not limited to that.
Diffstat (limited to 'components/layout/layout_task.rs')
-rw-r--r-- | components/layout/layout_task.rs | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index 090b51cee70..22e00904c75 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -10,7 +10,7 @@ use construct::ConstructionResult; use context::SharedLayoutContext; use flow::{mod, Flow, ImmutableFlowUtils, MutableFlowUtils, MutableOwnedFlowUtils}; use flow_ref::FlowRef; -use fragment::{Fragment, FragmentBoundsIterator}; +use fragment::{Fragment, FragmentOverflowIterator}; use incremental::{LayoutDamageComputation, REFLOW, REFLOW_ENTIRE_DOCUMENT, REPAINT}; use layout_debug; use parallel::{mod, UnsafeFlow}; @@ -604,7 +604,7 @@ impl LayoutTask { // FIXME(pcwalton): This has not been updated to handle the stacking context relative // stuff. So the position is wrong in most cases. let requested_node: OpaqueNode = OpaqueNodeMethods::from_script_node(requested_node); - let mut iterator = UnioningFragmentBoundsIterator::new(requested_node); + let mut iterator = UnioningFragmentOverflowIterator::new(requested_node); sequential::iterate_through_flow_tree_fragment_bounds(layout_root, &mut iterator); rw_data.content_box_response = iterator.rect; } @@ -616,7 +616,7 @@ impl LayoutTask { // FIXME(pcwalton): This has not been updated to handle the stacking context relative // stuff. So the position is wrong in most cases. let requested_node: OpaqueNode = OpaqueNodeMethods::from_script_node(requested_node); - let mut iterator = CollectingFragmentBoundsIterator::new(requested_node); + let mut iterator = CollectingFragmentOverflowIterator::new(requested_node); sequential::iterate_through_flow_tree_fragment_bounds(layout_root, &mut iterator); rw_data.content_boxes_response = iterator.rects; } @@ -689,11 +689,12 @@ impl LayoutTask { flow::mut_base(layout_root.deref_mut()).display_list_building_result .add_to(&mut *display_list); let paint_layer = Arc::new(PaintLayer::new(layout_root.layer_id(0), - color, - Scrollable)); + color, + Scrollable)); let origin = Rect(Point2D(Au(0), Au(0)), root_size); let stacking_context = Arc::new(StackingContext::new(display_list, - origin, + &origin, + &origin, 0, 1.0, Some(paint_layer))); @@ -1016,21 +1017,21 @@ impl LayoutRPC for LayoutRPCImpl { } } -struct UnioningFragmentBoundsIterator { +struct UnioningFragmentOverflowIterator { node_address: OpaqueNode, rect: Rect<Au>, } -impl UnioningFragmentBoundsIterator { - fn new(node_address: OpaqueNode) -> UnioningFragmentBoundsIterator { - UnioningFragmentBoundsIterator { +impl UnioningFragmentOverflowIterator { + fn new(node_address: OpaqueNode) -> UnioningFragmentOverflowIterator { + UnioningFragmentOverflowIterator { node_address: node_address, rect: Rect::zero(), } } } -impl FragmentBoundsIterator for UnioningFragmentBoundsIterator { +impl FragmentOverflowIterator for UnioningFragmentOverflowIterator { fn process(&mut self, _: &Fragment, bounds: Rect<Au>) { if self.rect.is_empty() { self.rect = bounds; @@ -1044,21 +1045,21 @@ impl FragmentBoundsIterator for UnioningFragmentBoundsIterator { } } -struct CollectingFragmentBoundsIterator { +struct CollectingFragmentOverflowIterator { node_address: OpaqueNode, rects: Vec<Rect<Au>>, } -impl CollectingFragmentBoundsIterator { - fn new(node_address: OpaqueNode) -> CollectingFragmentBoundsIterator { - CollectingFragmentBoundsIterator { +impl CollectingFragmentOverflowIterator { + fn new(node_address: OpaqueNode) -> CollectingFragmentOverflowIterator { + CollectingFragmentOverflowIterator { node_address: node_address, rects: Vec::new(), } } } -impl FragmentBoundsIterator for CollectingFragmentBoundsIterator { +impl FragmentOverflowIterator for CollectingFragmentOverflowIterator { fn process(&mut self, _: &Fragment, bounds: Rect<Au>) { self.rects.push(bounds); } |