servo: Merge #20499 - style: Implement percentages for 'column-gap' (from emilio:1398537); r=emilio,dholbert

Bug: 1398537
Reviewed-by: emilio,dholbert
Source-Repo: https://github.com/servo/servo
Source-Revision: 1e2411d2c50f87e2fbcfc91167029bd345649653

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 4e97c1d2a6096cf221c0c89377eb8bcff6ab663d
This commit is contained in:
Mats Palmgren 2018-04-01 18:59:15 -04:00
parent c55a3eaeb5
commit 2525140c5a
5 changed files with 26 additions and 12 deletions

View File

@ -106,6 +106,7 @@ 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::Second(_normal) => self.block_flow.fragment.style.get_font().font_size.size(),

View File

@ -1445,7 +1445,7 @@ impl Clone for ${style_struct.gecko_struct_name} {
"length::LengthOrAuto": impl_style_coord,
"length::LengthOrNormal": impl_style_coord,
"length::NonNegativeLengthOrAuto": impl_style_coord,
"length::NonNegativeLengthOrNormal": impl_style_coord,
"length::NonNegativeLengthOrPercentageOrNormal": impl_style_coord,
"Length": impl_absolute_length,
"LengthOrNormal": impl_style_coord,
"LengthOrPercentage": impl_style_coord,

View File

@ -29,14 +29,21 @@ ${helpers.predefined_type(
servo_restyle_damage="rebuild_and_reflow",
)}
${helpers.predefined_type("column-gap",
"length::NonNegativeLengthOrNormal",
"Either::Second(Normal)",
extra_prefixes="moz",
servo_pref="layout.columns.enabled",
animation_value_type="NonNegativeLengthOrNormal",
spec="https://drafts.csswg.org/css-multicol/#propdef-column-gap",
servo_restyle_damage = "reflow")}
<%
# FIXME(#20498): Servo should support percentages in column-gap.
col_gap_type = "NonNegativeLengthOrPercentageOrNormal" if product == "gecko" else "NonNegativeLengthOrNormal"
%>
${helpers.predefined_type(
"column-gap",
"length::%s" % col_gap_type,
"Either::Second(Normal)",
extra_prefixes="moz",
servo_pref="layout.columns.enabled",
animation_value_type=col_gap_type,
spec="https://drafts.csswg.org/css-multicol/#propdef-column-gap",
servo_restyle_damage = "reflow",
)}
${helpers.single_keyword("column-fill", "balance auto", extra_prefixes="moz",
products="gecko", animation_value_type="discrete",

View File

@ -897,6 +897,9 @@ pub type NonNegativeLengthOrAuto = Either<NonNegativeLength, Auto>;
/// Either a computed NonNegativeLength or the `normal` keyword.
pub type NonNegativeLengthOrNormal = Either<NonNegativeLength, Normal>;
/// Either a computed NonNegativeLengthOrPercentage or the `normal` keyword.
pub type NonNegativeLengthOrPercentageOrNormal = Either<NonNegativeLengthOrPercentage, Normal>;
/// A type for possible values for min- and max- flavors of width, height,
/// block-size, and inline-size.
#[allow(missing_docs)]

View File

@ -679,9 +679,6 @@ impl NonNegativeLength {
}
}
/// Either a NonNegativeLength or the `normal` keyword.
pub type NonNegativeLengthOrNormal = Either<NonNegativeLength, Normal>;
/// Either a NonNegativeLength or the `auto` keyword.
pub type NonNegativeLengthOrAuto = Either<NonNegativeLength, Auto>;
@ -1020,6 +1017,12 @@ impl Parse for LengthOrPercentageOrNone {
/// A wrapper of LengthOrPercentage, whose value must be >= 0.
pub type NonNegativeLengthOrPercentage = NonNegative<LengthOrPercentage>;
/// Either a computed NonNegativeLength or the `normal` keyword.
pub type NonNegativeLengthOrNormal = Either<NonNegativeLength, Normal>;
/// Either a NonNegativeLengthOrPercentage or the `normal` keyword.
pub type NonNegativeLengthOrPercentageOrNormal = Either<NonNegativeLengthOrPercentage, Normal>;
impl From<NoCalcLength> for NonNegativeLengthOrPercentage {
#[inline]
fn from(len: NoCalcLength) -> Self {