Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support interpolation between currentcolor and numeric color #17219

Merged
merged 10 commits into from Jun 8, 2017

Remove complex_color parameter.

  • Loading branch information
upsuper committed Jun 8, 2017
commit 742c45f8599272fd77cd342ca81621daa76366b6
@@ -148,7 +148,7 @@ class Longhand(object):
def __init__(self, style_struct, name, spec=None, animation_value_type=None, derived_from=None, keyword=None,
predefined_type=None, custom_cascade=False, experimental=False, internal=False,
need_clone=False, need_index=False, gecko_ffi_name=None, depend_on_viewport_size=False,
allowed_in_keyframe_block=True, complex_color=False, cast_type='u8',
allowed_in_keyframe_block=True, cast_type='u8',
has_uncacheable_values=False, logical=False, alias=None, extra_prefixes=None, boxed=False,
flags=None, allowed_in_page_rule=False, allow_quirks=False, ignored_when_colors_disabled=False,
vector=False):
@@ -169,7 +169,6 @@ def __init__(self, style_struct, name, spec=None, animation_value_type=None, der
self.gecko_ffi_name = gecko_ffi_name or "m" + self.camel_case
self.depend_on_viewport_size = depend_on_viewport_size
self.derived_from = (derived_from or "").split()
self.complex_color = complex_color
self.cast_type = cast_type
self.logical = arg_to_bool(logical)
self.alias = alias.split() if alias else []
@@ -315,23 +315,23 @@ def set_gecko_property(ffi_name, expr):
}
</%def>

<%def name="impl_color_setter(ident, gecko_ffi_name, complex_color=True)">
<%def name="impl_color_setter(ident, gecko_ffi_name)">
#[allow(unreachable_code)]
#[allow(non_snake_case)]
pub fn set_${ident}(&mut self, v: longhands::${ident}::computed_value::T) {
${set_gecko_property(gecko_ffi_name, "v.into()")}
}
</%def>

<%def name="impl_color_copy(ident, gecko_ffi_name, complex_color=True)">
<%def name="impl_color_copy(ident, gecko_ffi_name)">
#[allow(non_snake_case)]
pub fn copy_${ident}_from(&mut self, other: &Self) {
let color = ${get_gecko_property(gecko_ffi_name, self_param = "other")};
${set_gecko_property(gecko_ffi_name, "color")};
}
</%def>

<%def name="impl_color_clone(ident, gecko_ffi_name, complex_color=True)">
<%def name="impl_color_clone(ident, gecko_ffi_name)">
#[allow(non_snake_case)]
pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T {
${get_gecko_property(gecko_ffi_name)}.into()
@@ -386,11 +386,11 @@ def set_gecko_property(ffi_name, expr):
% endif
</%def>

<%def name="impl_color(ident, gecko_ffi_name, need_clone=False, complex_color=True)">
<%call expr="impl_color_setter(ident, gecko_ffi_name, complex_color)"></%call>
<%call expr="impl_color_copy(ident, gecko_ffi_name, complex_color)"></%call>
<%def name="impl_color(ident, gecko_ffi_name, need_clone=False)">
<%call expr="impl_color_setter(ident, gecko_ffi_name)"></%call>
<%call expr="impl_color_copy(ident, gecko_ffi_name)"></%call>
% if need_clone:
<%call expr="impl_color_clone(ident, gecko_ffi_name, complex_color)"></%call>
<%call expr="impl_color_clone(ident, gecko_ffi_name)"></%call>
% endif
</%def>

@@ -408,7 +408,7 @@ def set_gecko_property(ffi_name, expr):
% endif
</%def>

<%def name="impl_svg_paint(ident, gecko_ffi_name, need_clone=False, complex_color=True)">
<%def name="impl_svg_paint(ident, gecko_ffi_name, need_clone=False)">
#[allow(non_snake_case)]
pub fn set_${ident}(&mut self, mut v: longhands::${ident}::computed_value::T) {
use values::generics::SVGPaintKind;
@@ -11,7 +11,6 @@ ${helpers.predefined_type("background-color", "Color",
initial_specified_value="SpecifiedValue::transparent()",
spec="https://drafts.csswg.org/css-backgrounds/#background-color",
animation_value_type="IntermediateColor",
complex_color=True,
ignored_when_colors_disabled=True,
allow_quirks=True)}

@@ -55,8 +55,7 @@ ${helpers.predefined_type("column-rule-color", "Color",
"::cssparser::Color::CurrentColor",
initial_specified_value="specified::Color::currentcolor()",
products="gecko", animation_value_type="IntermediateColor", extra_prefixes="moz",
complex_color=True, need_clone=True,
ignored_when_colors_disabled=True,
need_clone=True, ignored_when_colors_disabled=True,
spec="https://drafts.csswg.org/css-multicol/#propdef-column-rule-color")}

${helpers.single_keyword("column-span", "none all",
@@ -689,8 +689,7 @@ ${helpers.predefined_type("text-emphasis-color", "Color",
"::cssparser::Color::CurrentColor",
initial_specified_value="specified::Color::currentcolor()",
products="gecko", animation_value_type="IntermediateColor",
complex_color=True, need_clone=True,
ignored_when_colors_disabled=True,
need_clone=True, ignored_when_colors_disabled=True,
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-emphasis-color")}


@@ -708,17 +707,15 @@ ${helpers.predefined_type(
"-webkit-text-fill-color", "Color",
"CSSParserColor::CurrentColor",
products="gecko", animation_value_type="IntermediateColor",
complex_color=True, need_clone=True,
ignored_when_colors_disabled=True,
need_clone=True, ignored_when_colors_disabled=True,
spec="https://compat.spec.whatwg.org/#the-webkit-text-fill-color")}

${helpers.predefined_type(
"-webkit-text-stroke-color", "Color",
"CSSParserColor::CurrentColor",
initial_specified_value="specified::Color::currentcolor()",
products="gecko", animation_value_type="IntermediateColor",
complex_color=True, need_clone=True,
ignored_when_colors_disabled=True,
need_clone=True, ignored_when_colors_disabled=True,
spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke-color")}

${helpers.predefined_type("-webkit-text-stroke-width",
@@ -12,7 +12,7 @@
// TODO(pcwalton): `invert`
${helpers.predefined_type("outline-color", "Color", "computed::Color::CurrentColor",
initial_specified_value="specified::Color::currentcolor()",
animation_value_type="IntermediateColor", complex_color=True, need_clone=True,
animation_value_type="IntermediateColor", need_clone=True,
ignored_when_colors_disabled=True,
spec="https://drafts.csswg.org/css-ui/#propdef-outline-color")}

@@ -281,7 +281,6 @@ ${helpers.predefined_type(
"text-decoration-color", "Color",
"computed::Color::CurrentColor",
initial_specified_value="specified::Color::currentcolor()",
complex_color=True,
products="gecko",
animation_value_type="IntermediateColor",
ignored_when_colors_disabled=True,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.