Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (177571 => 177572)
--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2014-12-19 08:37:10 UTC (rev 177571)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2014-12-19 08:57:30 UTC (rev 177572)
@@ -27,50 +27,27 @@
#include "config.h"
#include "DeprecatedStyleBuilder.h"
-#include "BasicShapeFunctions.h"
-#include "BasicShapes.h"
-#include "CSSAspectRatioValue.h"
-#include "CSSCalculationValue.h"
-#include "CSSCursorImageValue.h"
-#include "CSSImageGeneratorValue.h"
#include "CSSImageSetValue.h"
#include "CSSPrimitiveValue.h"
#include "CSSPrimitiveValueMappings.h"
#include "CSSToStyleMap.h"
#include "CSSValueList.h"
-#include "ClipPathOperation.h"
-#include "CursorList.h"
-#include "Document.h"
-#include "Frame.h"
#include "HTMLElement.h"
-#include "Pair.h"
-#include "Rect.h"
#include "RenderStyle.h"
-#include "RenderView.h"
-#include "Settings.h"
#include "StyleFontSizeFunctions.h"
#include "StyleResolver.h"
-#include <wtf/StdLibExtras.h>
-#if ENABLE(CSS_SHAPES)
-#include "ShapeValue.h"
-#endif
-
namespace WebCore {
using namespace HTMLNames;
-enum ExpandValueBehavior {SuppressValue = 0, ExpandValue};
-template <ExpandValueBehavior expandValue, CSSPropertyID _one_ = CSSPropertyInvalid, CSSPropertyID two = CSSPropertyInvalid, CSSPropertyID three = CSSPropertyInvalid, CSSPropertyID four = CSSPropertyInvalid, CSSPropertyID five = CSSPropertyInvalid>
-class ApplyPropertyExpanding {
+class ApplyPropertyPerspectiveOrigin {
public:
-
template <CSSPropertyID id>
static inline void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
{
- if (id == CSSPropertyInvalid)
- return;
-
+ // FIXME: This doesn't seem to do anything as CSSPropertyWebkitPerspectiveOriginX
+ // and CSSPropertyWebkitPerspectiveOriginY don't have a property handler.
const DeprecatedStyleBuilder& table = DeprecatedStyleBuilder::sharedStyleBuilder();
const PropertyHandler& handler = table.propertyHandler(id);
if (handler.isValid())
@@ -79,19 +56,15 @@
static void applyInheritValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
{
- applyInheritValue<one>(propertyID, styleResolver);
- applyInheritValue<two>(propertyID, styleResolver);
- applyInheritValue<three>(propertyID, styleResolver);
- applyInheritValue<four>(propertyID, styleResolver);
- applyInheritValue<five>(propertyID, styleResolver);
+ applyInheritValue<CSSPropertyWebkitPerspectiveOriginX>(propertyID, styleResolver);
+ applyInheritValue<CSSPropertyWebkitPerspectiveOriginY>(propertyID, styleResolver);
}
template <CSSPropertyID id>
static inline void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
{
- if (id == CSSPropertyInvalid)
- return;
-
+ // FIXME: This doesn't seem to do anything as CSSPropertyWebkitPerspectiveOriginX
+ // and CSSPropertyWebkitPerspectiveOriginY don't have a property handler.
const DeprecatedStyleBuilder& table = DeprecatedStyleBuilder::sharedStyleBuilder();
const PropertyHandler& handler = table.propertyHandler(id);
if (handler.isValid())
@@ -100,51 +73,16 @@
static void applyInitialValue(CSSPropertyID propertyID, StyleResolver* styleResolver)
{
- applyInitialValue<one>(propertyID, styleResolver);
- applyInitialValue<two>(propertyID, styleResolver);
- applyInitialValue<three>(propertyID, styleResolver);
- applyInitialValue<four>(propertyID, styleResolver);
- applyInitialValue<five>(propertyID, styleResolver);
+ applyInitialValue<CSSPropertyWebkitPerspectiveOriginX>(propertyID, styleResolver);
+ applyInitialValue<CSSPropertyWebkitPerspectiveOriginY>(propertyID, styleResolver);
}
- template <CSSPropertyID id>
- static inline void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
- {
- if (id == CSSPropertyInvalid)
- return;
+ static void applyValue(CSSPropertyID, StyleResolver*, CSSValue*)
+ { }
- const DeprecatedStyleBuilder& table = DeprecatedStyleBuilder::sharedStyleBuilder();
- const PropertyHandler& handler = table.propertyHandler(id);
- if (handler.isValid())
- handler.applyValue(propertyID, styleResolver, value);
- }
-
- static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
- {
- if (!expandValue)
- return;
-
- applyValue<one>(propertyID, styleResolver, value);
- applyValue<two>(propertyID, styleResolver, value);
- applyValue<three>(propertyID, styleResolver, value);
- applyValue<four>(propertyID, styleResolver, value);
- applyValue<five>(propertyID, styleResolver, value);
- }
static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
};
-template <typename GetterType, GetterType (RenderStyle::*getterFunction)() const, typename SetterType, void (RenderStyle::*setterFunction)(SetterType), typename InitialType, InitialType (*initialFunction)()>
-class ApplyPropertyDefaultBase {
-public:
- static void setValue(RenderStyle* style, SetterType value) { (style->*setterFunction)(value); }
- static GetterType value(RenderStyle* style) { return (style->*getterFunction)(); }
- static InitialType initial() { return (*initialFunction)(); }
- static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) { setValue(styleResolver->style(), value(styleResolver->parentStyle())); }
- static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { setValue(styleResolver->style(), initial()); }
- static void applyValue(CSSPropertyID, StyleResolver*, CSSValue*) { }
- static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
-};
-
enum AutoValueType {Number = 0, ComputeLength};
template <typename T, T (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(T), bool (RenderStyle::*hasAutoFunction)() const, void (RenderStyle::*setAutoFunction)(), AutoValueType valueType = Number, int autoIdentity = CSSValueAuto>
class ApplyPropertyAuto {
@@ -732,7 +670,7 @@
setPropertyHandler(CSSPropertyWebkitMaskRepeatY, ApplyPropertyFillLayer<EFillRepeat, CSSPropertyWebkitMaskRepeatY, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isRepeatYSet, &FillLayer::repeatY, &FillLayer::setRepeatY, &FillLayer::clearRepeatY, &FillLayer::initialFillRepeatY, &CSSToStyleMap::mapFillRepeatY>::createHandler());
setPropertyHandler(CSSPropertyWebkitMaskSize, ApplyPropertyFillLayer<FillSize, CSSPropertyWebkitMaskSize, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isSizeSet, &FillLayer::size, &FillLayer::setSize, &FillLayer::clearSize, &FillLayer::initialFillSize, &CSSToStyleMap::mapFillSize>::createHandler());
setPropertyHandler(CSSPropertyWebkitMaskSourceType, ApplyPropertyFillLayer<EMaskSourceType, CSSPropertyWebkitMaskSourceType, MaskFillLayer, &RenderStyle::accessMaskLayers, &RenderStyle::maskLayers, &FillLayer::isMaskSourceTypeSet, &FillLayer::maskSourceType, &FillLayer::setMaskSourceType, &FillLayer::clearMaskSourceType, &FillLayer::initialMaskSourceType, &CSSToStyleMap::mapFillMaskSourceType>::createHandler());
- setPropertyHandler(CSSPropertyWebkitPerspectiveOrigin, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitPerspectiveOriginX, CSSPropertyWebkitPerspectiveOriginY>::createHandler());
+ setPropertyHandler(CSSPropertyWebkitPerspectiveOrigin, ApplyPropertyPerspectiveOrigin::createHandler());
setPropertyHandler(CSSPropertyWebkitTextEmphasisColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textEmphasisColor, &RenderStyle::setTextEmphasisColor, &RenderStyle::setVisitedLinkTextEmphasisColor, &RenderStyle::color>::createHandler());
setPropertyHandler(CSSPropertyWebkitTextFillColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textFillColor, &RenderStyle::setTextFillColor, &RenderStyle::setVisitedLinkTextFillColor, &RenderStyle::color>::createHandler());
setPropertyHandler(CSSPropertyWebkitTextStrokeColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textStrokeColor, &RenderStyle::setTextStrokeColor, &RenderStyle::setVisitedLinkTextStrokeColor, &RenderStyle::color>::createHandler());
Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (177571 => 177572)
--- trunk/Source/WebCore/css/StyleBuilderCustom.h 2014-12-19 08:37:10 UTC (rev 177571)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h 2014-12-19 08:57:30 UTC (rev 177572)
@@ -40,109 +40,63 @@
namespace WebCore {
+#define DECLARE_PROPERTY_CUSTOM_HANDLERS(property) \
+ static void applyInherit##property(StyleResolver&); \
+ static void applyInitial##property(StyleResolver&); \
+ static void applyValue##property(StyleResolver&, CSSValue&)
+
// Note that we assume the CSS parser only allows valid CSSValue types.
class StyleBuilderCustom {
public:
- static void applyValueWebkitMarqueeIncrement(StyleResolver&, CSSValue&);
-
- static void applyValueDirection(StyleResolver&, CSSValue&);
-
- static void applyInitialZoom(StyleResolver&);
- static void applyInheritZoom(StyleResolver&);
- static void applyValueZoom(StyleResolver&, CSSValue&);
-
- static void applyValueVerticalAlign(StyleResolver&, CSSValue&);
-
+ // Custom handling of inherit, initial and value setting.
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(BorderImageOutset);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(BorderImageRepeat);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(BorderImageSlice);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(BorderImageWidth);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(BoxShadow);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(Clip);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(CounterIncrement);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(CounterReset);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(Cursor);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(FontFamily);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(FontWeight);
#if ENABLE(CSS_IMAGE_RESOLUTION)
- static void applyInheritImageResolution(StyleResolver&);
- static void applyInitialImageResolution(StyleResolver&);
- static void applyValueImageResolution(StyleResolver&, CSSValue&);
-#endif // ENABLE(CSS_IMAGE_RESOLUTION)
-
- static void applyInheritSize(StyleResolver&);
- static void applyInitialSize(StyleResolver&);
- static void applyValueSize(StyleResolver&, CSSValue&);
-
- static void applyInheritTextIndent(StyleResolver&);
- static void applyInitialTextIndent(StyleResolver&);
- static void applyValueTextIndent(StyleResolver&, CSSValue&);
-
-#define DECLARE_BORDER_IMAGE_MODIFIER_HANDLER(type, modifier) \
- static void applyInherit##type##modifier(StyleResolver&); \
- static void applyInitial##type##modifier(StyleResolver&); \
- static void applyValue##type##modifier(StyleResolver&, CSSValue&)
-
- DECLARE_BORDER_IMAGE_MODIFIER_HANDLER(BorderImage, Outset);
- DECLARE_BORDER_IMAGE_MODIFIER_HANDLER(BorderImage, Repeat);
- DECLARE_BORDER_IMAGE_MODIFIER_HANDLER(BorderImage, Slice);
- DECLARE_BORDER_IMAGE_MODIFIER_HANDLER(BorderImage, Width);
- DECLARE_BORDER_IMAGE_MODIFIER_HANDLER(WebkitMaskBoxImage, Outset);
- DECLARE_BORDER_IMAGE_MODIFIER_HANDLER(WebkitMaskBoxImage, Repeat);
- DECLARE_BORDER_IMAGE_MODIFIER_HANDLER(WebkitMaskBoxImage, Slice);
- DECLARE_BORDER_IMAGE_MODIFIER_HANDLER(WebkitMaskBoxImage, Width);
-
- static void applyValueWordSpacing(StyleResolver&, CSSValue&);
-
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(ImageResolution);
+#endif
#if ENABLE(IOS_TEXT_AUTOSIZING)
- static void applyInheritLineHeight(StyleResolver&);
- static void applyInitialLineHeight(StyleResolver&);
-#endif // ENABLE(IOS_TEXT_AUTOSIZING)
- static void applyValueLineHeight(StyleResolver&, CSSValue&);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(LineHeight);
+#endif
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(OutlineStyle);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(Size);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(TextIndent);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(TextShadow);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(WebkitAspectRatio);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(WebkitBoxShadow);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(WebkitMaskBoxImageOutset);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(WebkitMaskBoxImageRepeat);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(WebkitMaskBoxImageSlice);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(WebkitMaskBoxImageWidth);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(WebkitTextEmphasisStyle);
+ DECLARE_PROPERTY_CUSTOM_HANDLERS(Zoom);
- static void applyInheritOutlineStyle(StyleResolver&);
- static void applyInitialOutlineStyle(StyleResolver&);
- static void applyValueOutlineStyle(StyleResolver&, CSSValue&);
+ // Custom handling of inherit + value setting only.
+ static void applyInheritDisplay(StyleResolver&);
+ static void applyValueDisplay(StyleResolver&, CSSValue&);
- static void applyInitialClip(StyleResolver&);
- static void applyInheritClip(StyleResolver&);
- static void applyValueClip(StyleResolver&, CSSValue&);
-
- static void applyValueWebkitLocale(StyleResolver&, CSSValue&);
- static void applyValueWebkitWritingMode(StyleResolver&, CSSValue&);
- static void applyValueWebkitTextOrientation(StyleResolver&, CSSValue&);
+ // Custom handling of value setting only.
+ static void applyValueDirection(StyleResolver&, CSSValue&);
+#if !ENABLE(IOS_TEXT_AUTOSIZING)
+ static void applyValueLineHeight(StyleResolver&, CSSValue&);
+#endif
+ static void applyValueVerticalAlign(StyleResolver&, CSSValue&);
static void applyValueWebkitJustifySelf(StyleResolver&, CSSValue&);
+ static void applyValueWebkitLocale(StyleResolver&, CSSValue&);
+ static void applyValueWebkitMarqueeIncrement(StyleResolver&, CSSValue&);
static void applyValueWebkitPerspective(StyleResolver&, CSSValue&);
+ static void applyValueWebkitTextOrientation(StyleResolver&, CSSValue&);
+ static void applyValueWebkitWritingMode(StyleResolver&, CSSValue&);
+ static void applyValueWordSpacing(StyleResolver&, CSSValue&);
- static void applyInitialTextShadow(StyleResolver&);
- static void applyInheritTextShadow(StyleResolver&);
- static void applyValueTextShadow(StyleResolver&, CSSValue&);
- static void applyInitialBoxShadow(StyleResolver&);
- static void applyInheritBoxShadow(StyleResolver&);
- static void applyValueBoxShadow(StyleResolver&, CSSValue&);
- static void applyInitialWebkitBoxShadow(StyleResolver&);
- static void applyInheritWebkitBoxShadow(StyleResolver&);
- static void applyValueWebkitBoxShadow(StyleResolver&, CSSValue&);
-
- static void applyInitialFontFamily(StyleResolver&);
- static void applyInheritFontFamily(StyleResolver&);
- static void applyValueFontFamily(StyleResolver&, CSSValue&);
-
- static void applyInheritDisplay(StyleResolver&);
- static void applyValueDisplay(StyleResolver&, CSSValue&);
-
- static void applyInitialWebkitAspectRatio(StyleResolver&);
- static void applyInheritWebkitAspectRatio(StyleResolver&);
- static void applyValueWebkitAspectRatio(StyleResolver&, CSSValue&);
-
- static void applyInitialWebkitTextEmphasisStyle(StyleResolver&);
- static void applyInheritWebkitTextEmphasisStyle(StyleResolver&);
- static void applyValueWebkitTextEmphasisStyle(StyleResolver&, CSSValue&);
-
- static void applyInitialCounterIncrement(StyleResolver&) { }
- static void applyInheritCounterIncrement(StyleResolver&);
- static void applyValueCounterIncrement(StyleResolver&, CSSValue&);
- static void applyInitialCounterReset(StyleResolver&) { }
- static void applyInheritCounterReset(StyleResolver&);
- static void applyValueCounterReset(StyleResolver&, CSSValue&);
-
- static void applyInitialCursor(StyleResolver&);
- static void applyInheritCursor(StyleResolver&);
- static void applyValueCursor(StyleResolver&, CSSValue&);
-
- static void applyInitialFontWeight(StyleResolver&);
- static void applyInheritFontWeight(StyleResolver&);
- static void applyValueFontWeight(StyleResolver&, CSSValue&);
-
private:
static void resetEffectiveZoom(StyleResolver&);
static CSSToLengthConversionData csstoLengthConversionDataWithTextZoomFactor(StyleResolver&);
@@ -1126,6 +1080,8 @@
}
}
+inline void StyleBuilderCustom::applyInitialCounterIncrement(StyleResolver&) { }
+
inline void StyleBuilderCustom::applyInheritCounterIncrement(StyleResolver& styleResolver)
{
applyInheritCounter<Increment>(styleResolver);
@@ -1136,6 +1092,8 @@
applyValueCounter<Increment>(styleResolver, value);
}
+inline void StyleBuilderCustom::applyInitialCounterReset(StyleResolver&) { }
+
inline void StyleBuilderCustom::applyInheritCounterReset(StyleResolver& styleResolver)
{
applyInheritCounter<Reset>(styleResolver);