From ce2e5dc707fbab27c71bf1913c4c0b6520d0278f Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 24 Oct 2016 18:17:13 -0700 Subject: [PATCH] layout: Make intrinsic inline sizes take the value of `box-sizing` into account. --- components/layout/fragment.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index 61abc7fc7d5..e79360d08f4 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -1176,10 +1176,11 @@ impl Fragment { if let Some(max) = model::specified_or_none(style.max_inline_size(), Au(0)) { specified = min(specified, max) } - } - // FIXME(#2261, pcwalton): This won't work well for inlines: is this OK? - let surrounding_inline_size = self.surrounding_intrinsic_inline_size(); + if self.style.get_position().box_sizing == box_sizing::T::border_box { + specified -= border_padding + } + } IntrinsicISizesContribution { content_intrinsic_sizes: IntrinsicISizes {