Changeset 220379 in webkit
- Timestamp:
- Aug 7, 2017, 7:46:11 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/Source/WebCore/ChangeLog ¶
r220378 r220379 1 2017-08-07 Simon Fraser <simon.fraser@apple.com> 2 3 Make TransformOperation::type() non-virtual 4 https://bugs.webkit.org/show_bug.cgi?id=175297 5 6 Reviewed by Sam Weinig. 7 8 Store the OperationType in the base class so that type() and isSameType() can 9 be non-virtual. 10 11 Small perf win on some benchmarks. 12 13 * platform/graphics/transforms/IdentityTransformOperation.h: 14 * platform/graphics/transforms/Matrix3DTransformOperation.h: 15 * platform/graphics/transforms/MatrixTransformOperation.h: 16 * platform/graphics/transforms/PerspectiveTransformOperation.h: 17 * platform/graphics/transforms/RotateTransformOperation.cpp: 18 (WebCore::RotateTransformOperation::blend): 19 * platform/graphics/transforms/RotateTransformOperation.h: 20 * platform/graphics/transforms/ScaleTransformOperation.cpp: 21 (WebCore::ScaleTransformOperation::blend): 22 * platform/graphics/transforms/ScaleTransformOperation.h: 23 * platform/graphics/transforms/SkewTransformOperation.cpp: 24 (WebCore::SkewTransformOperation::blend): 25 * platform/graphics/transforms/SkewTransformOperation.h: 26 * platform/graphics/transforms/TransformOperation.h: 27 (WebCore::TransformOperation::TransformOperation): 28 (WebCore::TransformOperation::type const): 29 (WebCore::TransformOperation::isSameType const): 30 * platform/graphics/transforms/TranslateTransformOperation.cpp: 31 (WebCore::TranslateTransformOperation::blend): 32 * platform/graphics/transforms/TranslateTransformOperation.h: 33 1 34 2017-08-07 Simon Fraser <simon.fraser@apple.com> 2 35 -
TabularUnified trunk/Source/WebCore/platform/graphics/transforms/IdentityTransformOperation.h ¶
r200341 r220379 3 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 4 4 * (C) 2000 Dirk Mueller (mueller@kde.org) 5 * Copyright (C) 2003, 2005 , 2006, 2007, 2008Apple Inc. All rights reserved.5 * Copyright (C) 2003, 2005-2008, 2017 Apple Inc. All rights reserved. 6 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 7 * … … 23 23 */ 24 24 25 #ifndef IdentityTransformOperation_h 26 #define IdentityTransformOperation_h 25 #pragma once 27 26 28 27 #include "TransformOperation.h" … … 45 44 private: 46 45 bool isIdentity() const override { return true; } 47 OperationType type() const override { return IDENTITY; }48 bool isSameType(const TransformOperation& o) const override { return o.type() == IDENTITY; }49 46 50 47 bool operator==(const TransformOperation& o) const override … … 66 63 67 64 IdentityTransformOperation() 65 : TransformOperation(IDENTITY) 68 66 { 69 67 } 70 71 68 }; 72 69 … … 74 71 75 72 SPECIALIZE_TYPE_TRAITS_TRANSFORMOPERATION(WebCore::IdentityTransformOperation, type() == WebCore::TransformOperation::IDENTITY) 76 77 #endif // IdentityTransformOperation_h -
TabularUnified trunk/Source/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.h ¶
r200341 r220379 24 24 */ 25 25 26 #ifndef Matrix3DTransformOperation_h 27 #define Matrix3DTransformOperation_h 26 #pragma once 28 27 29 28 #include "TransformOperation.h" … … 50 49 bool isAffectedByTransformOrigin() const override { return !isIdentity(); } 51 50 52 OperationType type() const override { return MATRIX_3D; }53 bool isSameType(const TransformOperation& o) const override { return o.type() == MATRIX_3D; }54 55 51 bool operator==(const TransformOperation&) const override; 56 52 … … 66 62 67 63 Matrix3DTransformOperation(const TransformationMatrix& mat) 64 : TransformOperation(MATRIX_3D) 65 , m_matrix(mat) 68 66 { 69 m_matrix = mat;70 67 } 71 68 … … 76 73 77 74 SPECIALIZE_TYPE_TRAITS_TRANSFORMOPERATION(WebCore::Matrix3DTransformOperation, type() == WebCore::TransformOperation::MATRIX_3D) 78 79 #endif // Matrix3DTransformOperation_h -
TabularUnified trunk/Source/WebCore/platform/graphics/transforms/MatrixTransformOperation.h ¶
r200341 r220379 3 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 4 4 * (C) 2000 Dirk Mueller (mueller@kde.org) 5 * Copyright (C) 2003, 2005 , 2006, 2007, 2008Apple Inc. All rights reserved.5 * Copyright (C) 2003, 2005-2008, 2017 Apple Inc. All rights reserved. 6 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 7 * … … 23 23 */ 24 24 25 #ifndef MatrixTransformOperation_h 26 #define MatrixTransformOperation_h 25 #pragma once 27 26 28 27 #include "TransformOperation.h" … … 55 54 bool isAffectedByTransformOrigin() const override { return !isIdentity(); } 56 55 57 OperationType type() const override { return MATRIX; }58 bool isSameType(const TransformOperation& o) const override { return o.type() == MATRIX; }59 60 56 bool operator==(const TransformOperation&) const override; 61 57 … … 72 68 73 69 MatrixTransformOperation(double a, double b, double c, double d, double e, double f) 74 : m_a(a) 70 : TransformOperation(MATRIX) 71 , m_a(a) 75 72 , m_b(b) 76 73 , m_c(c) … … 82 79 83 80 MatrixTransformOperation(const TransformationMatrix& t) 84 : m_a(t.a()) 81 : TransformOperation(MATRIX) 82 , m_a(t.a()) 85 83 , m_b(t.b()) 86 84 , m_c(t.c()) … … 102 100 103 101 SPECIALIZE_TYPE_TRAITS_TRANSFORMOPERATION(WebCore::MatrixTransformOperation, type() == WebCore::TransformOperation::MATRIX) 104 105 #endif // MatrixTransformOperation_h -
TabularUnified trunk/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h ¶
r200341 r220379 24 24 */ 25 25 26 #ifndef PerspectiveTransformOperation_h 27 #define PerspectiveTransformOperation_h 26 #pragma once 28 27 29 28 #include "Length.h" … … 52 51 bool isAffectedByTransformOrigin() const override { return !isIdentity(); } 53 52 54 OperationType type() const override { return PERSPECTIVE; }55 bool isSameType(const TransformOperation& o) const override { return o.type() == PERSPECTIVE; }56 57 53 bool operator==(const TransformOperation&) const override; 58 54 … … 68 64 69 65 PerspectiveTransformOperation(const Length& p) 70 : m_p(p) 66 : TransformOperation(PERSPECTIVE) 67 , m_p(p) 71 68 { 72 69 ASSERT(p.isFixed()); … … 79 76 80 77 SPECIALIZE_TYPE_TRAITS_TRANSFORMOPERATION(WebCore::PerspectiveTransformOperation, type() == WebCore::TransformOperation::PERSPECTIVE) 81 82 #endif // PerspectiveTransformOperation_h -
TabularUnified trunk/Source/WebCore/platform/graphics/transforms/RotateTransformOperation.cpp ¶
r202195 r220379 44 44 45 45 if (blendToIdentity) 46 return RotateTransformOperation::create(m_x, m_y, m_z, m_angle - m_angle * progress, m_type);46 return RotateTransformOperation::create(m_x, m_y, m_z, m_angle - m_angle * progress, type()); 47 47 48 48 const RotateTransformOperation* fromOp = downcast<RotateTransformOperation>(from); … … 56 56 fromOp ? fromOp->m_y : m_y, 57 57 fromOp ? fromOp->m_z : m_z, 58 WebCore::blend(fromAngle, m_angle, progress), m_type);58 WebCore::blend(fromAngle, m_angle, progress), type()); 59 59 } 60 60 -
TabularUnified trunk/Source/WebCore/platform/graphics/transforms/RotateTransformOperation.h ¶
r200341 r220379 3 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 4 4 * (C) 2000 Dirk Mueller (mueller@kde.org) 5 * Copyright (C) 2003, 2005 , 2006, 2007, 2008Apple Inc. All rights reserved.5 * Copyright (C) 2003, 2005-2008, 2017 Apple Inc. All rights reserved. 6 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 7 * … … 23 23 */ 24 24 25 #ifndef RotateTransformOperation_h 26 #define RotateTransformOperation_h 25 #pragma once 27 26 28 27 #include "TransformOperation.h" … … 45 44 Ref<TransformOperation> clone() const override 46 45 { 47 return adoptRef(*new RotateTransformOperation(m_x, m_y, m_z, m_angle, m_type));46 return adoptRef(*new RotateTransformOperation(m_x, m_y, m_z, m_angle, type())); 48 47 } 49 48 … … 56 55 bool isIdentity() const override { return m_angle == 0; } 57 56 bool isAffectedByTransformOrigin() const override { return !isIdentity(); } 58 59 OperationType type() const override { return m_type; }60 bool isSameType(const TransformOperation& o) const override { return o.type() == m_type; }61 57 62 58 bool operator==(const TransformOperation&) const override; … … 73 69 74 70 RotateTransformOperation(double x, double y, double z, double angle, OperationType type) 75 : m_x(x) 71 : TransformOperation(type) 72 , m_x(x) 76 73 , m_y(y) 77 74 , m_z(z) 78 75 , m_angle(angle) 79 , m_type(type)80 76 { 81 77 ASSERT(isRotateTransformOperationType()); … … 86 82 double m_z; 87 83 double m_angle; 88 OperationType m_type;89 84 }; 90 85 … … 92 87 93 88 SPECIALIZE_TYPE_TRAITS_TRANSFORMOPERATION(WebCore::RotateTransformOperation, isRotateTransformOperationType()) 94 95 #endif // RotateTransformOperation_h -
TabularUnified trunk/Source/WebCore/platform/graphics/transforms/ScaleTransformOperation.cpp ¶
r200341 r220379 44 44 return ScaleTransformOperation::create(WebCore::blend(m_x, 1.0, progress), 45 45 WebCore::blend(m_y, 1.0, progress), 46 WebCore::blend(m_z, 1.0, progress), m_type);46 WebCore::blend(m_z, 1.0, progress), type()); 47 47 48 48 const ScaleTransformOperation* fromOp = downcast<ScaleTransformOperation>(from); … … 52 52 return ScaleTransformOperation::create(WebCore::blend(fromX, m_x, progress), 53 53 WebCore::blend(fromY, m_y, progress), 54 WebCore::blend(fromZ, m_z, progress), m_type);54 WebCore::blend(fromZ, m_z, progress), type()); 55 55 } 56 56 -
TabularUnified trunk/Source/WebCore/platform/graphics/transforms/ScaleTransformOperation.h ¶
r200341 r220379 3 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 4 4 * (C) 2000 Dirk Mueller (mueller@kde.org) 5 * Copyright (C) 2003, 2005 , 2006, 2007, 2008Apple Inc. All rights reserved.5 * Copyright (C) 2003, 2005-2008, 2017 Apple Inc. All rights reserved. 6 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 7 * … … 23 23 */ 24 24 25 #ifndef ScaleTransformOperation_h 26 #define ScaleTransformOperation_h 25 #pragma once 27 26 28 27 #include "TransformOperation.h" … … 45 44 Ref<TransformOperation> clone() const override 46 45 { 47 return adoptRef(*new ScaleTransformOperation(m_x, m_y, m_z, m_type));46 return adoptRef(*new ScaleTransformOperation(m_x, m_y, m_z, type())); 48 47 } 49 48 … … 55 54 bool isIdentity() const override { return m_x == 1 && m_y == 1 && m_z == 1; } 56 55 bool isAffectedByTransformOrigin() const override { return !isIdentity(); } 57 58 OperationType type() const override { return m_type; }59 bool isSameType(const TransformOperation& o) const override { return o.type() == m_type; }60 56 61 57 bool operator==(const TransformOperation&) const override; … … 72 68 73 69 ScaleTransformOperation(double sx, double sy, double sz, OperationType type) 74 : m_x(sx) 70 : TransformOperation(type) 71 , m_x(sx) 75 72 , m_y(sy) 76 73 , m_z(sz) 77 , m_type(type)78 74 { 79 75 ASSERT(isScaleTransformOperationType()); … … 83 79 double m_y; 84 80 double m_z; 85 OperationType m_type;86 81 }; 87 82 … … 89 84 90 85 SPECIALIZE_TYPE_TRAITS_TRANSFORMOPERATION(WebCore::ScaleTransformOperation, isScaleTransformOperationType()) 91 92 #endif // ScaleTransformOperation_h -
TabularUnified trunk/Source/WebCore/platform/graphics/transforms/SkewTransformOperation.cpp ¶
r200341 r220379 42 42 43 43 if (blendToIdentity) 44 return SkewTransformOperation::create(WebCore::blend(m_angleX, 0.0, progress), WebCore::blend(m_angleY, 0.0, progress), m_type);44 return SkewTransformOperation::create(WebCore::blend(m_angleX, 0.0, progress), WebCore::blend(m_angleY, 0.0, progress), type()); 45 45 46 46 const SkewTransformOperation* fromOp = downcast<SkewTransformOperation>(from); 47 47 double fromAngleX = fromOp ? fromOp->m_angleX : 0; 48 48 double fromAngleY = fromOp ? fromOp->m_angleY : 0; 49 return SkewTransformOperation::create(WebCore::blend(fromAngleX, m_angleX, progress), WebCore::blend(fromAngleY, m_angleY, progress), m_type);49 return SkewTransformOperation::create(WebCore::blend(fromAngleX, m_angleX, progress), WebCore::blend(fromAngleY, m_angleY, progress), type()); 50 50 } 51 51 -
TabularUnified trunk/Source/WebCore/platform/graphics/transforms/SkewTransformOperation.h ¶
r200341 r220379 3 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 4 4 * (C) 2000 Dirk Mueller (mueller@kde.org) 5 * Copyright (C) 2003, 2005 , 2006, 2007, 2008Apple Inc. All rights reserved.5 * Copyright (C) 2003, 2005-2008, 2017 Apple Inc. All rights reserved. 6 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 7 * … … 23 23 */ 24 24 25 #ifndef SkewTransformOperation_h 26 #define SkewTransformOperation_h 25 #pragma once 27 26 28 27 #include "TransformOperation.h" … … 40 39 Ref<TransformOperation> clone() const override 41 40 { 42 return adoptRef(*new SkewTransformOperation(m_angleX, m_angleY, m_type));41 return adoptRef(*new SkewTransformOperation(m_angleX, m_angleY, type())); 43 42 } 44 43 … … 49 48 bool isIdentity() const override { return m_angleX == 0 && m_angleY == 0; } 50 49 bool isAffectedByTransformOrigin() const override { return !isIdentity(); } 51 52 OperationType type() const override { return m_type; }53 bool isSameType(const TransformOperation& o) const override { return o.type() == m_type; }54 50 55 51 bool operator==(const TransformOperation&) const override; … … 66 62 67 63 SkewTransformOperation(double angleX, double angleY, OperationType type) 68 : m_angleX(angleX) 64 : TransformOperation(type) 65 , m_angleX(angleX) 69 66 , m_angleY(angleY) 70 , m_type(type)71 67 { 72 68 ASSERT(isSkewTransformOperationType()); … … 75 71 double m_angleX; 76 72 double m_angleY; 77 OperationType m_type;78 73 }; 79 74 … … 81 76 82 77 SPECIALIZE_TYPE_TRAITS_TRANSFORMOPERATION(WebCore::SkewTransformOperation, isSkewTransformOperationType()) 83 84 #endif // SkewTransformOperation_h -
TabularUnified trunk/Source/WebCore/platform/graphics/transforms/TransformOperation.h ¶
r200341 r220379 3 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 4 4 * (C) 2000 Dirk Mueller (mueller@kde.org) 5 * Copyright (C) 2003, 2005 , 2006, 2007, 2008Apple Inc. All rights reserved.5 * Copyright (C) 2003, 2005-2008, 2017 Apple Inc. All rights reserved. 6 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 7 * … … 23 23 */ 24 24 25 #ifndef TransformOperation_h 26 #define TransformOperation_h 25 #pragma once 27 26 28 27 #include "FloatSize.h" … … 53 52 }; 54 53 54 TransformOperation(OperationType type) 55 : m_type(type) 56 { 57 } 55 58 virtual ~TransformOperation() { } 56 59 … … 67 70 virtual Ref<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false) = 0; 68 71 69 virtual OperationType type() const = 0;70 virtual bool isSameType(const TransformOperation&) const { return false; }72 OperationType type() const { return m_type; } 73 bool isSameType(const TransformOperation& other) const { return type() == other.type(); } 71 74 72 75 virtual bool isAffectedByTransformOrigin() const { return false; } … … 107 110 108 111 virtual void dump(TextStream&) const = 0; 112 113 private: 114 OperationType m_type; 109 115 }; 110 116 … … 118 124 static bool isType(const WebCore::TransformOperation& operation) { return operation.predicate; } \ 119 125 SPECIALIZE_TYPE_TRAITS_END() 120 121 #endif // TransformOperation_h -
TabularUnified trunk/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.cpp ¶
r200343 r220379 43 43 Length zeroLength(0, Fixed); 44 44 if (blendToIdentity) 45 return TranslateTransformOperation::create(WebCore::blend(m_x, zeroLength, progress), WebCore::blend(m_y, zeroLength, progress), WebCore::blend(m_z, zeroLength, progress), m_type);45 return TranslateTransformOperation::create(WebCore::blend(m_x, zeroLength, progress), WebCore::blend(m_y, zeroLength, progress), WebCore::blend(m_z, zeroLength, progress), type()); 46 46 47 47 const TranslateTransformOperation* fromOp = downcast<TranslateTransformOperation>(from); … … 49 49 Length fromY = fromOp ? fromOp->m_y : zeroLength; 50 50 Length fromZ = fromOp ? fromOp->m_z : zeroLength; 51 return TranslateTransformOperation::create(WebCore::blend(fromX, x(), progress), WebCore::blend(fromY, y(), progress), WebCore::blend(fromZ, z(), progress), m_type);51 return TranslateTransformOperation::create(WebCore::blend(fromX, x(), progress), WebCore::blend(fromY, y(), progress), WebCore::blend(fromZ, z(), progress), type()); 52 52 } 53 53 -
TabularUnified trunk/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h ¶
r200341 r220379 3 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 4 4 * (C) 2000 Dirk Mueller (mueller@kde.org) 5 * Copyright (C) 2003, 2005 , 2006, 2007, 2008Apple Inc. All rights reserved.5 * Copyright (C) 2003, 2005-2008, 2017 Apple Inc. All rights reserved. 6 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 7 * … … 23 23 */ 24 24 25 #ifndef TranslateTransformOperation_h 26 #define TranslateTransformOperation_h 25 #pragma once 27 26 28 27 #include "Length.h" … … 47 46 Ref<TransformOperation> clone() const override 48 47 { 49 return adoptRef(*new TranslateTransformOperation(m_x, m_y, m_z, m_type));48 return adoptRef(*new TranslateTransformOperation(m_x, m_y, m_z, type())); 50 49 } 51 50 … … 60 59 private: 61 60 bool isIdentity() const override { return !floatValueForLength(m_x, 1) && !floatValueForLength(m_y, 1) && !floatValueForLength(m_z, 1); } 62 63 OperationType type() const override { return m_type; }64 bool isSameType(const TransformOperation& o) const override { return o.type() == m_type; }65 61 66 62 bool operator==(const TransformOperation&) const override; … … 77 73 78 74 TranslateTransformOperation(const Length& tx, const Length& ty, const Length& tz, OperationType type) 79 : m_x(tx) 75 : TransformOperation(type) 76 , m_x(tx) 80 77 , m_y(ty) 81 78 , m_z(tz) 82 , m_type(type)83 79 { 84 80 ASSERT(isTranslateTransformOperationType()); … … 88 84 Length m_y; 89 85 Length m_z; 90 OperationType m_type;91 86 }; 92 87 … … 94 89 95 90 SPECIALIZE_TYPE_TRAITS_TRANSFORMOPERATION(WebCore::TranslateTransformOperation, isTranslateTransformOperationType()) 96 97 #endif // TranslateTransformOperation_h
Note:
See TracChangeset
for help on using the changeset viewer.