mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
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:
parent
9f28242def
commit
d9de68ad6a
8 changed files with 44 additions and 44 deletions
|
@ -39,6 +39,7 @@ derive_helper_methods = true
|
|||
prefix = "Style"
|
||||
include = [
|
||||
"Appearance",
|
||||
"BreakBetween",
|
||||
"ComputedFontStretchRange",
|
||||
"ComputedFontStyleDescriptor",
|
||||
"ComputedFontWeightRange",
|
||||
|
|
|
@ -291,6 +291,7 @@ class Longhand(object):
|
|||
"AlignItems",
|
||||
"AlignSelf",
|
||||
"Appearance",
|
||||
"BreakBetween",
|
||||
"BackgroundRepeat",
|
||||
"BorderImageRepeat",
|
||||
"BorderStyle",
|
||||
|
|
|
@ -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")}
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -11,13 +11,11 @@ use crate::values::generics::box_::Perspective as GenericPerspective;
|
|||
use crate::values::generics::box_::VerticalAlign as GenericVerticalAlign;
|
||||
use crate::values::specified::box_ as specified;
|
||||
|
||||
pub use crate::values::specified::box_::{
|
||||
AnimationName, Appearance, Contain, Display, OverflowClipBox,
|
||||
};
|
||||
pub use crate::values::specified::box_::{AnimationName, Appearance, BreakBetween};
|
||||
pub use crate::values::specified::box_::{Contain, Display, OverflowClipBox};
|
||||
pub use crate::values::specified::box_::{Clear as SpecifiedClear, Float as SpecifiedFloat};
|
||||
pub use crate::values::specified::box_::{
|
||||
OverscrollBehavior, ScrollSnapType, TouchAction, TransitionProperty, WillChange,
|
||||
};
|
||||
pub use crate::values::specified::box_::{OverscrollBehavior, ScrollSnapType};
|
||||
pub use crate::values::specified::box_::{TouchAction, TransitionProperty, WillChange};
|
||||
|
||||
/// A computed value for the `vertical-align` property.
|
||||
pub type VerticalAlign = GenericVerticalAlign<LengthOrPercentage>;
|
||||
|
|
|
@ -42,7 +42,7 @@ pub use self::border::{BorderCornerRadius, BorderRadius, BorderSpacing};
|
|||
pub use self::border::{BorderImageRepeat, BorderImageSideWidth};
|
||||
pub use self::border::{BorderImageSlice, BorderImageWidth};
|
||||
pub use self::box_::{AnimationIterationCount, AnimationName, Contain};
|
||||
pub use self::box_::{Appearance, Clear, Float};
|
||||
pub use self::box_::{Appearance, BreakBetween, Clear, Float};
|
||||
pub use self::box_::{Display, TransitionProperty};
|
||||
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize};
|
||||
pub use self::box_::{ScrollSnapType, TouchAction, VerticalAlign, WillChange};
|
||||
|
|
|
@ -1289,3 +1289,29 @@ pub enum Appearance {
|
|||
#[css(skip)]
|
||||
Count,
|
||||
}
|
||||
|
||||
/// A kind of break between two boxes.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-break/#break-between
|
||||
#[allow(missing_docs)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
Hash,
|
||||
MallocSizeOf,
|
||||
Parse,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToCss,
|
||||
ToComputedValue,
|
||||
)]
|
||||
#[repr(u8)]
|
||||
pub enum BreakBetween {
|
||||
Auto,
|
||||
Always,
|
||||
Avoid,
|
||||
Left,
|
||||
Right,
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ pub use self::border::{BorderCornerRadius, BorderImageSlice, BorderImageWidth};
|
|||
pub use self::border::{BorderImageRepeat, BorderImageSideWidth};
|
||||
pub use self::border::{BorderRadius, BorderSideWidth, BorderSpacing};
|
||||
pub use self::box_::{AnimationIterationCount, AnimationName, Contain, Display};
|
||||
pub use self::box_::{Appearance, Clear, Float};
|
||||
pub use self::box_::{Appearance, BreakBetween, Clear, Float};
|
||||
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize};
|
||||
pub use self::box_::{ScrollSnapType, TouchAction, TransitionProperty, VerticalAlign, WillChange};
|
||||
pub use self::color::{Color, ColorPropertyValue, RGBAColor};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue