Chromium Code Reviews| Index: third_party/WebKit/Source/platform/graphics/paint/TransformPaintProperty.h |
| diff --git a/third_party/WebKit/Source/platform/graphics/paint/TransformPaintProperty.h b/third_party/WebKit/Source/platform/graphics/paint/TransformPaintProperty.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2bd549805a7ec23ffa18b9ee7478e5bdf2679ce8 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/platform/graphics/paint/TransformPaintProperty.h |
| @@ -0,0 +1,55 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef TransformPaintProperty_h |
| +#define TransformPaintProperty_h |
| + |
| +#include "platform/PlatformExport.h" |
| +#include "platform/geometry/FloatPoint3D.h" |
| +#include "platform/transforms/TransformationMatrix.h" |
| +#include "wtf/PassRefPtr.h" |
| +#include "wtf/RefCounted.h" |
| +#include "wtf/RefPtr.h" |
| + |
| +#include <iosfwd> |
| + |
| +namespace blink { |
| + |
| +// A transform created by a css property such as "transform" or "perspective" |
| +// along with a reference to the parent TransformPaintProperty, or nullptr for |
| +// the root. |
| +class PLATFORM_EXPORT TransformPaintProperty : public RefCounted<TransformPaintProperty> { |
|
jbroman
2015/10/07 15:22:22
nit: Having "node" in this would suggest hierarchy
pdr.
2015/10/07 20:19:11
Changed to TransformPaintPropertyNode. I wanted to
|
| +public: |
| + |
| + // Used for disambiguating multiple transforms of the same type. |
| + enum Type { |
| + Transform, |
| + Perspective |
|
jbroman
2015/10/07 15:22:22
Hmm. Ideally this distinction wouldn't leak into p
pdr.
2015/10/07 20:19:11
We can remove this for now, but it may be needed (
|
| + }; |
| + |
| + TransformPaintProperty(const Type type, const TransformationMatrix& matrix, const FloatPoint3D& origin, PassRefPtr<TransformPaintProperty> parent = nullptr) |
|
jbroman
2015/10/07 15:22:22
nit: taking arguments by const value is weird; jus
pdr.
2015/10/07 20:19:11
Fixed. For some reason this reminded me of the awe
|
| + : m_type(type), m_matrix(matrix), m_origin(origin), m_parent(parent) { } |
| + |
| + Type type() const { return m_type; } |
| + const TransformationMatrix& matrix() const { return m_matrix; } |
| + const FloatPoint3D& origin() const { return m_origin; } |
| + |
| + // Parent transform that this transform is relative to, or nullptr if this |
| + // is the root transform. |
| + const TransformPaintProperty* parent() const { return m_parent.get(); } |
| + |
| +private: |
| + const Type m_type; |
| + const TransformationMatrix m_matrix; |
| + const FloatPoint3D m_origin; |
| + RefPtr<TransformPaintProperty> m_parent; |
| +}; |
| + |
| +// Redeclared here to avoid ODR issues. |
| +// See platform/testing/PaintPrinters.h. |
| +void PrintTo(const TransformPaintProperty&, std::ostream*); |
| + |
| +} // namespace blink |
| + |
| +#endif // TransformPaintProperty_h |