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()
{
static const CSSPropertyID animationPropertiesForParsing[] = {
CSSPropertyAnimationDuration,
CSSPropertyAnimationTimingFunction,
CSSPropertyAnimationDelay,
CSSPropertyAnimationIterationCount,
CSSPropertyAnimationDirection,
CSSPropertyAnimationFillMode,
CSSPropertyAnimationPlayState,
CSSPropertyAnimationName
};
return StylePropertyShorthand(CSSPropertyAnimation, animationPropertiesForParsing);
}
StylePropertyShorthand transitionShorthandForParsing()
{
static const CSSPropertyID transitionProperties[] = {
CSSPropertyTransitionDuration, CSSPropertyTransitionTimingFunction,
CSSPropertyTransitionDelay, CSSPropertyTransitionProperty};
return StylePropertyShorthand(CSSPropertyTransition, transitionProperties);
}
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;
}
}