style: Remove -moz-border-*-colors.

Bug: 1429723
Reviewed-by: xidorn
MozReview-Commit-ID: 3P6f7rFcDa6
This commit is contained in:
Emilio Cobos Álvarez 2018-01-15 03:36:00 +01:00
parent ec8975b18d
commit c4ae2148f0
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 1 additions and 199 deletions

View file

@ -1616,57 +1616,9 @@ fn static_assert() {
["border-{0}-radius".format(x.ident.replace("_", "-"))
for x in CORNERS]) %>
<% skip_moz_border_color_longhands = " ".join("-moz-border-{0}-colors".format(x.ident)
for x in SIDES) %>
<%self:impl_trait style_struct_name="Border"
skip_longhands="${skip_border_longhands} border-image-source border-image-outset
border-image-repeat border-image-width border-image-slice
${skip_moz_border_color_longhands}">
fn set_moz_border_colors(&mut self, side: structs::Side, v: Option<Vec<::cssparser::RGBA>>) {
match v {
None => {
let ptr = self.gecko.mBorderColors.mPtr;
if let Some(colors) = unsafe { ptr.as_mut() } {
unsafe { colors.mColors[side as usize].clear() };
}
}
Some(ref colors) => {
unsafe { bindings::Gecko_EnsureMozBorderColors(&mut self.gecko) };
let border_colors = unsafe { self.gecko.mBorderColors.mPtr.as_mut().unwrap() };
let dest_colors = &mut border_colors.mColors[side as usize];
unsafe { dest_colors.set_len_pod(colors.len() as u32) };
for (dst, src) in dest_colors.iter_mut().zip(colors.into_iter()) {
*dst = convert_rgba_to_nscolor(src);
}
}
}
}
fn copy_moz_border_colors_from(&mut self, other: &Self, side: structs::Side) {
if let Some(dest) = unsafe { self.gecko.mBorderColors.mPtr.as_mut() } {
dest.mColors[side as usize].clear_pod();
}
if let Some(src) = unsafe { other.gecko.mBorderColors.mPtr.as_ref() } {
let src = &src.mColors[side as usize];
if !src.is_empty() {
unsafe { bindings::Gecko_EnsureMozBorderColors(&mut self.gecko) };
let dest = unsafe { self.gecko.mBorderColors.mPtr.as_mut().unwrap() };
let dest = &mut dest.mColors[side as usize];
unsafe { dest.set_len_pod(src.len() as u32) };
dest.copy_from_slice(&src);
}
}
}
fn clone_moz_border_colors(&self, side: structs::Side) -> Option<Vec<::cssparser::RGBA>> {
unsafe { self.gecko.mBorderColors.mPtr.as_ref() }.map(|colors| {
colors.mColors[side as usize].iter()
.map(|color| convert_nscolor_to_rgba(*color))
.collect()
})
}
border-image-repeat border-image-width border-image-slice">
% for side in SIDES:
<% impl_keyword("border_%s_style" % side.ident,
"mBorderStyle[%s]" % side.index,
@ -1713,29 +1665,6 @@ fn static_assert() {
pub fn border_${side.ident}_has_nonzero_width(&self) -> bool {
self.gecko.mComputedBorder.${side.ident} != 0
}
#[allow(non_snake_case)]
pub fn set__moz_border_${side.ident}_colors(&mut self,
v: longhands::_moz_border_${side.ident}_colors::computed_value::T) {
self.set_moz_border_colors(structs::Side::eSide${to_camel_case(side.ident)}, v.0);
}
#[allow(non_snake_case)]
pub fn copy__moz_border_${side.ident}_colors_from(&mut self, other: &Self) {
self.copy_moz_border_colors_from(other, structs::Side::eSide${to_camel_case(side.ident)});
}
#[allow(non_snake_case)]
pub fn reset__moz_border_${side.ident}_colors(&mut self, other: &Self) {
self.copy__moz_border_${side.ident}_colors_from(other)
}
#[allow(non_snake_case)]
pub fn clone__moz_border_${side.ident}_colors(&self)
-> longhands::_moz_border_${side.ident}_colors::computed_value::T {
use self::longhands::_moz_border_${side.ident}_colors::computed_value::T;
T(self.clone_moz_border_colors(structs::Side::eSide${to_camel_case(side.ident)}))
}
% endfor
% for corner in CORNERS:

View file

@ -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",

View file

@ -793,10 +793,6 @@ impl LonghandId {
LonghandId::BorderImageSource |
LonghandId::BoxShadow |
LonghandId::MaskImage |
LonghandId::MozBorderBottomColors |
LonghandId::MozBorderLeftColors |
LonghandId::MozBorderRightColors |
LonghandId::MozBorderTopColors |
LonghandId::TextShadow
)
% else: