style: Move the page-break-{before,after} properties to not use mako.

And respect the computed value of `left` / `right` / etc.

Differential Revision: https://phabricator.services.mozilla.com/D11872
This commit is contained in:
Emilio Cobos Álvarez 2018-11-15 08:15:13 +00:00
parent 9f28242def
commit d9de68ad6a
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
8 changed files with 44 additions and 44 deletions

View file

@ -291,6 +291,7 @@ class Longhand(object):
"AlignItems",
"AlignSelf",
"Appearance",
"BreakBetween",
"BackgroundRepeat",
"BorderImageRepeat",
"BorderStyle",

View file

@ -1396,6 +1396,7 @@ impl Clone for ${style_struct.gecko_struct_name} {
# Types used with predefined_type()-defined properties that we can auto-generate.
predefined_types = {
"BreakBetween": impl_simple,
"Color": impl_color,
"ColorOrAuto": impl_color,
"GreaterThanOrEqualToOneNumber": impl_simple,
@ -3029,8 +3030,7 @@ fn static_assert() {
animation-iteration-count animation-timing-function
transition-duration transition-delay
transition-timing-function transition-property
page-break-before page-break-after rotate
scroll-snap-points-x scroll-snap-points-y
rotate scroll-snap-points-x scroll-snap-points-y
scroll-snap-type-x scroll-snap-type-y scroll-snap-coordinate
perspective-origin -moz-binding will-change
offset-path overscroll-behavior-x overscroll-behavior-y
@ -3149,35 +3149,6 @@ fn static_assert() {
<%call expr="impl_coord_copy('vertical_align', 'mVerticalAlign')"></%call>
% for kind in ["before", "after"]:
// Temp fix for Bugzilla bug 24000.
// Map 'auto' and 'avoid' to false, and 'always', 'left', and 'right' to true.
// "A conforming user agent may interpret the values 'left' and 'right'
// as 'always'." - CSS2.1, section 13.3.1
pub fn set_page_break_${kind}(&mut self, v: longhands::page_break_${kind}::computed_value::T) {
use crate::computed_values::page_break_${kind}::T;
let result = match v {
T::Auto => false,
T::Always => true,
T::Avoid => false,
T::Left => true,
T::Right => true
};
self.gecko.mBreak${kind.title()} = result;
}
${impl_simple_copy('page_break_' + kind, 'mBreak' + kind.title())}
// Temp fix for Bugzilla bug 24000.
// See set_page_break_before/after for detail.
pub fn clone_page_break_${kind}(&self) -> longhands::page_break_${kind}::computed_value::T {
use crate::computed_values::page_break_${kind}::T;
if self.gecko.mBreak${kind.title()} { T::Always } else { T::Auto }
}
% endfor
${impl_style_coord("scroll_snap_points_x", "mScrollSnapPointsX")}
${impl_style_coord("scroll_snap_points_y", "mScrollSnapPointsY")}

View file

@ -437,18 +437,21 @@ ${helpers.single_keyword(
animation_value_type="discrete",
)}
// TODO add support for logical values recto and verso
${helpers.single_keyword(
${helpers.predefined_type(
"page-break-after",
"auto always avoid left right",
"BreakBetween",
"computed::BreakBetween::Auto",
needs_context=False,
products="gecko",
spec="https://drafts.csswg.org/css2/page.html#propdef-page-break-after",
animation_value_type="discrete",
)}
${helpers.single_keyword(
${helpers.predefined_type(
"page-break-before",
"auto always avoid left right",
"BreakBetween",
"computed::BreakBetween::Auto",
needs_context=False,
products="gecko",
spec="https://drafts.csswg.org/css2/page.html#propdef-page-break-before",
animation_value_type="discrete",