Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: sky/engine/core/css/StylePropertySerializer.cpp

Issue 760183003: Enable/Unprefix Animations & Transitions, add basic tests (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: patch for landing Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/css/CSSProperty.h ('k') | sky/engine/core/css/StylePropertySet.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
5 * Copyright (C) 2013 Intel Corporation. All rights reserved. 5 * Copyright (C) 2013 Intel Corporation. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 for (unsigned n = 0; n < size; ++n) { 69 for (unsigned n = 0; n < size; ++n) {
70 StylePropertySet::PropertyReference property = m_propertySet.propertyAt( n); 70 StylePropertySet::PropertyReference property = m_propertySet.propertyAt( n);
71 CSSPropertyID propertyID = property.id(); 71 CSSPropertyID propertyID = property.id();
72 // Only enabled or internal properties should be part of the style. 72 // Only enabled or internal properties should be part of the style.
73 ASSERT(CSSPropertyMetadata::isEnabledProperty(propertyID) || isInternalP roperty(propertyID)); 73 ASSERT(CSSPropertyMetadata::isEnabledProperty(propertyID) || isInternalP roperty(propertyID));
74 CSSPropertyID shorthandPropertyID = CSSPropertyInvalid; 74 CSSPropertyID shorthandPropertyID = CSSPropertyInvalid;
75 CSSPropertyID borderFallbackShorthandProperty = CSSPropertyInvalid; 75 CSSPropertyID borderFallbackShorthandProperty = CSSPropertyInvalid;
76 String value; 76 String value;
77 77
78 switch (propertyID) { 78 switch (propertyID) {
79 case CSSPropertyAnimationName:
80 case CSSPropertyAnimationDuration:
81 case CSSPropertyAnimationTimingFunction:
82 case CSSPropertyAnimationDelay:
83 case CSSPropertyAnimationIterationCount:
84 case CSSPropertyAnimationDirection:
85 case CSSPropertyAnimationFillMode:
86 shorthandPropertyID = CSSPropertyAnimation;
87 break;
79 case CSSPropertyBackgroundAttachment: 88 case CSSPropertyBackgroundAttachment:
80 case CSSPropertyBackgroundClip: 89 case CSSPropertyBackgroundClip:
81 case CSSPropertyBackgroundColor: 90 case CSSPropertyBackgroundColor:
82 case CSSPropertyBackgroundImage: 91 case CSSPropertyBackgroundImage:
83 case CSSPropertyBackgroundOrigin: 92 case CSSPropertyBackgroundOrigin:
84 case CSSPropertyBackgroundPositionX: 93 case CSSPropertyBackgroundPositionX:
85 case CSSPropertyBackgroundPositionY: 94 case CSSPropertyBackgroundPositionY:
86 case CSSPropertyBackgroundSize: 95 case CSSPropertyBackgroundSize:
87 case CSSPropertyBackgroundRepeatX: 96 case CSSPropertyBackgroundRepeatX:
88 case CSSPropertyBackgroundRepeatY: 97 case CSSPropertyBackgroundRepeatY:
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 case CSSPropertyPaddingBottom: 166 case CSSPropertyPaddingBottom:
158 case CSSPropertyPaddingLeft: 167 case CSSPropertyPaddingLeft:
159 shorthandPropertyID = CSSPropertyPadding; 168 shorthandPropertyID = CSSPropertyPadding;
160 break; 169 break;
161 case CSSPropertyTransitionProperty: 170 case CSSPropertyTransitionProperty:
162 case CSSPropertyTransitionDuration: 171 case CSSPropertyTransitionDuration:
163 case CSSPropertyTransitionTimingFunction: 172 case CSSPropertyTransitionTimingFunction:
164 case CSSPropertyTransitionDelay: 173 case CSSPropertyTransitionDelay:
165 shorthandPropertyID = CSSPropertyTransition; 174 shorthandPropertyID = CSSPropertyTransition;
166 break; 175 break;
167 case CSSPropertyWebkitAnimationName:
168 case CSSPropertyWebkitAnimationDuration:
169 case CSSPropertyWebkitAnimationTimingFunction:
170 case CSSPropertyWebkitAnimationDelay:
171 case CSSPropertyWebkitAnimationIterationCount:
172 case CSSPropertyWebkitAnimationDirection:
173 case CSSPropertyWebkitAnimationFillMode:
174 shorthandPropertyID = CSSPropertyWebkitAnimation;
175 break;
176 case CSSPropertyFlexDirection: 176 case CSSPropertyFlexDirection:
177 case CSSPropertyFlexWrap: 177 case CSSPropertyFlexWrap:
178 shorthandPropertyID = CSSPropertyFlexFlow; 178 shorthandPropertyID = CSSPropertyFlexFlow;
179 break; 179 break;
180 case CSSPropertyFlexBasis: 180 case CSSPropertyFlexBasis:
181 case CSSPropertyFlexGrow: 181 case CSSPropertyFlexGrow:
182 case CSSPropertyFlexShrink: 182 case CSSPropertyFlexShrink:
183 shorthandPropertyID = CSSPropertyFlex; 183 shorthandPropertyID = CSSPropertyFlex;
184 break; 184 break;
185 case CSSPropertyWebkitMaskPositionX: 185 case CSSPropertyWebkitMaskPositionX:
186 case CSSPropertyWebkitMaskPositionY: 186 case CSSPropertyWebkitMaskPositionY:
187 case CSSPropertyWebkitMaskRepeatX: 187 case CSSPropertyWebkitMaskRepeatX:
188 case CSSPropertyWebkitMaskRepeatY: 188 case CSSPropertyWebkitMaskRepeatY:
189 case CSSPropertyWebkitMaskImage: 189 case CSSPropertyWebkitMaskImage:
190 case CSSPropertyWebkitMaskRepeat: 190 case CSSPropertyWebkitMaskRepeat:
191 case CSSPropertyWebkitMaskPosition: 191 case CSSPropertyWebkitMaskPosition:
192 case CSSPropertyWebkitMaskClip: 192 case CSSPropertyWebkitMaskClip:
193 case CSSPropertyWebkitMaskOrigin: 193 case CSSPropertyWebkitMaskOrigin:
194 shorthandPropertyID = CSSPropertyWebkitMask; 194 shorthandPropertyID = CSSPropertyWebkitMask;
195 break; 195 break;
196 case CSSPropertyWebkitTransformOriginX: 196 case CSSPropertyWebkitTransformOriginX:
197 case CSSPropertyWebkitTransformOriginY: 197 case CSSPropertyWebkitTransformOriginY:
198 case CSSPropertyWebkitTransformOriginZ: 198 case CSSPropertyWebkitTransformOriginZ:
199 shorthandPropertyID = CSSPropertyWebkitTransformOrigin; 199 shorthandPropertyID = CSSPropertyWebkitTransformOrigin;
200 break; 200 break;
201 case CSSPropertyWebkitTransitionProperty:
202 case CSSPropertyWebkitTransitionDuration:
203 case CSSPropertyWebkitTransitionTimingFunction:
204 case CSSPropertyWebkitTransitionDelay:
205 shorthandPropertyID = CSSPropertyWebkitTransition;
206 break;
207 default: 201 default:
208 break; 202 break;
209 } 203 }
210 204
211 unsigned shortPropertyIndex = shorthandPropertyID - firstCSSProperty; 205 unsigned shortPropertyIndex = shorthandPropertyID - firstCSSProperty;
212 if (shorthandPropertyID) { 206 if (shorthandPropertyID) {
213 if (shorthandPropertyUsed.get(shortPropertyIndex)) 207 if (shorthandPropertyUsed.get(shortPropertyIndex))
214 continue; 208 continue;
215 if (!shorthandPropertyAppeared.get(shortPropertyIndex) && value.isNu ll()) 209 if (!shorthandPropertyAppeared.get(shortPropertyIndex) && value.isNu ll())
216 value = m_propertySet.getPropertyValue(shorthandPropertyID); 210 value = m_propertySet.getPropertyValue(shorthandPropertyID);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 return getLayeredShorthandValue(webkitMaskRepeatShorthand()); 286 return getLayeredShorthandValue(webkitMaskRepeatShorthand());
293 case CSSPropertyWebkitMask: 287 case CSSPropertyWebkitMask:
294 return getLayeredShorthandValue(webkitMaskShorthand()); 288 return getLayeredShorthandValue(webkitMaskShorthand());
295 case CSSPropertyWebkitTextEmphasis: 289 case CSSPropertyWebkitTextEmphasis:
296 return getShorthandValue(webkitTextEmphasisShorthand()); 290 return getShorthandValue(webkitTextEmphasisShorthand());
297 case CSSPropertyWebkitTextStroke: 291 case CSSPropertyWebkitTextStroke:
298 return getShorthandValue(webkitTextStrokeShorthand()); 292 return getShorthandValue(webkitTextStrokeShorthand());
299 case CSSPropertyTransformOrigin: 293 case CSSPropertyTransformOrigin:
300 case CSSPropertyWebkitTransformOrigin: 294 case CSSPropertyWebkitTransformOrigin:
301 return getShorthandValue(webkitTransformOriginShorthand()); 295 return getShorthandValue(webkitTransformOriginShorthand());
302 case CSSPropertyWebkitTransition:
303 return getLayeredShorthandValue(webkitTransitionShorthand());
304 case CSSPropertyWebkitAnimation:
305 return getLayeredShorthandValue(webkitAnimationShorthand());
306 case CSSPropertyBorderRadius: 296 case CSSPropertyBorderRadius:
307 return get4Values(borderRadiusShorthand()); 297 return get4Values(borderRadiusShorthand());
308 default: 298 default:
309 return String(); 299 return String();
310 } 300 }
311 } 301 }
312 302
313 String StylePropertySerializer::borderSpacingValue(const StylePropertyShorthand& shorthand) const 303 String StylePropertySerializer::borderSpacingValue(const StylePropertyShorthand& shorthand) const
314 { 304 {
315 RefPtr<CSSValue> horizontalValue = m_propertySet.getPropertyCSSValue(shortha nd.properties()[0]); 305 RefPtr<CSSValue> horizontalValue = m_propertySet.getPropertyCSSValue(shortha nd.properties()[0]);
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 isInitialValue = false; 834 isInitialValue = false;
845 if (!value->isInheritedValue()) 835 if (!value->isInheritedValue())
846 isInheritedValue = false; 836 isInheritedValue = false;
847 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie s()[i])) 837 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie s()[i]))
848 return false; 838 return false;
849 } 839 }
850 return isInitialValue || isInheritedValue; 840 return isInitialValue || isInheritedValue;
851 } 841 }
852 842
853 } 843 }
OLDNEW
« no previous file with comments | « sky/engine/core/css/CSSProperty.h ('k') | sky/engine/core/css/StylePropertySet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698