mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
layout: Make the style-specified width affect minimum width.
Improves the front page of Google.
This commit is contained in:
parent
8ecb9d681c
commit
a92baf7683
4 changed files with 70 additions and 8 deletions
|
@ -963,20 +963,19 @@ impl Fragment {
|
||||||
fn style_specified_intrinsic_inline_size(&self) -> IntrinsicISizesContribution {
|
fn style_specified_intrinsic_inline_size(&self) -> IntrinsicISizesContribution {
|
||||||
let flags = self.quantities_included_in_intrinsic_inline_size();
|
let flags = self.quantities_included_in_intrinsic_inline_size();
|
||||||
let style = self.style();
|
let style = self.style();
|
||||||
let (min_inline_size, specified) =
|
let specified = if flags.contains(INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED) {
|
||||||
if flags.contains(INTRINSIC_INLINE_SIZE_INCLUDES_SPECIFIED) {
|
Au::max(model::specified(style.min_inline_size(), Au(0)),
|
||||||
(model::specified(style.min_inline_size(), Au(0)),
|
MaybeAuto::from_style(style.content_inline_size(), Au(0)).specified_or_zero())
|
||||||
MaybeAuto::from_style(style.content_inline_size(), Au(0)).specified_or_zero())
|
} else {
|
||||||
} else {
|
Au(0)
|
||||||
(Au(0), Au(0))
|
};
|
||||||
};
|
|
||||||
|
|
||||||
// FIXME(#2261, pcwalton): This won't work well for inlines: is this OK?
|
// FIXME(#2261, pcwalton): This won't work well for inlines: is this OK?
|
||||||
let surrounding_inline_size = self.surrounding_intrinsic_inline_size();
|
let surrounding_inline_size = self.surrounding_intrinsic_inline_size();
|
||||||
|
|
||||||
IntrinsicISizesContribution {
|
IntrinsicISizesContribution {
|
||||||
content_intrinsic_sizes: IntrinsicISizes {
|
content_intrinsic_sizes: IntrinsicISizes {
|
||||||
minimum_inline_size: min_inline_size,
|
minimum_inline_size: specified,
|
||||||
preferred_inline_size: specified,
|
preferred_inline_size: specified,
|
||||||
},
|
},
|
||||||
surrounding_size: surrounding_inline_size,
|
surrounding_size: surrounding_inline_size,
|
||||||
|
|
|
@ -294,6 +294,7 @@ experimental == rtl_simple.html rtl_simple_ref.html
|
||||||
== table_containing_block_a.html table_containing_block_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_expansion_to_fit_a.html table_expansion_to_fit_ref.html
|
||||||
== table_float_translation_a.html table_float_translation_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_padding_a.html table_padding_ref.html
|
||||||
== table_percentage_capping_a.html table_percentage_capping_ref.html
|
== table_percentage_capping_a.html table_percentage_capping_ref.html
|
||||||
== table_percentage_width_a.html table_percentage_width_ref.html
|
== table_percentage_width_a.html table_percentage_width_ref.html
|
||||||
|
|
31
tests/ref/table_intrinsic_style_specified_width_a.html
Normal file
31
tests/ref/table_intrinsic_style_specified_width_a.html
Normal 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>
|
||||||
|
|
31
tests/ref/table_intrinsic_style_specified_width_ref.html
Normal file
31
tests/ref/table_intrinsic_style_specified_width_ref.html
Normal 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>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue