Modified: trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp (101237 => 101238)
--- trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp 2011-11-28 10:02:46 UTC (rev 101237)
+++ trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp 2011-11-28 10:05:28 UTC (rev 101238)
@@ -606,6 +606,30 @@
}
};
+enum BorderImageType { Image = 0, Mask };
+template <BorderImageType borderImageType,
+ CSSPropertyID property,
+ const NinePieceImage& (RenderStyle::*getterFunction)() const,
+ void (RenderStyle::*setterFunction)(const NinePieceImage&),
+ void (CSSStyleSelector::*mapNinePieceImage)(CSSPropertyID, CSSValue*, NinePieceImage&)>
+class ApplyPropertyBorderImage {
+public:
+ static void applyValue(CSSStyleSelector* selector, CSSValue* value)
+ {
+ NinePieceImage image;
+ if (borderImageType == Mask)
+ image.setMaskDefaults();
+ (selector->*mapNinePieceImage)(property, value, image);
+ (selector->style()->*setterFunction)(image);
+ }
+
+ static PropertyHandler createHandler()
+ {
+ PropertyHandler handler = ApplyPropertyDefaultBase<const NinePieceImage&, getterFunction, const NinePieceImage&, setterFunction, NinePieceImage, &RenderStyle::initialNinePieceImage>::createHandler();
+ return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
+ }
+};
+
enum CounterBehavior {Increment = 0, Reset};
template <CounterBehavior counterBehavior>
class ApplyPropertyCounter {
@@ -1056,6 +1080,10 @@
setPropertyHandler(CSSPropertyBorderColor, ApplyPropertyExpanding<SuppressValue, CSSPropertyBorderTopColor, CSSPropertyBorderRightColor, CSSPropertyBorderBottomColor, CSSPropertyBorderLeftColor>::createHandler());
setPropertyHandler(CSSPropertyBorder, ApplyPropertyExpanding<SuppressValue, CSSPropertyBorderStyle, CSSPropertyBorderWidth, CSSPropertyBorderColor>::createHandler());
+ setPropertyHandler(CSSPropertyBorderImage, ApplyPropertyBorderImage<Image, CSSPropertyBorderImage, &RenderStyle::borderImage, &RenderStyle::setBorderImage, &CSSStyleSelector::mapNinePieceImage>::createHandler());
+ setPropertyHandler(CSSPropertyWebkitBorderImage, ApplyPropertyBorderImage<Image, CSSPropertyWebkitBorderImage, &RenderStyle::borderImage, &RenderStyle::setBorderImage, &CSSStyleSelector::mapNinePieceImage>::createHandler());
+ setPropertyHandler(CSSPropertyWebkitMaskBoxImage, ApplyPropertyBorderImage<Mask, CSSPropertyWebkitMaskBoxImage, &RenderStyle::maskBoxImage, &RenderStyle::setMaskBoxImage, &CSSStyleSelector::mapNinePieceImage>::createHandler());
+
setPropertyHandler(CSSPropertyBorderTopLeftRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftRadius, &RenderStyle::initialBorderRadius>::createHandler());
setPropertyHandler(CSSPropertyBorderTopRightRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRightRadius, &RenderStyle::initialBorderRadius>::createHandler());
setPropertyHandler(CSSPropertyBorderBottomLeftRadius, ApplyPropertyBorderRadius<&RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBottomLeftRadius, &RenderStyle::initialBorderRadius>::createHandler());
Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (101237 => 101238)
--- trunk/Source/WebCore/css/CSSStyleSelector.cpp 2011-11-28 10:02:46 UTC (rev 101237)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp 2011-11-28 10:05:28 UTC (rev 101238)
@@ -166,33 +166,6 @@
if (primitiveValue) \
m_style->set##Prop(*primitiveValue);
-#define HANDLE_INHERIT_COND(propID, prop, Prop) \
-if (id == propID) { \
- m_style->set##Prop(m_parentStyle->prop()); \
- return; \
-}
-
-#define HANDLE_INHERIT_COND_WITH_BACKUP(propID, prop, propAlt, Prop) \
-if (id == propID) { \
- if (m_parentStyle->prop().isValid()) \
- m_style->set##Prop(m_parentStyle->prop()); \
- else \
- m_style->set##Prop(m_parentStyle->propAlt()); \
- return; \
-}
-
-#define HANDLE_INITIAL_COND(propID, Prop) \
-if (id == propID) { \
- m_style->set##Prop(RenderStyle::initial##Prop()); \
- return; \
-}
-
-#define HANDLE_INITIAL_COND_WITH_VALUE(propID, Prop, Value) \
-if (id == propID) { \
- m_style->set##Prop(RenderStyle::initial##Value()); \
- return; \
-}
-
class RuleData {
public:
RuleData(CSSStyleRule*, CSSSelector*, unsigned position);
@@ -3161,32 +3134,6 @@
case CSSPropertyWebkitAppearance:
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(appearance, Appearance)
return;
- case CSSPropertyBorderImage:
- case CSSPropertyWebkitBorderImage:
- case CSSPropertyWebkitMaskBoxImage: {
- if (isInherit) {
- HANDLE_INHERIT_COND(CSSPropertyBorderImage, borderImage, BorderImage)
- HANDLE_INHERIT_COND(CSSPropertyWebkitBorderImage, borderImage, BorderImage)
- HANDLE_INHERIT_COND(CSSPropertyWebkitMaskBoxImage, maskBoxImage, MaskBoxImage)
- return;
- } else if (isInitial) {
- HANDLE_INITIAL_COND_WITH_VALUE(CSSPropertyBorderImage, BorderImage, NinePieceImage)
- HANDLE_INITIAL_COND_WITH_VALUE(CSSPropertyWebkitBorderImage, BorderImage, NinePieceImage)
- HANDLE_INITIAL_COND_WITH_VALUE(CSSPropertyWebkitMaskBoxImage, MaskBoxImage, NinePieceImage)
- return;
- }
-
- NinePieceImage image;
- if (property == CSSPropertyWebkitMaskBoxImage)
- image.setMaskDefaults();
- mapNinePieceImage(property, value, image);
-
- if (id != CSSPropertyWebkitMaskBoxImage)
- m_style->setBorderImage(image);
- else
- m_style->setMaskBoxImage(image);
- return;
- }
case CSSPropertyBorderImageOutset:
case CSSPropertyWebkitMaskBoxImageOutset: {
bool isBorderImage = id == CSSPropertyBorderImageOutset;
@@ -3873,6 +3820,9 @@
case CSSPropertyBorderStyle:
case CSSPropertyBorderWidth:
case CSSPropertyBorderColor:
+ case CSSPropertyBorderImage:
+ case CSSPropertyWebkitBorderImage:
+ case CSSPropertyWebkitMaskBoxImage:
case CSSPropertyBorderTop:
case CSSPropertyBorderRight:
case CSSPropertyBorderBottom: