Modified: trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp (92741 => 92742)
--- trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp 2011-08-10 01:40:10 UTC (rev 92741)
+++ trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp 2011-08-10 01:44:07 UTC (rev 92742)
@@ -265,12 +265,12 @@
}
};
-enum LengthAuto {AutoDisabled = 0, AutoEnabled = 1};
-enum LengthIntrinsic {IntrinsicDisabled = 0, IntrinsicEnabled = 1};
-enum LengthMinIntrinsic {MinIntrinsicDisabled = 0, MinIntrinsicEnabled = 1};
-enum LengthNone {NoneDisabled = 0, NoneEnabled = 1};
-enum LengthUndefined {UndefinedDisabled = 0, UndefinedEnabled = 1};
-enum LengthFlexDirection {FlexDirectionDisabled = 0, FlexWidth = 1, FlexHeight};
+enum LengthAuto { AutoDisabled = 0, AutoEnabled };
+enum LengthIntrinsic { IntrinsicDisabled = 0, IntrinsicEnabled };
+enum LengthMinIntrinsic { MinIntrinsicDisabled = 0, MinIntrinsicEnabled };
+enum LengthNone { NoneDisabled = 0, NoneEnabled };
+enum LengthUndefined { UndefinedDisabled = 0, UndefinedEnabled };
+enum LengthFlexDirection { FlexDirectionDisabled = 0, FlexWidth, FlexHeight };
template <LengthAuto autoEnabled = AutoDisabled,
LengthIntrinsic intrinsicEnabled = IntrinsicDisabled,
LengthMinIntrinsic minIntrinsicEnabled = MinIntrinsicDisabled,
@@ -332,6 +332,29 @@
}
};
+enum StringIdentBehavior { NothingMapsToNull = 0, MapNoneToNull, MapAutoToNull };
+template <StringIdentBehavior identBehavior = NothingMapsToNull>
+class ApplyPropertyString : public ApplyPropertyDefaultBase<const AtomicString&> {
+public:
+ ApplyPropertyString(GetterFunction getter, SetterFunction setter, InitialFunction initial)
+ : ApplyPropertyDefaultBase<const AtomicString&>(getter, setter, initial)
+ {
+ }
+
+private:
+ virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
+ {
+ if (!value->isPrimitiveValue())
+ return;
+ CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+ if ((identBehavior == MapNoneToNull && primitiveValue->getIdent() == CSSValueNone)
+ || (identBehavior == MapAutoToNull && primitiveValue->getIdent() == CSSValueAuto))
+ setValue(selector->style(), nullAtom);
+ else
+ setValue(selector->style(), primitiveValue->getStringValue());
+ }
+};
+
class ApplyPropertyBorderRadius : public ApplyPropertyDefaultBase<LengthSize> {
public:
ApplyPropertyBorderRadius(GetterFunction getter, SetterFunction setter, InitialFunction initial)
@@ -931,6 +954,9 @@
setPropertyHandler(CSSPropertyWebkitColumnGap, new ApplyPropertyAuto<float, ComputeLength, CSSValueNormal>(&RenderStyle::columnGap, &RenderStyle::setColumnGap, &RenderStyle::hasNormalColumnGap, &RenderStyle::setHasNormalColumnGap));
setPropertyHandler(CSSPropertyWebkitColumnWidth, new ApplyPropertyAuto<float, ComputeLength>(&RenderStyle::columnWidth, &RenderStyle::setColumnWidth, &RenderStyle::hasAutoColumnWidth, &RenderStyle::setHasAutoColumnWidth));
+ setPropertyHandler(CSSPropertyWebkitHighlight, new ApplyPropertyString<MapNoneToNull>(&RenderStyle::highlight, &RenderStyle::setHighlight, &RenderStyle::initialHighlight));
+ setPropertyHandler(CSSPropertyWebkitHyphenateCharacter, new ApplyPropertyString<MapAutoToNull>(&RenderStyle::hyphenationString, &RenderStyle::setHyphenationString, &RenderStyle::initialHyphenationString));
+
setPropertyHandler(CSSPropertyWebkitTextCombine, new ApplyPropertyDefault<TextCombine>(&RenderStyle::textCombine, &RenderStyle::setTextCombine, &RenderStyle::initialTextCombine));
setPropertyHandler(CSSPropertyWebkitTextEmphasisPosition, new ApplyPropertyDefault<TextEmphasisPosition>(&RenderStyle::textEmphasisPosition, &RenderStyle::setTextEmphasisPosition, &RenderStyle::initialTextEmphasisPosition));
setPropertyHandler(CSSPropertyWebkitTextEmphasisStyle, new ApplyPropertyTextEmphasisStyle());
Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (92741 => 92742)
--- trunk/Source/WebCore/css/CSSStyleSelector.cpp 2011-08-10 01:40:10 UTC (rev 92741)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp 2011-08-10 01:44:07 UTC (rev 92742)
@@ -4741,25 +4741,9 @@
m_style->setLineClamp(LineClampValue(primitiveValue->getIntValue(CSSPrimitiveValue::CSS_PERCENTAGE), LineClampPercentage));
return;
}
- case CSSPropertyWebkitHighlight: {
- HANDLE_INHERIT_AND_INITIAL(highlight, Highlight);
- if (primitiveValue->getIdent() == CSSValueNone)
- m_style->setHighlight(nullAtom);
- else
- m_style->setHighlight(primitiveValue->getStringValue());
- return;
- }
case CSSPropertyWebkitHyphens:
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(hyphens, Hyphens);
return;
- case CSSPropertyWebkitHyphenateCharacter: {
- HANDLE_INHERIT_AND_INITIAL(hyphenationString, HyphenationString);
- if (primitiveValue->getIdent() == CSSValueAuto)
- m_style->setHyphenationString(nullAtom);
- else
- m_style->setHyphenationString(primitiveValue->getStringValue());
- return;
- }
case CSSPropertyWebkitHyphenateLimitAfter: {
HANDLE_INHERIT_AND_INITIAL(hyphenationLimitAfter, HyphenationLimitAfter);
if (primitiveValue->getIdent() == CSSValueAuto)
@@ -5222,6 +5206,8 @@
case CSSPropertyWebkitColumnCount:
case CSSPropertyWebkitColumnGap:
case CSSPropertyWebkitColumnWidth:
+ case CSSPropertyWebkitHighlight:
+ case CSSPropertyWebkitHyphenateCharacter:
case CSSPropertyWebkitTextCombine:
case CSSPropertyWebkitTextEmphasisPosition:
case CSSPropertyWebkitTextEmphasisStyle: