StylePropertyShorthand.cpp [plain text]
#include "config.h"
#include "StylePropertyShorthand.h"
#include "StylePropertyShorthandFunctions.h"
namespace WebCore {
StylePropertyShorthand borderAbridgedShorthand()
{
static const CSSPropertyID borderAbridgedProperties[] = { CSSPropertyBorderWidth, CSSPropertyBorderStyle, CSSPropertyBorderColor };
static const StylePropertyShorthand propertiesForInitialization[] = { borderWidthShorthand(), borderStyleShorthand(), borderColorShorthand() };
return StylePropertyShorthand(CSSPropertyBorder, borderAbridgedProperties, propertiesForInitialization);
}
StylePropertyShorthand animationShorthandForParsing(CSSPropertyID propId)
{
static const CSSPropertyID animationPropertiesForParsing[] = {
CSSPropertyAnimationDuration,
CSSPropertyAnimationTimingFunction,
CSSPropertyAnimationDelay,
CSSPropertyAnimationIterationCount,
CSSPropertyAnimationDirection,
CSSPropertyAnimationFillMode,
CSSPropertyAnimationPlayState,
CSSPropertyAnimationName
};
static const CSSPropertyID prefixedAnimationPropertiesForParsing[] = {
CSSPropertyWebkitAnimationDuration,
CSSPropertyWebkitAnimationTimingFunction,
CSSPropertyWebkitAnimationDelay,
CSSPropertyWebkitAnimationIterationCount,
CSSPropertyWebkitAnimationDirection,
CSSPropertyWebkitAnimationFillMode,
CSSPropertyWebkitAnimationPlayState,
CSSPropertyWebkitAnimationName
};
if (propId == CSSPropertyAnimation)
return StylePropertyShorthand(CSSPropertyAnimation, animationPropertiesForParsing);
return StylePropertyShorthand(CSSPropertyWebkitAnimation, prefixedAnimationPropertiesForParsing);
}
bool isShorthandCSSProperty(CSSPropertyID id)
{
return shorthandForProperty(id).length();
}
unsigned indexOfShorthandForLonghand(CSSPropertyID shorthandID, const StylePropertyShorthandVector& shorthands)
{
for (unsigned i = 0, size = shorthands.size(); i < size; ++i) {
if (shorthands[i].id() == shorthandID)
return i;
}
ASSERT_NOT_REACHED();
return 0;
}
}