Introduce CSSPixelLength and update NonNegativeLength.

First, we define computed::CSSPixelLength which contains a CSSFloat, a
pixel value, and then we replace computed::Length with CSSPixelLength.
Therefore, the |ComputedValue| of NoCalcLength, AbsoluteLength,
FontRelativeLength, ViewportPercentageLength, CharacterWidth, and
PhysicalLength is CSSPixelLength.

Besides, we drop NonNegativeAu, and replace computed::NonNegativeLength
with NonNegative<computed::Length>. (i.e. NonNegative<CSSPixelLength>)
This commit is contained in:
Boris Chiou 2017-09-13 14:26:51 +08:00
parent cad3aff508
commit a949e2a057
40 changed files with 502 additions and 406 deletions

View file

@ -6,7 +6,7 @@
use app_units::Au;
use values::RGBA;
use values::computed::{ComputedUrl, LengthOrPercentage, NonNegativeAu};
use values::computed::{ComputedUrl, LengthOrPercentage, NonNegativeLength};
use values::computed::{NonNegativeNumber, NonNegativeLengthOrPercentage, Number};
use values::computed::Opacity;
use values::generics::svg as generic;
@ -72,8 +72,8 @@ impl Into<NonNegativeSvgLengthOrPercentageOrNumber> for SvgLengthOrPercentageOrN
/// An non-negative wrapper of SVGLength.
pub type SVGWidth = generic::SVGLength<NonNegativeSvgLengthOrPercentageOrNumber>;
impl From<NonNegativeAu> for SVGWidth {
fn from(length: NonNegativeAu) -> Self {
impl From<NonNegativeLength> for SVGWidth {
fn from(length: NonNegativeLength) -> Self {
generic::SVGLength::Length(
generic::SvgLengthOrPercentageOrNumber::LengthOrPercentage(length.into()))
}