| OLD | NEW |
| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 static const CSSPropertyID animationPropertiesForParsing[] = { | 50 static const CSSPropertyID animationPropertiesForParsing[] = { |
| 51 CSSPropertyAnimationDuration, | 51 CSSPropertyAnimationDuration, |
| 52 CSSPropertyAnimationTimingFunction, | 52 CSSPropertyAnimationTimingFunction, |
| 53 CSSPropertyAnimationDelay, | 53 CSSPropertyAnimationDelay, |
| 54 CSSPropertyAnimationIterationCount, | 54 CSSPropertyAnimationIterationCount, |
| 55 CSSPropertyAnimationDirection, | 55 CSSPropertyAnimationDirection, |
| 56 CSSPropertyAnimationFillMode, | 56 CSSPropertyAnimationFillMode, |
| 57 CSSPropertyAnimationPlayState, | 57 CSSPropertyAnimationPlayState, |
| 58 CSSPropertyAnimationName | 58 CSSPropertyAnimationName |
| 59 }; | 59 }; |
| 60 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitAnimationLonghandsForParsi
ng, (CSSPropertyAnimation, animationPropertiesForParsing, WTF_ARRAY_LENGTH(anima
tionPropertiesForParsing))); | 60 DEFINE_STATIC_LOCAL(StylePropertyShorthand, animationLonghandsForParsing, (C
SSPropertyAnimation, animationPropertiesForParsing, WTF_ARRAY_LENGTH(animationPr
opertiesForParsing))); |
| 61 return webkitAnimationLonghandsForParsing; | 61 return animationLonghandsForParsing; |
| 62 } | 62 } |
| 63 | 63 |
| 64 const StylePropertyShorthand& webkitAnimationShorthandForParsing() | |
| 65 { | |
| 66 // When we parse the animation shorthand we need to look for animation-name | |
| 67 // last because otherwise it might match against the keywords for fill mode, | |
| 68 // timing functions and infinite iteration. This means that animation names | |
| 69 // that are the same as keywords (e.g. 'forwards') won't always match in the | |
| 70 // shorthand. In that case the authors should be using longhands (or | |
| 71 // reconsidering their approach). This is covered by the animations spec | |
| 72 // bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=14790 | |
| 73 // And in the spec (editor's draft) at: | |
| 74 // http://dev.w3.org/csswg/css3-animations/#animation-shorthand-property | |
| 75 static const CSSPropertyID animationPropertiesForParsing[] = { | |
| 76 CSSPropertyWebkitAnimationDuration, | |
| 77 CSSPropertyWebkitAnimationTimingFunction, | |
| 78 CSSPropertyWebkitAnimationDelay, | |
| 79 CSSPropertyWebkitAnimationIterationCount, | |
| 80 CSSPropertyWebkitAnimationDirection, | |
| 81 CSSPropertyWebkitAnimationFillMode, | |
| 82 CSSPropertyWebkitAnimationPlayState, | |
| 83 CSSPropertyWebkitAnimationName | |
| 84 }; | |
| 85 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitAnimationLonghandsForParsi
ng, (CSSPropertyWebkitAnimation, animationPropertiesForParsing, WTF_ARRAY_LENGTH
(animationPropertiesForParsing))); | |
| 86 return webkitAnimationLonghandsForParsing; | |
| 87 } | |
| 88 | |
| 89 // Similar to animations, we have property after timing-function and delay after
duration | |
| 90 const StylePropertyShorthand& transitionShorthandForParsing() | 64 const StylePropertyShorthand& transitionShorthandForParsing() |
| 91 { | 65 { |
| 92 static const CSSPropertyID transitionProperties[] = { | 66 static const CSSPropertyID transitionProperties[] = { |
| 93 CSSPropertyTransitionDuration, | 67 CSSPropertyTransitionDuration, |
| 94 CSSPropertyTransitionTimingFunction, | 68 CSSPropertyTransitionTimingFunction, |
| 95 CSSPropertyTransitionDelay, | 69 CSSPropertyTransitionDelay, |
| 96 CSSPropertyTransitionProperty | 70 CSSPropertyTransitionProperty |
| 97 }; | 71 }; |
| 98 DEFINE_STATIC_LOCAL(StylePropertyShorthand, transitionLonghands, (CSSPropert
yTransition, transitionProperties, WTF_ARRAY_LENGTH(transitionProperties))); | 72 DEFINE_STATIC_LOCAL(StylePropertyShorthand, transitionLonghands, (CSSPropert
yTransition, transitionProperties, WTF_ARRAY_LENGTH(transitionProperties))); |
| 99 return transitionLonghands; | 73 return transitionLonghands; |
| 100 } | 74 } |
| 101 | 75 |
| 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 | |
| 114 // Returns an empty list if the property is not a shorthand, otherwise the list
of longhands for parsing. | 76 // Returns an empty list if the property is not a shorthand, otherwise the list
of longhands for parsing. |
| 115 const StylePropertyShorthand& parsingShorthandForProperty(CSSPropertyID property
ID) | 77 const StylePropertyShorthand& parsingShorthandForProperty(CSSPropertyID property
ID) |
| 116 { | 78 { |
| 117 switch (propertyID) { | 79 switch (propertyID) { |
| 118 case CSSPropertyAnimation: | 80 case CSSPropertyAnimation: |
| 119 return animationShorthandForParsing(); | 81 return animationShorthandForParsing(); |
| 120 case CSSPropertyBorder: | 82 case CSSPropertyBorder: |
| 121 return borderShorthandForParsing(); | 83 return borderShorthandForParsing(); |
| 122 case CSSPropertyWebkitAnimation: | |
| 123 return webkitAnimationShorthandForParsing(); | |
| 124 case CSSPropertyTransition: | 84 case CSSPropertyTransition: |
| 125 return transitionShorthandForParsing(); | 85 return transitionShorthandForParsing(); |
| 126 case CSSPropertyWebkitTransition: | |
| 127 return webkitTransitionShorthandForParsing(); | |
| 128 default: | 86 default: |
| 129 return shorthandForProperty(propertyID); | 87 return shorthandForProperty(propertyID); |
| 130 } | 88 } |
| 131 } | 89 } |
| 132 | 90 |
| 133 bool isExpandedShorthand(CSSPropertyID id) | 91 bool isExpandedShorthand(CSSPropertyID id) |
| 134 { | 92 { |
| 135 // The system fonts bypass the normal style resolution by using RenderTheme, | 93 // The system fonts bypass the normal style resolution by using RenderTheme, |
| 136 // thus we need to special case it here. FIXME: This is a violation of CSS 3
Fonts | 94 // thus we need to special case it here. FIXME: This is a violation of CSS 3
Fonts |
| 137 // as we should still be able to change the longhands. | 95 // as we should still be able to change the longhands. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 162 { | 120 { |
| 163 for (unsigned i = 0; i < shorthands.size(); ++i) { | 121 for (unsigned i = 0; i < shorthands.size(); ++i) { |
| 164 if (shorthands.at(i).id() == shorthandID) | 122 if (shorthands.at(i).id() == shorthandID) |
| 165 return i; | 123 return i; |
| 166 } | 124 } |
| 167 ASSERT_NOT_REACHED(); | 125 ASSERT_NOT_REACHED(); |
| 168 return 0; | 126 return 0; |
| 169 } | 127 } |
| 170 | 128 |
| 171 } // namespace blink | 129 } // namespace blink |
| OLD | NEW |