aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/sequential.rs
diff options
context:
space:
mode:
authorEloy Coto <eloy.coto@gmail.com>2017-05-27 13:27:35 +0200
committerEloy Coto <eloy.coto@gmail.com>2017-05-30 09:38:37 +0200
commit33a46597ed0b5a6baec3444320dd3423f89a2294 (patch)
tree7586d6e0d2d8668b87e88ada0619d4b48e7398a1 /components/layout/sequential.rs
parent2151a1f459cda91f5c6f7aa2fee1b3261b02ea7d (diff)
downloadservo-33a46597ed0b5a6baec3444320dd3423f89a2294.tar.gz
servo-33a46597ed0b5a6baec3444320dd3423f89a2294.zip
Fix #6799: set stacking_context_position correctly on
fragment_border_iterator
Diffstat (limited to 'components/layout/sequential.rs')
-rw-r--r--components/layout/sequential.rs27
1 files changed, 17 insertions, 10 deletions
diff --git a/components/layout/sequential.rs b/components/layout/sequential.rs
index 6452be7b544..404d29a44d1 100644
--- a/components/layout/sequential.rs
+++ b/components/layout/sequential.rs
@@ -12,7 +12,7 @@ use floats::SpeculatedFloatPlacement;
use flow::{self, Flow, ImmutableFlowUtils, InorderFlowTraversal, MutableFlowUtils};
use flow::{PostorderFlowTraversal, PreorderFlowTraversal};
use flow::IS_ABSOLUTELY_POSITIONED;
-use fragment::FragmentBorderBoxIterator;
+use fragment::{FragmentBorderBoxIterator, CoordinateSystem};
use generated_content::ResolveGeneratedContent;
use incremental::RelayoutMode;
use servo_config::opts;
@@ -105,15 +105,22 @@ pub fn iterate_through_flow_tree_fragment_border_boxes(root: &mut Flow, iterator
flow.iterate_through_fragment_border_boxes(iterator, level, stacking_context_position);
for kid in flow::mut_base(flow).child_iter_mut() {
- let stacking_context_position = if kid.is_block_flow() &&
- kid.as_block().fragment.establishes_stacking_context() {
- let margin = Point2D::new(kid.as_block().fragment.margin.inline_start, Au(0));
- *stacking_context_position + flow::base(kid).stacking_relative_position + margin
- } else {
- *stacking_context_position
- };
-
- // FIXME(#2795): Get the real container size.
+ let mut stacking_context_position = *stacking_context_position;
+ if kid.is_block_flow() && kid.as_block().fragment.establishes_stacking_context() {
+ stacking_context_position = Point2D::new(kid.as_block().fragment.margin.inline_start, Au(0)) +
+ flow::base(kid).stacking_relative_position +
+ stacking_context_position;
+ let relative_position = kid.as_block()
+ .stacking_relative_position(CoordinateSystem::Own);
+ if let Some(matrix) = kid.as_block()
+ .fragment
+ .transform_matrix(&relative_position) {
+ let transform_matrix = matrix.transform_point(&Point2D::zero());
+ stacking_context_position = stacking_context_position +
+ Point2D::new(Au::from_f32_px(transform_matrix.x),
+ Au::from_f32_px(transform_matrix.y))
+ }
+ }
doit(kid, level + 1, iterator, &stacking_context_position);
}
}