From d588590ed232eedbf50751ef22545e4631d5f050 Mon Sep 17 00:00:00 2001 From: Ramshell Date: Thu, 5 Apr 2018 21:04:29 -0300 Subject: [PATCH 1/3] Add support for percentages in column-gap. --- components/layout/multicol.rs | 3 +-- components/style/properties/longhand/column.mako.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/components/layout/multicol.rs b/components/layout/multicol.rs index 22f8e3e24ab..3659d50e219 100644 --- a/components/layout/multicol.rs +++ b/components/layout/multicol.rs @@ -106,9 +106,8 @@ impl Flow for MulticolFlow { { let column_style = self.block_flow.fragment.style.get_column(); - // FIXME(#20498): This should support percentages too. let column_gap = match column_style.column_gap { - Either::First(len) => len.into(), + Either::First(len) => len.0.to_pixel_length(content_inline_size).into(), Either::Second(_normal) => self.block_flow.fragment.style.get_font().font_size.size(), }; diff --git a/components/style/properties/longhand/column.mako.rs b/components/style/properties/longhand/column.mako.rs index 9113479218b..13ae02987a0 100644 --- a/components/style/properties/longhand/column.mako.rs +++ b/components/style/properties/longhand/column.mako.rs @@ -32,7 +32,7 @@ ${helpers.predefined_type( <% # FIXME(#20498): Servo should support percentages in column-gap. -col_gap_type = "NonNegativeLengthOrPercentageOrNormal" if product == "gecko" else "NonNegativeLengthOrNormal" +col_gap_type = "NonNegativeLengthOrPercentageOrNormal" %> ${helpers.predefined_type( "column-gap", From 20e89224332d2b69610369d3033f6739ab4e0bf4 Mon Sep 17 00:00:00 2001 From: Ramshell Date: Fri, 6 Apr 2018 08:34:03 -0300 Subject: [PATCH 2/3] Remove FIXME comment --- components/style/properties/longhand/column.mako.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/components/style/properties/longhand/column.mako.rs b/components/style/properties/longhand/column.mako.rs index 13ae02987a0..a4da425d0a7 100644 --- a/components/style/properties/longhand/column.mako.rs +++ b/components/style/properties/longhand/column.mako.rs @@ -31,7 +31,6 @@ ${helpers.predefined_type( <% -# FIXME(#20498): Servo should support percentages in column-gap. col_gap_type = "NonNegativeLengthOrPercentageOrNormal" %> ${helpers.predefined_type( From 14a0e74ca34e702a603277c0b4182689bba4a24d Mon Sep 17 00:00:00 2001 From: Ramshell Date: Fri, 6 Apr 2018 12:23:25 -0300 Subject: [PATCH 3/3] Remove col_gap_type variable --- components/style/properties/longhand/column.mako.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/components/style/properties/longhand/column.mako.rs b/components/style/properties/longhand/column.mako.rs index a4da425d0a7..5ed8164e7eb 100644 --- a/components/style/properties/longhand/column.mako.rs +++ b/components/style/properties/longhand/column.mako.rs @@ -30,16 +30,14 @@ ${helpers.predefined_type( )} -<% -col_gap_type = "NonNegativeLengthOrPercentageOrNormal" -%> + ${helpers.predefined_type( "column-gap", - "length::%s" % col_gap_type, + "length::NonNegativeLengthOrPercentageOrNormal", "Either::Second(Normal)", extra_prefixes="moz", servo_pref="layout.columns.enabled", - animation_value_type=col_gap_type, + animation_value_type="NonNegativeLengthOrPercentageOrNormal", spec="https://drafts.csswg.org/css-multicol/#propdef-column-gap", servo_restyle_damage = "reflow", )}