mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
auto merge of #4598 : mttr/servo/table_percentage, r=pcwalton
Fixes #4421
This commit is contained in:
commit
62d1761d2a
4 changed files with 38 additions and 3 deletions
|
@ -28,7 +28,7 @@ use servo_util::geometry::Au;
|
|||
use std::cmp::{max, min};
|
||||
use std::fmt;
|
||||
use style::{ComputedValues, CSSFloat};
|
||||
use style::computed_values::table_layout;
|
||||
use style::computed_values::{table_layout, LengthOrPercentageOrAuto};
|
||||
use std::sync::Arc;
|
||||
|
||||
#[deriving(Copy, Encodable, Show)]
|
||||
|
@ -128,8 +128,18 @@ impl TableWrapperFlow {
|
|||
// FIXME(pcwalton, spec): INTRINSIC § 8 does not properly define how to compute this, but
|
||||
// says "the basic idea is the same as the shrink-to-fit width that CSS2.1 defines". So we
|
||||
// just use the shrink-to-fit inline size.
|
||||
let available_inline_size =
|
||||
self.block_flow.get_shrink_to_fit_inline_size(available_inline_size);
|
||||
let available_inline_size = match self.block_flow.fragment.style().content_inline_size() {
|
||||
LengthOrPercentageOrAuto::Auto => self.block_flow
|
||||
.get_shrink_to_fit_inline_size(available_inline_size),
|
||||
// FIXME(mttr) This fixes #4421 without breaking our current reftests, but I'm
|
||||
// not completely sure this is "correct".
|
||||
//
|
||||
// That said, `available_inline_size` is, as far as I can tell, equal to the table's
|
||||
// computed width property (W) and is used from this point forward in a way that seems
|
||||
// to correspond with CSS 2.1 § 17.5.2.2 under "Column and caption widths
|
||||
// influence the final table width as follows: ..."
|
||||
_ => available_inline_size,
|
||||
};
|
||||
|
||||
// Compute all the guesses for the column sizes, and sum them.
|
||||
let mut total_guess = AutoLayoutCandidateGuess::new();
|
||||
|
|
|
@ -174,6 +174,7 @@ fragment=top != ../html/acid2.html acid2_ref.html
|
|||
== many_brs_a.html many_brs_ref.html
|
||||
== table_expansion_to_fit_a.html table_expansion_to_fit_ref.html
|
||||
== table_percentage_width_a.html table_percentage_width_ref.html
|
||||
== table_percentage_capping_a.html table_percentage_capping_ref.html
|
||||
== legacy_input_size_attribute_override_a.html legacy_input_size_attribute_override_ref.html
|
||||
== legacy_td_width_attribute_a.html legacy_td_width_attribute_ref.html
|
||||
== box_sizing_sanity_check_a.html box_sizing_sanity_check_ref.html
|
||||
|
|
12
tests/ref/table_percentage_capping_a.html
Normal file
12
tests/ref/table_percentage_capping_a.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<title>Test for capping percentages</title>
|
||||
<style>
|
||||
div { width:300px; background:yellow; height:50px; }
|
||||
table { width:150%; }
|
||||
td { background:blue; }
|
||||
</style>
|
||||
<div>
|
||||
<table cellspacing="0" cellpadding="0" border="0">
|
||||
<tr><td>parent div float=left</td></tr>
|
||||
</table>
|
||||
</div>
|
12
tests/ref/table_percentage_capping_ref.html
Normal file
12
tests/ref/table_percentage_capping_ref.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<title>Test for capping percentages</title>
|
||||
<style>
|
||||
div { width:300px; background:yellow; height:50px; }
|
||||
table { width:450px; }
|
||||
td { background:blue; }
|
||||
</style>
|
||||
<div>
|
||||
<table cellspacing="0" cellpadding="0" border="0">
|
||||
<tr><td>parent div float=left</td></tr>
|
||||
</table>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue