Auto merge of #6081 - mbrubeck:table-wrapper-rtl, r=pcwalton

Fixes #6006. r? @pcwalton

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6081)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-05-15 22:46:35 -05:00
commit 3934831da3
4 changed files with 52 additions and 6 deletions

View file

@ -190,6 +190,18 @@ impl TableWrapperFlow {
table_border_padding + spacing;
self.block_flow.base.position.size.inline = total_used_inline_size +
table_border_padding + spacing + self.block_flow.fragment.margin.inline_start_end();
let writing_mode = self.block_flow.base.writing_mode;
let container_mode = self.block_flow.base.block_container_writing_mode;
if writing_mode.is_bidi_ltr() != container_mode.is_bidi_ltr() {
// If our "start" direction is different from our parent flow, then `border_box.start.i`
// depends on `border_box.size.inline`.
self.block_flow.fragment.border_box.start.i =
self.block_flow.base.block_container_inline_size -
self.block_flow.fragment.margin.inline_end -
self.block_flow.fragment.border_box.size.inline;
}
}
fn compute_used_inline_size(
@ -314,12 +326,8 @@ impl Flow for TableWrapperFlow {
let inline_start_content_edge = self.block_flow.fragment.border_box.start.i;
let content_inline_size = self.block_flow.fragment.border_box.size.inline;
// FIXME (mbrubeck): Test mixed RTL/LTR table layout, make sure this is right.
let inline_end_content_edge = self.block_flow.base.block_container_inline_size -
self.block_flow.fragment.margin.inline_end -
content_inline_size -
inline_start_content_edge;
let inline_end_content_edge = self.block_flow.fragment.border_padding.inline_end +
self.block_flow.fragment.margin.inline_end;
// In case of fixed layout, column inline-sizes are calculated in table flow.
let assigned_column_inline_sizes = match self.table_layout {

View file

@ -269,6 +269,7 @@ experimental != overconstrained_block.html overconstrained_block_ref.html
experimental == rtl_body.html rtl_body_ref.html
experimental == rtl_margin_a.html rtl_margin_ref.html
experimental == rtl_simple.html rtl_simple_ref.html
experimental == rtl_table_a.html rtl_table_ref.html
== servo_center_a.html servo_center_ref.html
== setattribute_id_restyle_a.html setattribute_id_restyle_b.html
== stacking_context_overflow_a.html stacking_context_overflow_ref.html

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>RTL Table test</title>
<style>
table { direction: rtl; }
td {
background: orange;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<table><tr><td></td></tr></table>
</body>
</html>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>RTL Table reference</title>
<style>
td {
background: orange;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<table><tr><td></td></tr></table>
</body>
</html>