diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-05-01 08:14:34 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-01 08:14:34 -0500 |
commit | b7f06d2c20d34bd0ee96d31f070623d6e46b8dda (patch) | |
tree | 24409e41d775ca3fbd977369b310b24fdfb29817 | |
parent | 9b72d909f989329201d4593972445689f55d59f1 (diff) | |
parent | 2c9a2f61f42a2927346ec83a8bd700ff07054a8f (diff) | |
download | servo-b7f06d2c20d34bd0ee96d31f070623d6e46b8dda.tar.gz servo-b7f06d2c20d34bd0ee96d31f070623d6e46b8dda.zip |
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 -->
-rw-r--r-- | components/style/properties/gecko.mako.rs | 9 | ||||
-rw-r--r-- | components/style/properties/longhand/ui.mako.rs | 47 |
2 files changed, 56 insertions, 0 deletions
diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index f3d4d229cec..aa362da1724 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -4041,6 +4041,15 @@ clip-path % endfor </%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" skip_longhands="-moz-stack-sizing -moz-box-ordinal-group"> diff --git a/components/style/properties/longhand/ui.mako.rs b/components/style/properties/longhand/ui.mako.rs index dff6e846050..05808307635 100644 --- a/components/style/properties/longhand/ui.mako.rs +++ b/components/style/properties/longhand/ui.mako.rs @@ -30,3 +30,50 @@ ${helpers.single_keyword("-moz-window-dragging", "default drag no-drag", product gecko_enum_prefix="StyleWindowDragging", animation_value_type="none", 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> |