Title: [220379] trunk/Source/WebCore
Revision
220379
Author
simon.fra...@apple.com
Date
2017-08-07 19:46:11 -0700 (Mon, 07 Aug 2017)

Log Message

Make TransformOperation::type() non-virtual
https://bugs.webkit.org/show_bug.cgi?id=175297

Reviewed by Sam Weinig.

Store the OperationType in the base class so that type() and isSameType() can
be non-virtual.

Small perf win on some benchmarks.

* platform/graphics/transforms/IdentityTransformOperation.h:
* platform/graphics/transforms/Matrix3DTransformOperation.h:
* platform/graphics/transforms/MatrixTransformOperation.h:
* platform/graphics/transforms/PerspectiveTransformOperation.h:
* platform/graphics/transforms/RotateTransformOperation.cpp:
(WebCore::RotateTransformOperation::blend):
* platform/graphics/transforms/RotateTransformOperation.h:
* platform/graphics/transforms/ScaleTransformOperation.cpp:
(WebCore::ScaleTransformOperation::blend):
* platform/graphics/transforms/ScaleTransformOperation.h:
* platform/graphics/transforms/SkewTransformOperation.cpp:
(WebCore::SkewTransformOperation::blend):
* platform/graphics/transforms/SkewTransformOperation.h:
* platform/graphics/transforms/TransformOperation.h:
(WebCore::TransformOperation::TransformOperation):
(WebCore::TransformOperation::type const):
(WebCore::TransformOperation::isSameType const):
* platform/graphics/transforms/TranslateTransformOperation.cpp:
(WebCore::TranslateTransformOperation::blend):
* platform/graphics/transforms/TranslateTransformOperation.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (220378 => 220379)


--- trunk/Source/WebCore/ChangeLog	2017-08-08 02:46:06 UTC (rev 220378)
+++ trunk/Source/WebCore/ChangeLog	2017-08-08 02:46:11 UTC (rev 220379)
@@ -1,5 +1,38 @@
 2017-08-07  Simon Fraser  <simon.fra...@apple.com>
 
+        Make TransformOperation::type() non-virtual
+        https://bugs.webkit.org/show_bug.cgi?id=175297
+
+        Reviewed by Sam Weinig.
+
+        Store the OperationType in the base class so that type() and isSameType() can
+        be non-virtual.
+
+        Small perf win on some benchmarks.
+
+        * platform/graphics/transforms/IdentityTransformOperation.h:
+        * platform/graphics/transforms/Matrix3DTransformOperation.h:
+        * platform/graphics/transforms/MatrixTransformOperation.h:
+        * platform/graphics/transforms/PerspectiveTransformOperation.h:
+        * platform/graphics/transforms/RotateTransformOperation.cpp:
+        (WebCore::RotateTransformOperation::blend):
+        * platform/graphics/transforms/RotateTransformOperation.h:
+        * platform/graphics/transforms/ScaleTransformOperation.cpp:
+        (WebCore::ScaleTransformOperation::blend):
+        * platform/graphics/transforms/ScaleTransformOperation.h:
+        * platform/graphics/transforms/SkewTransformOperation.cpp:
+        (WebCore::SkewTransformOperation::blend):
+        * platform/graphics/transforms/SkewTransformOperation.h:
+        * platform/graphics/transforms/TransformOperation.h:
+        (WebCore::TransformOperation::TransformOperation):
+        (WebCore::TransformOperation::type const):
+        (WebCore::TransformOperation::isSameType const):
+        * platform/graphics/transforms/TranslateTransformOperation.cpp:
+        (WebCore::TranslateTransformOperation::blend):
+        * platform/graphics/transforms/TranslateTransformOperation.h:
+
+2017-08-07  Simon Fraser  <simon.fra...@apple.com>
+
         Inline ~Color and Color::isExtended()
         https://bugs.webkit.org/show_bug.cgi?id=175293
 

Modified: trunk/Source/WebCore/platform/graphics/transforms/IdentityTransformOperation.h (220378 => 220379)


--- trunk/Source/WebCore/platform/graphics/transforms/IdentityTransformOperation.h	2017-08-08 02:46:06 UTC (rev 220378)
+++ trunk/Source/WebCore/platform/graphics/transforms/IdentityTransformOperation.h	2017-08-08 02:46:11 UTC (rev 220379)
@@ -2,7 +2,7 @@
  * Copyright (C) 2000 Lars Knoll (kn...@kde.org)
  *           (C) 2000 Antti Koivisto (koivi...@kde.org)
  *           (C) 2000 Dirk Mueller (muel...@kde.org)
- * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2005-2008, 2017 Apple Inc. All rights reserved.
  * Copyright (C) 2006 Graham Dennis (graham.den...@gmail.com)
  *
  * This library is free software; you can redistribute it and/or
@@ -22,8 +22,7 @@
  *
  */
 
-#ifndef IdentityTransformOperation_h
-#define IdentityTransformOperation_h
+#pragma once
 
 #include "TransformOperation.h"
 #include <wtf/Ref.h>
@@ -44,8 +43,6 @@
 
 private:
     bool isIdentity() const override { return true; }
-    OperationType type() const override { return IDENTITY; }
-    bool isSameType(const TransformOperation& o) const override { return o.type() == IDENTITY; }
 
     bool operator==(const TransformOperation& o) const override
     {
@@ -65,13 +62,11 @@
     void dump(TextStream&) const final;
 
     IdentityTransformOperation()
+        : TransformOperation(IDENTITY)
     {
     }
-
 };
 
 } // namespace WebCore
 
 SPECIALIZE_TYPE_TRAITS_TRANSFORMOPERATION(WebCore::IdentityTransformOperation, type() == WebCore::TransformOperation::IDENTITY)
-
-#endif // IdentityTransformOperation_h

Modified: trunk/Source/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.h (220378 => 220379)


--- trunk/Source/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.h	2017-08-08 02:46:06 UTC (rev 220378)
+++ trunk/Source/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.h	2017-08-08 02:46:11 UTC (rev 220379)
@@ -23,8 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef Matrix3DTransformOperation_h
-#define Matrix3DTransformOperation_h
+#pragma once
 
 #include "TransformOperation.h"
 #include <wtf/Ref.h>
@@ -49,9 +48,6 @@
     bool isIdentity() const override { return m_matrix.isIdentity(); }
     bool isAffectedByTransformOrigin() const override { return !isIdentity(); }
 
-    OperationType type() const override { return MATRIX_3D; }
-    bool isSameType(const TransformOperation& o) const override { return o.type() == MATRIX_3D; }
-
     bool operator==(const TransformOperation&) const override;
 
     bool apply(TransformationMatrix& transform, const FloatSize&) const override
@@ -65,8 +61,9 @@
     void dump(TextStream&) const final;
 
     Matrix3DTransformOperation(const TransformationMatrix& mat)
+        : TransformOperation(MATRIX_3D)
+        , m_matrix(mat)
     {
-        m_matrix = mat;
     }
 
     TransformationMatrix m_matrix;
@@ -75,5 +72,3 @@
 } // namespace WebCore
 
 SPECIALIZE_TYPE_TRAITS_TRANSFORMOPERATION(WebCore::Matrix3DTransformOperation, type() == WebCore::TransformOperation::MATRIX_3D)
-
-#endif // Matrix3DTransformOperation_h

Modified: trunk/Source/WebCore/platform/graphics/transforms/MatrixTransformOperation.h (220378 => 220379)


--- trunk/Source/WebCore/platform/graphics/transforms/MatrixTransformOperation.h	2017-08-08 02:46:06 UTC (rev 220378)
+++ trunk/Source/WebCore/platform/graphics/transforms/MatrixTransformOperation.h	2017-08-08 02:46:11 UTC (rev 220379)
@@ -2,7 +2,7 @@
  * Copyright (C) 2000 Lars Knoll (kn...@kde.org)
  *           (C) 2000 Antti Koivisto (koivi...@kde.org)
  *           (C) 2000 Dirk Mueller (muel...@kde.org)
- * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2005-2008, 2017 Apple Inc. All rights reserved.
  * Copyright (C) 2006 Graham Dennis (graham.den...@gmail.com)
  *
  * This library is free software; you can redistribute it and/or
@@ -22,8 +22,7 @@
  *
  */
 
-#ifndef MatrixTransformOperation_h
-#define MatrixTransformOperation_h
+#pragma once
 
 #include "TransformOperation.h"
 #include "TransformationMatrix.h"
@@ -54,9 +53,6 @@
     bool isIdentity() const override { return m_a == 1 && m_b == 0 && m_c == 0 && m_d == 1 && m_e == 0 && m_f == 0; }
     bool isAffectedByTransformOrigin() const override { return !isIdentity(); }
 
-    OperationType type() const override { return MATRIX; }
-    bool isSameType(const TransformOperation& o) const override { return o.type() == MATRIX; }
-
     bool operator==(const TransformOperation&) const override;
 
     bool apply(TransformationMatrix& transform, const FloatSize&) const override
@@ -71,7 +67,8 @@
     void dump(TextStream&) const final;
 
     MatrixTransformOperation(double a, double b, double c, double d, double e, double f)
-        : m_a(a)
+        : TransformOperation(MATRIX)
+        , m_a(a)
         , m_b(b)
         , m_c(c)
         , m_d(d)
@@ -81,7 +78,8 @@
     }
 
     MatrixTransformOperation(const TransformationMatrix& t)
-        : m_a(t.a())
+        : TransformOperation(MATRIX)
+        , m_a(t.a())
         , m_b(t.b())
         , m_c(t.c())
         , m_d(t.d())
@@ -101,5 +99,3 @@
 } // namespace WebCore
 
 SPECIALIZE_TYPE_TRAITS_TRANSFORMOPERATION(WebCore::MatrixTransformOperation, type() == WebCore::TransformOperation::MATRIX)
-
-#endif // MatrixTransformOperation_h

Modified: trunk/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h (220378 => 220379)


--- trunk/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h	2017-08-08 02:46:06 UTC (rev 220378)
+++ trunk/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h	2017-08-08 02:46:11 UTC (rev 220379)
@@ -23,8 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef PerspectiveTransformOperation_h
-#define PerspectiveTransformOperation_h
+#pragma once
 
 #include "Length.h"
 #include "LengthFunctions.h"
@@ -51,9 +50,6 @@
     bool isIdentity() const override { return !floatValueForLength(m_p, 1); }
     bool isAffectedByTransformOrigin() const override { return !isIdentity(); }
 
-    OperationType type() const override { return PERSPECTIVE; }
-    bool isSameType(const TransformOperation& o) const override { return o.type() == PERSPECTIVE; }
-
     bool operator==(const TransformOperation&) const override;
 
     bool apply(TransformationMatrix& transform, const FloatSize&) const override
@@ -67,7 +63,8 @@
     void dump(TextStream&) const final;
 
     PerspectiveTransformOperation(const Length& p)
-        : m_p(p)
+        : TransformOperation(PERSPECTIVE)
+        , m_p(p)
     {
         ASSERT(p.isFixed());
     }
@@ -78,5 +75,3 @@
 } // namespace WebCore
 
 SPECIALIZE_TYPE_TRAITS_TRANSFORMOPERATION(WebCore::PerspectiveTransformOperation, type() == WebCore::TransformOperation::PERSPECTIVE)
-
-#endif // PerspectiveTransformOperation_h

Modified: trunk/Source/WebCore/platform/graphics/transforms/RotateTransformOperation.cpp (220378 => 220379)


--- trunk/Source/WebCore/platform/graphics/transforms/RotateTransformOperation.cpp	2017-08-08 02:46:06 UTC (rev 220378)
+++ trunk/Source/WebCore/platform/graphics/transforms/RotateTransformOperation.cpp	2017-08-08 02:46:11 UTC (rev 220379)
@@ -43,7 +43,7 @@
         return *this;
     
     if (blendToIdentity)
-        return RotateTransformOperation::create(m_x, m_y, m_z, m_angle - m_angle * progress, m_type);
+        return RotateTransformOperation::create(m_x, m_y, m_z, m_angle - m_angle * progress, type());
     
     const RotateTransformOperation* fromOp = downcast<RotateTransformOperation>(from);
     
@@ -55,7 +55,7 @@
         return RotateTransformOperation::create(fromOp ? fromOp->m_x : m_x, 
                                                 fromOp ? fromOp->m_y : m_y, 
                                                 fromOp ? fromOp->m_z : m_z, 
-                                                WebCore::blend(fromAngle, m_angle, progress), m_type);
+                                                WebCore::blend(fromAngle, m_angle, progress), type());
     }
 
     const RotateTransformOperation* toOp = this;

Modified: trunk/Source/WebCore/platform/graphics/transforms/RotateTransformOperation.h (220378 => 220379)


--- trunk/Source/WebCore/platform/graphics/transforms/RotateTransformOperation.h	2017-08-08 02:46:06 UTC (rev 220378)
+++ trunk/Source/WebCore/platform/graphics/transforms/RotateTransformOperation.h	2017-08-08 02:46:11 UTC (rev 220379)
@@ -2,7 +2,7 @@
  * Copyright (C) 2000 Lars Knoll (kn...@kde.org)
  *           (C) 2000 Antti Koivisto (koivi...@kde.org)
  *           (C) 2000 Dirk Mueller (muel...@kde.org)
- * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2005-2008, 2017 Apple Inc. All rights reserved.
  * Copyright (C) 2006 Graham Dennis (graham.den...@gmail.com)
  *
  * This library is free software; you can redistribute it and/or
@@ -22,8 +22,7 @@
  *
  */
 
-#ifndef RotateTransformOperation_h
-#define RotateTransformOperation_h
+#pragma once
 
 #include "TransformOperation.h"
 #include <wtf/Ref.h>
@@ -44,7 +43,7 @@
 
     Ref<TransformOperation> clone() const override
     {
-        return adoptRef(*new RotateTransformOperation(m_x, m_y, m_z, m_angle, m_type));
+        return adoptRef(*new RotateTransformOperation(m_x, m_y, m_z, m_angle, type()));
     }
 
     double x() const { return m_x; }
@@ -56,9 +55,6 @@
     bool isIdentity() const override { return m_angle == 0; }
     bool isAffectedByTransformOrigin() const override { return !isIdentity(); }
 
-    OperationType type() const override { return m_type; }
-    bool isSameType(const TransformOperation& o) const override { return o.type() == m_type; }
-
     bool operator==(const TransformOperation&) const override;
 
     bool apply(TransformationMatrix& transform, const FloatSize& /*borderBoxSize*/) const override
@@ -72,11 +68,11 @@
     void dump(TextStream&) const final;
 
     RotateTransformOperation(double x, double y, double z, double angle, OperationType type)
-        : m_x(x)
+        : TransformOperation(type)
+        , m_x(x)
         , m_y(y)
         , m_z(z)
         , m_angle(angle)
-        , m_type(type)
     {
         ASSERT(isRotateTransformOperationType());
     }
@@ -85,11 +81,8 @@
     double m_y;
     double m_z;
     double m_angle;
-    OperationType m_type;
 };
 
 } // namespace WebCore
 
 SPECIALIZE_TYPE_TRAITS_TRANSFORMOPERATION(WebCore::RotateTransformOperation, isRotateTransformOperationType())
-
-#endif // RotateTransformOperation_h

Modified: trunk/Source/WebCore/platform/graphics/transforms/ScaleTransformOperation.cpp (220378 => 220379)


--- trunk/Source/WebCore/platform/graphics/transforms/ScaleTransformOperation.cpp	2017-08-08 02:46:06 UTC (rev 220378)
+++ trunk/Source/WebCore/platform/graphics/transforms/ScaleTransformOperation.cpp	2017-08-08 02:46:11 UTC (rev 220379)
@@ -43,7 +43,7 @@
     if (blendToIdentity)
         return ScaleTransformOperation::create(WebCore::blend(m_x, 1.0, progress),
                                                WebCore::blend(m_y, 1.0, progress),
-                                               WebCore::blend(m_z, 1.0, progress), m_type);
+                                               WebCore::blend(m_z, 1.0, progress), type());
     
     const ScaleTransformOperation* fromOp = downcast<ScaleTransformOperation>(from);
     double fromX = fromOp ? fromOp->m_x : 1.0;
@@ -51,7 +51,7 @@
     double fromZ = fromOp ? fromOp->m_z : 1.0;
     return ScaleTransformOperation::create(WebCore::blend(fromX, m_x, progress),
                                            WebCore::blend(fromY, m_y, progress),
-                                           WebCore::blend(fromZ, m_z, progress), m_type);
+                                           WebCore::blend(fromZ, m_z, progress), type());
 }
 
 void ScaleTransformOperation::dump(TextStream& ts) const

Modified: trunk/Source/WebCore/platform/graphics/transforms/ScaleTransformOperation.h (220378 => 220379)


--- trunk/Source/WebCore/platform/graphics/transforms/ScaleTransformOperation.h	2017-08-08 02:46:06 UTC (rev 220378)
+++ trunk/Source/WebCore/platform/graphics/transforms/ScaleTransformOperation.h	2017-08-08 02:46:11 UTC (rev 220379)
@@ -2,7 +2,7 @@
  * Copyright (C) 2000 Lars Knoll (kn...@kde.org)
  *           (C) 2000 Antti Koivisto (koivi...@kde.org)
  *           (C) 2000 Dirk Mueller (muel...@kde.org)
- * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2005-2008, 2017 Apple Inc. All rights reserved.
  * Copyright (C) 2006 Graham Dennis (graham.den...@gmail.com)
  *
  * This library is free software; you can redistribute it and/or
@@ -22,8 +22,7 @@
  *
  */
 
-#ifndef ScaleTransformOperation_h
-#define ScaleTransformOperation_h
+#pragma once
 
 #include "TransformOperation.h"
 #include <wtf/Ref.h>
@@ -44,7 +43,7 @@
 
     Ref<TransformOperation> clone() const override
     {
-        return adoptRef(*new ScaleTransformOperation(m_x, m_y, m_z, m_type));
+        return adoptRef(*new ScaleTransformOperation(m_x, m_y, m_z, type()));
     }
 
     double x() const { return m_x; }
@@ -55,9 +54,6 @@
     bool isIdentity() const override { return m_x == 1 &&  m_y == 1 &&  m_z == 1; }
     bool isAffectedByTransformOrigin() const override { return !isIdentity(); }
 
-    OperationType type() const override { return m_type; }
-    bool isSameType(const TransformOperation& o) const override { return o.type() == m_type; }
-
     bool operator==(const TransformOperation&) const override;
 
     bool apply(TransformationMatrix& transform, const FloatSize&) const override
@@ -71,10 +67,10 @@
     void dump(TextStream&) const final;
 
     ScaleTransformOperation(double sx, double sy, double sz, OperationType type)
-        : m_x(sx)
+        : TransformOperation(type)
+        , m_x(sx)
         , m_y(sy)
         , m_z(sz)
-        , m_type(type)
     {
         ASSERT(isScaleTransformOperationType());
     }
@@ -82,11 +78,8 @@
     double m_x;
     double m_y;
     double m_z;
-    OperationType m_type;
 };
 
 } // namespace WebCore
 
 SPECIALIZE_TYPE_TRAITS_TRANSFORMOPERATION(WebCore::ScaleTransformOperation, isScaleTransformOperationType())
-
-#endif // ScaleTransformOperation_h

Modified: trunk/Source/WebCore/platform/graphics/transforms/SkewTransformOperation.cpp (220378 => 220379)


--- trunk/Source/WebCore/platform/graphics/transforms/SkewTransformOperation.cpp	2017-08-08 02:46:06 UTC (rev 220378)
+++ trunk/Source/WebCore/platform/graphics/transforms/SkewTransformOperation.cpp	2017-08-08 02:46:11 UTC (rev 220379)
@@ -41,12 +41,12 @@
         return *this;
     
     if (blendToIdentity)
-        return SkewTransformOperation::create(WebCore::blend(m_angleX, 0.0, progress), WebCore::blend(m_angleY, 0.0, progress), m_type);
+        return SkewTransformOperation::create(WebCore::blend(m_angleX, 0.0, progress), WebCore::blend(m_angleY, 0.0, progress), type());
     
     const SkewTransformOperation* fromOp = downcast<SkewTransformOperation>(from);
     double fromAngleX = fromOp ? fromOp->m_angleX : 0;
     double fromAngleY = fromOp ? fromOp->m_angleY : 0;
-    return SkewTransformOperation::create(WebCore::blend(fromAngleX, m_angleX, progress), WebCore::blend(fromAngleY, m_angleY, progress), m_type);
+    return SkewTransformOperation::create(WebCore::blend(fromAngleX, m_angleX, progress), WebCore::blend(fromAngleY, m_angleY, progress), type());
 }
 
 void SkewTransformOperation::dump(TextStream& ts) const

Modified: trunk/Source/WebCore/platform/graphics/transforms/SkewTransformOperation.h (220378 => 220379)


--- trunk/Source/WebCore/platform/graphics/transforms/SkewTransformOperation.h	2017-08-08 02:46:06 UTC (rev 220378)
+++ trunk/Source/WebCore/platform/graphics/transforms/SkewTransformOperation.h	2017-08-08 02:46:11 UTC (rev 220379)
@@ -2,7 +2,7 @@
  * Copyright (C) 2000 Lars Knoll (kn...@kde.org)
  *           (C) 2000 Antti Koivisto (koivi...@kde.org)
  *           (C) 2000 Dirk Mueller (muel...@kde.org)
- * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2005-2008, 2017 Apple Inc. All rights reserved.
  * Copyright (C) 2006 Graham Dennis (graham.den...@gmail.com)
  *
  * This library is free software; you can redistribute it and/or
@@ -22,8 +22,7 @@
  *
  */
 
-#ifndef SkewTransformOperation_h
-#define SkewTransformOperation_h
+#pragma once
 
 #include "TransformOperation.h"
 #include <wtf/Ref.h>
@@ -39,7 +38,7 @@
 
     Ref<TransformOperation> clone() const override
     {
-        return adoptRef(*new SkewTransformOperation(m_angleX, m_angleY, m_type));
+        return adoptRef(*new SkewTransformOperation(m_angleX, m_angleY, type()));
     }
 
     double angleX() const { return m_angleX; }
@@ -49,9 +48,6 @@
     bool isIdentity() const override { return m_angleX == 0 && m_angleY == 0; }
     bool isAffectedByTransformOrigin() const override { return !isIdentity(); }
 
-    OperationType type() const override { return m_type; }
-    bool isSameType(const TransformOperation& o) const override { return o.type() == m_type; }
-
     bool operator==(const TransformOperation&) const override;
 
     bool apply(TransformationMatrix& transform, const FloatSize&) const override
@@ -65,9 +61,9 @@
     void dump(TextStream&) const final;
     
     SkewTransformOperation(double angleX, double angleY, OperationType type)
-        : m_angleX(angleX)
+        : TransformOperation(type)
+        , m_angleX(angleX)
         , m_angleY(angleY)
-        , m_type(type)
     {
         ASSERT(isSkewTransformOperationType());
     }
@@ -74,11 +70,8 @@
     
     double m_angleX;
     double m_angleY;
-    OperationType m_type;
 };
 
 } // namespace WebCore
 
 SPECIALIZE_TYPE_TRAITS_TRANSFORMOPERATION(WebCore::SkewTransformOperation, isSkewTransformOperationType())
-
-#endif // SkewTransformOperation_h

Modified: trunk/Source/WebCore/platform/graphics/transforms/TransformOperation.h (220378 => 220379)


--- trunk/Source/WebCore/platform/graphics/transforms/TransformOperation.h	2017-08-08 02:46:06 UTC (rev 220378)
+++ trunk/Source/WebCore/platform/graphics/transforms/TransformOperation.h	2017-08-08 02:46:11 UTC (rev 220379)
@@ -2,7 +2,7 @@
  * Copyright (C) 2000 Lars Knoll (kn...@kde.org)
  *           (C) 2000 Antti Koivisto (koivi...@kde.org)
  *           (C) 2000 Dirk Mueller (muel...@kde.org)
- * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2005-2008, 2017 Apple Inc. All rights reserved.
  * Copyright (C) 2006 Graham Dennis (graham.den...@gmail.com)
  *
  * This library is free software; you can redistribute it and/or
@@ -22,8 +22,7 @@
  *
  */
 
-#ifndef TransformOperation_h
-#define TransformOperation_h
+#pragma once
 
 #include "FloatSize.h"
 #include "TransformationMatrix.h"
@@ -52,6 +51,10 @@
         IDENTITY, NONE
     };
 
+    TransformOperation(OperationType type)
+        : m_type(type)
+    {
+    }
     virtual ~TransformOperation() { }
 
     virtual Ref<TransformOperation> clone() const = 0;
@@ -66,8 +69,8 @@
 
     virtual Ref<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false) = 0;
 
-    virtual OperationType type() const = 0;
-    virtual bool isSameType(const TransformOperation&) const { return false; }
+    OperationType type() const { return m_type; }
+    bool isSameType(const TransformOperation& other) const { return type() == other.type(); }
 
     virtual bool isAffectedByTransformOrigin() const { return false; }
     
@@ -106,6 +109,9 @@
     }
     
     virtual void dump(TextStream&) const = 0;
+
+private:
+    OperationType m_type;
 };
 
 TextStream& operator<<(TextStream&, TransformOperation::OperationType);
@@ -117,5 +123,3 @@
 SPECIALIZE_TYPE_TRAITS_BEGIN(ToValueTypeName) \
     static bool isType(const WebCore::TransformOperation& operation) { return operation.predicate; } \
 SPECIALIZE_TYPE_TRAITS_END()
-
-#endif // TransformOperation_h

Modified: trunk/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.cpp (220378 => 220379)


--- trunk/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.cpp	2017-08-08 02:46:06 UTC (rev 220378)
+++ trunk/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.cpp	2017-08-08 02:46:11 UTC (rev 220379)
@@ -42,13 +42,13 @@
 
     Length zeroLength(0, Fixed);
     if (blendToIdentity)
-        return TranslateTransformOperation::create(WebCore::blend(m_x, zeroLength, progress), WebCore::blend(m_y, zeroLength, progress), WebCore::blend(m_z, zeroLength, progress), m_type);
+        return TranslateTransformOperation::create(WebCore::blend(m_x, zeroLength, progress), WebCore::blend(m_y, zeroLength, progress), WebCore::blend(m_z, zeroLength, progress), type());
 
     const TranslateTransformOperation* fromOp = downcast<TranslateTransformOperation>(from);
     Length fromX = fromOp ? fromOp->m_x : zeroLength;
     Length fromY = fromOp ? fromOp->m_y : zeroLength;
     Length fromZ = fromOp ? fromOp->m_z : zeroLength;
-    return TranslateTransformOperation::create(WebCore::blend(fromX, x(), progress), WebCore::blend(fromY, y(), progress), WebCore::blend(fromZ, z(), progress), m_type);
+    return TranslateTransformOperation::create(WebCore::blend(fromX, x(), progress), WebCore::blend(fromY, y(), progress), WebCore::blend(fromZ, z(), progress), type());
 }
 
 void TranslateTransformOperation::dump(TextStream& ts) const

Modified: trunk/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h (220378 => 220379)


--- trunk/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h	2017-08-08 02:46:06 UTC (rev 220378)
+++ trunk/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h	2017-08-08 02:46:11 UTC (rev 220379)
@@ -2,7 +2,7 @@
  * Copyright (C) 2000 Lars Knoll (kn...@kde.org)
  *           (C) 2000 Antti Koivisto (koivi...@kde.org)
  *           (C) 2000 Dirk Mueller (muel...@kde.org)
- * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2005-2008, 2017 Apple Inc. All rights reserved.
  * Copyright (C) 2006 Graham Dennis (graham.den...@gmail.com)
  *
  * This library is free software; you can redistribute it and/or
@@ -22,8 +22,7 @@
  *
  */
 
-#ifndef TranslateTransformOperation_h
-#define TranslateTransformOperation_h
+#pragma once
 
 #include "Length.h"
 #include "LengthFunctions.h"
@@ -46,7 +45,7 @@
 
     Ref<TransformOperation> clone() const override
     {
-        return adoptRef(*new TranslateTransformOperation(m_x, m_y, m_z, m_type));
+        return adoptRef(*new TranslateTransformOperation(m_x, m_y, m_z, type()));
     }
 
     double x(const FloatSize& borderBoxSize) const { return floatValueForLength(m_x, borderBoxSize.width()); }
@@ -60,9 +59,6 @@
 private:
     bool isIdentity() const override { return !floatValueForLength(m_x, 1) && !floatValueForLength(m_y, 1) && !floatValueForLength(m_z, 1); }
 
-    OperationType type() const override { return m_type; }
-    bool isSameType(const TransformOperation& o) const override { return o.type() == m_type; }
-
     bool operator==(const TransformOperation&) const override;
 
     bool apply(TransformationMatrix& transform, const FloatSize& borderBoxSize) const override
@@ -76,10 +72,10 @@
     void dump(TextStream&) const final;
 
     TranslateTransformOperation(const Length& tx, const Length& ty, const Length& tz, OperationType type)
-        : m_x(tx)
+        : TransformOperation(type)
+        , m_x(tx)
         , m_y(ty)
         , m_z(tz)
-        , m_type(type)
     {
         ASSERT(isTranslateTransformOperationType());
     }
@@ -87,11 +83,8 @@
     Length m_x;
     Length m_y;
     Length m_z;
-    OperationType m_type;
 };
 
 } // namespace WebCore
 
 SPECIALIZE_TYPE_TRAITS_TRANSFORMOPERATION(WebCore::TranslateTransformOperation, isTranslateTransformOperationType())
-
-#endif // TranslateTransformOperation_h
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to