mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Auto merge of #5706 - pcwalton:absolute-clipping-of-own-contents, r=glennw
r? @glennw <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5706) <!-- Reviewable:end -->
This commit is contained in:
commit
f7bfea5879
5 changed files with 96 additions and 10 deletions
|
@ -170,7 +170,7 @@ impl DisplayList {
|
||||||
let doit = |items: &Vec<DisplayItem>| {
|
let doit = |items: &Vec<DisplayItem>| {
|
||||||
for item in items.iter() {
|
for item in items.iter() {
|
||||||
match *item {
|
match *item {
|
||||||
DisplayItem::SolidColorClass(ref solid_color) => println!("{:?} SolidColor. {:?}", indentation, solid_color.base.bounds),
|
DisplayItem::SolidColorClass(ref solid_color) => println!("{} SolidColor. {:?}", indentation, solid_color.base.bounds),
|
||||||
DisplayItem::TextClass(ref text) => println!("{:?} Text. {:?}", indentation, text.base.bounds),
|
DisplayItem::TextClass(ref text) => println!("{:?} Text. {:?}", indentation, text.base.bounds),
|
||||||
DisplayItem::ImageClass(ref image) => println!("{:?} Image. {:?}", indentation, image.base.bounds),
|
DisplayItem::ImageClass(ref image) => println!("{:?} Image. {:?}", indentation, image.base.bounds),
|
||||||
DisplayItem::BorderClass(ref border) => println!("{:?} Border. {:?}", indentation, border.base.bounds),
|
DisplayItem::BorderClass(ref border) => println!("{:?} Border. {:?}", indentation, border.base.bounds),
|
||||||
|
@ -184,14 +184,11 @@ impl DisplayList {
|
||||||
|
|
||||||
doit(&(self.all_display_items()));
|
doit(&(self.all_display_items()));
|
||||||
if self.children.len() != 0 {
|
if self.children.len() != 0 {
|
||||||
println!("{} Children stacking contexts list length: {}", indentation, self.children.len());
|
println!("{} Children stacking contexts list length: {}",
|
||||||
for subitem in self.children.iter() {
|
indentation,
|
||||||
doit(&subitem.display_list.all_display_items());
|
self.children.len());
|
||||||
if subitem.display_list.children.len() != 0 {
|
for sublist in self.children.iter() {
|
||||||
// Rant: String doesn't have a substr() method that won't overflow if the
|
sublist.display_list.print_items(indentation.clone()+&indentation[0..min_length]);
|
||||||
// selected range is bigger than the string length.
|
|
||||||
subitem.display_list.print_items(indentation.clone()+&indentation[0..min_length]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1253,6 +1253,11 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
layout_context: &LayoutContext,
|
layout_context: &LayoutContext,
|
||||||
background_border_level: BackgroundAndBorderLevel) {
|
background_border_level: BackgroundAndBorderLevel) {
|
||||||
// Add the box that starts the block context.
|
// Add the box that starts the block context.
|
||||||
|
let clip = if self.fragment.establishes_stacking_context() {
|
||||||
|
self.base.clip.translate(&-self.base.stacking_relative_position)
|
||||||
|
} else {
|
||||||
|
self.base.clip.clone()
|
||||||
|
};
|
||||||
self.fragment.build_display_list(display_list,
|
self.fragment.build_display_list(display_list,
|
||||||
layout_context,
|
layout_context,
|
||||||
&self.base.stacking_relative_position,
|
&self.base.stacking_relative_position,
|
||||||
|
@ -1263,7 +1268,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
.absolute_position_info
|
.absolute_position_info
|
||||||
.relative_containing_block_mode,
|
.relative_containing_block_mode,
|
||||||
background_border_level,
|
background_border_level,
|
||||||
&self.base.clip);
|
&clip);
|
||||||
|
|
||||||
// Add children.
|
// Add children.
|
||||||
for kid in self.base.children.iter_mut() {
|
for kid in self.base.children.iter_mut() {
|
||||||
|
|
42
tests/ref/absolute_clipping_of_own_contents_a.html
Normal file
42
tests/ref/absolute_clipping_of_own_contents_a.html
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<!-- Tests that clipping is preserved properly for nested `position: absolute` elements. -->
|
||||||
|
<style>
|
||||||
|
body, html {
|
||||||
|
margin: 0;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
#map {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
height: 256px;
|
||||||
|
background: lightblue;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
#outer {
|
||||||
|
position: absolute;
|
||||||
|
left: -128px;
|
||||||
|
top: -128px;
|
||||||
|
}
|
||||||
|
#inner {
|
||||||
|
position: absolute;
|
||||||
|
background: navy;
|
||||||
|
width: 256px;
|
||||||
|
height: 256px;
|
||||||
|
left: 128px;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id=map>
|
||||||
|
<div id=outer>
|
||||||
|
<div id=inner></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
41
tests/ref/absolute_clipping_of_own_contents_ref.html
Normal file
41
tests/ref/absolute_clipping_of_own_contents_ref.html
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<!-- Tests that clipping is preserved properly for nested `position: absolute` elements. -->
|
||||||
|
<style>
|
||||||
|
body, html {
|
||||||
|
margin: 0;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
#map {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
height: 256px;
|
||||||
|
background: lightblue;
|
||||||
|
}
|
||||||
|
#outer {
|
||||||
|
position: absolute;
|
||||||
|
left: -128px;
|
||||||
|
top: -128px;
|
||||||
|
}
|
||||||
|
#inner {
|
||||||
|
position: absolute;
|
||||||
|
background: navy;
|
||||||
|
width: 256px;
|
||||||
|
height: 256px;
|
||||||
|
left: 128px;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id=map>
|
||||||
|
<div id=outer>
|
||||||
|
<div id=inner></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -39,6 +39,7 @@ fragment=top != ../html/acid2.html acid2_ref.html
|
||||||
== 2dcontext/transform_a.html 2dcontext/transform_ref.html
|
== 2dcontext/transform_a.html 2dcontext/transform_ref.html
|
||||||
|
|
||||||
== abs_float_pref_width_a.html abs_float_pref_width_ref.html
|
== abs_float_pref_width_a.html abs_float_pref_width_ref.html
|
||||||
|
== absolute_clipping_of_own_contents_a.html absolute_clipping_of_own_contents_ref.html
|
||||||
== absolute_content_height_a.html absolute_content_height_ref.html
|
== absolute_content_height_a.html absolute_content_height_ref.html
|
||||||
== absolute_hypothetical_float_a.html absolute_hypothetical_float_ref.html
|
== absolute_hypothetical_float_a.html absolute_hypothetical_float_ref.html
|
||||||
== acid1_a.html acid1_b.html
|
== acid1_a.html acid1_b.html
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue