This source file includes following definitions.
- borderShorthandForParsing
- animationShorthandForParsing
- webkitAnimationShorthandForParsing
- parsingShorthandForProperty
- isExpandedShorthand
- indexOfShorthandForLonghand
#include "config.h"
#include "StylePropertyShorthand.h"
namespace WebCore {
const StylePropertyShorthand& borderShorthandForParsing()
{
static const CSSPropertyID borderShorthandProperties[] = { CSSPropertyBorderWidth, CSSPropertyBorderStyle, CSSPropertyBorderColor };
static const StylePropertyShorthand* propertiesForInitialization[] = {
&borderWidthShorthand(),
&borderStyleShorthand(),
&borderColorShorthand(),
};
DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderForParsingLonghands, (CSSPropertyBorder, borderShorthandProperties, propertiesForInitialization, WTF_ARRAY_LENGTH(borderShorthandProperties)));
return borderForParsingLonghands;
}
const StylePropertyShorthand& animationShorthandForParsing()
{
static const CSSPropertyID animationPropertiesForParsing[] = {
CSSPropertyAnimationDuration,
CSSPropertyAnimationTimingFunction,
CSSPropertyAnimationDelay,
CSSPropertyAnimationIterationCount,
CSSPropertyAnimationDirection,
CSSPropertyAnimationFillMode,
CSSPropertyAnimationPlayState,
CSSPropertyAnimationName
};
DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitAnimationLonghandsForParsing, (CSSPropertyAnimation, animationPropertiesForParsing, WTF_ARRAY_LENGTH(animationPropertiesForParsing)));
return webkitAnimationLonghandsForParsing;
}
const StylePropertyShorthand& webkitAnimationShorthandForParsing()
{
static const CSSPropertyID animationPropertiesForParsing[] = {
CSSPropertyWebkitAnimationDuration,
CSSPropertyWebkitAnimationTimingFunction,
CSSPropertyWebkitAnimationDelay,
CSSPropertyWebkitAnimationIterationCount,
CSSPropertyWebkitAnimationDirection,
CSSPropertyWebkitAnimationFillMode,
CSSPropertyWebkitAnimationPlayState,
CSSPropertyWebkitAnimationName
};
DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitAnimationLonghandsForParsing, (CSSPropertyWebkitAnimation, animationPropertiesForParsing, WTF_ARRAY_LENGTH(animationPropertiesForParsing)));
return webkitAnimationLonghandsForParsing;
}
const StylePropertyShorthand& parsingShorthandForProperty(CSSPropertyID propertyID)
{
switch (propertyID) {
case CSSPropertyAnimation:
return animationShorthandForParsing();
case CSSPropertyBorder:
return borderShorthandForParsing();
case CSSPropertyWebkitAnimation:
return webkitAnimationShorthandForParsing();
default:
return shorthandForProperty(propertyID);
}
}
bool isExpandedShorthand(CSSPropertyID id)
{
if (id == CSSPropertyFont)
return false;
return shorthandForProperty(id).length();
}
unsigned indexOfShorthandForLonghand(CSSPropertyID shorthandID, const Vector<StylePropertyShorthand, 4>& shorthands)
{
for (unsigned i = 0; i < shorthands.size(); ++i) {
if (shorthands.at(i).id() == shorthandID)
return i;
}
ASSERT_NOT_REACHED();
return 0;
}
}