⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 101221 in webkit


Ignore:
Timestamp:
Nov 27, 2011, 10:19:11 PM (15 years ago)
Author:
macpherson@chromium.org
Message:

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):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r101218 r101221  
     12011-11-27  Luke Macpherson   <macpherson@chromium.org>
     2
     3        Implement CSSPropertyTextAlign in CSSStyleApplyProperty.
     4        https://bugs.webkit.org/show_bug.cgi?id=73102
     5
     6        Reviewed by Andreas Kling.
     7
     8        Covered by fast/css/text-align*.html
     9
     10        * css/CSSStyleApplyProperty.cpp:
     11        (WebCore::ApplyPropertyTextAlign::applyValue):
     12        (WebCore::ApplyPropertyTextAlign::createHandler):
     13        (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):
     14        * css/CSSStyleSelector.cpp:
     15        (WebCore::CSSStyleSelector::applyProperty):
     16
    1172011-11-27  Andreas Kling  <kling@webkit.org>
    218
  • trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp

    r101177 r101221  
    686686};
    687687
     688class ApplyPropertyTextAlign {
     689public:
     690    static void applyValue(CSSStyleSelector* selector, CSSValue* value)
     691    {
     692        if (!value->isPrimitiveValue())
     693            return;
     694
     695        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
     696
     697        if (primitiveValue->getIdent() != CSSValueWebkitMatchParent)
     698            selector->style()->setTextAlign(*primitiveValue);
     699        else if (selector->parentStyle()->textAlign() == TASTART)
     700            selector->style()->setTextAlign(selector->parentStyle()->isLeftToRightDirection() ? LEFT : RIGHT);
     701        else if (selector->parentStyle()->textAlign() == TAEND)
     702            selector->style()->setTextAlign(selector->parentStyle()->isLeftToRightDirection() ? RIGHT : LEFT);
     703        else
     704            selector->style()->setTextAlign(selector->parentStyle()->textAlign());
     705    }
     706    static PropertyHandler createHandler()
     707    {
     708        PropertyHandler handler = ApplyPropertyDefaultBase<ETextAlign, &RenderStyle::textAlign, ETextAlign, &RenderStyle::setTextAlign, ETextAlign, &RenderStyle::initialTextAlign>::createHandler();
     709        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
     710    }
     711};
     712
    688713class ApplyPropertyTextEmphasisStyle {
    689714public:
     
    10131038    setPropertyHandler(CSSPropertyFontWeight, ApplyPropertyFontWeight::createHandler());
    10141039
     1040    setPropertyHandler(CSSPropertyTextAlign, ApplyPropertyTextAlign::createHandler());
     1041
    10151042    setPropertyHandler(CSSPropertyOutlineStyle, ApplyPropertyOutlineStyle::createHandler());
    10161043    setPropertyHandler(CSSPropertyOutlineColor, ApplyPropertyColor<InheritFromParent, &RenderStyle::outlineColor, &RenderStyle::setOutlineColor, &RenderStyle::setVisitedLinkOutlineColor, &RenderStyle::color>::createHandler());
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r101177 r101221  
    27792779            return;
    27802780        m_style->setLineHeight(lineHeight);
    2781         return;
    2782     }
    2783 
    2784 // string
    2785     case CSSPropertyTextAlign:
    2786     {
    2787         HANDLE_INHERIT_AND_INITIAL(textAlign, TextAlign)
    2788         if (!primitiveValue)
    2789             return;
    2790         if (primitiveValue->getIdent() == CSSValueWebkitMatchParent) {
    2791             if (m_parentStyle->textAlign() == TASTART)
    2792                 m_style->setTextAlign(m_parentStyle->isLeftToRightDirection() ? LEFT : RIGHT);
    2793             else if (m_parentStyle->textAlign() == TAEND)
    2794                 m_style->setTextAlign(m_parentStyle->isLeftToRightDirection() ? RIGHT : LEFT);
    2795             else
    2796                 m_style->setTextAlign(m_parentStyle->textAlign());
    2797             return;
    2798         }
    2799         m_style->setTextAlign(*primitiveValue);
    28002781        return;
    28012782    }
     
    40254006    case CSSPropertyPaddingLeft:
    40264007    case CSSPropertyPadding:
     4008    case CSSPropertyTextAlign:
    40274009    case CSSPropertyTextIndent:
    40284010    case CSSPropertyMaxHeight:
Note: See TracChangeset for help on using the changeset viewer.