Modified: trunk/Source/WebCore/ChangeLog (101220 => 101221)
--- trunk/Source/WebCore/ChangeLog 2011-11-28 05:46:59 UTC (rev 101220)
+++ trunk/Source/WebCore/ChangeLog 2011-11-28 06:19:11 UTC (rev 101221)
@@ -1,3 +1,19 @@
+2011-11-27 Luke Macpherson <macpher...@chromium.org>
+
+ Implement CSSPropertyTextAlign in CSSStyleApplyProperty.
+ https://bugs.webkit.org/show_bug.cgi?id=73102
+
+ Reviewed by Andreas Kling.
+
+ Covered by fast/css/text-align*.html
+
+ * css/CSSStyleApplyProperty.cpp:
+ (WebCore::ApplyPropertyTextAlign::applyValue):
+ (WebCore::ApplyPropertyTextAlign::createHandler):
+ (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::applyProperty):
+
2011-11-27 Andreas Kling <kl...@webkit.org>
CSSStyleRule: Pack m_sourceLine with CSSRule bits.
Modified: trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp (101220 => 101221)
--- trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp 2011-11-28 05:46:59 UTC (rev 101220)
+++ trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp 2011-11-28 06:19:11 UTC (rev 101221)
@@ -685,6 +685,31 @@
static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
};
+class ApplyPropertyTextAlign {
+public:
+ static void applyValue(CSSStyleSelector* selector, CSSValue* value)
+ {
+ if (!value->isPrimitiveValue())
+ return;
+
+ CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+
+ if (primitiveValue->getIdent() != CSSValueWebkitMatchParent)
+ selector->style()->setTextAlign(*primitiveValue);
+ else if (selector->parentStyle()->textAlign() == TASTART)
+ selector->style()->setTextAlign(selector->parentStyle()->isLeftToRightDirection() ? LEFT : RIGHT);
+ else if (selector->parentStyle()->textAlign() == TAEND)
+ selector->style()->setTextAlign(selector->parentStyle()->isLeftToRightDirection() ? RIGHT : LEFT);
+ else
+ selector->style()->setTextAlign(selector->parentStyle()->textAlign());
+ }
+ static PropertyHandler createHandler()
+ {
+ PropertyHandler handler = ApplyPropertyDefaultBase<ETextAlign, &RenderStyle::textAlign, ETextAlign, &RenderStyle::setTextAlign, ETextAlign, &RenderStyle::initialTextAlign>::createHandler();
+ return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
+ }
+};
+
class ApplyPropertyTextEmphasisStyle {
public:
static void applyInheritValue(CSSStyleSelector* selector)
@@ -1012,6 +1037,8 @@
setPropertyHandler(CSSPropertyWebkitTextOrientation, ApplyPropertyFont<TextOrientation, &FontDescription::textOrientation, &FontDescription::setTextOrientation, TextOrientationVerticalRight>::createHandler());
setPropertyHandler(CSSPropertyFontWeight, ApplyPropertyFontWeight::createHandler());
+ setPropertyHandler(CSSPropertyTextAlign, ApplyPropertyTextAlign::createHandler());
+
setPropertyHandler(CSSPropertyOutlineStyle, ApplyPropertyOutlineStyle::createHandler());
setPropertyHandler(CSSPropertyOutlineColor, ApplyPropertyColor<InheritFromParent, &RenderStyle::outlineColor, &RenderStyle::setOutlineColor, &RenderStyle::setVisitedLinkOutlineColor, &RenderStyle::color>::createHandler());
setPropertyHandler(CSSPropertyOutlineOffset, ApplyPropertyComputeLength<int, &RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset, &RenderStyle::initialOutlineOffset>::createHandler());
Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (101220 => 101221)
--- trunk/Source/WebCore/css/CSSStyleSelector.cpp 2011-11-28 05:46:59 UTC (rev 101220)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp 2011-11-28 06:19:11 UTC (rev 101221)
@@ -2781,25 +2781,6 @@
return;
}
-// string
- case CSSPropertyTextAlign:
- {
- HANDLE_INHERIT_AND_INITIAL(textAlign, TextAlign)
- if (!primitiveValue)
- return;
- if (primitiveValue->getIdent() == CSSValueWebkitMatchParent) {
- if (m_parentStyle->textAlign() == TASTART)
- m_style->setTextAlign(m_parentStyle->isLeftToRightDirection() ? LEFT : RIGHT);
- else if (m_parentStyle->textAlign() == TAEND)
- m_style->setTextAlign(m_parentStyle->isLeftToRightDirection() ? RIGHT : LEFT);
- else
- m_style->setTextAlign(m_parentStyle->textAlign());
- return;
- }
- m_style->setTextAlign(*primitiveValue);
- return;
- }
-
// rect
case CSSPropertyClip:
{
@@ -4024,6 +4005,7 @@
case CSSPropertyPaddingBottom:
case CSSPropertyPaddingLeft:
case CSSPropertyPadding:
+ case CSSPropertyTextAlign:
case CSSPropertyTextIndent:
case CSSPropertyMaxHeight:
case CSSPropertyHeight: