Modernize Length setters/getters
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Sep 2013 01:00:19 +0000 (01:00 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Sep 2013 01:00:19 +0000 (01:00 +0000)
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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156132 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/DeprecatedStyleBuilder.cpp
Source/WebCore/page/animation/CSSPropertyAnimation.cpp
Source/WebCore/platform/CalculationValue.h
Source/WebCore/platform/Length.cpp
Source/WebCore/platform/Length.h
Source/WebCore/platform/LengthBox.cpp
Source/WebCore/platform/LengthBox.h
Source/WebCore/platform/LengthSize.h
Source/WebCore/platform/graphics/filters/FilterOperation.h
Source/WebCore/rendering/style/BasicShapes.h
Source/WebCore/rendering/style/FillLayer.h
Source/WebCore/rendering/style/NinePieceImage.cpp
Source/WebCore/rendering/style/NinePieceImage.h
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/StyleBoxData.h
Source/WebCore/rendering/style/StyleReflection.h

index 016be6c..5ae386c 100644 (file)
@@ -1,3 +1,132 @@
+2013-09-19  Anders Carlsson  <andersca@apple.com>
+
+        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):
+
 2013-09-19  Andreas Kling  <akling@apple.com>
 
         Out-of-line InspectorValues create() methods.
index 5ea05c4..22939fa 100644 (file)
@@ -703,7 +703,7 @@ PassRefPtr<CSSPrimitiveValue> ComputedStyleExtractor::currentColorOrValidColor(R
     return cssValuePool().createColorValue(color.rgb());
 }
 
-static PassRefPtr<CSSValueList> getBorderRadiusCornerValues(LengthSize radius, const RenderStyle* style, RenderView* renderView)
+static PassRefPtr<CSSValueList> getBorderRadiusCornerValues(const LengthSize& radius, const RenderStyle* style, RenderView* renderView)
 {
     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
     if (radius.width().type() == Percent)
@@ -717,7 +717,7 @@ static PassRefPtr<CSSValueList> getBorderRadiusCornerValues(LengthSize radius, c
     return list.release();
 }
 
-static PassRefPtr<CSSValue> getBorderRadiusCornerValue(LengthSize radius, const RenderStyle* style, RenderView* renderView)
+static PassRefPtr<CSSValue> getBorderRadiusCornerValue(const LengthSize& radius, const RenderStyle* style, RenderView* renderView)
 {
     if (radius.width() == radius.height()) {
         if (radius.width().type() == Percent)
@@ -1586,7 +1586,7 @@ static PassRefPtr<CSSPrimitiveValue> fontWeightFromStyle(RenderStyle* style)
     return cssValuePool().createIdentifierValue(CSSValueNormal);
 }
 
-typedef Length (RenderStyle::*RenderStyleLengthGetter)() const;
+typedef const Length& (RenderStyle::*RenderStyleLengthGetter)() const;
 typedef LayoutUnit (RenderBoxModelObject::*RenderBoxComputedCSSValueGetter)() const;
 
 template<RenderStyleLengthGetter lengthGetter, RenderBoxComputedCSSValueGetter computedCSSValueGetter>
index 11957d8..ff58520 100644 (file)
@@ -346,7 +346,7 @@ enum LengthLegacyIntrinsic { LegacyIntrinsicDisabled = 0, LegacyIntrinsicEnabled
 enum LengthIntrinsic { IntrinsicDisabled = 0, IntrinsicEnabled };
 enum LengthNone { NoneDisabled = 0, NoneEnabled };
 enum LengthUndefined { UndefinedDisabled = 0, UndefinedEnabled };
-template <Length (RenderStyle::*getterFunction)() const,
+template <const Length& (RenderStyle::*getterFunction)() const,
           void (RenderStyle::*setterFunction)(Length),
           Length (*initialFunction)(),
           LengthAuto autoEnabled = AutoDisabled,
@@ -356,7 +356,7 @@ template <Length (RenderStyle::*getterFunction)() const,
           LengthUndefined noneUndefined = UndefinedDisabled>
 class ApplyPropertyLength {
 public:
-    static void setValue(RenderStyle* style, Length value) { (style->*setterFunction)(value); }
+    static void setValue(RenderStyle* style, Length value) { (style->*setterFunction)(std::move(value)); }
     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
     {
         if (!value->isPrimitiveValue())
@@ -402,7 +402,7 @@ public:
 
     static PropertyHandler createHandler()
     {
-        PropertyHandler handler = ApplyPropertyDefaultBase<Length, getterFunction, Length, setterFunction, Length, initialFunction>::createHandler();
+        PropertyHandler handler = ApplyPropertyDefaultBase<const Length&, getterFunction, Length, setterFunction, Length, initialFunction>::createHandler();
         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
     }
 };
@@ -430,10 +430,10 @@ public:
     }
 };
 
-template <LengthSize (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(LengthSize), LengthSize (*initialFunction)()>
+template <const LengthSize& (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(LengthSize), LengthSize (*initialFunction)()>
 class ApplyPropertyBorderRadius {
 public:
-    static void setValue(RenderStyle* style, LengthSize value) { (style->*setterFunction)(value); }
+    static void setValue(RenderStyle* style, LengthSize value) { (style->*setterFunction)(std::move(value)); }
     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
     {
         if (!value->isPrimitiveValue())
@@ -476,7 +476,7 @@ public:
     }
     static PropertyHandler createHandler()
     {
-        PropertyHandler handler = ApplyPropertyDefaultBase<LengthSize, getterFunction, LengthSize, setterFunction, LengthSize, initialFunction>::createHandler();
+        PropertyHandler handler = ApplyPropertyDefaultBase<const LengthSize&, getterFunction, LengthSize, setterFunction, LengthSize, initialFunction>::createHandler();
         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
     }
 };
@@ -485,12 +485,22 @@ template <typename T>
 struct FillLayerAccessorTypes {
     typedef T Setter;
     typedef T Getter;
+    typedef T InitialGetter;
 };
 
 template <>
 struct FillLayerAccessorTypes<StyleImage*> {
     typedef PassRefPtr<StyleImage> Setter;
     typedef StyleImage* Getter;
+    typedef StyleImage* InitialGetter;
+};
+
+template<>
+struct FillLayerAccessorTypes<Length>
+{
+    typedef Length Setter;
+    typedef const Length& Getter;
+    typedef Length InitialGetter;
 };
 
 template <typename T,
@@ -502,7 +512,7 @@ template <typename T,
           typename FillLayerAccessorTypes<T>::Getter (FillLayer::*getFunction)() const,
           void (FillLayer::*setFunction)(typename FillLayerAccessorTypes<T>::Setter),
           void (FillLayer::*clearFunction)(),
-          typename FillLayerAccessorTypes<T>::Getter (*initialFunction)(EFillLayerType),
+          typename FillLayerAccessorTypes<T>::InitialGetter (*initialFunction)(EFillLayerType),
           void (CSSToStyleMap::*mapFillFunction)(CSSPropertyID, FillLayer*, CSSValue*)>
 class ApplyPropertyFillLayer {
 public:
@@ -1420,7 +1430,7 @@ public:
     }
     static PropertyHandler createHandler()
     {
-        PropertyHandler handler = ApplyPropertyDefaultBase<Length, &RenderStyle::specifiedLineHeight, Length, &RenderStyle::setLineHeight, Length, &RenderStyle::initialLineHeight>::createHandler();
+        PropertyHandler handler = ApplyPropertyDefaultBase<const Length&, &RenderStyle::specifiedLineHeight, Length, &RenderStyle::setLineHeight, Length, &RenderStyle::initialLineHeight>::createHandler();
         return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue);
     }
 };
index 275f2f8..ca33a6e 100644 (file)
@@ -461,6 +461,23 @@ protected:
     void (RenderStyle::*m_setter)(PassRefPtr<T>);
 };
 
+template <typename T>
+class LengthPropertyWrapper : public PropertyWrapperGetter<const T&> {
+public:
+    LengthPropertyWrapper(CSSPropertyID prop, const T& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(T))
+        : PropertyWrapperGetter<const T&>(prop, getter)
+        , m_setter(setter)
+    {
+    }
+
+    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
+    {
+        (dst->*m_setter)(blendFunc(anim, (a->*PropertyWrapperGetter<const T&>::m_getter)(), (b->*PropertyWrapperGetter<const T&>::m_getter)(), progress));
+    }
+
+protected:
+    void (RenderStyle::*m_setter)(T);
+};
 
 class PropertyWrapperClipPath : public RefCountedPropertyWrapper<ClipPathOperation> {
 public:
@@ -519,6 +536,7 @@ protected:
     void (RenderStyle::*m_setter)(const Color&);
 };
 
+
 #if USE(ACCELERATED_COMPOSITING)
 class PropertyWrapperAcceleratedOpacity : public PropertyWrapper<float> {
 public:
@@ -827,17 +845,17 @@ protected:
 };
 
 template <typename T>
-class FillLayerPropertyWrapper : public FillLayerPropertyWrapperGetter<T> {
+class FillLayerPropertyWrapper : public FillLayerPropertyWrapperGetter<const T&> {
 public:
-    FillLayerPropertyWrapper(T (FillLayer::*getter)() const, void (FillLayer::*setter)(T))
-        : FillLayerPropertyWrapperGetter<T>(getter)
+    FillLayerPropertyWrapper(const T& (FillLayer::*getter)() const, void (FillLayer::*setter)(T))
+        : FillLayerPropertyWrapperGetter<const T&>(getter)
         , m_setter(setter)
     {
     }
 
     virtual void blend(const AnimationBase* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const
     {
-        (dst->*m_setter)(blendFunc(anim, (a->*FillLayerPropertyWrapperGetter<T>::m_getter)(), (b->*FillLayerPropertyWrapperGetter<T>::m_getter)(), progress));
+        (dst->*m_setter)(blendFunc(anim, (a->*FillLayerPropertyWrapperGetter<const T&>::m_getter)(), (b->*FillLayerPropertyWrapperGetter<const T&>::m_getter)(), progress));
     }
 
 protected:
@@ -884,7 +902,6 @@ public:
     }
 };
 
-
 class FillLayersPropertyWrapper : public AnimationPropertyWrapperBase {
 public:
     typedef const FillLayer* (RenderStyle::*LayersGetter)() const;
@@ -1126,18 +1143,18 @@ CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap()
 {
     // build the list of property wrappers to do the comparisons and blends
     AnimationPropertyWrapperBase* animatableLonghandPropertyWrappers[] = {
-        new PropertyWrapper<Length>(CSSPropertyLeft, &RenderStyle::left, &RenderStyle::setLeft),
-        new PropertyWrapper<Length>(CSSPropertyRight, &RenderStyle::right, &RenderStyle::setRight),
-        new PropertyWrapper<Length>(CSSPropertyTop, &RenderStyle::top, &RenderStyle::setTop),
-        new PropertyWrapper<Length>(CSSPropertyBottom, &RenderStyle::bottom, &RenderStyle::setBottom),
+        new LengthPropertyWrapper<Length>(CSSPropertyLeft, &RenderStyle::left, &RenderStyle::setLeft),
+        new LengthPropertyWrapper<Length>(CSSPropertyRight, &RenderStyle::right, &RenderStyle::setRight),
+        new LengthPropertyWrapper<Length>(CSSPropertyTop, &RenderStyle::top, &RenderStyle::setTop),
+        new LengthPropertyWrapper<Length>(CSSPropertyBottom, &RenderStyle::bottom, &RenderStyle::setBottom),
 
-        new PropertyWrapper<Length>(CSSPropertyWidth, &RenderStyle::width, &RenderStyle::setWidth),
-        new PropertyWrapper<Length>(CSSPropertyMinWidth, &RenderStyle::minWidth, &RenderStyle::setMinWidth),
-        new PropertyWrapper<Length>(CSSPropertyMaxWidth, &RenderStyle::maxWidth, &RenderStyle::setMaxWidth),
+        new LengthPropertyWrapper<Length>(CSSPropertyWidth, &RenderStyle::width, &RenderStyle::setWidth),
+        new LengthPropertyWrapper<Length>(CSSPropertyMinWidth, &RenderStyle::minWidth, &RenderStyle::setMinWidth),
+        new LengthPropertyWrapper<Length>(CSSPropertyMaxWidth, &RenderStyle::maxWidth, &RenderStyle::setMaxWidth),
 
-        new PropertyWrapper<Length>(CSSPropertyHeight, &RenderStyle::height, &RenderStyle::setHeight),
-        new PropertyWrapper<Length>(CSSPropertyMinHeight, &RenderStyle::minHeight, &RenderStyle::setMinHeight),
-        new PropertyWrapper<Length>(CSSPropertyMaxHeight, &RenderStyle::maxHeight, &RenderStyle::setMaxHeight),
+        new LengthPropertyWrapper<Length>(CSSPropertyHeight, &RenderStyle::height, &RenderStyle::setHeight),
+        new LengthPropertyWrapper<Length>(CSSPropertyMinHeight, &RenderStyle::minHeight, &RenderStyle::setMinHeight),
+        new LengthPropertyWrapper<Length>(CSSPropertyMaxHeight, &RenderStyle::maxHeight, &RenderStyle::setMaxHeight),
 
         new PropertyWrapperFlex(),
 
@@ -1145,14 +1162,14 @@ CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap()
         new PropertyWrapper<unsigned>(CSSPropertyBorderRightWidth, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth),
         new PropertyWrapper<unsigned>(CSSPropertyBorderTopWidth, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth),
         new PropertyWrapper<unsigned>(CSSPropertyBorderBottomWidth, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth),
-        new PropertyWrapper<Length>(CSSPropertyMarginLeft, &RenderStyle::marginLeft, &RenderStyle::setMarginLeft),
-        new PropertyWrapper<Length>(CSSPropertyMarginRight, &RenderStyle::marginRight, &RenderStyle::setMarginRight),
-        new PropertyWrapper<Length>(CSSPropertyMarginTop, &RenderStyle::marginTop, &RenderStyle::setMarginTop),
-        new PropertyWrapper<Length>(CSSPropertyMarginBottom, &RenderStyle::marginBottom, &RenderStyle::setMarginBottom),
-        new PropertyWrapper<Length>(CSSPropertyPaddingLeft, &RenderStyle::paddingLeft, &RenderStyle::setPaddingLeft),
-        new PropertyWrapper<Length>(CSSPropertyPaddingRight, &RenderStyle::paddingRight, &RenderStyle::setPaddingRight),
-        new PropertyWrapper<Length>(CSSPropertyPaddingTop, &RenderStyle::paddingTop, &RenderStyle::setPaddingTop),
-        new PropertyWrapper<Length>(CSSPropertyPaddingBottom, &RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom),
+        new LengthPropertyWrapper<Length>(CSSPropertyMarginLeft, &RenderStyle::marginLeft, &RenderStyle::setMarginLeft),
+        new LengthPropertyWrapper<Length>(CSSPropertyMarginRight, &RenderStyle::marginRight, &RenderStyle::setMarginRight),
+        new LengthPropertyWrapper<Length>(CSSPropertyMarginTop, &RenderStyle::marginTop, &RenderStyle::setMarginTop),
+        new LengthPropertyWrapper<Length>(CSSPropertyMarginBottom, &RenderStyle::marginBottom, &RenderStyle::setMarginBottom),
+        new LengthPropertyWrapper<Length>(CSSPropertyPaddingLeft, &RenderStyle::paddingLeft, &RenderStyle::setPaddingLeft),
+        new LengthPropertyWrapper<Length>(CSSPropertyPaddingRight, &RenderStyle::paddingRight, &RenderStyle::setPaddingRight),
+        new LengthPropertyWrapper<Length>(CSSPropertyPaddingTop, &RenderStyle::paddingTop, &RenderStyle::setPaddingTop),
+        new LengthPropertyWrapper<Length>(CSSPropertyPaddingBottom, &RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom),
         new PropertyWrapperVisitedAffectedColor(CSSPropertyColor, &RenderStyle::color, &RenderStyle::setColor, &RenderStyle::visitedLinkColor, &RenderStyle::setVisitedLinkColor),
 
         new PropertyWrapperVisitedAffectedColor(CSSPropertyBackgroundColor, &RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor, &RenderStyle::visitedLinkBackgroundColor, &RenderStyle::setVisitedLinkBackgroundColor),
@@ -1162,9 +1179,9 @@ CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap()
         new StyleImagePropertyWrapper(CSSPropertyWebkitMaskImage, &RenderStyle::maskImage, &RenderStyle::setMaskImage),
 
         new StyleImagePropertyWrapper(CSSPropertyBorderImageSource, &RenderStyle::borderImageSource, &RenderStyle::setBorderImageSource),
-        new PropertyWrapper<LengthBox>(CSSPropertyBorderImageSlice, &RenderStyle::borderImageSlices, &RenderStyle::setBorderImageSlices),
-        new PropertyWrapper<LengthBox>(CSSPropertyBorderImageWidth, &RenderStyle::borderImageWidth, &RenderStyle::setBorderImageWidth),
-        new PropertyWrapper<LengthBox>(CSSPropertyBorderImageOutset, &RenderStyle::borderImageOutset, &RenderStyle::setBorderImageOutset),
+        new LengthPropertyWrapper<LengthBox>(CSSPropertyBorderImageSlice, &RenderStyle::borderImageSlices, &RenderStyle::setBorderImageSlices),
+        new LengthPropertyWrapper<LengthBox>(CSSPropertyBorderImageWidth, &RenderStyle::borderImageWidth, &RenderStyle::setBorderImageWidth),
+        new LengthPropertyWrapper<LengthBox>(CSSPropertyBorderImageOutset, &RenderStyle::borderImageOutset, &RenderStyle::setBorderImageOutset),
 
         new StyleImagePropertyWrapper(CSSPropertyWebkitMaskBoxImageSource, &RenderStyle::maskBoxImageSource, &RenderStyle::setMaskBoxImageSource),
         new PropertyWrapper<const NinePieceImage&>(CSSPropertyWebkitMaskBoxImage, &RenderStyle::maskBoxImage, &RenderStyle::setMaskBoxImage),
@@ -1197,27 +1214,27 @@ CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap()
         new PropertyWrapper<int>(CSSPropertyZIndex, &RenderStyle::zIndex, &RenderStyle::setZIndex),
         new PropertyWrapper<short>(CSSPropertyOrphans, &RenderStyle::orphans, &RenderStyle::setOrphans),
         new PropertyWrapper<short>(CSSPropertyWidows, &RenderStyle::widows, &RenderStyle::setWidows),
-        new PropertyWrapper<Length>(CSSPropertyLineHeight, &RenderStyle::specifiedLineHeight, &RenderStyle::setLineHeight),
+        new LengthPropertyWrapper<Length>(CSSPropertyLineHeight, &RenderStyle::specifiedLineHeight, &RenderStyle::setLineHeight),
         new PropertyWrapper<int>(CSSPropertyOutlineOffset, &RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset),
         new PropertyWrapper<unsigned short>(CSSPropertyOutlineWidth, &RenderStyle::outlineWidth, &RenderStyle::setOutlineWidth),
         new PropertyWrapper<int>(CSSPropertyLetterSpacing, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing),
         new PropertyWrapper<int>(CSSPropertyWordSpacing, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing),
-        new PropertyWrapper<Length>(CSSPropertyTextIndent, &RenderStyle::textIndent, &RenderStyle::setTextIndent),
+        new LengthPropertyWrapper<Length>(CSSPropertyTextIndent, &RenderStyle::textIndent, &RenderStyle::setTextIndent),
 
         new PropertyWrapper<float>(CSSPropertyWebkitPerspective, &RenderStyle::perspective, &RenderStyle::setPerspective),
-        new PropertyWrapper<Length>(CSSPropertyWebkitPerspectiveOriginX, &RenderStyle::perspectiveOriginX, &RenderStyle::setPerspectiveOriginX),
-        new PropertyWrapper<Length>(CSSPropertyWebkitPerspectiveOriginY, &RenderStyle::perspectiveOriginY, &RenderStyle::setPerspectiveOriginY),
-        new PropertyWrapper<Length>(CSSPropertyWebkitTransformOriginX, &RenderStyle::transformOriginX, &RenderStyle::setTransformOriginX),
-        new PropertyWrapper<Length>(CSSPropertyWebkitTransformOriginY, &RenderStyle::transformOriginY, &RenderStyle::setTransformOriginY),
+        new LengthPropertyWrapper<Length>(CSSPropertyWebkitPerspectiveOriginX, &RenderStyle::perspectiveOriginX, &RenderStyle::setPerspectiveOriginX),
+        new LengthPropertyWrapper<Length>(CSSPropertyWebkitPerspectiveOriginY, &RenderStyle::perspectiveOriginY, &RenderStyle::setPerspectiveOriginY),
+        new LengthPropertyWrapper<Length>(CSSPropertyWebkitTransformOriginX, &RenderStyle::transformOriginX, &RenderStyle::setTransformOriginX),
+        new LengthPropertyWrapper<Length>(CSSPropertyWebkitTransformOriginY, &RenderStyle::transformOriginY, &RenderStyle::setTransformOriginY),
         new PropertyWrapper<float>(CSSPropertyWebkitTransformOriginZ, &RenderStyle::transformOriginZ, &RenderStyle::setTransformOriginZ),
-        new PropertyWrapper<LengthSize>(CSSPropertyBorderTopLeftRadius, &RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftRadius),
-        new PropertyWrapper<LengthSize>(CSSPropertyBorderTopRightRadius, &RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRightRadius),
-        new PropertyWrapper<LengthSize>(CSSPropertyBorderBottomLeftRadius, &RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBottomLeftRadius),
-        new PropertyWrapper<LengthSize>(CSSPropertyBorderBottomRightRadius, &RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius),
+        new LengthPropertyWrapper<LengthSize>(CSSPropertyBorderTopLeftRadius, &RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftRadius),
+        new LengthPropertyWrapper<LengthSize>(CSSPropertyBorderTopRightRadius, &RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRightRadius),
+        new LengthPropertyWrapper<LengthSize>(CSSPropertyBorderBottomLeftRadius, &RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBottomLeftRadius),
+        new LengthPropertyWrapper<LengthSize>(CSSPropertyBorderBottomRightRadius, &RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius),
         new PropertyWrapper<EVisibility>(CSSPropertyVisibility, &RenderStyle::visibility, &RenderStyle::setVisibility),
         new PropertyWrapper<float>(CSSPropertyZoom, &RenderStyle::zoom, &RenderStyle::setZoomWithoutReturnValue),
 
-        new PropertyWrapper<LengthBox>(CSSPropertyClip, &RenderStyle::clip, &RenderStyle::setClip),
+        new LengthPropertyWrapper<LengthBox>(CSSPropertyClip, &RenderStyle::clip, &RenderStyle::setClip),
 
 #if USE(ACCELERATED_COMPOSITING)
         new PropertyWrapperAcceleratedOpacity(),
index 72543ff..0aa7e20 100644 (file)
@@ -132,7 +132,7 @@ private:
 class CalcExpressionLength : public CalcExpressionNode {
 public:
     explicit CalcExpressionLength(Length length)
-        : m_length(length)
+        : m_length(std::move(length))
     {
         m_type = CalcExpressionNodeLength;
     }
@@ -188,8 +188,8 @@ private:
 class CalcExpressionBlendLength : public CalcExpressionNode {
 public:
     CalcExpressionBlendLength(Length from, Length to, float progress)
-        : m_from(from)
-        , m_to(to)
+        : m_from(std::move(from))
+        , m_to(std::move(to))
         , m_progress(progress)
     {
         m_type = CalcExpressionNodeBlendLength;
index 784e23c..19be2b8 100644 (file)
@@ -177,16 +177,28 @@ public:
         ASSERT(m_map.contains(index));
         m_map.remove(index);
     }
-    
+
+    void remove(HashMap<int, RefPtr<CalculationValue>>::iterator it)
+    {
+        ASSERT(it != m_map.end());
+        m_map.remove(it);
+    }
+
     PassRefPtr<CalculationValue> get(int index)
     {
         ASSERT(m_map.contains(index));
         return m_map.get(index);
     }
-    
+
+    HashMap<int, RefPtr<CalculationValue>>::iterator find(int index)
+    {
+        ASSERT(m_map.contains(index));
+        return m_map.find(index);
+    }
+
 private:        
     int m_index;
-    HashMap<int, RefPtr<CalculationValue> > m_map;
+    HashMap<int, RefPtr<CalculationValue>> m_map;
 };
     
 static CalculationValueHandleMap& calcHandles()
@@ -230,11 +242,10 @@ void Length::incrementCalculatedRef() const
 void Length::decrementCalculatedRef() const
 {
     ASSERT(isCalculated());
-    RefPtr<CalculationValue> calcLength = calculationValue();
-    if (calcLength->hasOneRef())
-        calcHandles().remove(calculationHandle());
-    calcLength->deref();
-}    
+    auto it = calcHandles().find(calculationHandle());
+    if (it->value->hasOneRef())
+        calcHandles().remove(it);
+}
 
 float Length::nonNanCalculatedValue(int maxValue) const
 {
index f405181..71e79f0 100644 (file)
@@ -89,13 +89,25 @@ public:
     {
         initFromLength(length);
     }
-    
+
+    Length(Length&& other)
+    {
+        moveFromLength(std::move(other));
+    }
+
     Length& operator=(const Length& length)
     {
         initFromLength(length);
         return *this;
     }
-    
+
+    Length& operator=(Length&& other)
+    {
+        if (this != &other)
+            moveFromLength(std::move(other));
+        return *this;
+    }
+
     ~Length()
     {
         if (isCalculated())
@@ -287,6 +299,13 @@ private:
             incrementCalculatedRef();
     }
 
+    void moveFromLength(Length&& length)
+    {
+        ASSERT(this != &length);
+        memcpy(this, &length, sizeof(Length));
+        length.m_type = Auto;
+    }
+
     Length blendMixedTypes(const Length& from, double progress) const;
 
     int calculationHandle() const
index a5205f2..2406903 100644 (file)
 
 namespace WebCore {
 
-Length LengthBox::logicalLeft(WritingMode writingMode) const
+const Length& LengthBox::logicalLeft(WritingMode writingMode) const
 {
     return isHorizontalWritingMode(writingMode) ? m_left : m_top;
 }
 
-Length LengthBox::logicalRight(WritingMode writingMode) const
+const Length& LengthBox::logicalRight(WritingMode writingMode) const
 {
     return isHorizontalWritingMode(writingMode) ? m_right : m_bottom;
 }
 
-Length LengthBox::before(WritingMode writingMode) const
+const Length& LengthBox::before(WritingMode writingMode) const
 {
     switch (writingMode) {
     case TopToBottomWritingMode:
@@ -59,7 +59,7 @@ Length LengthBox::before(WritingMode writingMode) const
     return m_top;
 }
 
-Length LengthBox::after(WritingMode writingMode) const
+const Length& LengthBox::after(WritingMode writingMode) const
 {
     switch (writingMode) {
     case TopToBottomWritingMode:
@@ -75,14 +75,14 @@ Length LengthBox::after(WritingMode writingMode) const
     return m_bottom;
 }
 
-Length LengthBox::start(WritingMode writingMode, TextDirection direction) const
+const Length& LengthBox::start(WritingMode writingMode, TextDirection direction) const
 {
     if (isHorizontalWritingMode(writingMode))
         return isLeftToRightDirection(direction) ? m_left : m_right;
     return isLeftToRightDirection(direction) ? m_top : m_bottom;
 }
 
-Length LengthBox::end(WritingMode writingMode, TextDirection direction) const
+const Length& LengthBox::end(WritingMode writingMode, TextDirection direction) const
 {
     if (isHorizontalWritingMode(writingMode))
         return isLeftToRightDirection(direction) ? m_right : m_left;
index d5dfc13..9addabd 100644 (file)
@@ -52,10 +52,10 @@ struct LengthBox {
     }
 
     LengthBox(Length t, Length r, Length b, Length l)
-        : m_left(l)
-        , m_right(r)
-        , m_top(t)
-        , m_bottom(b)
+        : m_left(std::move(l))
+        , m_right(std::move(r))
+        , m_top(std::move(t))
+        , m_bottom(std::move(b))
     {
     }
     
@@ -67,18 +67,18 @@ struct LengthBox {
     {
     }
 
-    Length left() const { return m_left; }
-    Length right() const { return m_right; }
-    Length top() const { return m_top; }
-    Length bottom() const { return m_bottom; }
+    const Length& left() const { return m_left; }
+    const Length& right() const { return m_right; }
+    const Length& top() const { return m_top; }
+    const Length& bottom() const { return m_bottom; }
 
-    Length logicalLeft(WritingMode) const;
-    Length logicalRight(WritingMode) const;
+    const Length& logicalLeft(WritingMode) const;
+    const Length& logicalRight(WritingMode) const;
 
-    Length before(WritingMode) const;
-    Length after(WritingMode) const;
-    Length start(WritingMode, TextDirection) const;
-    Length end(WritingMode, TextDirection) const;
+    const Length& before(WritingMode) const;
+    const Length& after(WritingMode) const;
+    const Length& start(WritingMode, TextDirection) const;
+    const Length& end(WritingMode, TextDirection) const;
 
     bool operator==(const LengthBox& o) const
     {
index dbcc83d..83136ab 100644 (file)
@@ -32,8 +32,8 @@ public:
     }
     
     LengthSize(Length width, Length height)
-        : m_width(width)
-        , m_height(height)
+        : m_width(std::move(width))
+        , m_height(std::move(height))
     {
     }
 
@@ -42,11 +42,11 @@ public:
         return m_width == o.m_width && m_height == o.m_height;
     }
 
-    void setWidth(Length width) { m_width = width; }
-    Length width() const { return m_width; }
+    void setWidth(Length width) { m_width = std::move(width); }
+    const Length& width() const { return m_width; }
 
-    void setHeight(Length height) { m_height = height; }
-    Length height() const { return m_height; }
+    void setHeight(Length height) { m_height = std::move(height); }
+    const Length& height() const { return m_height; }
 
 private:
     Length m_width;
index 5f61f8d..c0addd4 100644 (file)
@@ -307,10 +307,10 @@ class BlurFilterOperation : public FilterOperation {
 public:
     static PassRefPtr<BlurFilterOperation> create(Length stdDeviation, OperationType type)
     {
-        return adoptRef(new BlurFilterOperation(stdDeviation, type));
+        return adoptRef(new BlurFilterOperation(std::move(stdDeviation), type));
     }
 
-    Length stdDeviation() const { return m_stdDeviation; }
+    const Length& stdDeviation() const { return m_stdDeviation; }
 
     virtual bool affectsOpacity() const { return true; }
     virtual bool movesPixels() const { return true; }
@@ -328,7 +328,7 @@ private:
 
     BlurFilterOperation(Length stdDeviation, OperationType type)
         : FilterOperation(type)
-        , m_stdDeviation(stdDeviation)
+        , m_stdDeviation(std::move(stdDeviation))
     {
     }
 
index ec027fe..2153cf3 100644 (file)
@@ -68,26 +68,26 @@ class BasicShapeRectangle : public BasicShape {
 public:
     static PassRefPtr<BasicShapeRectangle> create() { return adoptRef(new BasicShapeRectangle); }
 
-    Length x() const { return m_x; }
-    Length y() const { return m_y; }
-    Length width() const { return m_width; }
-    Length height() const { return m_height; }
-    Length cornerRadiusX() const { return m_cornerRadiusX; }
-    Length cornerRadiusY() const { return m_cornerRadiusY; }
-
-    void setX(Length x) { m_x = x; }
-    void setY(Length y) { m_y = y; }
-    void setWidth(Length width) { m_width = width; }
-    void setHeight(Length height) { m_height = height; }
+    const Length& x() const { return m_x; }
+    const Length& y() const { return m_y; }
+    const Length& width() const { return m_width; }
+    const Length& height() const { return m_height; }
+    const Length& cornerRadiusX() const { return m_cornerRadiusX; }
+    const Length& cornerRadiusY() const { return m_cornerRadiusY; }
+
+    void setX(Length x) { m_x = std::move(x); }
+    void setY(Length y) { m_y = std::move(y); }
+    void setWidth(Length width) { m_width = std::move(width); }
+    void setHeight(Length height) { m_height = std::move(height); }
     void setCornerRadiusX(Length radiusX)
     {
         ASSERT(!radiusX.isUndefined());
-        m_cornerRadiusX = radiusX;
+        m_cornerRadiusX = std::move(radiusX);
     }
     void setCornerRadiusY(Length radiusY)
     {
         ASSERT(!radiusY.isUndefined());
-        m_cornerRadiusY = radiusY;
+        m_cornerRadiusY = std::move(radiusY);
     }
 
     virtual void path(Path&, const FloatRect&) OVERRIDE;
@@ -109,13 +109,13 @@ class BasicShapeCircle : public BasicShape {
 public:
     static PassRefPtr<BasicShapeCircle> create() { return adoptRef(new BasicShapeCircle); }
 
-    Length centerX() const { return m_centerX; }
-    Length centerY() const { return m_centerY; }
-    Length radius() const { return m_radius; }
+    const Length& centerX() const { return m_centerX; }
+    const Length& centerY() const { return m_centerY; }
+    const Length& radius() const { return m_radius; }
 
-    void setCenterX(Length centerX) { m_centerX = centerX; }
-    void setCenterY(Length centerY) { m_centerY = centerY; }
-    void setRadius(Length radius) { m_radius = radius; }
+    void setCenterX(Length centerX) { m_centerX = std::move(centerX); }
+    void setCenterY(Length centerY) { m_centerY = std::move(centerY); }
+    void setRadius(Length radius) { m_radius = std::move(radius); }
 
     virtual void path(Path&, const FloatRect&) OVERRIDE;
     virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRIDE;
@@ -133,15 +133,15 @@ class BasicShapeEllipse : public BasicShape {
 public:
     static PassRefPtr<BasicShapeEllipse> create() { return adoptRef(new BasicShapeEllipse); }
 
-    Length centerX() const { return m_centerX; }
-    Length centerY() const { return m_centerY; }
-    Length radiusX() const { return m_radiusX; }
-    Length radiusY() const { return m_radiusY; }
+    const Length& centerX() const { return m_centerX; }
+    const Length& centerY() const { return m_centerY; }
+    const Length& radiusX() const { return m_radiusX; }
+    const Length& radiusY() const { return m_radiusY; }
 
-    void setCenterX(Length centerX) { m_centerX = centerX; }
-    void setCenterY(Length centerY) { m_centerY = centerY; }
-    void setRadiusX(Length radiusX) { m_radiusX = radiusX; }
-    void setRadiusY(Length radiusY) { m_radiusY = radiusY; }
+    void setCenterX(Length centerX) { m_centerX = std::move(centerX); }
+    void setCenterY(Length centerY) { m_centerY = std::move(centerY); }
+    void setRadiusX(Length radiusX) { m_radiusX = std::move(radiusX); }
+    void setRadiusY(Length radiusY) { m_radiusY = std::move(radiusY); }
 
     virtual void path(Path&, const FloatRect&) OVERRIDE;
     virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRIDE;
@@ -161,11 +161,11 @@ public:
     static PassRefPtr<BasicShapePolygon> create() { return adoptRef(new BasicShapePolygon); }
 
     const Vector<Length>& values() const { return m_values; }
-    Length getXAt(unsigned i) const { return m_values.at(2 * i); }
-    Length getYAt(unsigned i) const { return m_values.at(2 * i + 1); }
+    const Length& getXAt(unsigned i) const { return m_values[2 * i]; }
+    const Length& getYAt(unsigned i) const { return m_values[2 * i + 1]; }
 
     void setWindRule(WindRule windRule) { m_windRule = windRule; }
-    void appendPoint(Length x, Length y) { m_values.append(x); m_values.append(y); }
+    void appendPoint(Length x, Length y) { m_values.append(std::move(x)); m_values.append(std::move(y)); }
 
     virtual void path(Path&, const FloatRect&) OVERRIDE;
     virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRIDE;
@@ -186,26 +186,26 @@ class BasicShapeInsetRectangle : public BasicShape {
 public:
     static PassRefPtr<BasicShapeInsetRectangle> create() { return adoptRef(new BasicShapeInsetRectangle); }
 
-    Length top() const { return m_top; }
-    Length right() const { return m_right; }
-    Length bottom() const { return m_bottom; }
-    Length left() const { return m_left; }
-    Length cornerRadiusX() const { return m_cornerRadiusX; }
-    Length cornerRadiusY() const { return m_cornerRadiusY; }
-
-    void setTop(Length top) { m_top = top; }
-    void setRight(Length right) { m_right = right; }
-    void setBottom(Length bottom) { m_bottom = bottom; }
-    void setLeft(Length left) { m_left = left; }
+    const Length& top() const { return m_top; }
+    const Length& right() const { return m_right; }
+    const Length& bottom() const { return m_bottom; }
+    const Length& left() const { return m_left; }
+    const Length& cornerRadiusX() const { return m_cornerRadiusX; }
+    const Length& cornerRadiusY() const { return m_cornerRadiusY; }
+
+    void setTop(Length top) { m_top = std::move(top); }
+    void setRight(Length right) { m_right = std::move(right); }
+    void setBottom(Length bottom) { m_bottom = std::move(bottom); }
+    void setLeft(Length left) { m_left = std::move(left); }
     void setCornerRadiusX(Length radiusX)
     {
         ASSERT(!radiusX.isUndefined());
-        m_cornerRadiusX = radiusX;
+        m_cornerRadiusX = std::move(radiusX);
     }
     void setCornerRadiusY(Length radiusY)
     {
         ASSERT(!radiusY.isUndefined());
-        m_cornerRadiusY = radiusY;
+        m_cornerRadiusY = std::move(radiusY);
     }
 
     virtual void path(Path&, const FloatRect&) OVERRIDE;
index b48f077..e980734 100644 (file)
@@ -40,9 +40,9 @@ struct FillSize {
     {
     }
 
-    FillSize(EFillSizeType t, LengthSize l)
+    FillSize(EFillSizeType t, LengthSize size)
         : type(t)
-        , size(l)
+        , size(std::move(size))
     {
     }
 
@@ -66,8 +66,8 @@ public:
     ~FillLayer();
 
     StyleImage* image() const { return m_image.get(); }
-    Length xPosition() const { return m_xPosition; }
-    Length yPosition() const { return m_yPosition; }
+    const Length& xPosition() const { return m_xPosition; }
+    const Length& yPosition() const { return m_yPosition; }
     BackgroundEdgeOrigin backgroundXOrigin() const { return static_cast<BackgroundEdgeOrigin>(m_backgroundXOrigin); }
     BackgroundEdgeOrigin backgroundYOrigin() const { return static_cast<BackgroundEdgeOrigin>(m_backgroundYOrigin); }
     EFillAttachment attachment() const { return static_cast<EFillAttachment>(m_attachment); }
@@ -77,7 +77,7 @@ public:
     EFillRepeat repeatY() const { return static_cast<EFillRepeat>(m_repeatY); }
     CompositeOperator composite() const { return static_cast<CompositeOperator>(m_composite); }
     BlendMode blendMode() const { return static_cast<BlendMode>(m_blendMode); }
-    LengthSize sizeLength() const { return m_sizeLength; }
+    const LengthSize& sizeLength() const { return m_sizeLength; }
     EFillSizeType sizeType() const { return static_cast<EFillSizeType>(m_sizeType); }
     FillSize size() const { return FillSize(static_cast<EFillSizeType>(m_sizeType), m_sizeLength); }
     EMaskSourceType maskSourceType() const { return static_cast<EMaskSourceType>(m_maskSourceType); }
@@ -100,8 +100,8 @@ public:
     bool isMaskSourceTypeSet() const { return m_maskSourceTypeSet; }
 
     void setImage(PassRefPtr<StyleImage> i) { m_image = i; m_imageSet = true; }
-    void setXPosition(Length l) { m_xPosition = l; m_xPosSet = true; }
-    void setYPosition(Length l) { m_yPosition = l; m_yPosSet = true; }
+    void setXPosition(Length length) { m_xPosition = std::move(length); m_xPosSet = true; }
+    void setYPosition(Length length) { m_yPosition = std::move(length); m_yPosSet = true; }
     void setBackgroundXOrigin(BackgroundEdgeOrigin o) { m_backgroundXOrigin = o; m_backgroundOriginSet = true; }
     void setBackgroundYOrigin(BackgroundEdgeOrigin o) { m_backgroundYOrigin = o; m_backgroundOriginSet = true; }
     void setAttachment(EFillAttachment attachment) { m_attachment = attachment; m_attachmentSet = true; }
index a463d81..5bb48c2 100644 (file)
@@ -43,9 +43,9 @@ NinePieceImage::NinePieceImage(PassRefPtr<StyleImage> image, LengthBox imageSlic
 {
     m_data.init();
     m_data.access()->image = image;
-    m_data.access()->imageSlices = imageSlices;
-    m_data.access()->borderSlices = borderSlices;
-    m_data.access()->outset = outset;
+    m_data.access()->imageSlices = std::move(imageSlices);
+    m_data.access()->borderSlices = std::move(borderSlices);
+    m_data.access()->outset = std::move(outset);
     m_data.access()->fill = fill;
     m_data.access()->horizontalRule = horizontalRule;
     m_data.access()->verticalRule = verticalRule;
index 0f3b339..3861205 100644 (file)
@@ -69,16 +69,16 @@ public:
     void setImage(PassRefPtr<StyleImage> image) { m_data.access()->image = image; }
     
     const LengthBox& imageSlices() const { return m_data->imageSlices; }
-    void setImageSlices(const LengthBox& slices) { m_data.access()->imageSlices = slices; }
+    void setImageSlices(LengthBox slices) { m_data.access()->imageSlices = std::move(slices); }
 
     bool fill() const { return m_data->fill; }
     void setFill(bool fill) { m_data.access()->fill = fill; }
 
     const LengthBox& borderSlices() const { return m_data->borderSlices; }
-    void setBorderSlices(const LengthBox& slices) { m_data.access()->borderSlices = slices; }
+    void setBorderSlices(LengthBox slices) { m_data.access()->borderSlices = std::move(slices); }
 
     const LengthBox& outset() const { return m_data->outset; }
-    void setOutset(const LengthBox& outset) { m_data.access()->outset = outset; }
+    void setOutset(LengthBox outset) { m_data.access()->outset = std::move(outset); }
 
     ENinePieceImageRule horizontalRule() const { return static_cast<ENinePieceImageRule>(m_data->horizontalRule); }
     void setHorizontalRule(ENinePieceImageRule rule) { m_data.access()->horizontalRule = rule; }
@@ -115,7 +115,7 @@ public:
         m_data.access()->borderSlices = LengthBox();
     }
 
-    static LayoutUnit computeOutset(Length outsetSide, LayoutUnit borderSide)
+    static LayoutUnit computeOutset(const Length& outsetSide, LayoutUnit borderSide)
     {
         if (outsetSide.isRelative())
             return outsetSide.value() * borderSide;
index 6606a4b..c62c4b0 100644 (file)
@@ -1423,10 +1423,10 @@ bool RenderStyle::setFontDescription(const FontDescription& v)
 }
 
 #if ENABLE(IOS_TEXT_AUTOSIZING)
-Length RenderStyle::specifiedLineHeight() const { return inherited->specifiedLineHeight; }
+const Length& RenderStyle::specifiedLineHeight() const { return inherited->specifiedLineHeight; }
 void RenderStyle::setSpecifiedLineHeight(Length v) { SET_VAR(inherited, specifiedLineHeight, v); }
 #else
-Length RenderStyle::specifiedLineHeight() const { return inherited->line_height; }
+const Length& RenderStyle::specifiedLineHeight() const { return inherited->line_height; }
 #endif
 
 Length RenderStyle::lineHeight() const
index 04adc85..30afddc 100644 (file)
@@ -446,16 +446,16 @@ public:
     EDisplay display() const { return static_cast<EDisplay>(noninherited_flags._effectiveDisplay); }
     EDisplay originalDisplay() const { return static_cast<EDisplay>(noninherited_flags._originalDisplay); }
 
-    Length left() const { return surround->offset.left(); }
-    Length right() const { return surround->offset.right(); }
-    Length top() const { return surround->offset.top(); }
-    Length bottom() const { return surround->offset.bottom(); }
+    const Length& left() const { return surround->offset.left(); }
+    const Length& right() const { return surround->offset.right(); }
+    const Length& top() const { return surround->offset.top(); }
+    const Length& bottom() const { return surround->offset.bottom(); }
 
     // Accessors for positioned object edges that take into account writing mode.
-    Length logicalLeft() const { return surround->offset.logicalLeft(writingMode()); }
-    Length logicalRight() const { return surround->offset.logicalRight(writingMode()); }
-    Length logicalTop() const { return surround->offset.before(writingMode()); }
-    Length logicalBottom() const { return surround->offset.after(writingMode()); }
+    const Length& logicalLeft() const { return surround->offset.logicalLeft(writingMode()); }
+    const Length& logicalRight() const { return surround->offset.logicalRight(writingMode()); }
+    const Length& logicalTop() const { return surround->offset.before(writingMode()); }
+    const Length& logicalBottom() const { return surround->offset.after(writingMode()); }
 
     // Whether or not a positioned element requires normal flow x/y to be computed
     // to determine its position.
@@ -470,19 +470,19 @@ public:
     bool hasViewportConstrainedPosition() const { return position() == FixedPosition || position() == StickyPosition; }
     EFloat floating() const { return static_cast<EFloat>(noninherited_flags._floating); }
 
-    Length width() const { return m_box->width(); }
-    Length height() const { return m_box->height(); }
-    Length minWidth() const { return m_box->minWidth(); }
-    Length maxWidth() const { return m_box->maxWidth(); }
-    Length minHeight() const { return m_box->minHeight(); }
-    Length maxHeight() const { return m_box->maxHeight(); }
+    const Length& width() const { return m_box->width(); }
+    const Length& height() const { return m_box->height(); }
+    const Length& minWidth() const { return m_box->minWidth(); }
+    const Length& maxWidth() const { return m_box->maxWidth(); }
+    const Length& minHeight() const { return m_box->minHeight(); }
+    const Length& maxHeight() const { return m_box->maxHeight(); }
     
-    Length logicalWidth() const { return isHorizontalWritingMode() ? width() : height(); }
-    Length logicalHeight() const { return isHorizontalWritingMode() ? height() : width(); }
-    Length logicalMinWidth() const { return isHorizontalWritingMode() ? minWidth() : minHeight(); }
-    Length logicalMaxWidth() const { return isHorizontalWritingMode() ? maxWidth() : maxHeight(); }
-    Length logicalMinHeight() const { return isHorizontalWritingMode() ? minHeight() : minWidth(); }
-    Length logicalMaxHeight() const { return isHorizontalWritingMode() ? maxHeight() : maxWidth(); }
+    const Length& logicalWidth() const { return isHorizontalWritingMode() ? width() : height(); }
+    const Length& logicalHeight() const { return isHorizontalWritingMode() ? height() : width(); }
+    const Length& logicalMinWidth() const { return isHorizontalWritingMode() ? minWidth() : minHeight(); }
+    const Length& logicalMaxWidth() const { return isHorizontalWritingMode() ? maxWidth() : maxHeight(); }
+    const Length& logicalMinHeight() const { return isHorizontalWritingMode() ? minHeight() : minWidth(); }
+    const Length& logicalMaxHeight() const { return isHorizontalWritingMode() ? maxHeight() : maxWidth(); }
 
     const BorderData& border() const { return surround->border; }
     const BorderValue& borderLeft() const { return surround->border.left(); }
@@ -497,14 +497,14 @@ public:
 
     const NinePieceImage& borderImage() const { return surround->border.image(); }
     StyleImage* borderImageSource() const { return surround->border.image().image(); }
-    LengthBox borderImageSlices() const { return surround->border.image().imageSlices(); }
-    LengthBox borderImageWidth() const { return surround->border.image().borderSlices(); }
-    LengthBox borderImageOutset() const { return surround->border.image().outset(); }
-
-    LengthSize borderTopLeftRadius() const { return surround->border.topLeft(); }
-    LengthSize borderTopRightRadius() const { return surround->border.topRight(); }
-    LengthSize borderBottomLeftRadius() const { return surround->border.bottomLeft(); }
-    LengthSize borderBottomRightRadius() const { return surround->border.bottomRight(); }
+    const LengthBox& borderImageSlices() const { return surround->border.image().imageSlices(); }
+    const LengthBox& borderImageWidth() const { return surround->border.image().borderSlices(); }
+    const LengthBox& borderImageOutset() const { return surround->border.image().outset(); }
+
+    const LengthSize& borderTopLeftRadius() const { return surround->border.topLeft(); }
+    const LengthSize& borderTopRightRadius() const { return surround->border.topRight(); }
+    const LengthSize& borderBottomLeftRadius() const { return surround->border.bottomLeft(); }
+    const LengthSize& borderBottomRightRadius() const { return surround->border.bottomRight(); }
     bool hasBorderRadius() const { return surround->border.hasBorderRadius(); }
 
     unsigned borderLeftWidth() const { return surround->border.borderLeftWidth(); }
@@ -541,13 +541,13 @@ public:
 
     EVisibility visibility() const { return static_cast<EVisibility>(inherited_flags._visibility); }
     EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(noninherited_flags._vertical_align); }
-    Length verticalAlignLength() const { return m_box->verticalAlign(); }
+    const Length& verticalAlignLength() const { return m_box->verticalAlign(); }
 
-    Length clipLeft() const { return visual->clip.left(); }
-    Length clipRight() const { return visual->clip.right(); }
-    Length clipTop() const { return visual->clip.top(); }
-    Length clipBottom() const { return visual->clip.bottom(); }
-    LengthBox clip() const { return visual->clip; }
+    const Length& clipLeft() const { return visual->clip.left(); }
+    const Length& clipRight() const { return visual->clip.right(); }
+    const Length& clipTop() const { return visual->clip.top(); }
+    const Length& clipBottom() const { return visual->clip.bottom(); }
+    const LengthBox& clip() const { return visual->clip; }
     bool hasClip() const { return visual->hasClip; }
 
     EUnicodeBidi unicodeBidi() const { return static_cast<EUnicodeBidi>(noninherited_flags._unicodeBidi); }
@@ -567,7 +567,7 @@ public:
     float textAutosizingMultiplier() const { return visual->m_textAutosizingMultiplier; }
 #endif
 
-    Length textIndent() const { return rareInheritedData->indent; }
+    const Length& textIndent() const { return rareInheritedData->indent; }
 #if ENABLE(CSS3_TEXT)
     TextIndentLine textIndentLine() const { return static_cast<TextIndentLine>(rareInheritedData->m_textIndentLine); }
     TextIndentType textIndentType() const { return static_cast<TextIndentType>(rareInheritedData->m_textIndentType); }
@@ -593,7 +593,7 @@ public:
     TextDirection direction() const { return static_cast<TextDirection>(inherited_flags._direction); }
     bool isLeftToRightDirection() const { return direction() == LTR; }
 
-    Length specifiedLineHeight() const;
+    const Length& specifiedLineHeight() const;
     Length lineHeight() const;
     int computedLineHeight(RenderView* = 0) const;
 
@@ -659,10 +659,10 @@ public:
     EFillAttachment backgroundAttachment() const { return static_cast<EFillAttachment>(m_background->background().attachment()); }
     EFillBox backgroundClip() const { return static_cast<EFillBox>(m_background->background().clip()); }
     EFillBox backgroundOrigin() const { return static_cast<EFillBox>(m_background->background().origin()); }
-    Length backgroundXPosition() const { return m_background->background().xPosition(); }
-    Length backgroundYPosition() const { return m_background->background().yPosition(); }
+    const Length& backgroundXPosition() const { return m_background->background().xPosition(); }
+    const Length& backgroundYPosition() const { return m_background->background().yPosition(); }
     EFillSizeType backgroundSizeType() const { return m_background->background().sizeType(); }
-    LengthSize backgroundSizeLength() const { return m_background->background().sizeLength(); }
+    const LengthSize& backgroundSizeLength() const { return m_background->background().sizeLength(); }
     FillLayer* accessBackgroundLayers() { return &(m_background.access()->m_background); }
     const FillLayer* backgroundLayers() const { return &(m_background->background()); }
 
@@ -672,10 +672,10 @@ public:
     CompositeOperator maskComposite() const { return static_cast<CompositeOperator>(rareNonInheritedData->m_mask.composite()); }
     EFillBox maskClip() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.clip()); }
     EFillBox maskOrigin() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.origin()); }
-    Length maskXPosition() const { return rareNonInheritedData->m_mask.xPosition(); }
-    Length maskYPosition() const { return rareNonInheritedData->m_mask.yPosition(); }
+    const Length& maskXPosition() const { return rareNonInheritedData->m_mask.xPosition(); }
+    const Length& maskYPosition() const { return rareNonInheritedData->m_mask.yPosition(); }
     EFillSizeType maskSizeType() const { return rareNonInheritedData->m_mask.sizeType(); }
-    LengthSize maskSizeLength() const { return rareNonInheritedData->m_mask.sizeLength(); }
+    const LengthSize& maskSizeLength() const { return rareNonInheritedData->m_mask.sizeLength(); }
     FillLayer* accessMaskLayers() { return &(rareNonInheritedData.access()->m_mask); }
     const FillLayer* maskLayers() const { return &(rareNonInheritedData->m_mask); }
     const NinePieceImage& maskBoxImage() const { return rareNonInheritedData->m_maskBoxImage; }
@@ -691,28 +691,28 @@ public:
     StyleImage* listStyleImage() const;
     EListStylePosition listStylePosition() const { return static_cast<EListStylePosition>(inherited_flags._list_style_position); }
 
-    Length marginTop() const { return surround->margin.top(); }
-    Length marginBottom() const { return surround->margin.bottom(); }
-    Length marginLeft() const { return surround->margin.left(); }
-    Length marginRight() const { return surround->margin.right(); }
-    Length marginBefore() const { return surround->margin.before(writingMode()); }
-    Length marginAfter() const { return surround->margin.after(writingMode()); }
-    Length marginStart() const { return surround->margin.start(writingMode(), direction()); }
-    Length marginEnd() const { return surround->margin.end(writingMode(), direction()); }
-    Length marginStartUsing(const RenderStyle* otherStyle) const { return surround->margin.start(otherStyle->writingMode(), otherStyle->direction()); }
-    Length marginEndUsing(const RenderStyle* otherStyle) const { return surround->margin.end(otherStyle->writingMode(), otherStyle->direction()); }
-    Length marginBeforeUsing(const RenderStyle* otherStyle) const { return surround->margin.before(otherStyle->writingMode()); }
-    Length marginAfterUsing(const RenderStyle* otherStyle) const { return surround->margin.after(otherStyle->writingMode()); }
-
-    LengthBox paddingBox() const { return surround->padding; }
-    Length paddingTop() const { return surround->padding.top(); }
-    Length paddingBottom() const { return surround->padding.bottom(); }
-    Length paddingLeft() const { return surround->padding.left(); }
-    Length paddingRight() const { return surround->padding.right(); }
-    Length paddingBefore() const { return surround->padding.before(writingMode()); }
-    Length paddingAfter() const { return surround->padding.after(writingMode()); }
-    Length paddingStart() const { return surround->padding.start(writingMode(), direction()); }
-    Length paddingEnd() const { return surround->padding.end(writingMode(), direction()); }
+    const Length& marginTop() const { return surround->margin.top(); }
+    const Length& marginBottom() const { return surround->margin.bottom(); }
+    const Length& marginLeft() const { return surround->margin.left(); }
+    const Length& marginRight() const { return surround->margin.right(); }
+    const Length& marginBefore() const { return surround->margin.before(writingMode()); }
+    const Length& marginAfter() const { return surround->margin.after(writingMode()); }
+    const Length& marginStart() const { return surround->margin.start(writingMode(), direction()); }
+    const Length& marginEnd() const { return surround->margin.end(writingMode(), direction()); }
+    const Length& marginStartUsing(const RenderStyle* otherStyle) const { return surround->margin.start(otherStyle->writingMode(), otherStyle->direction()); }
+    const Length& marginEndUsing(const RenderStyle* otherStyle) const { return surround->margin.end(otherStyle->writingMode(), otherStyle->direction()); }
+    const Length& marginBeforeUsing(const RenderStyle* otherStyle) const { return surround->margin.before(otherStyle->writingMode()); }
+    const Length& marginAfterUsing(const RenderStyle* otherStyle) const { return surround->margin.after(otherStyle->writingMode()); }
+
+    const LengthBox& paddingBox() const { return surround->padding; }
+    const Length& paddingTop() const { return surround->padding.top(); }
+    const Length& paddingBottom() const { return surround->padding.bottom(); }
+    const Length& paddingLeft() const { return surround->padding.left(); }
+    const Length& paddingRight() const { return surround->padding.right(); }
+    const Length& paddingBefore() const { return surround->padding.before(writingMode()); }
+    const Length& paddingAfter() const { return surround->padding.after(writingMode()); }
+    const Length& paddingStart() const { return surround->padding.start(writingMode(), direction()); }
+    const Length& paddingEnd() const { return surround->padding.end(writingMode(), direction()); }
 
     ECursor cursor() const { return static_cast<ECursor>(inherited_flags._cursor_style); }
 #if ENABLE(CURSOR_VISIBILITY)
@@ -769,7 +769,7 @@ public:
     int order() const { return rareNonInheritedData->m_order; }
     float flexGrow() const { return rareNonInheritedData->m_flexibleBox->m_flexGrow; }
     float flexShrink() const { return rareNonInheritedData->m_flexibleBox->m_flexShrink; }
-    Length flexBasis() const { return rareNonInheritedData->m_flexibleBox->m_flexBasis; }
+    const Length& flexBasis() const { return rareNonInheritedData->m_flexibleBox->m_flexBasis; }
     EAlignContent alignContent() const { return static_cast<EAlignContent>(rareNonInheritedData->m_alignContent); }
     EAlignItems alignItems() const { return static_cast<EAlignItems>(rareNonInheritedData->m_alignItems); }
     EAlignItems alignSelf() const { return static_cast<EAlignItems>(rareNonInheritedData->m_alignSelf); }
@@ -805,7 +805,7 @@ public:
 #endif
     StyleReflection* boxReflect() const { return rareNonInheritedData->m_boxReflect.get(); }
     EBoxSizing boxSizing() const { return m_box->boxSizing(); }
-    Length marqueeIncrement() const { return rareNonInheritedData->m_marquee->increment; }
+    const Length& marqueeIncrement() const { return rareNonInheritedData->m_marquee->increment; }
     int marqueeSpeed() const { return rareNonInheritedData->m_marquee->speed; }
     int marqueeLoopCount() const { return rareNonInheritedData->m_marquee->loops; }
     EMarqueeBehavior marqueeBehavior() const { return static_cast<EMarqueeBehavior>(rareNonInheritedData->m_marquee->behavior); }
@@ -853,8 +853,8 @@ public:
     EPageBreak regionBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakInside); }
     EPageBreak regionBreakAfter() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakAfter); }
     const TransformOperations& transform() const { return rareNonInheritedData->m_transform->m_operations; }
-    Length transformOriginX() const { return rareNonInheritedData->m_transform->m_x; }
-    Length transformOriginY() const { return rareNonInheritedData->m_transform->m_y; }
+    const Length& transformOriginX() const { return rareNonInheritedData->m_transform->m_x; }
+    const Length& transformOriginY() const { return rareNonInheritedData->m_transform->m_y; }
     float transformOriginZ() const { return rareNonInheritedData->m_transform->m_z; }
     bool hasTransform() const { return !rareNonInheritedData->m_transform->m_operations.operations().isEmpty(); }
 
@@ -919,9 +919,9 @@ public:
     EBackfaceVisibility backfaceVisibility() const { return static_cast<EBackfaceVisibility>(rareNonInheritedData->m_backfaceVisibility); }
     float perspective() const { return rareNonInheritedData->m_perspective; }
     bool hasPerspective() const { return rareNonInheritedData->m_perspective > 0; }
-    Length perspectiveOriginX() const { return rareNonInheritedData->m_perspectiveOriginX; }
-    Length perspectiveOriginY() const { return rareNonInheritedData->m_perspectiveOriginY; }
-    LengthSize pageSize() const { return rareNonInheritedData->m_pageSize; }
+    const Length& perspectiveOriginX() const { return rareNonInheritedData->m_perspectiveOriginX; }
+    const Length& perspectiveOriginY() const { return rareNonInheritedData->m_perspectiveOriginY; }
+    const LengthSize& pageSize() const { return rareNonInheritedData->m_pageSize; }
     PageSizeType pageSizeType() const { return static_cast<PageSizeType>(rareNonInheritedData->m_pageSizeType); }
     
 #if USE(ACCELERATED_COMPOSITING)
@@ -990,36 +990,36 @@ public:
     void setPosition(EPosition v) { noninherited_flags._position = v; }
     void setFloating(EFloat v) { noninherited_flags._floating = v; }
 
-    void setLeft(Length v) { SET_VAR(surround, offset.m_left, v); }
-    void setRight(Length v) { SET_VAR(surround, offset.m_right, v); }
-    void setTop(Length v) { SET_VAR(surround, offset.m_top, v); }
-    void setBottom(Length v) { SET_VAR(surround, offset.m_bottom, v); }
+    void setLeft(Length v) { SET_VAR(surround, offset.m_left, std::move(v)); }
+    void setRight(Length v) { SET_VAR(surround, offset.m_right, std::move(v)); }
+    void setTop(Length v) { SET_VAR(surround, offset.m_top, std::move(v)); }
+    void setBottom(Length v) { SET_VAR(surround, offset.m_bottom, std::move(v)); }
 
-    void setWidth(Length v) { SET_VAR(m_box, m_width, v); }
-    void setHeight(Length v) { SET_VAR(m_box, m_height, v); }
+    void setWidth(Length v) { SET_VAR(m_box, m_width, std::move(v)); }
+    void setHeight(Length v) { SET_VAR(m_box, m_height, std::move(v)); }
 
     void setLogicalWidth(Length v)
     {
         if (isHorizontalWritingMode()) {
-            SET_VAR(m_box, m_width, v);
+            SET_VAR(m_box, m_width, std::move(v));
         } else {
-            SET_VAR(m_box, m_height, v);
+            SET_VAR(m_box, m_height, std::move(v));
         }
     }
 
     void setLogicalHeight(Length v)
     {
         if (isHorizontalWritingMode()) {
-            SET_VAR(m_box, m_height, v);
+            SET_VAR(m_box, m_height, std::move(v));
         } else {
-            SET_VAR(m_box, m_width, v);
+            SET_VAR(m_box, m_width, std::move(v));
         }
     }
 
-    void setMinWidth(Length v) { SET_VAR(m_box, m_minWidth, v); }
-    void setMaxWidth(Length v) { SET_VAR(m_box, m_maxWidth, v); }
-    void setMinHeight(Length v) { SET_VAR(m_box, m_minHeight, v); }
-    void setMaxHeight(Length v) { SET_VAR(m_box, m_maxHeight, v); }
+    void setMinWidth(Length v) { SET_VAR(m_box, m_minWidth, std::move(v)); }
+    void setMaxWidth(Length v) { SET_VAR(m_box, m_maxWidth, std::move(v)); }
+    void setMinHeight(Length v) { SET_VAR(m_box, m_minHeight, std::move(v)); }
+    void setMaxHeight(Length v) { SET_VAR(m_box, m_maxHeight, std::move(v)); }
 
 #if ENABLE(DASHBOARD_SUPPORT)
     Vector<StyleDashboardRegion> dashboardRegions() const { return rareNonInheritedData->m_dashboardRegions; }
@@ -1029,10 +1029,10 @@ public:
     {
         StyleDashboardRegion region;
         region.label = label;
-        region.offset.m_top = t;
-        region.offset.m_right = r;
-        region.offset.m_bottom = b;
-        region.offset.m_left = l;
+        region.offset.m_top = std::move(t);
+        region.offset.m_right = std::move(r);
+        region.offset.m_bottom = std::move(b);
+        region.offset.m_left = std::move(l);
         region.type = type;
         if (!append)
             rareNonInheritedData.access()->m_dashboardRegions.clear();
@@ -1059,10 +1059,10 @@ public:
 
     void setBackgroundColor(const Color& v) { SET_VAR(m_background, m_color, v); }
 
-    void setBackgroundXPosition(Length length) { SET_VAR(m_background, m_background.m_xPosition, length); }
-    void setBackgroundYPosition(Length length) { SET_VAR(m_background, m_background.m_yPosition, length); }
+    void setBackgroundXPosition(Length length) { SET_VAR(m_background, m_background.m_xPosition, std::move(length)); }
+    void setBackgroundYPosition(Length length) { SET_VAR(m_background, m_background.m_yPosition, std::move(length)); }
     void setBackgroundSize(EFillSizeType b) { SET_VAR(m_background, m_background.m_sizeType, b); }
-    void setBackgroundSizeLength(LengthSize s) { SET_VAR(m_background, m_background.m_sizeLength, s); }
+    void setBackgroundSizeLength(LengthSize size) { SET_VAR(m_background, m_background.m_sizeLength, std::move(size)); }
     
     void setBorderImage(const NinePieceImage& b) { SET_VAR(surround, border.m_image, b); }
     void setBorderImageSource(PassRefPtr<StyleImage>);
@@ -1070,10 +1070,10 @@ public:
     void setBorderImageWidth(LengthBox);
     void setBorderImageOutset(LengthBox);
 
-    void setBorderTopLeftRadius(LengthSize s) { SET_VAR(surround, border.m_topLeft, s); }
-    void setBorderTopRightRadius(LengthSize s) { SET_VAR(surround, border.m_topRight, s); }
-    void setBorderBottomLeftRadius(LengthSize s) { SET_VAR(surround, border.m_bottomLeft, s); }
-    void setBorderBottomRightRadius(LengthSize s) { SET_VAR(surround, border.m_bottomRight, s); }
+    void setBorderTopLeftRadius(LengthSize size) { SET_VAR(surround, border.m_topLeft, std::move(size)); }
+    void setBorderTopRightRadius(LengthSize size) { SET_VAR(surround, border.m_topRight, std::move(size)); }
+    void setBorderBottomLeftRadius(LengthSize size) { SET_VAR(surround, border.m_bottomLeft, std::move(size)); }
+    void setBorderBottomRightRadius(LengthSize size) { SET_VAR(surround, border.m_bottomRight, std::move(size)); }
 
     void setBorderRadius(LengthSize s)
     {
@@ -1115,15 +1115,15 @@ public:
     void setOverflowY(EOverflow v) { noninherited_flags._overflowY = v; }
     void setVisibility(EVisibility v) { inherited_flags._visibility = v; }
     void setVerticalAlign(EVerticalAlign v) { noninherited_flags._vertical_align = v; }
-    void setVerticalAlignLength(Length length) { setVerticalAlign(LENGTH); SET_VAR(m_box, m_verticalAlign, length); }
+    void setVerticalAlignLength(Length length) { setVerticalAlign(LENGTH); SET_VAR(m_box, m_verticalAlign, std::move(length)); }
 
     void setHasClip(bool b = true) { SET_VAR(visual, hasClip, b); }
-    void setClipLeft(Length v) { SET_VAR(visual, clip.m_left, v); }
-    void setClipRight(Length v) { SET_VAR(visual, clip.m_right, v); }
-    void setClipTop(Length v) { SET_VAR(visual, clip.m_top, v); }
-    void setClipBottom(Length v) { SET_VAR(visual, clip.m_bottom, v); }
+    void setClipLeft(Length length) { SET_VAR(visual, clip.m_left, std::move(length)); }
+    void setClipRight(Length length) { SET_VAR(visual, clip.m_right, std::move(length)); }
+    void setClipTop(Length length) { SET_VAR(visual, clip.m_top, std::move(length)); }
+    void setClipBottom(Length length) { SET_VAR(visual, clip.m_bottom, std::move(length)); }
     void setClip(Length top, Length right, Length bottom, Length left);
-    void setClip(LengthBox box) { SET_VAR(visual, clip, box); }
+    void setClip(LengthBox box) { SET_VAR(visual, clip, std::move(box)); }
 
     void setUnicodeBidi(EUnicodeBidi b) { noninherited_flags._unicodeBidi = b; }
 
@@ -1143,7 +1143,7 @@ public:
 #endif
 
     void setColor(const Color&);
-    void setTextIndent(Length v) { SET_VAR(rareInheritedData, indent, v); }
+    void setTextIndent(Length length) { SET_VAR(rareInheritedData, indent, std::move(length)); }
 #if ENABLE(CSS3_TEXT)
     void setTextIndentLine(TextIndentLine v) { SET_VAR(rareInheritedData, m_textIndentLine, v); }
     void setTextIndentType(TextIndentType v) { SET_VAR(rareInheritedData, m_textIndentType, v); }
@@ -1211,9 +1211,9 @@ public:
 
     void setMaskBoxImage(const NinePieceImage& b) { SET_VAR(rareNonInheritedData, m_maskBoxImage, b); }
     void setMaskBoxImageSource(PassRefPtr<StyleImage> v) { rareNonInheritedData.access()->m_maskBoxImage.setImage(v); }
-    void setMaskXPosition(Length length) { SET_VAR(rareNonInheritedData, m_mask.m_xPosition, length); }
-    void setMaskYPosition(Length length) { SET_VAR(rareNonInheritedData, m_mask.m_yPosition, length); }
-    void setMaskSize(LengthSize s) { SET_VAR(rareNonInheritedData, m_mask.m_sizeLength, s); }
+    void setMaskXPosition(Length length) { SET_VAR(rareNonInheritedData, m_mask.m_xPosition, std::move(length)); }
+    void setMaskYPosition(Length length) { SET_VAR(rareNonInheritedData, m_mask.m_yPosition, std::move(length)); }
+    void setMaskSize(LengthSize size) { SET_VAR(rareNonInheritedData, m_mask.m_sizeLength, std::move(size)); }
 
     void setBorderCollapse(EBorderCollapse collapse) { inherited_flags._border_collapse = collapse; }
     void setHorizontalBorderSpacing(short);
@@ -1230,19 +1230,19 @@ public:
     void setListStylePosition(EListStylePosition v) { inherited_flags._list_style_position = v; }
 
     void resetMargin() { SET_VAR(surround, margin, LengthBox(Fixed)); }
-    void setMarginTop(Length v) { SET_VAR(surround, margin.m_top, v); }
-    void setMarginBottom(Length v) { SET_VAR(surround, margin.m_bottom, v); }
-    void setMarginLeft(Length v) { SET_VAR(surround, margin.m_left, v); }
-    void setMarginRight(Length v) { SET_VAR(surround, margin.m_right, v); }
+    void setMarginTop(Length length) { SET_VAR(surround, margin.m_top, std::move(length)); }
+    void setMarginBottom(Length length) { SET_VAR(surround, margin.m_bottom, std::move(length)); }
+    void setMarginLeft(Length length) { SET_VAR(surround, margin.m_left, std::move(length)); }
+    void setMarginRight(Length length) { SET_VAR(surround, margin.m_right, std::move(length)); }
     void setMarginStart(Length);
     void setMarginEnd(Length);
 
     void resetPadding() { SET_VAR(surround, padding, LengthBox(Auto)); }
-    void setPaddingBox(const LengthBox& b) { SET_VAR(surround, padding, b); }
-    void setPaddingTop(Length v) { SET_VAR(surround, padding.m_top, v); }
-    void setPaddingBottom(Length v) { SET_VAR(surround, padding.m_bottom, v); }
-    void setPaddingLeft(Length v) { SET_VAR(surround, padding.m_left, v); }
-    void setPaddingRight(Length v) { SET_VAR(surround, padding.m_right, v); }
+    void setPaddingBox(LengthBox box) { SET_VAR(surround, padding, std::move(box)); }
+    void setPaddingTop(Length length) { SET_VAR(surround, padding.m_top, std::move(length)); }
+    void setPaddingBottom(Length length) { SET_VAR(surround, padding.m_bottom, std::move(length)); }
+    void setPaddingLeft(Length length) { SET_VAR(surround, padding.m_left, std::move(length)); }
+    void setPaddingRight(Length length) { SET_VAR(surround, padding.m_right, std::move(length)); }
 
     void setCursor(ECursor c) { inherited_flags._cursor_style = c; }
     void addCursor(PassRefPtr<StyleImage>, const IntPoint& hotSpot = IntPoint());
@@ -1301,7 +1301,7 @@ public:
     void setBoxSizing(EBoxSizing s) { SET_VAR(m_box, m_boxSizing, s); }
     void setFlexGrow(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexGrow, f); }
     void setFlexShrink(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexShrink, f); }
-    void setFlexBasis(Length length) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexBasis, length); }
+    void setFlexBasis(Length length) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexBasis, std::move(length)); }
     void setOrder(int o) { SET_VAR(rareNonInheritedData, m_order, o); }
     void setAlignContent(EAlignContent p) { SET_VAR(rareNonInheritedData, m_alignContent, p); }
     void setAlignItems(EAlignItems a) { SET_VAR(rareNonInheritedData, m_alignItems, a); }
@@ -1321,7 +1321,7 @@ public:
     void setGridItemRowStart(const GridPosition& rowStartPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridRowStart, rowStartPosition); }
     void setGridItemRowEnd(const GridPosition& rowEndPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridRowEnd, rowEndPosition); }
 
-    void setMarqueeIncrement(Length f) { SET_VAR(rareNonInheritedData.access()->m_marquee, increment, f); }
+    void setMarqueeIncrement(Length length) { SET_VAR(rareNonInheritedData.access()->m_marquee, increment, std::move(length)); }
     void setMarqueeSpeed(int f) { SET_VAR(rareNonInheritedData.access()->m_marquee, speed, f); }
     void setMarqueeDirection(EMarqueeDirection d) { SET_VAR(rareNonInheritedData.access()->m_marquee, direction, d); }
     void setMarqueeBehavior(EMarqueeBehavior b) { SET_VAR(rareNonInheritedData.access()->m_marquee, behavior, b); }
@@ -1367,8 +1367,8 @@ public:
     void setRegionBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData, m_regionBreakAfter, p); }
     void inheritColumnPropertiesFrom(RenderStyle* parent) { rareNonInheritedData.access()->m_multiCol = parent->rareNonInheritedData->m_multiCol; }
     void setTransform(const TransformOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_transform, m_operations, ops); }
-    void setTransformOriginX(Length l) { SET_VAR(rareNonInheritedData.access()->m_transform, m_x, l); }
-    void setTransformOriginY(Length l) { SET_VAR(rareNonInheritedData.access()->m_transform, m_y, l); }
+    void setTransformOriginX(Length length) { SET_VAR(rareNonInheritedData.access()->m_transform, m_x, std::move(length)); }
+    void setTransformOriginY(Length length) { SET_VAR(rareNonInheritedData.access()->m_transform, m_y, std::move(length)); }
     void setTransformOriginZ(float f) { SET_VAR(rareNonInheritedData.access()->m_transform, m_z, f); }
     void setSpeak(ESpeak s) { SET_VAR(rareInheritedData, speak, s); }
     void setTextCombine(TextCombine v) { SET_VAR(rareNonInheritedData, m_textCombine, v); }
@@ -1426,9 +1426,9 @@ public:
     void setTransformStyle3D(ETransformStyle3D b) { SET_VAR(rareNonInheritedData, m_transformStyle3D, b); }
     void setBackfaceVisibility(EBackfaceVisibility b) { SET_VAR(rareNonInheritedData, m_backfaceVisibility, b); }
     void setPerspective(float p) { SET_VAR(rareNonInheritedData, m_perspective, p); }
-    void setPerspectiveOriginX(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginX, l); }
-    void setPerspectiveOriginY(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginY, l); }
-    void setPageSize(LengthSize s) { SET_VAR(rareNonInheritedData, m_pageSize, s); }
+    void setPerspectiveOriginX(Length length) { SET_VAR(rareNonInheritedData, m_perspectiveOriginX, std::move(length)); }
+    void setPerspectiveOriginY(Length length) { SET_VAR(rareNonInheritedData, m_perspectiveOriginY, std::move(length)); }
+    void setPageSize(LengthSize size) { SET_VAR(rareNonInheritedData, m_pageSize, std::move(size)); }
     void setPageSizeType(PageSizeType t) { SET_VAR(rareNonInheritedData, m_pageSizeType, t); }
     void resetPageSizeType() { SET_VAR(rareNonInheritedData, m_pageSizeType, PAGE_SIZE_AUTO); }
 
@@ -1516,12 +1516,12 @@ public:
     static ShapeValue* initialShapeInside();
     static ShapeValue* initialShapeOutside() { return 0; }
 
-    Length shapePadding() const { return rareNonInheritedData->m_shapePadding; }
-    void setShapePadding(Length shapePadding) { SET_VAR(rareNonInheritedData, m_shapePadding, shapePadding); }
+    const Length& shapePadding() const { return rareNonInheritedData->m_shapePadding; }
+    void setShapePadding(Length shapePadding) { SET_VAR(rareNonInheritedData, m_shapePadding, std::move(shapePadding)); }
     static Length initialShapePadding() { return Length(0, Fixed); }
 
-    Length shapeMargin() const { return rareNonInheritedData->m_shapeMargin; }
-    void setShapeMargin(Length shapeMargin) { SET_VAR(rareNonInheritedData, m_shapeMargin, shapeMargin); }
+    const Length& shapeMargin() const { return rareNonInheritedData->m_shapeMargin; }
+    void setShapeMargin(Length shapeMargin) { SET_VAR(rareNonInheritedData, m_shapeMargin, std::move(shapeMargin)); }
     static Length initialShapeMargin() { return Length(0, Fixed); }
 #endif
 
index 86fd6e9..ebd9495 100644 (file)
@@ -43,16 +43,16 @@ public:
         return !(*this == o);
     }
 
-    Length width() const { return m_width; }
-    Length height() const { return m_height; }
+    const Length& width() const { return m_width; }
+    const Length& height() const { return m_height; }
     
-    Length minWidth() const { return m_minWidth; }
-    Length minHeight() const { return m_minHeight; }
+    const Length& minWidth() const { return m_minWidth; }
+    const Length& minHeight() const { return m_minHeight; }
     
-    Length maxWidth() const { return m_maxWidth; }
-    Length maxHeight() const { return m_maxHeight; }
+    const Length& maxWidth() const { return m_maxWidth; }
+    const Length& maxHeight() const { return m_maxHeight; }
     
-    Length verticalAlign() const { return m_verticalAlign; }
+    const Length& verticalAlign() const { return m_verticalAlign; }
     
     int zIndex() const { return m_zIndex; }
     bool hasAutoZIndex() const { return m_hasAutoZIndex; }
index 9326ce4..45b93e2 100644 (file)
@@ -46,11 +46,11 @@ public:
     bool operator!=(const StyleReflection& o) const { return !(*this == o); }
 
     CSSReflectionDirection direction() const { return m_direction; }
-    Length offset() const { return m_offset; }
+    const Length& offset() const { return m_offset; }
     const NinePieceImage& mask() const { return m_mask; }
 
     void setDirection(CSSReflectionDirection dir) { m_direction = dir; }
-    void setOffset(const Length& l) { m_offset = l; }
+    void setOffset(Length offset) { m_offset = std::move(offset); }
     void setMask(const NinePieceImage& image) { m_mask = image; }
 
 private: