mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
style: Rename background::RepeatKeyword and border::RepeatKeyword.
This commit is contained in:
parent
50b517d0db
commit
8e411105ce
8 changed files with 55 additions and 51 deletions
|
@ -21,7 +21,7 @@ use style::values::generics::background::BackgroundSize;
|
||||||
use style::values::generics::image::{Circle, Ellipse, ShapeExtent};
|
use style::values::generics::image::{Circle, Ellipse, ShapeExtent};
|
||||||
use style::values::generics::image::EndingShape as GenericEndingShape;
|
use style::values::generics::image::EndingShape as GenericEndingShape;
|
||||||
use style::values::generics::image::GradientItem as GenericGradientItem;
|
use style::values::generics::image::GradientItem as GenericGradientItem;
|
||||||
use style::values::specified::background::RepeatKeyword;
|
use style::values::specified::background::BackgroundRepeatKeyword;
|
||||||
use style::values::specified::position::{X, Y};
|
use style::values::specified::position::{X, Y};
|
||||||
use webrender_api::{ExtendMode, GradientStop};
|
use webrender_api::{ExtendMode, GradientStop};
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ fn tile_image(position: &mut Au, size: &mut Au, absolute_anchor_origin: Au, imag
|
||||||
///
|
///
|
||||||
/// This is done separately for both axes because the repeat keywords may differ.
|
/// This is done separately for both axes because the repeat keywords may differ.
|
||||||
pub fn tile_image_axis(
|
pub fn tile_image_axis(
|
||||||
repeat: RepeatKeyword,
|
repeat: BackgroundRepeatKeyword,
|
||||||
position: &mut Au,
|
position: &mut Au,
|
||||||
size: &mut Au,
|
size: &mut Au,
|
||||||
tile_size: &mut Au,
|
tile_size: &mut Au,
|
||||||
|
@ -187,16 +187,16 @@ pub fn tile_image_axis(
|
||||||
) {
|
) {
|
||||||
let absolute_anchor_origin = *position + offset;
|
let absolute_anchor_origin = *position + offset;
|
||||||
match repeat {
|
match repeat {
|
||||||
RepeatKeyword::NoRepeat => {
|
BackgroundRepeatKeyword::NoRepeat => {
|
||||||
*position += offset;
|
*position += offset;
|
||||||
*size = *tile_size;
|
*size = *tile_size;
|
||||||
},
|
},
|
||||||
RepeatKeyword::Repeat => {
|
BackgroundRepeatKeyword::Repeat => {
|
||||||
*position = clip_origin;
|
*position = clip_origin;
|
||||||
*size = clip_size;
|
*size = clip_size;
|
||||||
tile_image(position, size, absolute_anchor_origin, *tile_size);
|
tile_image(position, size, absolute_anchor_origin, *tile_size);
|
||||||
},
|
},
|
||||||
RepeatKeyword::Space => {
|
BackgroundRepeatKeyword::Space => {
|
||||||
tile_image_spaced(
|
tile_image_spaced(
|
||||||
position,
|
position,
|
||||||
size,
|
size,
|
||||||
|
@ -209,7 +209,7 @@ pub fn tile_image_axis(
|
||||||
*size = clip_size;
|
*size = clip_size;
|
||||||
tile_image(position, size, absolute_anchor_origin, combined_tile_size);
|
tile_image(position, size, absolute_anchor_origin, combined_tile_size);
|
||||||
},
|
},
|
||||||
RepeatKeyword::Round => {
|
BackgroundRepeatKeyword::Round => {
|
||||||
tile_image_round(position, size, absolute_anchor_origin, tile_size);
|
tile_image_round(position, size, absolute_anchor_origin, tile_size);
|
||||||
*position = clip_origin;
|
*position = clip_origin;
|
||||||
*size = clip_size;
|
*size = clip_size;
|
||||||
|
|
|
@ -69,7 +69,6 @@ use style::values::computed::effects::SimpleShadow;
|
||||||
use style::values::computed::pointing::Cursor;
|
use style::values::computed::pointing::Cursor;
|
||||||
use style::values::generics::background::BackgroundSize;
|
use style::values::generics::background::BackgroundSize;
|
||||||
use style::values::generics::image::{GradientKind, Image, PaintWorklet};
|
use style::values::generics::image::{GradientKind, Image, PaintWorklet};
|
||||||
use style::values::specified::border::RepeatKeyword;
|
|
||||||
use style_traits::CSSPixel;
|
use style_traits::CSSPixel;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
use style_traits::cursor::CursorKind;
|
use style_traits::cursor::CursorKind;
|
||||||
|
|
|
@ -7,10 +7,10 @@ use euclid::{Point2D, Rect, SideOffsets2D, Size2D, Vector2D};
|
||||||
use style::computed_values::image_rendering::T as ImageRendering;
|
use style::computed_values::image_rendering::T as ImageRendering;
|
||||||
use style::computed_values::mix_blend_mode::T as MixBlendMode;
|
use style::computed_values::mix_blend_mode::T as MixBlendMode;
|
||||||
use style::computed_values::transform_style::T as TransformStyle;
|
use style::computed_values::transform_style::T as TransformStyle;
|
||||||
use style::properties::longhands::border_image_repeat::RepeatKeyword;
|
|
||||||
use style::values::RGBA;
|
use style::values::RGBA;
|
||||||
use style::values::computed::{BorderStyle, Filter};
|
use style::values::computed::{BorderStyle, Filter};
|
||||||
use style::values::generics::effects::Filter as GenericFilter;
|
use style::values::generics::effects::Filter as GenericFilter;
|
||||||
|
use style::values::specified::border::BorderImageRepeatKeyword;
|
||||||
use webrender_api as wr;
|
use webrender_api as wr;
|
||||||
|
|
||||||
pub trait ToLayout {
|
pub trait ToLayout {
|
||||||
|
@ -152,14 +152,15 @@ impl ToLayout for Vector2D<Au> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToLayout for RepeatKeyword {
|
impl ToLayout for BorderImageRepeatKeyword {
|
||||||
type Type = wr::RepeatMode;
|
type Type = wr::RepeatMode;
|
||||||
|
|
||||||
fn to_layout(&self) -> Self::Type {
|
fn to_layout(&self) -> Self::Type {
|
||||||
match *self {
|
match *self {
|
||||||
RepeatKeyword::Stretch => wr::RepeatMode::Stretch,
|
BorderImageRepeatKeyword::Stretch => wr::RepeatMode::Stretch,
|
||||||
RepeatKeyword::Repeat => wr::RepeatMode::Repeat,
|
BorderImageRepeatKeyword::Repeat => wr::RepeatMode::Repeat,
|
||||||
RepeatKeyword::Round => wr::RepeatMode::Round,
|
BorderImageRepeatKeyword::Round => wr::RepeatMode::Round,
|
||||||
RepeatKeyword::Space => wr::RepeatMode::Space,
|
BorderImageRepeatKeyword::Space => wr::RepeatMode::Space,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1713,13 +1713,13 @@ fn static_assert() {
|
||||||
%>
|
%>
|
||||||
|
|
||||||
pub fn set_border_image_repeat(&mut self, v: longhands::border_image_repeat::computed_value::T) {
|
pub fn set_border_image_repeat(&mut self, v: longhands::border_image_repeat::computed_value::T) {
|
||||||
use values::specified::border::RepeatKeyword;
|
use values::specified::border::BorderImageRepeatKeyword;
|
||||||
use gecko_bindings::structs::StyleBorderImageRepeat;
|
use gecko_bindings::structs::StyleBorderImageRepeat;
|
||||||
|
|
||||||
% for i, side in enumerate(["H", "V"]):
|
% for i, side in enumerate(["H", "V"]):
|
||||||
self.gecko.mBorderImageRepeat${side} = match v.${i} {
|
self.gecko.mBorderImageRepeat${side} = match v.${i} {
|
||||||
% for keyword in border_image_repeat_keywords:
|
% for keyword in border_image_repeat_keywords:
|
||||||
RepeatKeyword::${keyword} => StyleBorderImageRepeat::${keyword},
|
BorderImageRepeatKeyword::${keyword} => StyleBorderImageRepeat::${keyword},
|
||||||
% endfor
|
% endfor
|
||||||
};
|
};
|
||||||
% endfor
|
% endfor
|
||||||
|
@ -1735,13 +1735,13 @@ fn static_assert() {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clone_border_image_repeat(&self) -> longhands::border_image_repeat::computed_value::T {
|
pub fn clone_border_image_repeat(&self) -> longhands::border_image_repeat::computed_value::T {
|
||||||
use values::specified::border::RepeatKeyword;
|
use values::specified::border::BorderImageRepeatKeyword;
|
||||||
use gecko_bindings::structs::StyleBorderImageRepeat;
|
use gecko_bindings::structs::StyleBorderImageRepeat;
|
||||||
|
|
||||||
% for side in ["H", "V"]:
|
% for side in ["H", "V"]:
|
||||||
let servo_${side.lower()} = match self.gecko.mBorderImageRepeat${side} {
|
let servo_${side.lower()} = match self.gecko.mBorderImageRepeat${side} {
|
||||||
% for keyword in border_image_repeat_keywords:
|
% for keyword in border_image_repeat_keywords:
|
||||||
StyleBorderImageRepeat::${keyword} => RepeatKeyword::${keyword},
|
StyleBorderImageRepeat::${keyword} => BorderImageRepeatKeyword::${keyword},
|
||||||
% endfor
|
% endfor
|
||||||
};
|
};
|
||||||
% endfor
|
% endfor
|
||||||
|
@ -3816,16 +3816,16 @@ fn static_assert() {
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<%self:simple_image_array_property name="repeat" shorthand="${shorthand}" field_name="mRepeat">
|
<%self:simple_image_array_property name="repeat" shorthand="${shorthand}" field_name="mRepeat">
|
||||||
use values::specified::background::RepeatKeyword;
|
use values::specified::background::BackgroundRepeatKeyword;
|
||||||
use gecko_bindings::structs::nsStyleImageLayers_Repeat;
|
use gecko_bindings::structs::nsStyleImageLayers_Repeat;
|
||||||
use gecko_bindings::structs::StyleImageLayerRepeat;
|
use gecko_bindings::structs::StyleImageLayerRepeat;
|
||||||
|
|
||||||
fn to_ns(repeat: RepeatKeyword) -> StyleImageLayerRepeat {
|
fn to_ns(repeat: BackgroundRepeatKeyword) -> StyleImageLayerRepeat {
|
||||||
match repeat {
|
match repeat {
|
||||||
RepeatKeyword::Repeat => StyleImageLayerRepeat::Repeat,
|
BackgroundRepeatKeyword::Repeat => StyleImageLayerRepeat::Repeat,
|
||||||
RepeatKeyword::Space => StyleImageLayerRepeat::Space,
|
BackgroundRepeatKeyword::Space => StyleImageLayerRepeat::Space,
|
||||||
RepeatKeyword::Round => StyleImageLayerRepeat::Round,
|
BackgroundRepeatKeyword::Round => StyleImageLayerRepeat::Round,
|
||||||
RepeatKeyword::NoRepeat => StyleImageLayerRepeat::NoRepeat,
|
BackgroundRepeatKeyword::NoRepeat => StyleImageLayerRepeat::NoRepeat,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3839,15 +3839,15 @@ fn static_assert() {
|
||||||
|
|
||||||
pub fn clone_${shorthand}_repeat(&self) -> longhands::${shorthand}_repeat::computed_value::T {
|
pub fn clone_${shorthand}_repeat(&self) -> longhands::${shorthand}_repeat::computed_value::T {
|
||||||
use properties::longhands::${shorthand}_repeat::single_value::computed_value::T;
|
use properties::longhands::${shorthand}_repeat::single_value::computed_value::T;
|
||||||
use values::specified::background::RepeatKeyword;
|
use values::specified::background::BackgroundRepeatKeyword;
|
||||||
use gecko_bindings::structs::StyleImageLayerRepeat;
|
use gecko_bindings::structs::StyleImageLayerRepeat;
|
||||||
|
|
||||||
fn to_servo(repeat: StyleImageLayerRepeat) -> RepeatKeyword {
|
fn to_servo(repeat: StyleImageLayerRepeat) -> BackgroundRepeatKeyword {
|
||||||
match repeat {
|
match repeat {
|
||||||
StyleImageLayerRepeat::Repeat => RepeatKeyword::Repeat,
|
StyleImageLayerRepeat::Repeat => BackgroundRepeatKeyword::Repeat,
|
||||||
StyleImageLayerRepeat::Space => RepeatKeyword::Space,
|
StyleImageLayerRepeat::Space => BackgroundRepeatKeyword::Space,
|
||||||
StyleImageLayerRepeat::Round => RepeatKeyword::Round,
|
StyleImageLayerRepeat::Round => BackgroundRepeatKeyword::Round,
|
||||||
StyleImageLayerRepeat::NoRepeat => RepeatKeyword::NoRepeat,
|
StyleImageLayerRepeat::NoRepeat => BackgroundRepeatKeyword::NoRepeat,
|
||||||
_ => panic!("Found unexpected value in style struct for ${shorthand}_repeat property"),
|
_ => panic!("Found unexpected value in style struct for ${shorthand}_repeat property"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ use values::animated::{ToAnimatedValue, ToAnimatedZero};
|
||||||
use values::computed::{Context, ToComputedValue};
|
use values::computed::{Context, ToComputedValue};
|
||||||
use values::computed::length::LengthOrPercentageOrAuto;
|
use values::computed::length::LengthOrPercentageOrAuto;
|
||||||
use values::generics::background::BackgroundSize as GenericBackgroundSize;
|
use values::generics::background::BackgroundSize as GenericBackgroundSize;
|
||||||
use values::specified::background::{BackgroundRepeat as SpecifiedBackgroundRepeat, RepeatKeyword};
|
use values::specified::background::{BackgroundRepeat as SpecifiedBackgroundRepeat, BackgroundRepeatKeyword};
|
||||||
|
|
||||||
/// A computed value for the `background-size` property.
|
/// A computed value for the `background-size` property.
|
||||||
pub type BackgroundSize = GenericBackgroundSize<LengthOrPercentageOrAuto>;
|
pub type BackgroundSize = GenericBackgroundSize<LengthOrPercentageOrAuto>;
|
||||||
|
@ -86,12 +86,12 @@ impl ToAnimatedValue for BackgroundSizeList {
|
||||||
///
|
///
|
||||||
/// https://drafts.csswg.org/css-backgrounds/#the-background-repeat
|
/// https://drafts.csswg.org/css-backgrounds/#the-background-repeat
|
||||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
|
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
|
||||||
pub struct BackgroundRepeat(pub RepeatKeyword, pub RepeatKeyword);
|
pub struct BackgroundRepeat(pub BackgroundRepeatKeyword, pub BackgroundRepeatKeyword);
|
||||||
|
|
||||||
impl BackgroundRepeat {
|
impl BackgroundRepeat {
|
||||||
/// Returns the `repeat repeat` value.
|
/// Returns the `repeat repeat` value.
|
||||||
pub fn repeat() -> Self {
|
pub fn repeat() -> Self {
|
||||||
BackgroundRepeat(RepeatKeyword::Repeat, RepeatKeyword::Repeat)
|
BackgroundRepeat(BackgroundRepeatKeyword::Repeat, BackgroundRepeatKeyword::Repeat)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,8 +101,12 @@ impl ToCss for BackgroundRepeat {
|
||||||
W: Write,
|
W: Write,
|
||||||
{
|
{
|
||||||
match (self.0, self.1) {
|
match (self.0, self.1) {
|
||||||
(RepeatKeyword::Repeat, RepeatKeyword::NoRepeat) => dest.write_str("repeat-x"),
|
(BackgroundRepeatKeyword::Repeat, BackgroundRepeatKeyword::NoRepeat) => {
|
||||||
(RepeatKeyword::NoRepeat, RepeatKeyword::Repeat) => dest.write_str("repeat-y"),
|
dest.write_str("repeat-x")
|
||||||
|
},
|
||||||
|
(BackgroundRepeatKeyword::NoRepeat, BackgroundRepeatKeyword::Repeat) => {
|
||||||
|
dest.write_str("repeat-y")
|
||||||
|
},
|
||||||
(horizontal, vertical) => {
|
(horizontal, vertical) => {
|
||||||
horizontal.to_css(dest)?;
|
horizontal.to_css(dest)?;
|
||||||
if horizontal != vertical {
|
if horizontal != vertical {
|
||||||
|
@ -122,10 +126,10 @@ impl ToComputedValue for SpecifiedBackgroundRepeat {
|
||||||
fn to_computed_value(&self, _: &Context) -> Self::ComputedValue {
|
fn to_computed_value(&self, _: &Context) -> Self::ComputedValue {
|
||||||
match *self {
|
match *self {
|
||||||
SpecifiedBackgroundRepeat::RepeatX => {
|
SpecifiedBackgroundRepeat::RepeatX => {
|
||||||
BackgroundRepeat(RepeatKeyword::Repeat, RepeatKeyword::NoRepeat)
|
BackgroundRepeat(BackgroundRepeatKeyword::Repeat, BackgroundRepeatKeyword::NoRepeat)
|
||||||
}
|
}
|
||||||
SpecifiedBackgroundRepeat::RepeatY => {
|
SpecifiedBackgroundRepeat::RepeatY => {
|
||||||
BackgroundRepeat(RepeatKeyword::NoRepeat, RepeatKeyword::Repeat)
|
BackgroundRepeat(BackgroundRepeatKeyword::NoRepeat, BackgroundRepeatKeyword::Repeat)
|
||||||
}
|
}
|
||||||
SpecifiedBackgroundRepeat::Keywords(horizontal, vertical) => {
|
SpecifiedBackgroundRepeat::Keywords(horizontal, vertical) => {
|
||||||
BackgroundRepeat(horizontal, vertical.unwrap_or(horizontal))
|
BackgroundRepeat(horizontal, vertical.unwrap_or(horizontal))
|
||||||
|
@ -138,10 +142,10 @@ impl ToComputedValue for SpecifiedBackgroundRepeat {
|
||||||
// FIXME(emilio): Why can't this just be:
|
// FIXME(emilio): Why can't this just be:
|
||||||
// SpecifiedBackgroundRepeat::Keywords(computed.0, computed.1)
|
// SpecifiedBackgroundRepeat::Keywords(computed.0, computed.1)
|
||||||
match (computed.0, computed.1) {
|
match (computed.0, computed.1) {
|
||||||
(RepeatKeyword::Repeat, RepeatKeyword::NoRepeat) => {
|
(BackgroundRepeatKeyword::Repeat, BackgroundRepeatKeyword::NoRepeat) => {
|
||||||
SpecifiedBackgroundRepeat::RepeatX
|
SpecifiedBackgroundRepeat::RepeatX
|
||||||
}
|
}
|
||||||
(RepeatKeyword::NoRepeat, RepeatKeyword::Repeat) => {
|
(BackgroundRepeatKeyword::NoRepeat, BackgroundRepeatKeyword::Repeat) => {
|
||||||
SpecifiedBackgroundRepeat::RepeatY
|
SpecifiedBackgroundRepeat::RepeatY
|
||||||
}
|
}
|
||||||
(horizontal, vertical) => {
|
(horizontal, vertical) => {
|
||||||
|
|
|
@ -17,7 +17,7 @@ use values::generics::border::BorderRadius as GenericBorderRadius;
|
||||||
use values::generics::border::BorderSpacing as GenericBorderSpacing;
|
use values::generics::border::BorderSpacing as GenericBorderSpacing;
|
||||||
use values::generics::rect::Rect;
|
use values::generics::rect::Rect;
|
||||||
use values::generics::size::Size;
|
use values::generics::size::Size;
|
||||||
use values::specified::border::{BorderImageRepeat as SpecifiedBorderImageRepeat, RepeatKeyword};
|
use values::specified::border::{BorderImageRepeat as SpecifiedBorderImageRepeat, BorderImageRepeatKeyword};
|
||||||
|
|
||||||
/// A computed value for the `border-image-width` property.
|
/// A computed value for the `border-image-width` property.
|
||||||
pub type BorderImageWidth = Rect<BorderImageSideWidth>;
|
pub type BorderImageWidth = Rect<BorderImageSideWidth>;
|
||||||
|
@ -89,12 +89,12 @@ impl ToAnimatedZero for BorderCornerRadius {
|
||||||
///
|
///
|
||||||
/// https://drafts.csswg.org/css-backgrounds/#the-border-image-repeat
|
/// https://drafts.csswg.org/css-backgrounds/#the-border-image-repeat
|
||||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
|
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
|
||||||
pub struct BorderImageRepeat(pub RepeatKeyword, pub RepeatKeyword);
|
pub struct BorderImageRepeat(pub BorderImageRepeatKeyword, pub BorderImageRepeatKeyword);
|
||||||
|
|
||||||
impl BorderImageRepeat {
|
impl BorderImageRepeat {
|
||||||
/// Returns the `stretch` value.
|
/// Returns the `stretch` value.
|
||||||
pub fn stretch() -> Self {
|
pub fn stretch() -> Self {
|
||||||
BorderImageRepeat(RepeatKeyword::Stretch, RepeatKeyword::Stretch)
|
BorderImageRepeat(BorderImageRepeatKeyword::Stretch, BorderImageRepeatKeyword::Stretch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ impl BackgroundSize {
|
||||||
/// One of the keywords for `background-repeat`.
|
/// One of the keywords for `background-repeat`.
|
||||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
|
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
pub enum RepeatKeyword {
|
pub enum BackgroundRepeatKeyword {
|
||||||
Repeat,
|
Repeat,
|
||||||
Space,
|
Space,
|
||||||
Round,
|
Round,
|
||||||
|
@ -65,14 +65,14 @@ pub enum BackgroundRepeat {
|
||||||
/// `repeat-y`
|
/// `repeat-y`
|
||||||
RepeatY,
|
RepeatY,
|
||||||
/// `[repeat | space | round | no-repeat]{1,2}`
|
/// `[repeat | space | round | no-repeat]{1,2}`
|
||||||
Keywords(RepeatKeyword, Option<RepeatKeyword>),
|
Keywords(BackgroundRepeatKeyword, Option<BackgroundRepeatKeyword>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BackgroundRepeat {
|
impl BackgroundRepeat {
|
||||||
/// Returns the `repeat` value.
|
/// Returns the `repeat` value.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn repeat() -> Self {
|
pub fn repeat() -> Self {
|
||||||
BackgroundRepeat::Keywords(RepeatKeyword::Repeat, None)
|
BackgroundRepeat::Keywords(BackgroundRepeatKeyword::Repeat, None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ impl Parse for BackgroundRepeat {
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
|
|
||||||
let horizontal = match RepeatKeyword::from_ident(&ident) {
|
let horizontal = match BackgroundRepeatKeyword::from_ident(&ident) {
|
||||||
Ok(h) => h,
|
Ok(h) => h,
|
||||||
Err(()) => {
|
Err(()) => {
|
||||||
return Err(input.new_custom_error(
|
return Err(input.new_custom_error(
|
||||||
|
@ -98,7 +98,7 @@ impl Parse for BackgroundRepeat {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let vertical = input.try(RepeatKeyword::parse).ok();
|
let vertical = input.try(BackgroundRepeatKeyword::parse).ok();
|
||||||
Ok(BackgroundRepeat::Keywords(horizontal, vertical))
|
Ok(BackgroundRepeat::Keywords(horizontal, vertical))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,7 @@ impl Parse for BorderSpacing {
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss)]
|
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss)]
|
||||||
pub enum RepeatKeyword {
|
pub enum BorderImageRepeatKeyword {
|
||||||
Stretch,
|
Stretch,
|
||||||
Repeat,
|
Repeat,
|
||||||
Round,
|
Round,
|
||||||
|
@ -187,13 +187,13 @@ pub enum RepeatKeyword {
|
||||||
///
|
///
|
||||||
/// https://drafts.csswg.org/css-backgrounds/#the-border-image-repeat
|
/// https://drafts.csswg.org/css-backgrounds/#the-border-image-repeat
|
||||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
|
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||||
pub struct BorderImageRepeat(pub RepeatKeyword, pub Option<RepeatKeyword>);
|
pub struct BorderImageRepeat(pub BorderImageRepeatKeyword, pub Option<BorderImageRepeatKeyword>);
|
||||||
|
|
||||||
impl BorderImageRepeat {
|
impl BorderImageRepeat {
|
||||||
/// Returns the `stretch` value.
|
/// Returns the `stretch` value.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn stretch() -> Self {
|
pub fn stretch() -> Self {
|
||||||
BorderImageRepeat(RepeatKeyword::Stretch, None)
|
BorderImageRepeat(BorderImageRepeatKeyword::Stretch, None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,8 +202,8 @@ impl Parse for BorderImageRepeat {
|
||||||
_context: &ParserContext,
|
_context: &ParserContext,
|
||||||
input: &mut Parser<'i, 't>,
|
input: &mut Parser<'i, 't>,
|
||||||
) -> Result<Self, ParseError<'i>> {
|
) -> Result<Self, ParseError<'i>> {
|
||||||
let horizontal = RepeatKeyword::parse(input)?;
|
let horizontal = BorderImageRepeatKeyword::parse(input)?;
|
||||||
let vertical = input.try(RepeatKeyword::parse).ok();
|
let vertical = input.try(BorderImageRepeatKeyword::parse).ok();
|
||||||
Ok(BorderImageRepeat(horizontal, vertical))
|
Ok(BorderImageRepeat(horizontal, vertical))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue