From a92baf7683f7ec8677db8ffba6a6dc72a5fbd905 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 27 Apr 2015 18:26:11 -0700 Subject: [PATCH] layout: Make the style-specified width affect minimum width. Improves the front page of Google. --- components/layout/fragment.rs | 15 +++++---- tests/ref/basic.list | 1 + ...ble_intrinsic_style_specified_width_a.html | 31 +++++++++++++++++++ ...e_intrinsic_style_specified_width_ref.html | 31 +++++++++++++++++++ 4 files changed, 70 insertions(+), 8 deletions(-) create mode 100644 tests/ref/table_intrinsic_style_specified_width_a.html create mode 100644 tests/ref/table_intrinsic_style_specified_width_ref.html diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index 16ff6a6d307..c7e1cd1ed04 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -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, diff --git a/tests/ref/basic.list b/tests/ref/basic.list index e762048e1ca..6d98644daef 100644 --- a/tests/ref/basic.list +++ b/tests/ref/basic.list @@ -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 diff --git a/tests/ref/table_intrinsic_style_specified_width_a.html b/tests/ref/table_intrinsic_style_specified_width_a.html new file mode 100644 index 00000000000..42b72c63246 --- /dev/null +++ b/tests/ref/table_intrinsic_style_specified_width_a.html @@ -0,0 +1,31 @@ + + + + + + +
+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 +
+ + + diff --git a/tests/ref/table_intrinsic_style_specified_width_ref.html b/tests/ref/table_intrinsic_style_specified_width_ref.html new file mode 100644 index 00000000000..20eb6836c39 --- /dev/null +++ b/tests/ref/table_intrinsic_style_specified_width_ref.html @@ -0,0 +1,31 @@ + + + + + + +
+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 +
+ + +