mirror of
https://github.com/servo/servo.git
synced 2025-06-19 06:38:59 +01:00
Merge pull request #2667 from mrobinson/overflow
Add overflow to child layer size
This commit is contained in:
commit
5b0feac32a
4 changed files with 38 additions and 12 deletions
|
@ -1256,10 +1256,11 @@ impl BlockFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we got here, then we need a new layer.
|
// If we got here, then we need a new layer.
|
||||||
let size = Size2D(self.base.position.size.width.to_nearest_px() as uint,
|
let layer_rect = self.base.position.union(&self.base.overflow);
|
||||||
self.base.position.size.height.to_nearest_px() as uint);
|
let size = Size2D(layer_rect.size.width.to_nearest_px() as uint,
|
||||||
let origin = Point2D(self.base.abs_position.x.to_nearest_px() as uint,
|
layer_rect.size.height.to_nearest_px() as uint);
|
||||||
self.base.abs_position.y.to_nearest_px() as uint);
|
let origin = Point2D(layer_rect.origin.x.to_nearest_px() as uint,
|
||||||
|
layer_rect.origin.y.to_nearest_px() as uint);
|
||||||
let scroll_policy = if self.is_fixed() {
|
let scroll_policy = if self.is_fixed() {
|
||||||
FixedPosition
|
FixedPosition
|
||||||
} else {
|
} else {
|
||||||
|
@ -1814,6 +1815,8 @@ pub trait WidthAndMarginsComputer {
|
||||||
fn set_width_constraint_solutions(&self,
|
fn set_width_constraint_solutions(&self,
|
||||||
block: &mut BlockFlow,
|
block: &mut BlockFlow,
|
||||||
solution: WidthConstraintSolution) {
|
solution: WidthConstraintSolution) {
|
||||||
|
let mut width = Au(0);
|
||||||
|
{
|
||||||
let fragment = block.fragment();
|
let fragment = block.fragment();
|
||||||
fragment.margin.left = solution.margin_left;
|
fragment.margin.left = solution.margin_left;
|
||||||
fragment.margin.right = solution.margin_right;
|
fragment.margin.right = solution.margin_right;
|
||||||
|
@ -1822,7 +1825,15 @@ pub trait WidthAndMarginsComputer {
|
||||||
// Left border edge.
|
// Left border edge.
|
||||||
fragment.border_box.origin.x = fragment.margin.left;
|
fragment.border_box.origin.x = fragment.margin.left;
|
||||||
// Border box width.
|
// Border box width.
|
||||||
fragment.border_box.size.width = solution.width + fragment.border_padding.horizontal();
|
width = solution.width + fragment.border_padding.horizontal();
|
||||||
|
fragment.border_box.size.width = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We also resize the block itself, to ensure that overflow is not calculated
|
||||||
|
// as the width of our parent. We might be smaller and we might be larger if we
|
||||||
|
// overflow.
|
||||||
|
let flow = flow::mut_base(block);
|
||||||
|
flow.position.size.width = width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the x coordinate of the given flow if it is absolutely positioned.
|
/// Set the x coordinate of the given flow if it is absolutely positioned.
|
||||||
|
|
|
@ -77,3 +77,4 @@
|
||||||
== linebreak_inline_span_a.html linebreak_inline_span_b.html
|
== linebreak_inline_span_a.html linebreak_inline_span_b.html
|
||||||
== overconstrained_block.html overconstrained_block_ref.html
|
== overconstrained_block.html overconstrained_block_ref.html
|
||||||
== position_fixed_background_color_a.html position_fixed_background_color_b.html
|
== position_fixed_background_color_a.html position_fixed_background_color_b.html
|
||||||
|
== position_fixed_overflow_a.html position_fixed_overflow_b.html
|
||||||
|
|
8
src/test/ref/position_fixed_overflow_a.html
Normal file
8
src/test/ref/position_fixed_overflow_a.html
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<div style="top: 5px; left: 5px; height: 5px; width: 5px; position: fixed;">
|
||||||
|
<div style="height: 100px; width: 100px; background: black;"></div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
6
src/test/ref/position_fixed_overflow_b.html
Normal file
6
src/test/ref/position_fixed_overflow_b.html
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<div style="top: 5px; left: 5px; height: 100px; width: 100px; position: absolute; background: black;"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue