layout: Make the style-specified width affect minimum width.

Improves the front page of Google.
This commit is contained in:
Patrick Walton 2015-04-27 18:26:11 -07:00
parent 8ecb9d681c
commit a92baf7683
4 changed files with 70 additions and 8 deletions

View file

@ -963,20 +963,19 @@ impl Fragment {
fn style_specified_intrinsic_inline_size(&self) -> IntrinsicISizesContribution {
let flags = self.quantities_included_in_intrinsic_inline_size();
let style = self.style();
let (min_inline_size, specified) =
if flags.contains(INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED) {
(model::specified(style.min_inline_size(), Au(0)),
MaybeAuto::from_style(style.content_inline_size(), Au(0)).specified_or_zero())
} else {
(Au(0), Au(0))
};
let specified = if flags.contains(INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED) {
Au::max(model::specified(style.min_inline_size(), Au(0)),
MaybeAuto::from_style(style.content_inline_size(), Au(0)).specified_or_zero())
} else {
Au(0)
};
// FIXME(#2261, pcwalton): This won't work well for inlines: is this OK?
let surrounding_inline_size = self.surrounding_intrinsic_inline_size();
IntrinsicISizesContribution {
content_intrinsic_sizes: IntrinsicISizes {
minimum_inline_size: min_inline_size,
minimum_inline_size: specified,
preferred_inline_size: specified,
},
surrounding_size: surrounding_inline_size,

View file

@ -294,6 +294,7 @@ experimental == rtl_simple.html rtl_simple_ref.html
== table_containing_block_a.html table_containing_block_ref.html
== table_expansion_to_fit_a.html table_expansion_to_fit_ref.html
== table_float_translation_a.html table_float_translation_ref.html
== table_intrinsic_style_specified_width_a.html table_intrinsic_style_specified_width_ref.html
== table_padding_a.html table_padding_ref.html
== table_percentage_capping_a.html table_percentage_capping_ref.html
== table_percentage_width_a.html table_percentage_width_ref.html

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<style>
section {
width: 400px;
}
table {
width: 400px;
height: 100px;
}
#a {
width: 100px;
height: 100px;
background: green;
}
#b {
background: lightblue;
}
</style>
</head>
<body>
<section><table><tr><td><div id=a></div></td><td id=b>
Foo foo foo foo foo foo foo foo
foo foo foo foo foo foo foo foo
foo foo foo foo foo foo foo foo
foo foo foo foo foo foo foo foo
</td></tr></table></section>
</body>
</html>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<style>
section {
width: 400px;
}
table {
width: 400px;
height: 100px;
}
#a {
min-width: 100px;
height: 100px;
background: green;
}
#b {
background: lightblue;
}
</style>
</head>
<body>
<section><table><tr><td><div id=a></div></td><td id=b>
Foo foo foo foo foo foo foo foo
foo foo foo foo foo foo foo foo
foo foo foo foo foo foo foo foo
foo foo foo foo foo foo foo foo
</td></tr></table></section>
</body>
</html>