Changeset 175481 in webkit


Ignore:
Timestamp:
Nov 3, 2014 11:40:23 AM (9 years ago)
Author:
Chris Dumez
Message:

Move -webkit-shape-outside to the new StyleBuilder
https://bugs.webkit.org/show_bug.cgi?id=138296

Reviewed by Zoltan Horvath.

Move -webkit-shape-outside to the new StyleBuilder, using custom
code as it does not always call setShapeOutside().

No new tests, no behavior change.

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

(WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
(WebCore::ApplyPropertyShape::setValue): Deleted.
(WebCore::ApplyPropertyShape::applyValue): Deleted.
(WebCore::ApplyPropertyShape::createHandler): Deleted.

  • css/StyleBuilderCustom.h:

(WebCore::StyleBuilderFunctions::applyValueWebkitShapeOutside):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r175477 r175481  
     12014-11-03  Chris Dumez  <cdumez@apple.com>
     2
     3        Move -webkit-shape-outside to the new StyleBuilder
     4        https://bugs.webkit.org/show_bug.cgi?id=138296
     5
     6        Reviewed by Zoltan Horvath.
     7
     8        Move -webkit-shape-outside to the new StyleBuilder, using custom
     9        code as it does not always call setShapeOutside().
     10
     11        No new tests, no behavior change.
     12
     13        * css/CSSPropertyNames.in:
     14        * css/DeprecatedStyleBuilder.cpp:
     15        (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
     16        (WebCore::ApplyPropertyShape::setValue): Deleted.
     17        (WebCore::ApplyPropertyShape::applyValue): Deleted.
     18        (WebCore::ApplyPropertyShape::createHandler): Deleted.
     19        * css/StyleBuilderCustom.h:
     20        (WebCore::StyleBuilderFunctions::applyValueWebkitShapeOutside):
     21
    1222014-11-03  Alexey Proskuryakov  <ap@apple.com>
    223
  • trunk/Source/WebCore/css/CSSPropertyNames.in

    r175467 r175481  
    515515#endif
    516516#if defined(ENABLE_CSS_SHAPES) && ENABLE_CSS_SHAPES
    517 -webkit-shape-outside
     517-webkit-shape-outside [NewStyleBuilder, Custom=Value]
    518518-webkit-shape-margin [NewStyleBuilder, Converter=Length]
    519519-webkit-shape-image-threshold [NewStyleBuilder, Converter=Number<float>]
  • trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp

    r175467 r175481  
    18031803    }
    18041804};
    1805 
    1806 #if ENABLE(CSS_SHAPES)
    1807 template <ShapeValue* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<ShapeValue>), ShapeValue* (*initialFunction)()>
    1808 class ApplyPropertyShape {
    1809 public:
    1810     static void setValue(RenderStyle* style, PassRefPtr<ShapeValue> value) { (style->*setterFunction)(value); }
    1811     static void applyValue(CSSPropertyID property, StyleResolver* styleResolver, CSSValue* value)
    1812     {
    1813         if (is<CSSPrimitiveValue>(*value)) {
    1814             CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);
    1815             if (primitiveValue.getValueID() == CSSValueAuto)
    1816                 setValue(styleResolver->style(), 0);
    1817         } else if (value->isImageValue() || value->isImageGeneratorValue() || value->isImageSetValue()) {
    1818             RefPtr<ShapeValue> shape = ShapeValue::createImageValue(styleResolver->styleImage(property, value));
    1819             setValue(styleResolver->style(), shape.release());
    1820         } else if (is<CSSValueList>(*value)) {
    1821             RefPtr<BasicShape> shape;
    1822             CSSBoxType referenceBox = BoxMissing;
    1823             CSSValueList& valueList = downcast<CSSValueList>(*value);
    1824             for (unsigned i = 0; i < valueList.length(); ++i) {
    1825                 CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*valueList.itemWithoutBoundsCheck(i));
    1826                 if (primitiveValue.isShape())
    1827                     shape = basicShapeForValue(styleResolver->state().cssToLengthConversionData(), primitiveValue.getShapeValue());
    1828                 else if (primitiveValue.getValueID() == CSSValueContentBox
    1829                     || primitiveValue.getValueID() == CSSValueBorderBox
    1830                     || primitiveValue.getValueID() == CSSValuePaddingBox
    1831                     || primitiveValue.getValueID() == CSSValueMarginBox)
    1832                     referenceBox = CSSBoxType(primitiveValue);
    1833                 else
    1834                     return;
    1835             }
    1836 
    1837             if (shape)
    1838                 setValue(styleResolver->style(), ShapeValue::createShapeValue(shape.release(), referenceBox));
    1839             else if (referenceBox != BoxMissing)
    1840                 setValue(styleResolver->style(), ShapeValue::createBoxShapeValue(referenceBox));
    1841 
    1842         }
    1843     }
    1844 
    1845     static PropertyHandler createHandler()
    1846     {
    1847         PropertyHandler handler = ApplyPropertyDefaultBase<ShapeValue*, getterFunction, PassRefPtr<ShapeValue>, setterFunction, ShapeValue*, initialFunction>::createHandler();
    1848         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
    1849     }
    1850 };
    1851 #endif
    18521805
    18531806#if ENABLE(CSS_IMAGE_RESOLUTION)
     
    20712024    setPropertyHandler(CSSPropertyWebkitTransitionTimingFunction, ApplyPropertyAnimation<const PassRefPtr<TimingFunction>, &Animation::timingFunction, &Animation::setTimingFunction, &Animation::isTimingFunctionSet, &Animation::clearTimingFunction, &Animation::initialAnimationTimingFunction, &CSSToStyleMap::mapAnimationTimingFunction, &RenderStyle::accessTransitions, &RenderStyle::transitions>::createHandler());
    20722025    setPropertyHandler(CSSPropertyWebkitClipPath, ApplyPropertyClipPath<&RenderStyle::clipPath, &RenderStyle::setClipPath, &RenderStyle::initialClipPath>::createHandler());
    2073 #if ENABLE(CSS_SHAPES)
    2074     setPropertyHandler(CSSPropertyWebkitShapeOutside, ApplyPropertyShape<&RenderStyle::shapeOutside, &RenderStyle::setShapeOutside, &RenderStyle::initialShapeOutside>::createHandler());
    2075 #endif
    20762026    setPropertyHandler(CSSPropertyWidows, ApplyPropertyAuto<short, &RenderStyle::widows, &RenderStyle::setWidows, &RenderStyle::hasAutoWidows, &RenderStyle::setHasAutoWidows>::createHandler());
    20772027    setPropertyHandler(CSSPropertyWordSpacing, ApplyPropertyWordSpacing::createHandler());
  • trunk/Source/WebCore/css/StyleBuilderCustom.h

    r175467 r175481  
    2828#define StyleBuilderCustom_h
    2929
     30#include "BasicShapeFunctions.h"
     31#include "CSSImageGeneratorValue.h"
     32#include "CSSImageSetValue.h"
     33#include "CSSImageValue.h"
    3034#include "StyleResolver.h"
    3135
     
    110114}
    111115
     116#if ENABLE(CSS_SHAPES)
     117inline void applyValueWebkitShapeOutside(StyleResolver& styleResolver, CSSValue& value)
     118{
     119    if (is<CSSPrimitiveValue>(value)) {
     120        // FIXME: Shouldn't this be CSSValueNone?
     121        // http://www.w3.org/TR/css-shapes/#shape-outside-property
     122        if (downcast<CSSPrimitiveValue>(value).getValueID() == CSSValueAuto)
     123            styleResolver.style()->setShapeOutside(nullptr);
     124    } if (is<CSSImageValue>(value) || is<CSSImageGeneratorValue>(value) || is<CSSImageSetValue>(value)) {
     125        RefPtr<ShapeValue> shape = ShapeValue::createImageValue(styleResolver.styleImage(CSSPropertyWebkitShapeOutside, &value));
     126        styleResolver.style()->setShapeOutside(shape.release());
     127    } else if (is<CSSValueList>(value)) {
     128        RefPtr<BasicShape> shape;
     129        CSSBoxType referenceBox = BoxMissing;
     130        auto& valueList = downcast<CSSValueList>(value);
     131        for (unsigned i = 0; i < valueList.length(); ++i) {
     132            CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*valueList.itemWithoutBoundsCheck(i));
     133            if (primitiveValue.isShape())
     134                shape = basicShapeForValue(styleResolver.state().cssToLengthConversionData(), primitiveValue.getShapeValue());
     135            else if (primitiveValue.getValueID() == CSSValueContentBox
     136                || primitiveValue.getValueID() == CSSValueBorderBox
     137                || primitiveValue.getValueID() == CSSValuePaddingBox
     138                || primitiveValue.getValueID() == CSSValueMarginBox)
     139                referenceBox = CSSBoxType(primitiveValue);
     140            else
     141                return;
     142        }
     143
     144        if (shape)
     145            styleResolver.style()->setShapeOutside(ShapeValue::createShapeValue(shape.release(), referenceBox));
     146        else if (referenceBox != BoxMissing)
     147            styleResolver.style()->setShapeOutside(ShapeValue::createBoxShapeValue(referenceBox));
     148    }
     149}
     150#endif // ENABLE(CSS_SHAPES)
     151
    112152} // namespace StyleBuilderFunctions
    113153
Note: See TracChangeset for help on using the changeset viewer.