mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Use CSSPixelLength in LengthOrPercentage{*}.
Replace Au with CSSPixelLength in LengthOrPercentage, LengthOrPercentageOrAuto, and LengthOrPercentageOrNone.
This commit is contained in:
parent
535c1e3c6f
commit
b89286e8e7
25 changed files with 109 additions and 118 deletions
|
@ -633,7 +633,7 @@ def set_gecko_property(ffi_name, expr):
|
|||
SvgLengthOrPercentageOrNumber::Number(number),
|
||||
CoordDataValue::Coord(coord) =>
|
||||
SvgLengthOrPercentageOrNumber::LengthOrPercentage(
|
||||
LengthOrPercentage::Length(Au(coord))),
|
||||
LengthOrPercentage::Length(Au(coord).into())),
|
||||
CoordDataValue::Percent(p) =>
|
||||
SvgLengthOrPercentageOrNumber::LengthOrPercentage(
|
||||
LengthOrPercentage::Percentage(Percentage(p))),
|
||||
|
@ -5210,7 +5210,7 @@ clip-path
|
|||
vec.push(SvgLengthOrPercentageOrNumber::Number(number.into())),
|
||||
CoordDataValue::Coord(coord) =>
|
||||
vec.push(SvgLengthOrPercentageOrNumber::LengthOrPercentage(
|
||||
LengthOrPercentage::Length(Au(coord)).into())),
|
||||
LengthOrPercentage::Length(Au(coord).into()).into())),
|
||||
CoordDataValue::Percent(p) =>
|
||||
vec.push(SvgLengthOrPercentageOrNumber::LengthOrPercentage(
|
||||
LengthOrPercentage::Percentage(Percentage(p)).into())),
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
<% from data import to_idl_name, SYSTEM_FONT_LONGHANDS %>
|
||||
|
||||
use app_units::Au;
|
||||
use cssparser::Parser;
|
||||
#[cfg(feature = "gecko")] use gecko_bindings::bindings::RawServoAnimationValueMap;
|
||||
#[cfg(feature = "gecko")] use gecko_bindings::structs::RawGeckoGfxMatrix4x4;
|
||||
|
@ -47,7 +46,7 @@ use values::animated::effects::FilterList as AnimatedFilterList;
|
|||
use values::animated::effects::TextShadowList as AnimatedTextShadowList;
|
||||
use values::computed::{Angle, BorderCornerRadius, CalcLengthOrPercentage};
|
||||
use values::computed::{ClipRect, Context, ComputedUrl};
|
||||
use values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto};
|
||||
use values::computed::{Length, LengthOrPercentage, LengthOrPercentageOrAuto};
|
||||
use values::computed::{LengthOrPercentageOrNone, MaxLength, NonNegativeLength};
|
||||
use values::computed::{NonNegativeNumber, Number, NumberOrPercentage, Percentage};
|
||||
use values::computed::{PositiveIntegerOrAuto, ToComputedValue};
|
||||
|
@ -813,7 +812,7 @@ impl ToAnimatedZero for LengthOrPercentageOrAuto {
|
|||
LengthOrPercentageOrAuto::Length(_) |
|
||||
LengthOrPercentageOrAuto::Percentage(_) |
|
||||
LengthOrPercentageOrAuto::Calc(_) => {
|
||||
Ok(LengthOrPercentageOrAuto::Length(Au(0)))
|
||||
Ok(LengthOrPercentageOrAuto::Length(Length::new(0.)))
|
||||
},
|
||||
LengthOrPercentageOrAuto::Auto => Err(()),
|
||||
}
|
||||
|
@ -827,7 +826,7 @@ impl ToAnimatedZero for LengthOrPercentageOrNone {
|
|||
LengthOrPercentageOrNone::Length(_) |
|
||||
LengthOrPercentageOrNone::Percentage(_) |
|
||||
LengthOrPercentageOrNone::Calc(_) => {
|
||||
Ok(LengthOrPercentageOrNone::Length(Au(0)))
|
||||
Ok(LengthOrPercentageOrNone::Length(Length::new(0.)))
|
||||
},
|
||||
LengthOrPercentageOrNone::None => Err(()),
|
||||
}
|
||||
|
@ -2314,9 +2313,9 @@ impl ComputeSquaredDistance for TransformOperation {
|
|||
// convert Au into px.
|
||||
let extract_pixel_length = |lop: &LengthOrPercentage| {
|
||||
match *lop {
|
||||
LengthOrPercentage::Length(au) => au.to_f64_px(),
|
||||
LengthOrPercentage::Length(px) => px.px(),
|
||||
LengthOrPercentage::Percentage(_) => 0.,
|
||||
LengthOrPercentage::Calc(calc) => calc.length().px() as f64,
|
||||
LengthOrPercentage::Calc(calc) => calc.length().px(),
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -2465,7 +2464,7 @@ impl From<NonNegativeNumber> for NumberOrPercentage {
|
|||
impl From<LengthOrPercentage> for NumberOrPercentage {
|
||||
fn from(lop: LengthOrPercentage) -> NumberOrPercentage {
|
||||
match lop {
|
||||
LengthOrPercentage::Length(len) => NumberOrPercentage::Number(len.to_f32_px()),
|
||||
LengthOrPercentage::Length(len) => NumberOrPercentage::Number(len.px()),
|
||||
LengthOrPercentage::Percentage(p) => NumberOrPercentage::Percentage(p),
|
||||
LengthOrPercentage::Calc(_) => {
|
||||
panic!("We dont't expected calc interpolation for SvgLengthOrPercentageOrNumber");
|
||||
|
|
|
@ -1480,11 +1480,10 @@ ${helpers.predefined_type(
|
|||
}
|
||||
|
||||
// Converts computed LengthOrPercentageOrNumber into computed
|
||||
// LengthOrPercentage. Number maps into Length
|
||||
// LengthOrPercentage. Number maps into Length (pixel unit)
|
||||
fn lopon_to_lop(value: &ComputedLoPoNumber) -> ComputedLoP {
|
||||
use app_units::Au;
|
||||
match *value {
|
||||
Either::First(number) => ComputedLoP::Length(Au::from_f32_px(number)),
|
||||
Either::First(number) => ComputedLoP::Length(ComputedLength::new(number)),
|
||||
Either::Second(length_or_percentage) => length_or_percentage,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ ${helpers.single_keyword("-moz-text-size-adjust", "auto none",
|
|||
|
||||
${helpers.predefined_type("text-indent",
|
||||
"LengthOrPercentage",
|
||||
"computed::LengthOrPercentage::Length(Au(0))",
|
||||
"computed::LengthOrPercentage::Length(computed::Length::new(0.))",
|
||||
animation_value_type="ComputedValue",
|
||||
spec="https://drafts.csswg.org/css-text/#propdef-text-indent",
|
||||
allow_quirks=True)}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
spec = "https://drafts.csswg.org/css-logical-props/#propdef-margin-%s" % side[1]
|
||||
%>
|
||||
${helpers.predefined_type("margin-%s" % side[0], "LengthOrPercentageOrAuto",
|
||||
"computed::LengthOrPercentageOrAuto::Length(Au(0))",
|
||||
"computed::LengthOrPercentageOrAuto::Length(computed::Length::new(0.))",
|
||||
alias=maybe_moz_logical_alias(product, side, "-moz-margin-%s"),
|
||||
allow_quirks=not side[1],
|
||||
animation_value_type="ComputedValue", logical = side[1], spec = spec,
|
||||
|
|
|
@ -209,7 +209,7 @@ ${helpers.predefined_type("order", "Integer", "0",
|
|||
animation_value_type="ComputedValue", logical = logical)}
|
||||
${helpers.predefined_type("min-%s" % size,
|
||||
"LengthOrPercentage",
|
||||
"computed::LengthOrPercentage::Length(Au(0))",
|
||||
"computed::LengthOrPercentage::Length(computed::Length::new(0.))",
|
||||
"parse_non_negative",
|
||||
spec=spec % ("min-%s" % size),
|
||||
animation_value_type="ComputedValue",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue