| 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 17 matching lines...) Expand all Loading... |
| 28 static const CSSPropertyID borderShorthandProperties[] = { CSSPropertyBorder
Width, CSSPropertyBorderStyle, CSSPropertyBorderColor }; | 28 static const CSSPropertyID borderShorthandProperties[] = { CSSPropertyBorder
Width, CSSPropertyBorderStyle, CSSPropertyBorderColor }; |
| 29 static const StylePropertyShorthand* propertiesForInitialization[] = { | 29 static const StylePropertyShorthand* propertiesForInitialization[] = { |
| 30 &borderWidthShorthand(), | 30 &borderWidthShorthand(), |
| 31 &borderStyleShorthand(), | 31 &borderStyleShorthand(), |
| 32 &borderColorShorthand(), | 32 &borderColorShorthand(), |
| 33 }; | 33 }; |
| 34 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderForParsingLonghands, (CSSP
ropertyBorder, borderShorthandProperties, propertiesForInitialization, WTF_ARRAY
_LENGTH(borderShorthandProperties))); | 34 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderForParsingLonghands, (CSSP
ropertyBorder, borderShorthandProperties, propertiesForInitialization, WTF_ARRAY
_LENGTH(borderShorthandProperties))); |
| 35 return borderForParsingLonghands; | 35 return borderForParsingLonghands; |
| 36 } | 36 } |
| 37 | 37 |
| 38 const StylePropertyShorthand& animationShorthandForParsing() | |
| 39 { | |
| 40 // When we parse the animation shorthand we need to look for animation-name | |
| 41 // last because otherwise it might match against the keywords for fill mode, | |
| 42 // timing functions and infinite iteration. This means that animation names | |
| 43 // that are the same as keywords (e.g. 'forwards') won't always match in the | |
| 44 // shorthand. In that case the authors should be using longhands (or | |
| 45 // reconsidering their approach). This is covered by the animations spec | |
| 46 // bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=14790 | |
| 47 // And in the spec (editor's draft) at: | |
| 48 // http://dev.w3.org/csswg/css3-animations/#animation-shorthand-property | |
| 49 static const CSSPropertyID animationPropertiesForParsing[] = { | |
| 50 CSSPropertyAnimationDuration, | |
| 51 CSSPropertyAnimationTimingFunction, | |
| 52 CSSPropertyAnimationDelay, | |
| 53 CSSPropertyAnimationIterationCount, | |
| 54 CSSPropertyAnimationDirection, | |
| 55 CSSPropertyAnimationFillMode, | |
| 56 CSSPropertyAnimationPlayState, | |
| 57 CSSPropertyAnimationName | |
| 58 }; | |
| 59 DEFINE_STATIC_LOCAL(StylePropertyShorthand, animationLonghandsForParsing, (C
SSPropertyAnimation, animationPropertiesForParsing, WTF_ARRAY_LENGTH(animationPr
opertiesForParsing))); | |
| 60 return animationLonghandsForParsing; | |
| 61 } | |
| 62 | |
| 63 const StylePropertyShorthand& transitionShorthandForParsing() | |
| 64 { | |
| 65 static const CSSPropertyID transitionProperties[] = { | |
| 66 CSSPropertyTransitionDuration, | |
| 67 CSSPropertyTransitionTimingFunction, | |
| 68 CSSPropertyTransitionDelay, | |
| 69 CSSPropertyTransitionProperty | |
| 70 }; | |
| 71 DEFINE_STATIC_LOCAL(StylePropertyShorthand, transitionLonghands, (CSSPropert
yTransition, transitionProperties, WTF_ARRAY_LENGTH(transitionProperties))); | |
| 72 return transitionLonghands; | |
| 73 } | |
| 74 | |
| 75 // Returns an empty list if the property is not a shorthand, otherwise the list
of longhands for parsing. | 38 // Returns an empty list if the property is not a shorthand, otherwise the list
of longhands for parsing. |
| 76 const StylePropertyShorthand& parsingShorthandForProperty(CSSPropertyID property
ID) | 39 const StylePropertyShorthand& parsingShorthandForProperty(CSSPropertyID property
ID) |
| 77 { | 40 { |
| 78 switch (propertyID) { | 41 switch (propertyID) { |
| 79 case CSSPropertyAnimation: | |
| 80 return animationShorthandForParsing(); | |
| 81 case CSSPropertyBorder: | 42 case CSSPropertyBorder: |
| 82 return borderShorthandForParsing(); | 43 return borderShorthandForParsing(); |
| 83 case CSSPropertyTransition: | |
| 84 return transitionShorthandForParsing(); | |
| 85 default: | 44 default: |
| 86 return shorthandForProperty(propertyID); | 45 return shorthandForProperty(propertyID); |
| 87 } | 46 } |
| 88 } | 47 } |
| 89 | 48 |
| 90 bool isExpandedShorthand(CSSPropertyID id) | 49 bool isExpandedShorthand(CSSPropertyID id) |
| 91 { | 50 { |
| 92 // The system fonts bypass the normal style resolution by using RenderTheme, | 51 // The system fonts bypass the normal style resolution by using RenderTheme, |
| 93 // thus we need to special case it here. FIXME: This is a violation of CSS 3
Fonts | 52 // thus we need to special case it here. FIXME: This is a violation of CSS 3
Fonts |
| 94 // as we should still be able to change the longhands. | 53 // as we should still be able to change the longhands. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 119 { | 78 { |
| 120 for (unsigned i = 0; i < shorthands.size(); ++i) { | 79 for (unsigned i = 0; i < shorthands.size(); ++i) { |
| 121 if (shorthands.at(i).id() == shorthandID) | 80 if (shorthands.at(i).id() == shorthandID) |
| 122 return i; | 81 return i; |
| 123 } | 82 } |
| 124 ASSERT_NOT_REACHED(); | 83 ASSERT_NOT_REACHED(); |
| 125 return 0; | 84 return 0; |
| 126 } | 85 } |
| 127 | 86 |
| 128 } // namespace blink | 87 } // namespace blink |
| OLD | NEW |