Add type-checked casts for TransformOperations
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 25 May 2014 18:09:16 +0000 (18:09 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 25 May 2014 18:09:16 +0000 (18:09 +0000)
commitdadcaf71700e403c11933011826c3eea65e55e85
tree168dc29cdf8f042ba826342e43f42798e7dd8923
parentc9ebcf5c22cfcebf1d147d8c663464752aeb008a
Add type-checked casts for TransformOperations
<http://webkit.org/b/133217>

Reviewed by Simon Fraser.

Source/WebCore:

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::validateTransformOperations):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::getTransformFunctionValue):
- Switch to type-checked casts.

* platform/graphics/transforms/IdentityTransformOperation.h:
* platform/graphics/transforms/Matrix3DTransformOperation.h:
* platform/graphics/transforms/MatrixTransformOperation.h:
* platform/graphics/transforms/PerspectiveTransformOperation.h:
* platform/graphics/transforms/RotateTransformOperation.h:
* platform/graphics/transforms/ScaleTransformOperation.h:
* platform/graphics/transforms/SkewTransformOperation.h:
* platform/graphics/transforms/TranslateTransformOperation.h:
- Add 'final' to class declaration.
- Add 'override' to overridden methods.
- Add type-checked cast via TRANSFORMOPERATION_TYPE_CASTS macro.
- Move implementation of operator==(const TransformOperation&)
  from header to source file so it is able to use a type-checked
  cast, and switch back to using a reference instead of a
  pointer.
- Add or update ASSERT in private constructor to check for
  correct OperationType in classes that represent multiple
  types.

* platform/graphics/transforms/Matrix3DTransformOperation.cpp:
(WebCore::Matrix3DTransformOperation::operator==): Added.

* platform/graphics/transforms/MatrixTransformOperation.cpp:
(WebCore::Matrix3DTransformOperation::operator==): Added.
(WebCore::MatrixTransformOperation::blend):
- Switch to type-checked casts and use a reference.

* platform/graphics/transforms/PerspectiveTransformOperation.cpp:
(WebCore::Matrix3DTransformOperation::operator==): Added.
(WebCore::PerspectiveTransformOperation::blend):
* platform/graphics/transforms/RotateTransformOperation.cpp:
(WebCore::Matrix3DTransformOperation::operator==): Added.
(WebCore::RotateTransformOperation::blend):
* platform/graphics/transforms/ScaleTransformOperation.cpp:
(WebCore::Matrix3DTransformOperation::operator==): Added.
(WebCore::ScaleTransformOperation::blend):
* platform/graphics/transforms/SkewTransformOperation.cpp:
(WebCore::Matrix3DTransformOperation::operator==): Added.
(WebCore::SkewTransformOperation::blend):
* platform/graphics/transforms/TranslateTransformOperation.cpp:
(WebCore::Matrix3DTransformOperation::operator==): Added.
(WebCore::TranslateTransformOperation::blend):
- Switch to type-checked casts.

* platform/graphics/transforms/TransformOperation.h:
(WebCore::TransformOperation::isRotateTransformOperationType):
(WebCore::TransformOperation::isScaleTransformOperationType):
(WebCore::TransformOperation::isSkewTransformOperationType):
(WebCore::TransformOperation::isTranslateTransformOperationType):
- Add type-checking methods used in constructors and type-checked
  casts.
- Define TRANSFORMOPERATION_TYPE_CASTS macro used by subclasses.

Source/WebKit2:

* Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:
(IPC::ArgumentCoder<TransformOperations>::encode):
- Switch to type-checked casts.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@169320 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GraphicsLayer.cpp
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/graphics/transforms/IdentityTransformOperation.h
Source/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.cpp
Source/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.h
Source/WebCore/platform/graphics/transforms/MatrixTransformOperation.cpp
Source/WebCore/platform/graphics/transforms/MatrixTransformOperation.h
Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.cpp
Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h
Source/WebCore/platform/graphics/transforms/RotateTransformOperation.cpp
Source/WebCore/platform/graphics/transforms/RotateTransformOperation.h
Source/WebCore/platform/graphics/transforms/ScaleTransformOperation.cpp
Source/WebCore/platform/graphics/transforms/ScaleTransformOperation.h
Source/WebCore/platform/graphics/transforms/SkewTransformOperation.cpp
Source/WebCore/platform/graphics/transforms/SkewTransformOperation.h
Source/WebCore/platform/graphics/transforms/TransformOperation.h
Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.cpp
Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp