Title: [182354] trunk/Source/WebCore
Revision
182354
Author
simon.fra...@apple.com
Date
2015-04-04 23:11:00 -0700 (Sat, 04 Apr 2015)

Log Message

More const in CSSToStyleMap
https://bugs.webkit.org/show_bug.cgi?id=143409

Reviewed by Andreas Kling.

The CSSValues passed to CSSToStyleMap functions can mostly be treated
as |const|, except for CSSImageValues which have special behavior.

This makes it clearer what the inputs and outputs of these
functions are.

* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::computeDegrees):
* css/CSSPrimitiveValue.h:
(WebCore::CSSPrimitiveValue::computeTime):
* css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::mapFillAttachment):
(WebCore::CSSToStyleMap::mapFillClip):
(WebCore::CSSToStyleMap::mapFillComposite):
(WebCore::CSSToStyleMap::mapFillBlendMode):
(WebCore::CSSToStyleMap::mapFillOrigin):
(WebCore::CSSToStyleMap::mapFillRepeatX):
(WebCore::CSSToStyleMap::mapFillRepeatY):
(WebCore::CSSToStyleMap::mapFillSize):
(WebCore::CSSToStyleMap::mapFillXPosition):
(WebCore::CSSToStyleMap::mapFillYPosition):
(WebCore::CSSToStyleMap::mapFillMaskSourceType):
(WebCore::CSSToStyleMap::mapAnimationDelay):
(WebCore::CSSToStyleMap::mapAnimationDirection):
(WebCore::CSSToStyleMap::mapAnimationDuration):
(WebCore::CSSToStyleMap::mapAnimationFillMode):
(WebCore::CSSToStyleMap::mapAnimationIterationCount):
(WebCore::CSSToStyleMap::mapAnimationName):
(WebCore::CSSToStyleMap::mapAnimationPlayState):
(WebCore::CSSToStyleMap::mapAnimationProperty):
(WebCore::CSSToStyleMap::mapAnimationTimingFunction):
(WebCore::CSSToStyleMap::mapAnimationTrigger):
* css/CSSToStyleMap.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (182353 => 182354)


--- trunk/Source/WebCore/ChangeLog	2015-04-05 03:09:24 UTC (rev 182353)
+++ trunk/Source/WebCore/ChangeLog	2015-04-05 06:11:00 UTC (rev 182354)
@@ -1,3 +1,44 @@
+2015-04-04  Simon Fraser  <simon.fra...@apple.com>
+
+        More const in CSSToStyleMap
+        https://bugs.webkit.org/show_bug.cgi?id=143409
+
+        Reviewed by Andreas Kling.
+
+        The CSSValues passed to CSSToStyleMap functions can mostly be treated
+        as |const|, except for CSSImageValues which have special behavior.
+        
+        This makes it clearer what the inputs and outputs of these
+        functions are.
+
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::CSSPrimitiveValue::computeDegrees):
+        * css/CSSPrimitiveValue.h:
+        (WebCore::CSSPrimitiveValue::computeTime):
+        * css/CSSToStyleMap.cpp:
+        (WebCore::CSSToStyleMap::mapFillAttachment):
+        (WebCore::CSSToStyleMap::mapFillClip):
+        (WebCore::CSSToStyleMap::mapFillComposite):
+        (WebCore::CSSToStyleMap::mapFillBlendMode):
+        (WebCore::CSSToStyleMap::mapFillOrigin):
+        (WebCore::CSSToStyleMap::mapFillRepeatX):
+        (WebCore::CSSToStyleMap::mapFillRepeatY):
+        (WebCore::CSSToStyleMap::mapFillSize):
+        (WebCore::CSSToStyleMap::mapFillXPosition):
+        (WebCore::CSSToStyleMap::mapFillYPosition):
+        (WebCore::CSSToStyleMap::mapFillMaskSourceType):
+        (WebCore::CSSToStyleMap::mapAnimationDelay):
+        (WebCore::CSSToStyleMap::mapAnimationDirection):
+        (WebCore::CSSToStyleMap::mapAnimationDuration):
+        (WebCore::CSSToStyleMap::mapAnimationFillMode):
+        (WebCore::CSSToStyleMap::mapAnimationIterationCount):
+        (WebCore::CSSToStyleMap::mapAnimationName):
+        (WebCore::CSSToStyleMap::mapAnimationPlayState):
+        (WebCore::CSSToStyleMap::mapAnimationProperty):
+        (WebCore::CSSToStyleMap::mapAnimationTimingFunction):
+        (WebCore::CSSToStyleMap::mapAnimationTrigger):
+        * css/CSSToStyleMap.h:
+
 2015-04-04  Dan Bernstein  <m...@apple.com>
 
         Tried to fix the build.

Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (182353 => 182354)


--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2015-04-05 03:09:24 UTC (rev 182353)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2015-04-05 06:11:00 UTC (rev 182354)
@@ -541,7 +541,7 @@
     }
 }
 
-double CSSPrimitiveValue::computeDegrees()
+double CSSPrimitiveValue::computeDegrees() const
 {
     switch (primitiveType()) {
     case CSS_DEG:

Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.h (182353 => 182354)


--- trunk/Source/WebCore/css/CSSPrimitiveValue.h	2015-04-05 03:09:24 UTC (rev 182353)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.h	2015-04-05 06:11:00 UTC (rev 182354)
@@ -259,10 +259,10 @@
 
     unsigned short primitiveType() const;
 
-    double computeDegrees();
+    double computeDegrees() const;
 
     enum TimeUnit { Seconds, Milliseconds };
-    template <typename T, TimeUnit timeUnit> T computeTime()
+    template <typename T, TimeUnit timeUnit> T computeTime() const
     {
         if (timeUnit == Seconds && primitiveType() == CSS_S)
             return getValue<T>();

Modified: trunk/Source/WebCore/css/CSSToStyleMap.cpp (182353 => 182354)


--- trunk/Source/WebCore/css/CSSToStyleMap.cpp	2015-04-05 03:09:24 UTC (rev 182353)
+++ trunk/Source/WebCore/css/CSSToStyleMap.cpp	2015-04-05 06:11:00 UTC (rev 182354)
@@ -71,7 +71,7 @@
     return m_resolver->styleImage(propertyId, value);
 }
 
-void CSSToStyleMap::mapFillAttachment(CSSPropertyID, FillLayer& layer, CSSValue& value)
+void CSSToStyleMap::mapFillAttachment(CSSPropertyID, FillLayer& layer, const CSSValue& value)
 {
     if (value.isInitialValue()) {
         layer.setAttachment(FillLayer::initialFillAttachment(layer.type()));
@@ -96,7 +96,7 @@
     }
 }
 
-void CSSToStyleMap::mapFillClip(CSSPropertyID, FillLayer& layer, CSSValue& value)
+void CSSToStyleMap::mapFillClip(CSSPropertyID, FillLayer& layer, const CSSValue& value)
 {
     if (value.isInitialValue()) {
         layer.setClip(FillLayer::initialFillClip(layer.type()));
@@ -109,7 +109,7 @@
     layer.setClip(downcast<CSSPrimitiveValue>(value));
 }
 
-void CSSToStyleMap::mapFillComposite(CSSPropertyID, FillLayer& layer, CSSValue& value)
+void CSSToStyleMap::mapFillComposite(CSSPropertyID, FillLayer& layer, const CSSValue& value)
 {
     if (value.isInitialValue()) {
         layer.setComposite(FillLayer::initialFillComposite(layer.type()));
@@ -122,7 +122,7 @@
     layer.setComposite(downcast<CSSPrimitiveValue>(value));
 }
 
-void CSSToStyleMap::mapFillBlendMode(CSSPropertyID, FillLayer& layer, CSSValue& value)
+void CSSToStyleMap::mapFillBlendMode(CSSPropertyID, FillLayer& layer, const CSSValue& value)
 {
     if (value.isInitialValue()) {
         layer.setBlendMode(FillLayer::initialFillBlendMode(layer.type()));
@@ -135,7 +135,7 @@
     layer.setBlendMode(downcast<CSSPrimitiveValue>(value));
 }
 
-void CSSToStyleMap::mapFillOrigin(CSSPropertyID, FillLayer& layer, CSSValue& value)
+void CSSToStyleMap::mapFillOrigin(CSSPropertyID, FillLayer& layer, const CSSValue& value)
 {
     if (value.isInitialValue()) {
         layer.setOrigin(FillLayer::initialFillOrigin(layer.type()));
@@ -148,7 +148,6 @@
     layer.setOrigin(downcast<CSSPrimitiveValue>(value));
 }
 
-
 void CSSToStyleMap::mapFillImage(CSSPropertyID property, FillLayer& layer, CSSValue& value)
 {
     if (value.isInitialValue()) {
@@ -159,7 +158,7 @@
     layer.setImage(styleImage(property, value));
 }
 
-void CSSToStyleMap::mapFillRepeatX(CSSPropertyID, FillLayer& layer, CSSValue& value)
+void CSSToStyleMap::mapFillRepeatX(CSSPropertyID, FillLayer& layer, const CSSValue& value)
 {
     if (value.isInitialValue()) {
         layer.setRepeatX(FillLayer::initialFillRepeatX(layer.type()));
@@ -172,7 +171,7 @@
     layer.setRepeatX(downcast<CSSPrimitiveValue>(value));
 }
 
-void CSSToStyleMap::mapFillRepeatY(CSSPropertyID, FillLayer& layer, CSSValue& value)
+void CSSToStyleMap::mapFillRepeatY(CSSPropertyID, FillLayer& layer, const CSSValue& value)
 {
     if (value.isInitialValue()) {
         layer.setRepeatY(FillLayer::initialFillRepeatY(layer.type()));
@@ -196,7 +195,7 @@
     return !size.width().isUndefined() && !size.height().isUndefined();
 }
 
-void CSSToStyleMap::mapFillSize(CSSPropertyID, FillLayer& layer, CSSValue& value)
+void CSSToStyleMap::mapFillSize(CSSPropertyID, FillLayer& layer, const CSSValue& value)
 {
     if (value.isInitialValue()) {
         layer.setSize(FillLayer::initialFillSize(layer.type()));
@@ -224,7 +223,7 @@
     layer.setSize(fillSize);
 }
 
-void CSSToStyleMap::mapFillXPosition(CSSPropertyID propertyID, FillLayer& layer, CSSValue& value)
+void CSSToStyleMap::mapFillXPosition(CSSPropertyID propertyID, FillLayer& layer, const CSSValue& value)
 {
     if (value.isInitialValue()) {
         layer.setXPosition(FillLayer::initialFillXPosition(layer.type()));
@@ -256,7 +255,7 @@
         layer.setBackgroundXOrigin(*pair->first());
 }
 
-void CSSToStyleMap::mapFillYPosition(CSSPropertyID propertyID, FillLayer& layer, CSSValue& value)
+void CSSToStyleMap::mapFillYPosition(CSSPropertyID propertyID, FillLayer& layer, const CSSValue& value)
 {
     if (value.isInitialValue()) {
         layer.setYPosition(FillLayer::initialFillYPosition(layer.type()));
@@ -288,7 +287,7 @@
         layer.setBackgroundYOrigin(*pair->first());
 }
 
-void CSSToStyleMap::mapFillMaskSourceType(CSSPropertyID, FillLayer& layer, CSSValue& value)
+void CSSToStyleMap::mapFillMaskSourceType(CSSPropertyID, FillLayer& layer, const CSSValue& value)
 {
     EMaskSourceType type = FillLayer::initialFillMaskSourceType(layer.type());
     if (value.isInitialValue()) {
@@ -315,7 +314,7 @@
     layer.setMaskSourceType(type);
 }
 
-void CSSToStyleMap::mapAnimationDelay(Animation& animation, CSSValue& value)
+void CSSToStyleMap::mapAnimationDelay(Animation& animation, const CSSValue& value)
 {
     if (value.isInitialValue()) {
         animation.setDelay(Animation::initialDelay());
@@ -328,7 +327,7 @@
     animation.setDelay(downcast<CSSPrimitiveValue>(value).computeTime<double, CSSPrimitiveValue::Seconds>());
 }
 
-void CSSToStyleMap::mapAnimationDirection(Animation& layer, CSSValue& value)
+void CSSToStyleMap::mapAnimationDirection(Animation& layer, const CSSValue& value)
 {
     if (value.isInitialValue()) {
         layer.setDirection(Animation::initialDirection());
@@ -356,7 +355,7 @@
     }
 }
 
-void CSSToStyleMap::mapAnimationDuration(Animation& animation, CSSValue& value)
+void CSSToStyleMap::mapAnimationDuration(Animation& animation, const CSSValue& value)
 {
     if (value.isInitialValue()) {
         animation.setDuration(Animation::initialDuration());
@@ -369,7 +368,7 @@
     animation.setDuration(downcast<CSSPrimitiveValue>(value).computeTime<double, CSSPrimitiveValue::Seconds>());
 }
 
-void CSSToStyleMap::mapAnimationFillMode(Animation& layer, CSSValue& value)
+void CSSToStyleMap::mapAnimationFillMode(Animation& layer, const CSSValue& value)
 {
     if (value.isInitialValue()) {
         layer.setFillMode(Animation::initialFillMode());
@@ -397,7 +396,7 @@
     }
 }
 
-void CSSToStyleMap::mapAnimationIterationCount(Animation& animation, CSSValue& value)
+void CSSToStyleMap::mapAnimationIterationCount(Animation& animation, const CSSValue& value)
 {
     if (value.isInitialValue()) {
         animation.setIterationCount(Animation::initialIterationCount());
@@ -414,7 +413,7 @@
         animation.setIterationCount(primitiveValue.getFloatValue());
 }
 
-void CSSToStyleMap::mapAnimationName(Animation& layer, CSSValue& value)
+void CSSToStyleMap::mapAnimationName(Animation& layer, const CSSValue& value)
 {
     if (value.isInitialValue()) {
         layer.setName(Animation::initialName());
@@ -431,7 +430,7 @@
         layer.setName(primitiveValue.getStringValue());
 }
 
-void CSSToStyleMap::mapAnimationPlayState(Animation& layer, CSSValue& value)
+void CSSToStyleMap::mapAnimationPlayState(Animation& layer, const CSSValue& value)
 {
     if (value.isInitialValue()) {
         layer.setPlayState(Animation::initialPlayState());
@@ -445,7 +444,7 @@
     layer.setPlayState(playState);
 }
 
-void CSSToStyleMap::mapAnimationProperty(Animation& animation, CSSValue& value)
+void CSSToStyleMap::mapAnimationProperty(Animation& animation, const CSSValue& value)
 {
     if (value.isInitialValue()) {
         animation.setAnimationMode(Animation::AnimateAll);
@@ -469,7 +468,7 @@
     }
 }
 
-void CSSToStyleMap::mapAnimationTimingFunction(Animation& animation, CSSValue& value)
+void CSSToStyleMap::mapAnimationTimingFunction(Animation& animation, const CSSValue& value)
 {
     if (value.isInitialValue()) {
         animation.setTimingFunction(Animation::initialTimingFunction());
@@ -515,7 +514,7 @@
 }
 
 #if ENABLE(CSS_ANIMATIONS_LEVEL_2)
-void CSSToStyleMap::mapAnimationTrigger(Animation& animation, CSSValue& value)
+void CSSToStyleMap::mapAnimationTrigger(Animation& animation, const CSSValue& value)
 {
     if (value.isInitialValue()) {
         animation.setTrigger(Animation::initialTrigger());

Modified: trunk/Source/WebCore/css/CSSToStyleMap.h (182353 => 182354)


--- trunk/Source/WebCore/css/CSSToStyleMap.h	2015-04-05 03:09:24 UTC (rev 182353)
+++ trunk/Source/WebCore/css/CSSToStyleMap.h	2015-04-05 06:11:00 UTC (rev 182354)
@@ -45,30 +45,30 @@
 public:
     CSSToStyleMap(StyleResolver*);
 
-    void mapFillAttachment(CSSPropertyID, FillLayer&, CSSValue&);
-    void mapFillClip(CSSPropertyID, FillLayer&, CSSValue&);
-    void mapFillComposite(CSSPropertyID, FillLayer&, CSSValue&);
-    void mapFillBlendMode(CSSPropertyID, FillLayer&, CSSValue&);
-    void mapFillOrigin(CSSPropertyID, FillLayer&, CSSValue&);
+    void mapFillAttachment(CSSPropertyID, FillLayer&, const CSSValue&);
+    void mapFillClip(CSSPropertyID, FillLayer&, const CSSValue&);
+    void mapFillComposite(CSSPropertyID, FillLayer&, const CSSValue&);
+    void mapFillBlendMode(CSSPropertyID, FillLayer&, const CSSValue&);
+    void mapFillOrigin(CSSPropertyID, FillLayer&, const CSSValue&);
     void mapFillImage(CSSPropertyID, FillLayer&, CSSValue&);
-    void mapFillRepeatX(CSSPropertyID, FillLayer&, CSSValue&);
-    void mapFillRepeatY(CSSPropertyID, FillLayer&, CSSValue&);
-    void mapFillSize(CSSPropertyID, FillLayer&, CSSValue&);
-    void mapFillXPosition(CSSPropertyID, FillLayer&, CSSValue&);
-    void mapFillYPosition(CSSPropertyID, FillLayer&, CSSValue&);
-    void mapFillMaskSourceType(CSSPropertyID, FillLayer&, CSSValue&);
+    void mapFillRepeatX(CSSPropertyID, FillLayer&, const CSSValue&);
+    void mapFillRepeatY(CSSPropertyID, FillLayer&, const CSSValue&);
+    void mapFillSize(CSSPropertyID, FillLayer&, const CSSValue&);
+    void mapFillXPosition(CSSPropertyID, FillLayer&, const CSSValue&);
+    void mapFillYPosition(CSSPropertyID, FillLayer&, const CSSValue&);
+    void mapFillMaskSourceType(CSSPropertyID, FillLayer&, const CSSValue&);
 
-    void mapAnimationDelay(Animation&, CSSValue&);
-    void mapAnimationDirection(Animation&, CSSValue&);
-    void mapAnimationDuration(Animation&, CSSValue&);
-    void mapAnimationFillMode(Animation&, CSSValue&);
-    void mapAnimationIterationCount(Animation&, CSSValue&);
-    void mapAnimationName(Animation&, CSSValue&);
-    void mapAnimationPlayState(Animation&, CSSValue&);
-    void mapAnimationProperty(Animation&, CSSValue&);
-    void mapAnimationTimingFunction(Animation&, CSSValue&);
+    void mapAnimationDelay(Animation&, const CSSValue&);
+    void mapAnimationDirection(Animation&, const CSSValue&);
+    void mapAnimationDuration(Animation&, const CSSValue&);
+    void mapAnimationFillMode(Animation&, const CSSValue&);
+    void mapAnimationIterationCount(Animation&, const CSSValue&);
+    void mapAnimationName(Animation&, const CSSValue&);
+    void mapAnimationPlayState(Animation&, const CSSValue&);
+    void mapAnimationProperty(Animation&, const CSSValue&);
+    void mapAnimationTimingFunction(Animation&, const CSSValue&);
 #if ENABLE(CSS_ANIMATIONS_LEVEL_2)
-    void mapAnimationTrigger(Animation&, CSSValue&);
+    void mapAnimationTrigger(Animation&, const CSSValue&);
 #endif
 
     void mapNinePieceImage(CSSPropertyID, CSSValue*, NinePieceImage&);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to