mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Add support for 'image-rendering' in geckolib
This commit is contained in:
parent
5fd398ec06
commit
710157c617
2 changed files with 33 additions and 7 deletions
|
@ -219,7 +219,7 @@ def set_gecko_property(ffi_name, expr):
|
||||||
// FIXME(bholley): Align binary representations and ditch |match| for cast + static_asserts
|
// FIXME(bholley): Align binary representations and ditch |match| for cast + static_asserts
|
||||||
let result = match v {
|
let result = match v {
|
||||||
% for value in keyword.values_for('gecko'):
|
% for value in keyword.values_for('gecko'):
|
||||||
Keyword::${to_rust_ident(value)} => structs::${keyword.gecko_constant(value)} ${keyword.maybe_cast("u8")},
|
Keyword::${to_rust_ident(value)} => structs::${keyword.gecko_constant(value)} ${keyword.maybe_cast("u8")},
|
||||||
% endfor
|
% endfor
|
||||||
};
|
};
|
||||||
${set_gecko_property(gecko_ffi_name, "result")}
|
${set_gecko_property(gecko_ffi_name, "result")}
|
||||||
|
@ -1445,6 +1445,17 @@ fn static_assert() {
|
||||||
</%self:impl_trait>
|
</%self:impl_trait>
|
||||||
|
|
||||||
|
|
||||||
|
<%self:impl_trait style_struct_name="InheritedBox"
|
||||||
|
skip_longhands="image-rendering">
|
||||||
|
|
||||||
|
<% render_keyword = Keyword("image-rendering",
|
||||||
|
"auto optimizequality optimizespeed crispedges") %>
|
||||||
|
|
||||||
|
${impl_keyword('image_rendering', 'mImageRendering', render_keyword, need_clone=False)}
|
||||||
|
|
||||||
|
</%self:impl_trait>
|
||||||
|
|
||||||
|
|
||||||
<%self:impl_trait style_struct_name="InheritedText"
|
<%self:impl_trait style_struct_name="InheritedText"
|
||||||
skip_longhands="text-align text-shadow line-height letter-spacing word-spacing">
|
skip_longhands="text-align text-shadow line-height letter-spacing word-spacing">
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ ${helpers.single_keyword("color-adjust",
|
||||||
"economy exact", products="gecko",
|
"economy exact", products="gecko",
|
||||||
animatable=False)}
|
animatable=False)}
|
||||||
|
|
||||||
<%helpers:longhand name="image-rendering" products="servo" animatable="False">
|
<%helpers:longhand name="image-rendering" animatable="False">
|
||||||
pub mod computed_value {
|
pub mod computed_value {
|
||||||
use cssparser::ToCss;
|
use cssparser::ToCss;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
@ -51,7 +51,12 @@ ${helpers.single_keyword("color-adjust",
|
||||||
pub enum T {
|
pub enum T {
|
||||||
auto,
|
auto,
|
||||||
crispedges,
|
crispedges,
|
||||||
pixelated,
|
% if product == "gecko":
|
||||||
|
optimizequality,
|
||||||
|
optimizespeed,
|
||||||
|
% else:
|
||||||
|
pixelated, // firefox doesn't support it (https://bugzilla.mozilla.org/show_bug.cgi?id=856337)
|
||||||
|
% endif
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToCss for T {
|
impl ToCss for T {
|
||||||
|
@ -59,7 +64,12 @@ ${helpers.single_keyword("color-adjust",
|
||||||
match *self {
|
match *self {
|
||||||
T::auto => dest.write_str("auto"),
|
T::auto => dest.write_str("auto"),
|
||||||
T::crispedges => dest.write_str("crisp-edges"),
|
T::crispedges => dest.write_str("crisp-edges"),
|
||||||
T::pixelated => dest.write_str("pixelated"),
|
% if product == "gecko":
|
||||||
|
T::optimizequality => dest.write_str("optimizeQuality"),
|
||||||
|
T::optimizespeed => dest.write_str("optimizeSpeed"),
|
||||||
|
% else:
|
||||||
|
T::pixelated => dest.write_str("pixelated"),
|
||||||
|
% endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,10 +91,15 @@ ${helpers.single_keyword("color-adjust",
|
||||||
match_ignore_ascii_case! {
|
match_ignore_ascii_case! {
|
||||||
try!(input.expect_ident()),
|
try!(input.expect_ident()),
|
||||||
"auto" => Ok(computed_value::T::auto),
|
"auto" => Ok(computed_value::T::auto),
|
||||||
"optimizespeed" => Ok(computed_value::T::auto),
|
|
||||||
"optimizequality" => Ok(computed_value::T::auto),
|
|
||||||
"crisp-edges" => Ok(computed_value::T::crispedges),
|
"crisp-edges" => Ok(computed_value::T::crispedges),
|
||||||
"pixelated" => Ok(computed_value::T::pixelated),
|
% if product == "gecko":
|
||||||
|
"optimizequality" => Ok(computed_value::T::optimizequality),
|
||||||
|
"optimizespeed" => Ok(computed_value::T::optimizespeed),
|
||||||
|
% else:
|
||||||
|
"optimizequality" => Ok(computed_value::T::auto),
|
||||||
|
"optimizespeed" => Ok(computed_value::T::auto),
|
||||||
|
"pixelated" => Ok(computed_value::T::pixelated),
|
||||||
|
% endif
|
||||||
_ => Err(())
|
_ => Err(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue