Ignore:
Timestamp:
Jun 27, 2012, 10:45:24 AM (13 years ago)
Author:
[email protected]
Message:

Move CSSWrapShape style resolution from StyleResolver to StyleBuilder
https://bugs.webkit.org/show_bug.cgi?id=89668

Patch by Hans Muller <[email protected]> on 2012-06-27
Reviewed by Andreas Kling.

Moved the resolution of the shapeInside and shapeOutside CSS properties
from the StyleResolver class to StyleBuilder. This is just refactoring
in preparation for fixing https://bugs.webkit.org/show_bug.cgi?id=89670.

No new tests were required.

  • css/StyleBuilder.cpp:

(WebCore):
(ApplyPropertyWrapShape):
(WebCore::ApplyPropertyWrapShape::setValue):
(WebCore::ApplyPropertyWrapShape::applyValue):
(WebCore::ApplyPropertyWrapShape::createHandler):
(WebCore::StyleBuilder::StyleBuilder):

  • css/StyleResolver.cpp:

(WebCore::StyleResolver::collectMatchingRulesForList):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/StyleBuilder.cpp

    r121289 r121349  
    17801780
    17811781};
     1782
     1783#if ENABLE(CSS_EXCLUSIONS)
     1784template <CSSWrapShape* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<CSSWrapShape>), CSSWrapShape* (*initialFunction)()>
     1785class ApplyPropertyWrapShape {
     1786public:
     1787    static void setValue(RenderStyle* style, PassRefPtr<CSSWrapShape> value) { (style->*setterFunction)(value); }
     1788    static void applyValue(StyleResolver* styleResolver, CSSValue* value)
     1789    {
     1790        if (value->isPrimitiveValue()) {
     1791            CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
     1792            if (primitiveValue->getIdent() == CSSValueAuto)
     1793                setValue(styleResolver->style(), 0);
     1794            else if (primitiveValue->isShape())
     1795                setValue(styleResolver->style(), primitiveValue->getShapeValue());
     1796        }
     1797    }
     1798    static PropertyHandler createHandler()
     1799    {
     1800        PropertyHandler handler = ApplyPropertyDefaultBase<CSSWrapShape*, getterFunction, PassRefPtr<CSSWrapShape>, setterFunction, CSSWrapShape*, initialFunction>::createHandler();
     1801        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
     1802    }
     1803};
     1804#endif
    17821805
    17831806#if ENABLE(CSS_IMAGE_RESOLUTION)
     
    20952118    setPropertyHandler(CSSPropertyWebkitWrapPadding, ApplyPropertyLength<&RenderStyle::wrapPadding, &RenderStyle::setWrapPadding, &RenderStyle::initialWrapPadding>::createHandler());
    20962119    setPropertyHandler(CSSPropertyWebkitWrapThrough, ApplyPropertyDefault<WrapThrough, &RenderStyle::wrapThrough, WrapThrough, &RenderStyle::setWrapThrough, WrapThrough, &RenderStyle::initialWrapThrough>::createHandler());
     2120    setPropertyHandler(CSSPropertyWebkitShapeInside, ApplyPropertyWrapShape<&RenderStyle::wrapShapeInside, &RenderStyle::setWrapShapeInside, &RenderStyle::initialWrapShapeInside>::createHandler());
     2121    setPropertyHandler(CSSPropertyWebkitShapeOutside, ApplyPropertyWrapShape<&RenderStyle::wrapShapeOutside, &RenderStyle::setWrapShapeOutside, &RenderStyle::initialWrapShapeOutside>::createHandler());
    20972122#endif
    20982123    setPropertyHandler(CSSPropertyWhiteSpace, ApplyPropertyDefault<EWhiteSpace, &RenderStyle::whiteSpace, EWhiteSpace, &RenderStyle::setWhiteSpace, EWhiteSpace, &RenderStyle::initialWhiteSpace>::createHandler());
Note: See TracChangeset for help on using the changeset viewer.