Changeset 175458 in webkit


Ignore:
Timestamp:
Nov 1, 2014 10:58:02 PM (9 years ago)
Author:
Chris Dumez
Message:

Move "direction" CSS property to the new StyleBuilder
https://bugs.webkit.org/show_bug.cgi?id=138288

Reviewed by Sam Weinig.

Move "direction" CSS property to the new StyleBuilder by using custom
code as it requires special handling to call
Document::setDirectionSetOnDocumentElement() when necessary.

No new tests, no behavior change.

  • css/CSSPropertyNames.in:
  • css/DeprecatedStyleBuilder.cpp:

(WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
(WebCore::ApplyPropertyDirection::applyValue): Deleted.
(WebCore::ApplyPropertyDirection::createHandler): Deleted.

  • css/StyleBuilderCustom.h:

(WebCore::StyleBuilderFunctions::applyValueDirection):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r175454 r175458  
     12014-11-01  Chris Dumez  <cdumez@apple.com>
     2
     3        Move "direction" CSS property to the new StyleBuilder
     4        https://bugs.webkit.org/show_bug.cgi?id=138288
     5
     6        Reviewed by Sam Weinig.
     7
     8        Move "direction" CSS property to the new StyleBuilder by using custom
     9        code as it requires special handling to call
     10        Document::setDirectionSetOnDocumentElement() when necessary.
     11
     12        No new tests, no behavior change.
     13
     14        * css/CSSPropertyNames.in:
     15        * css/DeprecatedStyleBuilder.cpp:
     16        (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
     17        (WebCore::ApplyPropertyDirection::applyValue): Deleted.
     18        (WebCore::ApplyPropertyDirection::createHandler): Deleted.
     19        * css/StyleBuilderCustom.h:
     20        (WebCore::StyleBuilderFunctions::applyValueDirection):
     21
    1222014-11-01  Sam Weinig  <sam@webkit.org>
    223
  • trunk/Source/WebCore/css/CSSPropertyNames.in

    r175454 r175458  
    5555// for applying them first.
    5656color [Inherited]
    57 direction [Inherited]
     57direction [Inherited, NewStyleBuilder, Custom=Value]
    5858display
    5959font [Inherited]
  • trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp

    r175439 r175458  
    301301
    302302    static PropertyHandler createHandler() { return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyValue); }
    303 };
    304 
    305 template <TextDirection (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(TextDirection), TextDirection (*initialFunction)()>
    306 class ApplyPropertyDirection {
    307 public:
    308     static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolver, CSSValue* value)
    309     {
    310         ApplyPropertyDefault<TextDirection, getterFunction, TextDirection, setterFunction, TextDirection, initialFunction>::applyValue(propertyID, styleResolver, value);
    311         Element* element = styleResolver->element();
    312         if (element && styleResolver->element() == element->document().documentElement())
    313             element->document().setDirectionSetOnDocumentElement(true);
    314     }
    315 
    316     static PropertyHandler createHandler()
    317     {
    318         PropertyHandler handler = ApplyPropertyDefault<TextDirection, getterFunction, TextDirection, setterFunction, TextDirection, initialFunction>::createHandler();
    319         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
    320     }
    321303};
    322304
     
    20902072    setPropertyHandler(CSSPropertyCounterReset, ApplyPropertyCounter<Reset>::createHandler());
    20912073    setPropertyHandler(CSSPropertyCursor, ApplyPropertyCursor::createHandler());
    2092     setPropertyHandler(CSSPropertyDirection, ApplyPropertyDirection<&RenderStyle::direction, &RenderStyle::setDirection, RenderStyle::initialDirection>::createHandler());
    20932074    setPropertyHandler(CSSPropertyDisplay, ApplyPropertyDisplay::createHandler());
    20942075    setPropertyHandler(CSSPropertyFontFamily, ApplyPropertyFontFamily::createHandler());
  • trunk/Source/WebCore/css/StyleBuilderCustom.h

    r175445 r175458  
    5858}
    5959
     60inline void applyValueDirection(StyleResolver& styleResolver, CSSValue& value)
     61{
     62    styleResolver.style()->setDirection(downcast<CSSPrimitiveValue>(value));
     63
     64    Element* element = styleResolver.element();
     65    if (element && styleResolver.element() == element->document().documentElement())
     66        element->document().setDirectionSetOnDocumentElement(true);
     67}
     68
    6069} // namespace StyleBuilderFunctions
    6170
Note: See TracChangeset for help on using the changeset viewer.