mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
style: Remove -moz-border-*-colors.
Bug: 1429723 Reviewed-by: xidorn MozReview-Commit-ID: 3P6f7rFcDa6
This commit is contained in:
parent
ec8975b18d
commit
c4ae2148f0
3 changed files with 1 additions and 199 deletions
|
@ -67,129 +67,6 @@ ${helpers.gecko_keyword_conversion(Keyword('border-style',
|
|||
animation_value_type="BorderCornerRadius")}
|
||||
% endfor
|
||||
|
||||
/// -moz-border-*-colors: color, string, enum, none, inherit/initial
|
||||
/// These non-spec properties are just for Gecko (Stylo) internal use.
|
||||
% for side in PHYSICAL_SIDES:
|
||||
<%helpers:longhand name="-moz-border-${side}-colors" animation_value_type="discrete"
|
||||
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-border-*-colors)"
|
||||
products="gecko"
|
||||
flags="APPLIES_TO_FIRST_LETTER"
|
||||
enabled_in="chrome"
|
||||
ignored_when_colors_disabled="True">
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::specified::RGBAColor;
|
||||
|
||||
pub mod computed_value {
|
||||
use cssparser::RGBA;
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
|
||||
pub struct T(pub Option<Vec<RGBA>>);
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
|
||||
pub enum SpecifiedValue {
|
||||
None,
|
||||
Colors(Vec<RGBAColor>),
|
||||
}
|
||||
|
||||
impl ToCss for computed_value::T {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match self.0 {
|
||||
None => return dest.write_str("none"),
|
||||
Some(ref vec) => {
|
||||
let mut first = true;
|
||||
for ref color in vec {
|
||||
if !first {
|
||||
dest.write_str(" ")?;
|
||||
}
|
||||
first = false;
|
||||
color.to_css(dest)?
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToCss for SpecifiedValue {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
SpecifiedValue::None => return dest.write_str("none"),
|
||||
SpecifiedValue::Colors(ref vec) => {
|
||||
let mut first = true;
|
||||
for ref color in vec {
|
||||
if !first {
|
||||
dest.write_str(" ")?;
|
||||
}
|
||||
first = false;
|
||||
color.to_css(dest)?
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[inline] pub fn get_initial_value() -> computed_value::T {
|
||||
computed_value::T(None)
|
||||
}
|
||||
|
||||
#[inline] pub fn get_initial_specified_value() -> SpecifiedValue {
|
||||
SpecifiedValue::None
|
||||
}
|
||||
|
||||
impl ToComputedValue for SpecifiedValue {
|
||||
type ComputedValue = computed_value::T;
|
||||
|
||||
#[inline]
|
||||
fn to_computed_value(&self, context: &Context) -> computed_value::T {
|
||||
match *self {
|
||||
SpecifiedValue::Colors(ref vec) => {
|
||||
computed_value::T(Some(vec.iter()
|
||||
.map(|c| c.to_computed_value(context))
|
||||
.collect()))
|
||||
},
|
||||
SpecifiedValue::None => {
|
||||
computed_value::T(None)
|
||||
}
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
fn from_computed_value(computed: &computed_value::T) -> Self {
|
||||
match *computed {
|
||||
computed_value::T(Some(ref vec)) => {
|
||||
SpecifiedValue::Colors(vec.iter()
|
||||
.map(ToComputedValue::from_computed_value)
|
||||
.collect())
|
||||
},
|
||||
computed_value::T(None) => {
|
||||
SpecifiedValue::None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
|
||||
-> Result<SpecifiedValue, ParseError<'i>> {
|
||||
if input.try(|input| input.expect_ident_matching("none")).is_ok() {
|
||||
return Ok(SpecifiedValue::None)
|
||||
}
|
||||
|
||||
let mut result = Vec::new();
|
||||
while let Ok(value) = input.try(|i| RGBAColor::parse(context, i)) {
|
||||
result.push(value);
|
||||
}
|
||||
|
||||
if !result.is_empty() {
|
||||
Ok(SpecifiedValue::Colors(result))
|
||||
} else {
|
||||
Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError))
|
||||
}
|
||||
}
|
||||
</%helpers:longhand>
|
||||
% endfor
|
||||
|
||||
${helpers.single_keyword("box-decoration-break", "slice clone",
|
||||
gecko_enum_prefix="StyleBoxDecorationBreak",
|
||||
gecko_pref="layout.css.box-decoration-break.enabled",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue