mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
style: Move -moz-force-broken-image-icon out of mako
This commit is contained in:
parent
b2b51d333e
commit
b2df766da8
5 changed files with 71 additions and 54 deletions
|
@ -63,57 +63,9 @@ ${helpers.predefined_type("-moz-window-transform-origin",
|
||||||
enabled_in="ua",
|
enabled_in="ua",
|
||||||
spec="None (Nonstandard internal property)")}
|
spec="None (Nonstandard internal property)")}
|
||||||
|
|
||||||
<%helpers:longhand name="-moz-force-broken-image-icon"
|
${helpers.predefined_type("-moz-force-broken-image-icon",
|
||||||
products="gecko"
|
"MozForceBrokenImageIcon",
|
||||||
animation_value_type="discrete"
|
"computed::MozForceBrokenImageIcon::false_value()",
|
||||||
spec="None (Nonstandard Firefox-only property)">
|
animation_value_type="discrete",
|
||||||
use std::fmt;
|
products="gecko",
|
||||||
use style_traits::ToCss;
|
spec="None (Nonstandard Firefox-only property)")}
|
||||||
|
|
||||||
pub mod computed_value {
|
|
||||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>)
|
|
||||||
-> Result<SpecifiedValue, ParseError<'i>> {
|
|
||||||
match input.expect_integer()? {
|
|
||||||
0 => Ok(computed_value::T(false)),
|
|
||||||
1 => Ok(computed_value::T(true)),
|
|
||||||
_ => Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<u8> for SpecifiedValue {
|
|
||||||
fn from(bits: u8) -> SpecifiedValue {
|
|
||||||
SpecifiedValue(bits == 1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<SpecifiedValue> for u8 {
|
|
||||||
fn from(v: SpecifiedValue) -> u8 {
|
|
||||||
match v.0 {
|
|
||||||
true => 1u8,
|
|
||||||
false => 0u8,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</%helpers:longhand>
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ pub use self::table::XSpan;
|
||||||
pub use self::text::{InitialLetter, LetterSpacing, LineHeight, TextOverflow, WordSpacing};
|
pub use self::text::{InitialLetter, LetterSpacing, LineHeight, TextOverflow, WordSpacing};
|
||||||
pub use self::time::Time;
|
pub use self::time::Time;
|
||||||
pub use self::transform::{TimingFunction, Transform, TransformOperation, TransformOrigin};
|
pub use self::transform::{TimingFunction, Transform, TransformOperation, TransformOrigin};
|
||||||
|
pub use self::ui::MozForceBrokenImageIcon;
|
||||||
|
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
pub mod align;
|
pub mod align;
|
||||||
|
@ -84,6 +85,7 @@ pub mod table;
|
||||||
pub mod text;
|
pub mod text;
|
||||||
pub mod time;
|
pub mod time;
|
||||||
pub mod transform;
|
pub mod transform;
|
||||||
|
pub mod ui;
|
||||||
|
|
||||||
/// A `Context` is all the data a specified value could ever need to compute
|
/// A `Context` is all the data a specified value could ever need to compute
|
||||||
/// itself and be transformed to a computed value.
|
/// itself and be transformed to a computed value.
|
||||||
|
|
7
components/style/values/computed/ui.rs
Normal file
7
components/style/values/computed/ui.rs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
//! Computed values for UI properties
|
||||||
|
|
||||||
|
pub use values::specified::ui::MozForceBrokenImageIcon;
|
|
@ -55,6 +55,7 @@ pub use self::table::XSpan;
|
||||||
pub use self::text::{InitialLetter, LetterSpacing, LineHeight, TextDecorationLine, TextOverflow, WordSpacing};
|
pub use self::text::{InitialLetter, LetterSpacing, LineHeight, TextDecorationLine, TextOverflow, WordSpacing};
|
||||||
pub use self::time::Time;
|
pub use self::time::Time;
|
||||||
pub use self::transform::{TimingFunction, Transform, TransformOrigin};
|
pub use self::transform::{TimingFunction, Transform, TransformOrigin};
|
||||||
|
pub use self::ui::MozForceBrokenImageIcon;
|
||||||
pub use super::generics::grid::GridTemplateComponent as GenericGridTemplateComponent;
|
pub use super::generics::grid::GridTemplateComponent as GenericGridTemplateComponent;
|
||||||
|
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
|
@ -84,6 +85,7 @@ pub mod table;
|
||||||
pub mod text;
|
pub mod text;
|
||||||
pub mod time;
|
pub mod time;
|
||||||
pub mod transform;
|
pub mod transform;
|
||||||
|
pub mod ui;
|
||||||
|
|
||||||
/// Common handling for the specified value CSS url() values.
|
/// Common handling for the specified value CSS url() values.
|
||||||
pub mod url {
|
pub mod url {
|
||||||
|
|
54
components/style/values/specified/ui.rs
Normal file
54
components/style/values/specified/ui.rs
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
//! Specified types for UI properties.
|
||||||
|
|
||||||
|
use cssparser::Parser;
|
||||||
|
use parser::{Parse, ParserContext};
|
||||||
|
use std::fmt;
|
||||||
|
use style_traits::{ParseError, StyleParseErrorKind, ToCss};
|
||||||
|
|
||||||
|
/// Specified value of `-moz-force-broken-image-icon`
|
||||||
|
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
|
||||||
|
pub struct MozForceBrokenImageIcon(pub bool);
|
||||||
|
|
||||||
|
impl MozForceBrokenImageIcon {
|
||||||
|
/// Return initial value of -moz-force-broken-image-icon which is false.
|
||||||
|
#[inline]
|
||||||
|
pub fn false_value() -> MozForceBrokenImageIcon {
|
||||||
|
MozForceBrokenImageIcon(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Parse for MozForceBrokenImageIcon {
|
||||||
|
fn parse<'i, 't>(
|
||||||
|
_context: &ParserContext,
|
||||||
|
input: &mut Parser<'i, 't>
|
||||||
|
) -> Result<MozForceBrokenImageIcon, ParseError<'i>> {
|
||||||
|
// We intentionally don't support calc values here.
|
||||||
|
match input.expect_integer()? {
|
||||||
|
0 => Ok(MozForceBrokenImageIcon(false)),
|
||||||
|
1 => Ok(MozForceBrokenImageIcon(true)),
|
||||||
|
_ => Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ToCss for MozForceBrokenImageIcon {
|
||||||
|
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||||
|
dest.write_str(if self.0 { "1" } else { "0" })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<u8> for MozForceBrokenImageIcon {
|
||||||
|
fn from(bits: u8) -> MozForceBrokenImageIcon {
|
||||||
|
MozForceBrokenImageIcon(bits == 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<MozForceBrokenImageIcon> for u8 {
|
||||||
|
fn from(v: MozForceBrokenImageIcon) -> u8 {
|
||||||
|
if v.0 { 1 } else { 0 }
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue