Auto merge of #16672 - nox:moz-force-broken-image-icon, r=emilio

Implement -moz-force-broken-image-icon in geckolib

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16672)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-05-01 08:14:34 -05:00 committed by GitHub
commit b7f06d2c20
2 changed files with 56 additions and 0 deletions

View file

@ -4041,6 +4041,15 @@ clip-path
% endfor % endfor
</%self:impl_trait> </%self:impl_trait>
<%self:impl_trait style_struct_name="UI" skip_longhands="-moz-force-broken-image-icon">
#[allow(non_snake_case)]
pub fn set__moz_force_broken_image_icon(&mut self, v: longhands::_moz_force_broken_image_icon::computed_value::T) {
self.gecko.mForceBrokenImageIcon = v.0 as u8;
}
${impl_simple_copy("_moz_force_broken_image_icon", "mForceBrokenImageIcon")}
</%self:impl_trait>
<%self:impl_trait style_struct_name="XUL" <%self:impl_trait style_struct_name="XUL"
skip_longhands="-moz-stack-sizing -moz-box-ordinal-group"> skip_longhands="-moz-stack-sizing -moz-box-ordinal-group">

View file

@ -30,3 +30,50 @@ ${helpers.single_keyword("-moz-window-dragging", "default drag no-drag", product
gecko_enum_prefix="StyleWindowDragging", gecko_enum_prefix="StyleWindowDragging",
animation_value_type="none", animation_value_type="none",
spec="None (Nonstandard Firefox-only property)")} spec="None (Nonstandard Firefox-only property)")}
<%helpers:longhand name="-moz-force-broken-image-icon"
products="gecko"
animation_value_type="none"
spec="None (Nonstandard Firefox-only property)">
use cssparser::Token;
use std::fmt;
use style_traits::ToCss;
use values::HasViewportPercentage;
use values::computed::ComputedValueAsSpecified;
no_viewport_percentage!(SpecifiedValue);
pub mod computed_value {
#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T(pub bool);
}
pub use self::computed_value::T as SpecifiedValue;
impl ToCss for computed_value::T {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
dest.write_str(if self.0 { "1" } else { "0" })
}
}
#[inline]
pub fn get_initial_value() -> computed_value::T {
computed_value::T(false)
}
#[inline]
pub fn get_initial_specified_value() -> SpecifiedValue {
computed_value::T(false)
}
impl ComputedValueAsSpecified for SpecifiedValue {}
pub fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
match try!(input.expect_integer()) {
0 => Ok(computed_value::T(false)),
1 => Ok(computed_value::T(true)),
_ => Err(()),
}
}
</%helpers:longhand>