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

Side by Side Diff: Source/core/css/StylePropertyShorthandCustom.cpp

Issue 298043007: Support unknown property strings in transition-property (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 6 years, 6 months 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
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 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2013 Intel Corporation. All rights reserved. 4 * Copyright (C) 2013 Intel Corporation. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 CSSPropertyWebkitAnimationIterationCount, 79 CSSPropertyWebkitAnimationIterationCount,
80 CSSPropertyWebkitAnimationDirection, 80 CSSPropertyWebkitAnimationDirection,
81 CSSPropertyWebkitAnimationFillMode, 81 CSSPropertyWebkitAnimationFillMode,
82 CSSPropertyWebkitAnimationPlayState, 82 CSSPropertyWebkitAnimationPlayState,
83 CSSPropertyWebkitAnimationName 83 CSSPropertyWebkitAnimationName
84 }; 84 };
85 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitAnimationLonghandsForParsi ng, (CSSPropertyWebkitAnimation, animationPropertiesForParsing, WTF_ARRAY_LENGTH (animationPropertiesForParsing))); 85 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitAnimationLonghandsForParsi ng, (CSSPropertyWebkitAnimation, animationPropertiesForParsing, WTF_ARRAY_LENGTH (animationPropertiesForParsing)));
86 return webkitAnimationLonghandsForParsing; 86 return webkitAnimationLonghandsForParsing;
87 } 87 }
88 88
89 // Similar to animations, we have property after timing-function and delay after duration
90 const StylePropertyShorthand& transitionShorthandForParsing()
91 {
92 static const CSSPropertyID transitionProperties[] = {
93 CSSPropertyTransitionDuration,
94 CSSPropertyTransitionTimingFunction,
95 CSSPropertyTransitionDelay,
96 CSSPropertyTransitionProperty
97 };
98 DEFINE_STATIC_LOCAL(StylePropertyShorthand, transitionLonghands, (CSSPropert yTransition, transitionProperties, WTF_ARRAY_LENGTH(transitionProperties)));
99 return transitionLonghands;
100 }
101
102 const StylePropertyShorthand& webkitTransitionShorthandForParsing()
103 {
104 static const CSSPropertyID webkitTransitionProperties[] = {
105 CSSPropertyWebkitTransitionDuration,
106 CSSPropertyWebkitTransitionTimingFunction,
107 CSSPropertyWebkitTransitionDelay,
108 CSSPropertyWebkitTransitionProperty
109 };
110 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitTransitionLonghands, (CSSP ropertyWebkitTransition, webkitTransitionProperties, WTF_ARRAY_LENGTH(webkitTran sitionProperties)));
111 return webkitTransitionLonghands;
112 }
113
89 // Returns an empty list if the property is not a shorthand, otherwise the list of longhands for parsing. 114 // Returns an empty list if the property is not a shorthand, otherwise the list of longhands for parsing.
90 const StylePropertyShorthand& parsingShorthandForProperty(CSSPropertyID property ID) 115 const StylePropertyShorthand& parsingShorthandForProperty(CSSPropertyID property ID)
91 { 116 {
92 switch (propertyID) { 117 switch (propertyID) {
93 case CSSPropertyAnimation: 118 case CSSPropertyAnimation:
94 return animationShorthandForParsing(); 119 return animationShorthandForParsing();
95 case CSSPropertyBorder: 120 case CSSPropertyBorder:
96 return borderShorthandForParsing(); 121 return borderShorthandForParsing();
97 case CSSPropertyWebkitAnimation: 122 case CSSPropertyWebkitAnimation:
98 return webkitAnimationShorthandForParsing(); 123 return webkitAnimationShorthandForParsing();
124 case CSSPropertyTransition:
125 return transitionShorthandForParsing();
126 case CSSPropertyWebkitTransition:
127 return webkitTransitionShorthandForParsing();
99 default: 128 default:
100 return shorthandForProperty(propertyID); 129 return shorthandForProperty(propertyID);
101 } 130 }
102 } 131 }
103 132
104 bool isExpandedShorthand(CSSPropertyID id) 133 bool isExpandedShorthand(CSSPropertyID id)
105 { 134 {
106 // The system fonts bypass the normal style resolution by using RenderTheme, 135 // The system fonts bypass the normal style resolution by using RenderTheme,
107 // thus we need to special case it here. FIXME: This is a violation of CSS 3 Fonts 136 // thus we need to special case it here. FIXME: This is a violation of CSS 3 Fonts
108 // as we should still be able to change the longhands. 137 // as we should still be able to change the longhands.
(...skipping 24 matching lines...) Expand all
133 { 162 {
134 for (unsigned i = 0; i < shorthands.size(); ++i) { 163 for (unsigned i = 0; i < shorthands.size(); ++i) {
135 if (shorthands.at(i).id() == shorthandID) 164 if (shorthands.at(i).id() == shorthandID)
136 return i; 165 return i;
137 } 166 }
138 ASSERT_NOT_REACHED(); 167 ASSERT_NOT_REACHED();
139 return 0; 168 return 0;
140 } 169 }
141 170
142 } // namespace WebCore 171 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/CSSComputedStyleDeclaration.cpp ('k') | Source/core/css/parser/CSSPropertyParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698