Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Unified Diff: third_party/WebKit/Source/core/css/cssom/CSSRotation.h

Issue 2550063002: Remove double constructors that assume degrees from CSSRotation (Closed)
Patch Set: Fix test Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/cssom/CSSRotation.h
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSRotation.h b/third_party/WebKit/Source/core/css/cssom/CSSRotation.h
index eed7e981bc0e246b1f44980ac13746c1de74d82c..25628f056f96999f93f44f79587253e8737f15e2 100644
--- a/third_party/WebKit/Source/core/css/cssom/CSSRotation.h
+++ b/third_party/WebKit/Source/core/css/cssom/CSSRotation.h
@@ -16,26 +16,24 @@ class CORE_EXPORT CSSRotation final : public CSSTransformComponent {
DEFINE_WRAPPERTYPEINFO();
public:
- static CSSRotation* create(double angle) { return new CSSRotation(angle); }
-
static CSSRotation* create(const CSSAngleValue* angleValue) {
- return new CSSRotation(angleValue->degrees());
- }
-
- static CSSRotation* create(double x, double y, double z, double angle) {
- return new CSSRotation(x, y, z, angle);
+ return new CSSRotation(angleValue);
}
static CSSRotation* create(double x,
double y,
double z,
const CSSAngleValue* angleValue) {
- return new CSSRotation(x, y, z, angleValue->degrees());
+ return new CSSRotation(x, y, z, angleValue);
}
static CSSRotation* fromCSSValue(const CSSFunctionValue&);
- double angle() const { return m_angle; }
+ // Bindings requires returning non-const pointers. This is safe because
+ // CSSAngleValues are immutable.
+ CSSAngleValue* angle() const {
+ return const_cast<CSSAngleValue*>(m_angle.get());
+ }
double x() const { return m_x; }
double y() const { return m_y; }
double z() const { return m_z; }
@@ -45,24 +43,29 @@ class CORE_EXPORT CSSRotation final : public CSSTransformComponent {
}
CSSMatrixTransformComponent* asMatrix() const override {
- return m_is2D
- ? CSSMatrixTransformComponent::rotate(m_angle)
- : CSSMatrixTransformComponent::rotate3d(m_angle, m_x, m_y, m_z);
+ return m_is2D ? CSSMatrixTransformComponent::rotate(m_angle->degrees())
+ : CSSMatrixTransformComponent::rotate3d(m_angle->degrees(),
+ m_x, m_y, m_z);
}
CSSFunctionValue* toCSSValue() const override;
+ DEFINE_INLINE_VIRTUAL_TRACE() {
+ visitor->trace(m_angle);
+ CSSTransformComponent::trace(visitor);
+ }
+
private:
- CSSRotation(double angle)
- : m_x(0), m_y(0), m_z(1), m_angle(angle), m_is2D(true) {}
+ CSSRotation(const CSSAngleValue* angle)
+ : m_angle(angle), m_x(0), m_y(0), m_z(1), m_is2D(true) {}
- CSSRotation(double x, double y, double z, double angle)
- : m_x(x), m_y(y), m_z(z), m_angle(angle), m_is2D(false) {}
+ CSSRotation(double x, double y, double z, const CSSAngleValue* angle)
+ : m_angle(angle), m_x(x), m_y(y), m_z(z), m_is2D(false) {}
+ Member<const CSSAngleValue> m_angle;
double m_x;
double m_y;
double m_z;
- double m_angle;
bool m_is2D;
};
« no previous file with comments | « third_party/WebKit/Source/core/css/cssom/CSSAngleValue.cpp ('k') | third_party/WebKit/Source/core/css/cssom/CSSRotation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698