@@ -156,26 +156,6 @@ impl TransitionHandler {
156156 let mut delays = std:: mem:: take ( & mut self . delays ) ;
157157 let mut timing_functions = std:: mem:: take ( & mut self . timing_functions ) ;
158158
159- macro_rules! expand {
160- ( $prop: ident, $val: ident, $prefixes: ident) => {
161- if $prefixes. contains( VendorPrefix :: WebKit ) {
162- self . decls. push( Property :: $prop( $val. clone( ) , VendorPrefix :: WebKit ) ) ;
163- }
164-
165- if $prefixes. contains( VendorPrefix :: Moz ) {
166- self . decls. push( Property :: $prop( $val. clone( ) , VendorPrefix :: Moz ) ) ;
167- }
168-
169- if $prefixes. contains( VendorPrefix :: Ms ) {
170- self . decls. push( Property :: $prop( $val. clone( ) , VendorPrefix :: Ms ) ) ;
171- }
172-
173- if $prefixes. contains( VendorPrefix :: None ) {
174- self . decls. push( Property :: $prop( $val, VendorPrefix :: None ) ) ;
175- }
176- } ;
177- }
178-
179159 if let ( Some ( ( properties, property_prefixes) ) , Some ( ( durations, duration_prefixes) ) , Some ( ( delays, delay_prefixes) ) , Some ( ( timing_functions, timing_prefixes) ) ) = ( & mut properties, & mut durations, & mut delays, & mut timing_functions) {
180160 // Only use shorthand syntax if the number of transitions matches on all properties.
181161 let len = properties. len ( ) ;
@@ -189,41 +169,42 @@ impl TransitionHandler {
189169 }
190170 } ) . collect ( ) ;
191171
192- macro_rules! handle_prefix {
193- ( $prefix: ident) => {
194- // If all properties have this vendor prefix, use the shorthand syntax.
195- // Otherwise, we'll fall through below to individual properties.
196- if property_prefixes. contains( VendorPrefix :: $prefix) && duration_prefixes. contains( VendorPrefix :: $prefix) && delay_prefixes. contains( VendorPrefix :: $prefix) && timing_prefixes. contains( VendorPrefix :: $prefix) {
197- self . decls. push( Property :: Transition ( transitions. clone( ) , VendorPrefix :: $prefix) ) ;
198- property_prefixes. remove( VendorPrefix :: $prefix) ;
199- duration_prefixes. remove( VendorPrefix :: $prefix) ;
200- delay_prefixes. remove( VendorPrefix :: $prefix) ;
201- timing_prefixes. remove( VendorPrefix :: $prefix) ;
202- }
203- } ;
172+ // Find the intersection of prefixes with the same value.
173+ // Remove that from the prefixes of each of the properties. The remaining
174+ // prefixes will be handled by outputing individual properties below.
175+ let intersection = * property_prefixes & * duration_prefixes & * delay_prefixes & * timing_prefixes;
176+ if !intersection. is_empty ( ) {
177+ self . decls . push ( Property :: Transition ( transitions. clone ( ) , intersection) ) ;
178+ property_prefixes. remove ( intersection) ;
179+ duration_prefixes. remove ( intersection) ;
180+ delay_prefixes. remove ( intersection) ;
181+ timing_prefixes. remove ( intersection) ;
204182 }
205-
206- handle_prefix ! ( WebKit ) ;
207- handle_prefix ! ( Moz ) ;
208- handle_prefix ! ( Ms ) ;
209- handle_prefix ! ( None ) ;
210183 }
211184 }
212185
213186 if let Some ( ( properties, prefix) ) = properties {
214- expand ! ( TransitionProperty , properties, prefix) ;
187+ if !prefix. is_empty ( ) {
188+ self . decls . push ( Property :: TransitionProperty ( properties, prefix) ) ;
189+ }
215190 }
216191
217192 if let Some ( ( durations, prefix) ) = durations {
218- expand ! ( TransitionDuration , durations, prefix) ;
193+ if !prefix. is_empty ( ) {
194+ self . decls . push ( Property :: TransitionDuration ( durations, prefix) ) ;
195+ }
219196 }
220197
221198 if let Some ( ( delays, prefix) ) = delays {
222- expand ! ( TransitionDelay , delays, prefix) ;
199+ if !prefix. is_empty ( ) {
200+ self . decls . push ( Property :: TransitionDelay ( delays, prefix) ) ;
201+ }
223202 }
224203
225204 if let Some ( ( timing_functions, prefix) ) = timing_functions {
226- expand ! ( TransitionTimingFunction , timing_functions, prefix) ;
205+ if !prefix. is_empty ( ) {
206+ self . decls . push ( Property :: TransitionTimingFunction ( timing_functions, prefix) ) ;
207+ }
227208 }
228209
229210 self . reset ( ) ;
0 commit comments