From 25a46c40b317498429abf829529edab1b7017898 Mon Sep 17 00:00:00 2001 From: Daisuke Akatsuka Date: Thu, 3 Aug 2017 22:33:28 +0900 Subject: [PATCH] make paint-order animatable --- components/style/properties/gecko.mako.rs | 24 +++++++++++++++++++ .../properties/longhand/inherited_svg.mako.rs | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 7db095ef64d..3bf4cb2c488 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -5082,6 +5082,30 @@ clip-path ${impl_simple_copy('paint_order', 'mPaintOrder')} + pub fn clone_paint_order(&self) -> longhands::paint_order::computed_value::T { + use self::longhands::paint_order::{COUNT, FILL, MARKERS, NORMAL, SHIFT, STROKE}; + use self::longhands::paint_order::computed_value::T; + + if self.gecko.mPaintOrder == structs::NS_STYLE_PAINT_ORDER_NORMAL as u8 { + return T(NORMAL); + } + + const PAINT_ORDER_BITWIDTH: u8 = structs::NS_STYLE_PAINT_ORDER_BITWIDTH as u8; + let mask = (1 << PAINT_ORDER_BITWIDTH) - 1; + let mut order = 0; + for pos in 0..COUNT { + let value = + match (self.gecko.mPaintOrder >> pos * PAINT_ORDER_BITWIDTH & mask) as u32 { + structs::NS_STYLE_PAINT_ORDER_FILL => FILL, + structs::NS_STYLE_PAINT_ORDER_STROKE => STROKE, + structs::NS_STYLE_PAINT_ORDER_MARKERS => MARKERS, + _ => unreachable!(), + }; + order |= value << (pos * SHIFT); + }; + T(order) + } + pub fn set_stroke_dasharray(&mut self, v: longhands::stroke_dasharray::computed_value::T) { use gecko_bindings::structs::nsStyleSVG_STROKE_DASHARRAY_CONTEXT as CONTEXT_VALUE; use values::generics::svg::SVGStrokeDashArray; diff --git a/components/style/properties/longhand/inherited_svg.mako.rs b/components/style/properties/longhand/inherited_svg.mako.rs index 053dd168629..a5bd2fdb35e 100644 --- a/components/style/properties/longhand/inherited_svg.mako.rs +++ b/components/style/properties/longhand/inherited_svg.mako.rs @@ -133,7 +133,7 @@ ${helpers.predefined_type("marker-end", "UrlOrNone", "Either::Second(None_)", spec="https://www.w3.org/TR/SVG2/painting.html#VertexMarkerProperties")} <%helpers:longhand name="paint-order" - animation_value_type="none" + animation_value_type="discrete" products="gecko" spec="https://www.w3.org/TR/SVG2/painting.html#PaintOrder">