Changeset 82942 in webkit


Ignore:
Timestamp:
Apr 5, 2011 8:36:16 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-04-05 Luke Macpherson <macpherson@chromium.org>

Reviewed by Dimitri Glazkov.

Implement CSSPropertyDirection in CSSStyleApplyProperty
https://bugs.webkit.org/show_bug.cgi?id=57608

No new tests required as no new functionality introduced.

  • css/CSSStyleApplyProperty.cpp: Add implementation class for CSSPropertyDirection
  • css/CSSStyleSelector.cpp: Remove existing implementation for CSSPropertyDirection
  • css/CSSStyleSelector.h: Add getter for element
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r82940 r82942  
     12011-04-05  Luke Macpherson   <macpherson@chromium.org>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        Implement CSSPropertyDirection in CSSStyleApplyProperty
     6        https://bugs.webkit.org/show_bug.cgi?id=57608
     7
     8        No new tests required as no new functionality introduced.
     9
     10        * css/CSSStyleApplyProperty.cpp:
     11        Add implementation class for CSSPropertyDirection
     12        * css/CSSStyleSelector.cpp:
     13        Remove existing implementation for CSSPropertyDirection
     14        * css/CSSStyleSelector.h:
     15        Add getter for element
     16
    1172011-04-05  Leandro Gracia Gil  <leandrogracia@chromium.org>
    218
  • trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp

    r80893 r82942  
    2828#include "CSSPrimitiveValueMappings.h"
    2929#include "CSSStyleSelector.h"
     30#include "Document.h"
     31#include "Element.h"
    3032#include "RenderStyle.h"
    3133#include <wtf/StdLibExtras.h>
     
    135137};
    136138
     139// CSSPropertyDirection
     140class ApplyPropertyDirection : public ApplyPropertyDefault<TextDirection> {
     141public:
     142    ApplyPropertyDirection(TextDirection (RenderStyle::*getter)() const, void (RenderStyle::*setter)(TextDirection), TextDirection (*initial)())
     143        : ApplyPropertyDefault<TextDirection>(getter, setter, initial)
     144    {
     145    }
     146
     147    virtual void value(CSSStyleSelector* selector, CSSValue* value) const
     148    {
     149        ApplyPropertyDefault<TextDirection>::value(selector, value);
     150        Element* element = selector->element();
     151        if (element && selector->element() == element->document()->documentElement())
     152            element->document()->setDirectionSetOnDocumentElement(true);
     153    }
     154};
     155
    137156const CSSStyleApplyProperty& CSSStyleApplyProperty::sharedCSSStyleApplyProperty()
    138157{
     
    148167
    149168    setPropertyValue(CSSPropertyColor, new ApplyPropertyColor(&RenderStyle::color, &RenderStyle::setColor, RenderStyle::initialColor));
     169    setPropertyValue(CSSPropertyDirection, new ApplyPropertyDirection(&RenderStyle::direction, &RenderStyle::setDirection, RenderStyle::initialDirection));
    150170    setPropertyValue(CSSPropertyBackgroundColor, new ApplyPropertyColorBase(&RenderStyle::backgroundColor, 0, &RenderStyle::setBackgroundColor));
    151171    setPropertyValue(CSSPropertyBorderBottomColor, new ApplyPropertyColorBase(&RenderStyle::borderBottomColor, &RenderStyle::color, &RenderStyle::setBorderBottomColor));
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r82799 r82942  
    37233723        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(clear, Clear)
    37243724        return;
    3725     case CSSPropertyDirection:
    3726         HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(direction, Direction)
    3727         if (!isInherit && !isInitial && m_element && m_element == m_element->document()->documentElement())
    3728             m_element->document()->setDirectionSetOnDocumentElement(true);
    3729         return;
    37303725    case CSSPropertyDisplay:
    37313726        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(display, Display)
     
    61986193    // These properties are implemented in the CSSStyleApplyProperty lookup table.
    61996194    case CSSPropertyColor:
     6195    case CSSPropertyDirection:
    62006196    case CSSPropertyBackgroundColor:
    62016197    case CSSPropertyBorderBottomColor:
  • trunk/Source/WebCore/css/CSSStyleSelector.h

    r82183 r82942  
    116116        RenderStyle* style() const { return m_style.get(); }
    117117        RenderStyle* parentStyle() const { return m_parentStyle; }
     118        Element* element() const { return m_element; }
    118119
    119120    private:
Note: See TracChangeset for help on using the changeset viewer.