Use BorderSideWidth for outline-width

This commit is contained in:
Anthony Ramine 2017-05-31 21:09:01 +02:00
parent 2c7fbb4b4c
commit 7da94d0880
13 changed files with 137 additions and 186 deletions

View file

@ -61,50 +61,13 @@ ${helpers.predefined_type("outline-color", "CSSColor", "computed::CSSColor::Curr
}
</%helpers:longhand>
<%helpers:longhand name="outline-width" animation_value_type="ComputedValue"
spec="https://drafts.csswg.org/css-ui/#propdef-outline-width">
use std::fmt;
use style_traits::ToCss;
impl ToCss for SpecifiedValue {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
self.0.to_css(dest)
}
}
pub fn parse(context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
specified::parse_border_width(context, input).map(SpecifiedValue)
}
#[derive(Clone, Debug, HasViewportPercentage, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedValue(pub specified::Length);
pub mod computed_value {
use app_units::Au;
pub type T = Au;
}
pub use super::border_top_width::get_initial_value;
#[inline]
pub fn get_initial_specified_value() -> SpecifiedValue {
SpecifiedValue(specified::Length::NoCalc(specified::NoCalcLength::medium()))
}
impl ToComputedValue for SpecifiedValue {
type ComputedValue = computed_value::T;
#[inline]
fn to_computed_value(&self, context: &Context) -> computed_value::T {
self.0.to_computed_value(context)
}
#[inline]
fn from_computed_value(computed: &computed_value::T) -> Self {
SpecifiedValue(ToComputedValue::from_computed_value(computed))
}
}
</%helpers:longhand>
${helpers.predefined_type("outline-width",
"BorderSideWidth",
"Au::from_px(3)",
initial_specified_value="specified::BorderSideWidth::Medium",
computed_type="::app_units::Au",
animation_value_type="ComputedValue",
spec="https://drafts.csswg.org/css-ui/#propdef-outline-width")}
// The -moz-outline-radius-* properties are non-standard and not on a standards track.
// TODO: Should they animate?