Skip to content
Permalink
Browse files

style: Implement scroll-padding parser and serializer.

  • Loading branch information...
hiikezoe authored and emilio committed Feb 18, 2019
1 parent 79a5e97 commit 7cbaaf6734756774546b87f253b4516a65fb8756
@@ -78,6 +78,7 @@ include = [
"LengthPercentage",
"NonNegativeLengthPercentage",
"LengthPercentageOrAuto",
"NonNegativeLengthPercentageOrAuto",
"Rect",
"IntersectionObserverRootMargin",
"Size",
@@ -1677,14 +1677,17 @@ fn static_assert() {
% endfor
</%self:impl_trait>

<% skip_scroll_padding_longhands = " ".join(["scroll-padding-%s" % x.ident for x in SIDES]) %>
<% skip_padding_longhands = " ".join(["padding-%s" % x.ident for x in SIDES]) %>
<%self:impl_trait style_struct_name="Padding"
skip_longhands="${skip_padding_longhands}">
skip_longhands="${skip_padding_longhands}
${skip_scroll_padding_longhands}">

% for side in SIDES:
<% impl_split_style_coord("padding_%s" % side.ident,
"mPadding",
side.index) %>
<% impl_split_style_coord("scroll_padding_%s" % side.ident, "mScrollPadding", side.index) %>
% endfor
</%self:impl_trait>

@@ -28,3 +28,17 @@
servo_restyle_damage="reflow rebuild_and_reflow_inline"
)}
% endfor

% for side in ALL_SIDES:
${helpers.predefined_type(
"scroll-padding-%s" % side[0],
"NonNegativeLengthPercentageOrAuto",
"computed::NonNegativeLengthPercentageOrAuto::auto()",
products="gecko",
gecko_pref="layout.css.scroll-snap-v1.enabled",
logical=side[1],
logical_group="scroll-padding",
spec="https://drafts.csswg.org/css-scroll-snap-1/#propdef-scroll-padding-%s" % side[0],
animation_value_type="ComputedValue",
)}
% endfor
@@ -27,3 +27,33 @@ ${helpers.two_properties_shorthand(
"specified::NonNegativeLengthPercentage::parse",
spec="https://drafts.csswg.org/css-logical/#propdef-padding-inline"
)}

${helpers.four_sides_shorthand(
"scroll-padding",
"scroll-padding-%s",
"specified::NonNegativeLengthPercentageOrAuto::parse",
products="gecko",
gecko_pref="layout.css.scroll-snap-v1.enabled",
spec="https://drafts.csswg.org/css-scroll-snap-1/#propdef-scroll-padding"
)}

${helpers.two_properties_shorthand(
"scroll-padding-block",
"scroll-padding-block-start",
"scroll-padding-block-end",
"specified::NonNegativeLengthPercentageOrAuto::parse",
products="gecko",
gecko_pref="layout.css.scroll-snap-v1.enabled",
spec="https://drafts.csswg.org/css-scroll-snap-1/#propdef-scroll-padding-block"
)}

${helpers.two_properties_shorthand(
"scroll-padding-inline",
"scroll-padding-inline-start",
"scroll-padding-inline-end",
"specified::NonNegativeLengthPercentageOrAuto::parse",
products="gecko",
gecko_pref="layout.css.scroll-snap-v1.enabled",
spec="https://drafts.csswg.org/css-scroll-snap-1/#propdef-scroll-padding-inline"
)}

@@ -503,7 +503,7 @@ impl LengthPercentageOrAuto {

/// A wrapper of LengthPercentageOrAuto, whose value must be >= 0.
pub type NonNegativeLengthPercentageOrAuto =
generics::LengthPercentageOrAuto<NonNegativeLengthPercentage>;
generics::GenericLengthPercentageOrAuto<NonNegativeLengthPercentage>;

impl NonNegativeLengthPercentageOrAuto {
computed_length_percentage_or_auto!(NonNegativeLengthPercentage);

0 comments on commit 7cbaaf6

Please sign in to comment.
You can’t perform that action at this time.