mirror of
https://github.com/servo/servo.git
synced 2025-08-10 16:05:43 +01:00
Implement a URL-generic type for list-style-image
This should fix the following two "expected to fail" tests: - getComputedStyle(elem) for url() listStyleImage uses the resolved URL and elem.style uses the original URL - getComputedStyle(elem) for url() listStyle uses the resolved URL and elem.style uses the original URL
This commit is contained in:
parent
8f226f841b
commit
cc838f54e5
26 changed files with 157 additions and 124 deletions
|
@ -9,7 +9,8 @@
|
|||
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::computed::{LengthOrPercentage, ComputedUrl, Image};
|
||||
use values::computed::{LengthOrPercentage, Image};
|
||||
use values::computed::url::ComputedUrl;
|
||||
use values::generics::basic_shape::{BasicShape as GenericBasicShape};
|
||||
use values::generics::basic_shape::{Circle as GenericCircle, ClippingShape as GenericClippingShape};
|
||||
use values::generics::basic_shape::{Ellipse as GenericEllipse, FloatAreaShape as GenericFloatAreaShape};
|
||||
|
|
|
@ -12,11 +12,12 @@ use std::f32::consts::PI;
|
|||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::{Either, None_};
|
||||
use values::computed::{Angle, ComputedImageUrl, Context};
|
||||
use values::computed::{Angle, Context};
|
||||
use values::computed::{Length, LengthOrPercentage, NumberOrPercentage, ToComputedValue};
|
||||
#[cfg(feature = "gecko")]
|
||||
use values::computed::Percentage;
|
||||
use values::computed::position::Position;
|
||||
use values::computed::url::ComputedImageUrl;
|
||||
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::{Image as GenericImage, GradientKind as GenericGradientKind};
|
||||
|
|
|
@ -21,7 +21,8 @@ use values::specified::length::{AbsoluteLength, FontBaseSize, FontRelativeLength
|
|||
use values::specified::length::ViewportPercentageLength;
|
||||
|
||||
pub use super::image::Image;
|
||||
pub use values::specified::{Angle, BorderStyle, Time, UrlOrNone};
|
||||
pub use values::specified::url::UrlOrNone;
|
||||
pub use values::specified::{Angle, BorderStyle, Time};
|
||||
|
||||
impl ToComputedValue for specified::NoCalcLength {
|
||||
type ComputedValue = CSSPixelLength;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! `list` computed values.
|
||||
|
||||
pub use values::specified::list::{ListStyleImage, Quotes};
|
||||
pub use values::specified::list::Quotes;
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use values::specified::list::ListStyleType;
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ pub use self::length::{CalcLengthOrPercentage, Length, LengthOrNumber, LengthOrP
|
|||
pub use self::length::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone, MaxLength, MozLength};
|
||||
pub use self::length::{CSSPixelLength, ExtremumLength, NonNegativeLength};
|
||||
pub use self::length::{NonNegativeLengthOrPercentage, NonNegativeLengthOrPercentageOrAuto};
|
||||
pub use self::list::{ListStyleImage, Quotes};
|
||||
pub use self::list::Quotes;
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use self::list::ListStyleType;
|
||||
pub use self::outline::OutlineStyle;
|
||||
|
@ -81,7 +81,6 @@ pub use self::time::Time;
|
|||
pub use self::transform::{Rotate, Scale, TimingFunction, Transform, TransformOperation};
|
||||
pub use self::transform::{TransformOrigin, TransformStyle, Translate};
|
||||
pub use self::ui::MozForceBrokenImageIcon;
|
||||
pub use self::url::{ComputedUrl, ComputedImageUrl};
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
pub mod align;
|
||||
|
@ -114,14 +113,7 @@ pub mod text;
|
|||
pub mod time;
|
||||
pub mod transform;
|
||||
pub mod ui;
|
||||
|
||||
/// Common handling for the computed value CSS url() values.
|
||||
pub mod url {
|
||||
#[cfg(feature = "servo")]
|
||||
pub use ::servo::url::{ComputedUrl, ComputedImageUrl};
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use ::gecko::url::{ComputedUrl, ComputedImageUrl};
|
||||
}
|
||||
pub mod url;
|
||||
|
||||
/// A `Context` is all the data a specified value could ever need to compute
|
||||
/// itself and be transformed to a computed value.
|
||||
|
@ -639,9 +631,3 @@ impl ClipRectOrAuto {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <url> | <none>
|
||||
pub type UrlOrNone = Either<ComputedUrl, None_>;
|
||||
|
||||
/// <url> | <none> for image
|
||||
pub type ImageUrlOrNone = Either<ComputedImageUrl, None_>;
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
|
||||
use app_units::Au;
|
||||
use values::RGBA;
|
||||
use values::computed::{ComputedUrl, LengthOrPercentage, NonNegativeLength};
|
||||
use values::computed::{LengthOrPercentage, NonNegativeLength};
|
||||
use values::computed::{NonNegativeNumber, NonNegativeLengthOrPercentage, Number};
|
||||
use values::computed::Opacity;
|
||||
use values::computed::url::ComputedUrl;
|
||||
use values::generics::svg as generic;
|
||||
|
||||
pub use values::specified::SVGPaintOrder;
|
||||
|
|
18
components/style/values/computed/url.rs
Normal file
18
components/style/values/computed/url.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//! Common handling for the computed value CSS url() values.
|
||||
|
||||
use values::generics::url::UrlOrNone as GenericUrlOrNone;
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
pub use ::servo::url::{ComputedUrl, ComputedImageUrl};
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use ::gecko::url::{ComputedUrl, ComputedImageUrl};
|
||||
|
||||
/// Computed <url> | <none>
|
||||
pub type UrlOrNone = GenericUrlOrNone<ComputedUrl>;
|
||||
|
||||
/// Computed image <url> | <none>
|
||||
pub type ImageUrlOrNone = GenericUrlOrNone<ComputedImageUrl>;
|
Loading…
Add table
Add a link
Reference in a new issue