Skip to content

Commit e68bd8d

Browse files
author
bors-servo
committed
Auto merge of #7771 - mbrubeck:rtl-stacking-context, r=pcwalton
Use the correct container size in compute_overflow Fixes #7768 - positioning of RTL stacking contexts. r? @pcwalton <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7771) <!-- Reviewable:end -->
2 parents 8547d13 + 441cc47 commit e68bd8d

File tree

6 files changed

+61
-8
lines changed

6 files changed

+61
-8
lines changed

components/layout/block.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,9 +2126,10 @@ impl Flow for BlockFlow {
21262126
}
21272127

21282128
fn compute_overflow(&self) -> Rect<Au> {
2129-
self.fragment.compute_overflow(&self.base
2130-
.early_absolute_position_info
2131-
.relative_containing_block_size)
2129+
self.fragment.compute_overflow(&self.base.early_absolute_position_info
2130+
.relative_containing_block_size,
2131+
self.base.early_absolute_position_info
2132+
.relative_containing_block_mode)
21322133
}
21332134

21342135
fn iterate_through_fragment_border_boxes(&self,

components/layout/fragment.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2160,9 +2160,12 @@ impl Fragment {
21602160
}
21612161

21622162
/// Computes the overflow rect of this fragment relative to the start of the flow.
2163-
pub fn compute_overflow(&self, relative_containing_block_size: &LogicalSize<Au>) -> Rect<Au> {
2164-
// FIXME(pcwalton, #2795): Get the real container size.
2165-
let container_size = Size2D::zero();
2163+
pub fn compute_overflow(&self,
2164+
relative_containing_block_size: &LogicalSize<Au>,
2165+
relative_containing_block_mode: WritingMode)
2166+
-> Rect<Au> {
2167+
let container_size =
2168+
relative_containing_block_size.to_physical(relative_containing_block_mode);
21662169
let mut border_box = self.border_box.to_physical(self.style.writing_mode, container_size);
21672170

21682171
// Relative position can cause us to draw outside our border box.

components/layout/inline.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1775,7 +1775,8 @@ impl Flow for InlineFlow {
17751775
let mut overflow = ZERO_RECT;
17761776
for fragment in &self.fragments.fragments {
17771777
overflow = overflow.union(&fragment.compute_overflow(
1778-
&self.base.early_absolute_position_info.relative_containing_block_size))
1778+
&self.base.early_absolute_position_info.relative_containing_block_size,
1779+
self.base.early_absolute_position_info.relative_containing_block_mode));
17791780
}
17801781
overflow
17811782
}

tests/wpt/mozilla/meta/MANIFEST.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,18 @@
111111
"url": "/_mozilla/css/setpropertypriority.html"
112112
}
113113
],
114+
"css/stacking_context_rtl.html": [
115+
{
116+
"path": "css/stacking_context_rtl.html",
117+
"references": [
118+
[
119+
"/_mozilla/css/stacking_context_rtl-ref.html",
120+
"=="
121+
]
122+
],
123+
"url": "/_mozilla/css/stacking_context_rtl.html"
124+
}
125+
],
114126
"css/word-spacing.html": [
115127
{
116128
"path": "css/word-spacing.html",
@@ -1118,4 +1130,4 @@
11181130
"rev": null,
11191131
"url_base": "/_mozilla/",
11201132
"version": 2
1121-
}
1133+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<style>
6+
div {
7+
background: green;
8+
height: 100px;
9+
}
10+
</style>
11+
</head>
12+
<body>
13+
Test passes if there is a green rectangle below.
14+
<div></div>
15+
</body>
16+
</html>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<link rel=match href="stacking_context_rtl-ref.html">
6+
<style>
7+
div {
8+
background: green;
9+
height: 100px;
10+
direction: rtl;
11+
position: relative;
12+
z-index: 0;
13+
}
14+
</style>
15+
</head>
16+
<body>
17+
Test passes if there is a green rectangle below.
18+
<div></div>
19+
</body>
20+
</html>

0 commit comments

Comments
 (0)