Ignore:
Timestamp:
Sep 19, 2013, 6:00:19 PM (12 years ago)
Author:
[email protected]
Message:

Modernize Length setters/getters
https://bugs.webkit.org/show_bug.cgi?id=121647

Reviewed by Andreas Kling.

Add a move constructor and move assignment operator to Length and fixup some of the getters and setters.

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::getBorderRadiusCornerValues):
(WebCore::getBorderRadiusCornerValue):

  • css/DeprecatedStyleBuilder.cpp:

(WebCore::ApplyPropertyLength::setValue):
(WebCore::ApplyPropertyLength::createHandler):
(WebCore::ApplyPropertyBorderRadius::setValue):
(WebCore::ApplyPropertyBorderRadius::createHandler):
(WebCore::ApplyPropertyLineHeight::createHandler):

  • page/animation/CSSPropertyAnimation.cpp:

(WebCore::LengthPropertyWrapper::LengthPropertyWrapper):
(WebCore::LengthPropertyWrapper::blend):
(WebCore::FillLayerPropertyWrapper::FillLayerPropertyWrapper):
(WebCore::FillLayerPropertyWrapper::blend):
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):

  • platform/CalculationValue.h:

(WebCore::CalcExpressionLength::CalcExpressionLength):
(WebCore::CalcExpressionBlendLength::CalcExpressionBlendLength):

  • platform/Length.cpp:

(WebCore::CalculationValueHandleMap::remove):
(WebCore::CalculationValueHandleMap::find):
(WebCore::Length::decrementCalculatedRef):

  • platform/Length.h:

(WebCore::Length::Length):
(WebCore::Length::operator=):
(WebCore::Length::moveFromLength):

  • platform/LengthBox.cpp:

(WebCore::LengthBox::logicalLeft):
(WebCore::LengthBox::logicalRight):
(WebCore::LengthBox::before):
(WebCore::LengthBox::after):
(WebCore::LengthBox::start):
(WebCore::LengthBox::end):

  • platform/LengthBox.h:

(WebCore::LengthBox::LengthBox):
(WebCore::LengthBox::left):
(WebCore::LengthBox::right):
(WebCore::LengthBox::top):
(WebCore::LengthBox::bottom):

  • platform/LengthSize.h:

(WebCore::LengthSize::LengthSize):
(WebCore::LengthSize::setWidth):
(WebCore::LengthSize::width):
(WebCore::LengthSize::setHeight):
(WebCore::LengthSize::height):

  • platform/graphics/filters/FilterOperation.h:

(WebCore::FilterOperation::BlurFilterOperation::create):
(WebCore::FilterOperation::BlurFilterOperation::stdDeviation):
(WebCore::FilterOperation::BlurFilterOperation::BlurFilterOperation):

  • rendering/style/BasicShapes.h:

(WebCore::BasicShapeRectangle::x):
(WebCore::BasicShapeRectangle::y):
(WebCore::BasicShapeRectangle::width):
(WebCore::BasicShapeRectangle::height):
(WebCore::BasicShapeRectangle::cornerRadiusX):
(WebCore::BasicShapeRectangle::cornerRadiusY):
(WebCore::BasicShapeRectangle::setX):
(WebCore::BasicShapeRectangle::setY):
(WebCore::BasicShapeRectangle::setWidth):
(WebCore::BasicShapeRectangle::setHeight):
(WebCore::BasicShapeRectangle::setCornerRadiusX):
(WebCore::BasicShapeRectangle::setCornerRadiusY):
(WebCore::BasicShapeCircle::centerX):
(WebCore::BasicShapeCircle::centerY):
(WebCore::BasicShapeCircle::radius):
(WebCore::BasicShapeCircle::setCenterX):
(WebCore::BasicShapeCircle::setCenterY):
(WebCore::BasicShapeCircle::setRadius):
(WebCore::BasicShapeEllipse::centerX):
(WebCore::BasicShapeEllipse::centerY):
(WebCore::BasicShapeEllipse::radiusX):
(WebCore::BasicShapeEllipse::radiusY):
(WebCore::BasicShapeEllipse::setCenterX):
(WebCore::BasicShapeEllipse::setCenterY):
(WebCore::BasicShapeEllipse::setRadiusX):
(WebCore::BasicShapeEllipse::setRadiusY):
(WebCore::BasicShapePolygon::getXAt):
(WebCore::BasicShapePolygon::getYAt):
(WebCore::BasicShapePolygon::appendPoint):
(WebCore::BasicShapeInsetRectangle::top):
(WebCore::BasicShapeInsetRectangle::right):
(WebCore::BasicShapeInsetRectangle::bottom):
(WebCore::BasicShapeInsetRectangle::left):
(WebCore::BasicShapeInsetRectangle::cornerRadiusX):
(WebCore::BasicShapeInsetRectangle::cornerRadiusY):
(WebCore::BasicShapeInsetRectangle::setTop):
(WebCore::BasicShapeInsetRectangle::setRight):
(WebCore::BasicShapeInsetRectangle::setBottom):
(WebCore::BasicShapeInsetRectangle::setLeft):
(WebCore::BasicShapeInsetRectangle::setCornerRadiusX):
(WebCore::BasicShapeInsetRectangle::setCornerRadiusY):

  • rendering/style/FillLayer.h:

(WebCore::FillSize::FillSize):
(WebCore::FillLayer::xPosition):
(WebCore::FillLayer::yPosition):
(WebCore::FillLayer::sizeLength):
(WebCore::FillLayer::setXPosition):
(WebCore::FillLayer::setYPosition):

  • rendering/style/NinePieceImage.cpp:

(WebCore::NinePieceImage::NinePieceImage):

  • rendering/style/NinePieceImage.h:

(WebCore::NinePieceImage::setImageSlices):
(WebCore::NinePieceImage::setBorderSlices):
(WebCore::NinePieceImage::setOutset):
(WebCore::NinePieceImage::computeOutset):

  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::specifiedLineHeight):

  • rendering/style/RenderStyle.h:
  • rendering/style/StyleBoxData.h:

(WebCore::StyleBoxData::width):
(WebCore::StyleBoxData::height):
(WebCore::StyleBoxData::minWidth):
(WebCore::StyleBoxData::minHeight):
(WebCore::StyleBoxData::maxWidth):
(WebCore::StyleBoxData::maxHeight):
(WebCore::StyleBoxData::verticalAlign):

  • rendering/style/StyleReflection.h:

(WebCore::StyleReflection::offset):
(WebCore::StyleReflection::setOffset):

File:
1 edited

Legend:

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

    r156091 r156132  
    347347enum LengthNone { NoneDisabled = 0, NoneEnabled };
    348348enum LengthUndefined { UndefinedDisabled = 0, UndefinedEnabled };
    349 template <Length (RenderStyle::*getterFunction)() const,
     349template <const Length& (RenderStyle::*getterFunction)() const,
    350350          void (RenderStyle::*setterFunction)(Length),
    351351          Length (*initialFunction)(),
     
    357357class ApplyPropertyLength {
    358358public:
    359     static void setValue(RenderStyle* style, Length value) { (style->*setterFunction)(value); }
     359    static void setValue(RenderStyle* style, Length value) { (style->*setterFunction)(std::move(value)); }
    360360    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
    361361    {
     
    403403    static PropertyHandler createHandler()
    404404    {
    405         PropertyHandler handler = ApplyPropertyDefaultBase<Length, getterFunction, Length, setterFunction, Length, initialFunction>::createHandler();
     405        PropertyHandler handler = ApplyPropertyDefaultBase<const Length&, getterFunction, Length, setterFunction, Length, initialFunction>::createHandler();
    406406        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
    407407    }
     
    431431};
    432432
    433 template <LengthSize (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(LengthSize), LengthSize (*initialFunction)()>
     433template <const LengthSize& (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(LengthSize), LengthSize (*initialFunction)()>
    434434class ApplyPropertyBorderRadius {
    435435public:
    436     static void setValue(RenderStyle* style, LengthSize value) { (style->*setterFunction)(value); }
     436    static void setValue(RenderStyle* style, LengthSize value) { (style->*setterFunction)(std::move(value)); }
    437437    static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
    438438    {
     
    477477    static PropertyHandler createHandler()
    478478    {
    479         PropertyHandler handler = ApplyPropertyDefaultBase<LengthSize, getterFunction, LengthSize, setterFunction, LengthSize, initialFunction>::createHandler();
     479        PropertyHandler handler = ApplyPropertyDefaultBase<const LengthSize&, getterFunction, LengthSize, setterFunction, LengthSize, initialFunction>::createHandler();
    480480        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
    481481    }
     
    486486    typedef T Setter;
    487487    typedef T Getter;
     488    typedef T InitialGetter;
    488489};
    489490
     
    492493    typedef PassRefPtr<StyleImage> Setter;
    493494    typedef StyleImage* Getter;
     495    typedef StyleImage* InitialGetter;
     496};
     497
     498template<>
     499struct FillLayerAccessorTypes<Length>
     500{
     501    typedef Length Setter;
     502    typedef const Length& Getter;
     503    typedef Length InitialGetter;
    494504};
    495505
     
    503513          void (FillLayer::*setFunction)(typename FillLayerAccessorTypes<T>::Setter),
    504514          void (FillLayer::*clearFunction)(),
    505           typename FillLayerAccessorTypes<T>::Getter (*initialFunction)(EFillLayerType),
     515          typename FillLayerAccessorTypes<T>::InitialGetter (*initialFunction)(EFillLayerType),
    506516          void (CSSToStyleMap::*mapFillFunction)(CSSPropertyID, FillLayer*, CSSValue*)>
    507517class ApplyPropertyFillLayer {
     
    14211431    static PropertyHandler createHandler()
    14221432    {
    1423         PropertyHandler handler = ApplyPropertyDefaultBase<Length, &RenderStyle::specifiedLineHeight, Length, &RenderStyle::setLineHeight, Length, &RenderStyle::initialLineHeight>::createHandler();
     1433        PropertyHandler handler = ApplyPropertyDefaultBase<const Length&, &RenderStyle::specifiedLineHeight, Length, &RenderStyle::setLineHeight, Length, &RenderStyle::initialLineHeight>::createHandler();
    14241434        return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
    14251435    }
Note: See TracChangeset for help on using the changeset viewer.