mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Use BorderSideWidth for outline-width
This commit is contained in:
parent
2c7fbb4b4c
commit
7da94d0880
13 changed files with 137 additions and 186 deletions
|
@ -32,7 +32,9 @@
|
|||
spec=maybe_logical_spec(side, "style"),
|
||||
animation_value_type="none", logical=side[1])}
|
||||
|
||||
${helpers.predefined_type("border-%s-width" % side[0], "BorderWidth", "Au::from_px(3)",
|
||||
${helpers.predefined_type("border-%s-width" % side[0],
|
||||
"BorderSideWidth",
|
||||
"Au::from_px(3)",
|
||||
computed_type="::app_units::Au",
|
||||
alias=maybe_moz_logical_alias(product, side, "-moz-border-%s-width"),
|
||||
spec=maybe_logical_spec(side, "width"),
|
||||
|
|
|
@ -40,11 +40,15 @@ ${helpers.single_keyword("column-fill", "balance auto", extra_prefixes="moz",
|
|||
products="gecko", animation_value_type="discrete",
|
||||
spec="https://drafts.csswg.org/css-multicol/#propdef-column-fill")}
|
||||
|
||||
${helpers.predefined_type("column-rule-width", "BorderWidth", "Au::from_px(3)",
|
||||
initial_specified_value="specified::BorderWidth::Medium",
|
||||
products="gecko", computed_type="::app_units::Au",
|
||||
${helpers.predefined_type("column-rule-width",
|
||||
"BorderSideWidth",
|
||||
"Au::from_px(3)",
|
||||
initial_specified_value="specified::BorderSideWidth::Medium",
|
||||
computed_type="::app_units::Au",
|
||||
products="gecko",
|
||||
spec="https://drafts.csswg.org/css-multicol/#propdef-column-rule-width",
|
||||
animation_value_type="ComputedValue", extra_prefixes="moz")}
|
||||
animation_value_type="ComputedValue",
|
||||
extra_prefixes="moz")}
|
||||
|
||||
// https://drafts.csswg.org/css-multicol-1/#crc
|
||||
${helpers.predefined_type("column-rule-color", "CSSColor",
|
||||
|
|
|
@ -872,13 +872,15 @@ ${helpers.predefined_type(
|
|||
ignored_when_colors_disabled=True,
|
||||
spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke-color")}
|
||||
|
||||
${helpers.predefined_type("-webkit-text-stroke-width", "BorderWidth", "Au::from_px(0)",
|
||||
initial_specified_value="specified::BorderWidth::from_length(specified::Length::zero())",
|
||||
computed_type="::app_units::Au", products="gecko",
|
||||
${helpers.predefined_type("-webkit-text-stroke-width",
|
||||
"BorderSideWidth",
|
||||
"Au::from_px(0)",
|
||||
initial_specified_value="specified::BorderSideWidth::Length(specified::Length::zero())",
|
||||
computed_type="::app_units::Au",
|
||||
products="gecko",
|
||||
spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke-width",
|
||||
animation_value_type="none")}
|
||||
|
||||
|
||||
// CSS Ruby Layout Module Level 1
|
||||
// https://drafts.csswg.org/css-ruby/
|
||||
${helpers.single_keyword("ruby-align", "space-around start center space-between",
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -18,11 +18,11 @@ ${helpers.four_sides_shorthand("border-style", "border-%s-style",
|
|||
for side in PHYSICAL_SIDES)}"
|
||||
spec="https://drafts.csswg.org/css-backgrounds/#border-width">
|
||||
use values::generics::rect::Rect;
|
||||
use values::specified::{AllowQuirks, BorderWidth};
|
||||
use values::specified::{AllowQuirks, BorderSideWidth};
|
||||
|
||||
pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> {
|
||||
let rect = Rect::parse_with(context, input, |_, i| {
|
||||
BorderWidth::parse_quirky(context, i, AllowQuirks::Yes)
|
||||
BorderSideWidth::parse_quirky(context, i, AllowQuirks::Yes)
|
||||
})?;
|
||||
Ok(expanded! {
|
||||
border_top_width: rect.0,
|
||||
|
@ -46,8 +46,8 @@ ${helpers.four_sides_shorthand("border-style", "border-%s-style",
|
|||
pub fn parse_border(context: &ParserContext, input: &mut Parser)
|
||||
-> Result<(specified::CSSColor,
|
||||
specified::BorderStyle,
|
||||
specified::BorderWidth), ()> {
|
||||
use values::specified::{CSSColor, BorderStyle, BorderWidth};
|
||||
specified::BorderSideWidth), ()> {
|
||||
use values::specified::{CSSColor, BorderStyle, BorderSideWidth};
|
||||
let _unused = context;
|
||||
let mut color = None;
|
||||
let mut style = None;
|
||||
|
@ -69,7 +69,7 @@ pub fn parse_border(context: &ParserContext, input: &mut Parser)
|
|||
}
|
||||
}
|
||||
if width.is_none() {
|
||||
if let Ok(value) = input.try(|i| BorderWidth::parse(context, i)) {
|
||||
if let Ok(value) = input.try(|i| BorderSideWidth::parse(context, i)) {
|
||||
width = Some(value);
|
||||
any = true;
|
||||
continue
|
||||
|
@ -80,7 +80,7 @@ pub fn parse_border(context: &ParserContext, input: &mut Parser)
|
|||
if any {
|
||||
Ok((color.unwrap_or_else(|| CSSColor::currentcolor()),
|
||||
style.unwrap_or(BorderStyle::none),
|
||||
width.unwrap_or(BorderWidth::Medium)))
|
||||
width.unwrap_or(BorderSideWidth::Medium)))
|
||||
} else {
|
||||
Err(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue