Rename ImageRect to MozImageRect

This commit is contained in:
Anthony Ramine 2017-07-12 10:11:28 +02:00
parent 50c46ae0e1
commit 907d629ca4
6 changed files with 18 additions and 18 deletions

View file

@ -370,7 +370,7 @@ impl nsStyleImage {
pub unsafe fn into_image(self: &nsStyleImage) -> Option<Image> { pub unsafe fn into_image(self: &nsStyleImage) -> Option<Image> {
use gecko_bindings::bindings::Gecko_GetImageElement; use gecko_bindings::bindings::Gecko_GetImageElement;
use gecko_bindings::structs::nsStyleImageType; use gecko_bindings::structs::nsStyleImageType;
use values::computed::{NumberOrPercentage, ImageRect}; use values::computed::{NumberOrPercentage, MozImageRect};
match self.mType { match self.mType {
nsStyleImageType::eStyleImageType_Null => { nsStyleImageType::eStyleImageType_Null => {
@ -387,7 +387,7 @@ impl nsStyleImage {
NumberOrPercentage::from_gecko_style_coord(&rect.data_at(2)), NumberOrPercentage::from_gecko_style_coord(&rect.data_at(2)),
NumberOrPercentage::from_gecko_style_coord(&rect.data_at(3))) { NumberOrPercentage::from_gecko_style_coord(&rect.data_at(3))) {
(Some(top), Some(right), Some(bottom), Some(left)) => (Some(top), Some(right), Some(bottom), Some(left)) =>
Some(GenericImage::Rect(ImageRect { url, top, right, bottom, left } )), Some(GenericImage::Rect(MozImageRect { url, top, right, bottom, left } )),
_ => { _ => {
debug_assert!(false, "mCropRect could not convert to NumberOrPercentage"); debug_assert!(false, "mCropRect could not convert to NumberOrPercentage");
None None

View file

@ -17,7 +17,7 @@ use values::computed::position::Position;
use values::generics::image::{CompatMode, ColorStop as GenericColorStop, EndingShape as GenericEndingShape}; use values::generics::image::{CompatMode, ColorStop as GenericColorStop, EndingShape as GenericEndingShape};
use values::generics::image::{Gradient as GenericGradient, GradientItem as GenericGradientItem}; use values::generics::image::{Gradient as GenericGradient, GradientItem as GenericGradientItem};
use values::generics::image::{Image as GenericImage, GradientKind as GenericGradientKind}; use values::generics::image::{Image as GenericImage, GradientKind as GenericGradientKind};
use values::generics::image::{ImageRect as GenericImageRect, LineDirection as GenericLineDirection}; use values::generics::image::{LineDirection as GenericLineDirection, MozImageRect as GenericMozImageRect};
use values::specified::image::{Gradient as SpecifiedGradient, LineDirection as SpecifiedLineDirection}; use values::specified::image::{Gradient as SpecifiedGradient, LineDirection as SpecifiedLineDirection};
use values::specified::image::{GradientKind as SpecifiedGradientKind}; use values::specified::image::{GradientKind as SpecifiedGradientKind};
use values::specified::position::{X, Y}; use values::specified::position::{X, Y};
@ -27,7 +27,7 @@ pub type ImageLayer = Either<None_, Image>;
/// Computed values for an image according to CSS-IMAGES. /// Computed values for an image according to CSS-IMAGES.
/// https://drafts.csswg.org/css-images/#image-values /// https://drafts.csswg.org/css-images/#image-values
pub type Image = GenericImage<Gradient, ImageRect>; pub type Image = GenericImage<Gradient, MozImageRect>;
/// Computed values for a CSS gradient. /// Computed values for a CSS gradient.
/// https://drafts.csswg.org/css-images/#gradients /// https://drafts.csswg.org/css-images/#gradients
@ -71,8 +71,8 @@ pub type GradientItem = GenericGradientItem<RGBA, LengthOrPercentage>;
/// A computed color stop. /// A computed color stop.
pub type ColorStop = GenericColorStop<RGBA, LengthOrPercentage>; pub type ColorStop = GenericColorStop<RGBA, LengthOrPercentage>;
/// Computed values for ImageRect. /// Computed values for `-moz-image-rect(...)`.
pub type ImageRect = GenericImageRect<NumberOrPercentage>; pub type MozImageRect = GenericMozImageRect<NumberOrPercentage>;
impl GenericLineDirection for LineDirection { impl GenericLineDirection for LineDirection {
fn points_downwards(&self) -> bool { fn points_downwards(&self) -> bool {

View file

@ -30,7 +30,7 @@ pub use self::border::{BorderRadius, BorderCornerRadius};
pub use self::color::{Color, RGBAColor}; pub use self::color::{Color, RGBAColor};
pub use self::effects::{BoxShadow, Filter, SimpleShadow}; pub use self::effects::{BoxShadow, Filter, SimpleShadow};
pub use self::flex::FlexBasis; pub use self::flex::FlexBasis;
pub use self::image::{Gradient, GradientItem, ImageLayer, LineDirection, Image, ImageRect}; pub use self::image::{Gradient, GradientItem, Image, ImageLayer, LineDirection, MozImageRect};
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
pub use self::gecko::ScrollSnapPoint; pub use self::gecko::ScrollSnapPoint;
pub use self::rect::LengthOrNumberRect; pub use self::rect::LengthOrNumberRect;

View file

@ -18,13 +18,13 @@ use values::specified::url::SpecifiedUrl;
/// [image]: https://drafts.csswg.org/css-images/#image-values /// [image]: https://drafts.csswg.org/css-images/#image-values
#[derive(Clone, PartialEq, ToComputedValue)] #[derive(Clone, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum Image<Gradient, ImageRect> { pub enum Image<Gradient, MozImageRect> {
/// A `<url()>` image. /// A `<url()>` image.
Url(SpecifiedUrl), Url(SpecifiedUrl),
/// A `<gradient>` image. /// A `<gradient>` image.
Gradient(Gradient), Gradient(Gradient),
/// A `-moz-image-rect` image /// A `-moz-image-rect` image
Rect(ImageRect), Rect(MozImageRect),
/// A `-moz-element(# <element-id>)` /// A `-moz-element(# <element-id>)`
Element(Atom), Element(Atom),
/// A paint worklet image. /// A paint worklet image.
@ -157,7 +157,7 @@ impl ToCss for PaintWorklet {
#[derive(Clone, Debug, PartialEq, ToComputedValue)] #[derive(Clone, Debug, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[allow(missing_docs)] #[allow(missing_docs)]
pub struct ImageRect<NumberOrPercentage> { pub struct MozImageRect<NumberOrPercentage> {
pub url: SpecifiedUrl, pub url: SpecifiedUrl,
pub top: NumberOrPercentage, pub top: NumberOrPercentage,
pub bottom: NumberOrPercentage, pub bottom: NumberOrPercentage,
@ -330,7 +330,7 @@ impl<C, L> fmt::Debug for ColorStop<C, L>
} }
} }
impl<C> ToCss for ImageRect<C> impl<C> ToCss for MozImageRect<C>
where C: ToCss, where C: ToCss,
{ {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {

View file

@ -24,8 +24,8 @@ use values::computed::{Context, Position as ComputedPosition, ToComputedValue};
use values::generics::image::{Circle, CompatMode, Ellipse, ColorStop as GenericColorStop}; use values::generics::image::{Circle, CompatMode, Ellipse, ColorStop as GenericColorStop};
use values::generics::image::{EndingShape as GenericEndingShape, Gradient as GenericGradient}; use values::generics::image::{EndingShape as GenericEndingShape, Gradient as GenericGradient};
use values::generics::image::{GradientItem as GenericGradientItem, GradientKind as GenericGradientKind}; use values::generics::image::{GradientItem as GenericGradientItem, GradientKind as GenericGradientKind};
use values::generics::image::{Image as GenericImage, ImageRect as GenericImageRect}; use values::generics::image::{Image as GenericImage, LineDirection as GenericsLineDirection};
use values::generics::image::{LineDirection as GenericsLineDirection, ShapeExtent}; use values::generics::image::{MozImageRect as GenericMozImageRect, ShapeExtent};
use values::generics::image::PaintWorklet; use values::generics::image::PaintWorklet;
use values::generics::position::Position as GenericPosition; use values::generics::position::Position as GenericPosition;
use values::specified::{Angle, Color, Length, LengthOrPercentage}; use values::specified::{Angle, Color, Length, LengthOrPercentage};
@ -38,7 +38,7 @@ pub type ImageLayer = Either<None_, Image>;
/// Specified values for an image according to CSS-IMAGES. /// Specified values for an image according to CSS-IMAGES.
/// https://drafts.csswg.org/css-images/#image-values /// https://drafts.csswg.org/css-images/#image-values
pub type Image = GenericImage<Gradient, ImageRect>; pub type Image = GenericImage<Gradient, MozImageRect>;
/// Specified values for a CSS gradient. /// Specified values for a CSS gradient.
/// https://drafts.csswg.org/css-images/#gradients /// https://drafts.csswg.org/css-images/#gradients
@ -146,7 +146,7 @@ impl Parse for Image {
return Ok(GenericImage::PaintWorklet(paint_worklet)); return Ok(GenericImage::PaintWorklet(paint_worklet));
} }
} }
if let Ok(mut image_rect) = input.try(|input| ImageRect::parse(context, input)) { if let Ok(mut image_rect) = input.try(|input| MozImageRect::parse(context, input)) {
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
{ {
image_rect.url.build_image_value(); image_rect.url.build_image_value();
@ -885,7 +885,7 @@ impl Parse for PaintWorklet {
} }
} }
impl Parse for ImageRect { impl Parse for MozImageRect {
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> { fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
input.try(|i| i.expect_function_matching("-moz-image-rect"))?; input.try(|i| i.expect_function_matching("-moz-image-rect"))?;
input.parse_nested_block(|i| { input.parse_nested_block(|i| {
@ -900,7 +900,7 @@ impl Parse for ImageRect {
i.expect_comma()?; i.expect_comma()?;
let left = NumberOrPercentage::parse_non_negative(context, i)?; let left = NumberOrPercentage::parse_non_negative(context, i)?;
Ok(ImageRect { Ok(MozImageRect {
url: url, url: url,
top: top, top: top,
right: right, right: right,

View file

@ -37,7 +37,7 @@ pub use self::flex::FlexBasis;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
pub use self::gecko::ScrollSnapPoint; pub use self::gecko::ScrollSnapPoint;
pub use self::image::{ColorStop, EndingShape as GradientEndingShape, Gradient}; pub use self::image::{ColorStop, EndingShape as GradientEndingShape, Gradient};
pub use self::image::{GradientItem, GradientKind, Image, ImageRect, ImageLayer}; pub use self::image::{GradientItem, GradientKind, Image, ImageLayer, MozImageRect};
pub use self::length::{AbsoluteLength, CalcLengthOrPercentage, CharacterWidth}; pub use self::length::{AbsoluteLength, CalcLengthOrPercentage, CharacterWidth};
pub use self::length::{FontRelativeLength, Length, LengthOrNone, LengthOrNumber}; pub use self::length::{FontRelativeLength, Length, LengthOrNone, LengthOrNumber};
pub use self::length::{LengthOrPercentage, LengthOrPercentageOrAuto}; pub use self::length::{LengthOrPercentage, LengthOrPercentageOrAuto};