aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2014-11-26 18:39:38 -0700
committerbors-servo <metajack+bors@gmail.com>2014-11-26 18:39:38 -0700
commit431644bfc8208b613bf69a89826376ffb143cb58 (patch)
treeb8a00a2ae622859a0fc360ada99aa563b04c0458
parent184a3346ab2fb2a4dfd267681af02711cfb6bc44 (diff)
parent59cdce30010c108303dfcf4a57596f31e0b4b4ac (diff)
downloadservo-431644bfc8208b613bf69a89826376ffb143cb58.tar.gz
servo-431644bfc8208b613bf69a89826376ffb143cb58.zip
auto merge of #4114 : glennw/servo/table-layout-fix, r=pcwalton
-rw-r--r--components/layout/table.rs7
-rw-r--r--tests/ref/basic.list1
-rw-r--r--tests/ref/table_specified_width_a.html37
-rw-r--r--tests/ref/table_specified_width_ref.html17
4 files changed, 57 insertions, 5 deletions
diff --git a/components/layout/table.rs b/components/layout/table.rs
index 72f11d66fbf..20bc19c91fc 100644
--- a/components/layout/table.rs
+++ b/components/layout/table.rs
@@ -265,12 +265,9 @@ impl Flow for TableFlow {
// if there are any, or among all the columns if all are specified.
if total_column_inline_size < content_inline_size &&
num_unspecified_inline_sizes == 0 {
- let extra_column_inline_size = content_inline_size;
- (content_inline_size - total_column_inline_size) /
- (self.column_inline_sizes.len() as i32);
+ let ratio = content_inline_size.to_subpx() / total_column_inline_size.to_subpx();
for column_inline_size in self.column_inline_sizes.iter_mut() {
- column_inline_size.minimum_length = column_inline_size.minimum_length +
- extra_column_inline_size;
+ column_inline_size.minimum_length = column_inline_size.minimum_length.scale_by(ratio);
column_inline_size.percentage = 0.0;
}
} else if num_unspecified_inline_sizes != 0 {
diff --git a/tests/ref/basic.list b/tests/ref/basic.list
index b1480e1d856..de0dbb6eb28 100644
--- a/tests/ref/basic.list
+++ b/tests/ref/basic.list
@@ -185,3 +185,4 @@ fragment=top != ../html/acid2.html acid2_ref.html
!= linear_gradients_corners_a.html linear_gradients_corners_ref.html
== linear_gradients_lengths_a.html linear_gradients_lengths_ref.html
== incremental_float_a.html incremental_float_ref.html
+== table_specified_width_a.html table_specified_width_ref.html
diff --git a/tests/ref/table_specified_width_a.html b/tests/ref/table_specified_width_a.html
new file mode 100644
index 00000000000..aa9912add20
--- /dev/null
+++ b/tests/ref/table_specified_width_a.html
@@ -0,0 +1,37 @@
+<html>
+ <head>
+ <style>
+ body {
+ margin: 0;
+ }
+ table {
+ table-layout: fixed;
+ width: 400px;
+ border-spacing: 0;
+ }
+ td {
+ padding: 0;
+ }
+ .td1 {
+ background: #ff0000;
+ height: 100px;
+ }
+ .td2 {
+ background: #00ff00;
+ height: 100px;
+ }
+ </style>
+ </head>
+ <body>
+ <table id="mn">
+ <tbody>
+ <tr>
+ <td class="td1" width="50">
+ </td>
+ <td class="td2" width="150">
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </body>
+</html>
diff --git a/tests/ref/table_specified_width_ref.html b/tests/ref/table_specified_width_ref.html
new file mode 100644
index 00000000000..5d1965711e2
--- /dev/null
+++ b/tests/ref/table_specified_width_ref.html
@@ -0,0 +1,17 @@
+<html>
+ <head>
+ <link rel="stylesheet" type="text/css" href="css/ahem.css">
+ <style>
+ body {
+ margin: 0;
+ }
+ .red {
+ color: #ff0000;
+ }
+ .green {
+ color: #00ff00;
+ }
+ </style>
+ </head>
+ <body><span class="red">X</span><span class="green">XXX</span></body>
+</html>