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

Side by Side Diff: Source/core/style/StyleTransformData.cpp

Issue 1158603003: CSS Independent Transform Properties (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 months 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 * 19 *
20 */ 20 */
21 21
22 #include "config.h" 22 #include "config.h"
23 #include "core/style/StyleTransformData.h" 23 #include "core/style/StyleTransformData.h"
24
alancutter (OOO until 2018) 2015/06/12 07:56:31 These two headers should always be separated from
soonm 2015/06/15 05:07:17 Done.
25 #include "core/style/ComputedStyle.h" 24 #include "core/style/ComputedStyle.h"
26 25
27 namespace blink { 26 namespace blink {
28 27
29 StyleTransformData::StyleTransformData() 28 StyleTransformData::StyleTransformData()
30 : m_operations(ComputedStyle::initialTransform()) 29 : m_operations(ComputedStyle::initialTransform())
31 , m_origin(ComputedStyle::initialTransformOrigin()) 30 , m_origin(ComputedStyle::initialTransformOrigin())
32 , m_motion(nullptr, ComputedStyle::initialMotionOffset(), ComputedStyle::ini tialMotionRotation(), ComputedStyle::initialMotionRotationType()) 31 , m_motion(nullptr, ComputedStyle::initialMotionOffset(), ComputedStyle::ini tialMotionRotation(), ComputedStyle::initialMotionRotationType())
33 { 32 {
34 } 33 }
35 34
36 StyleTransformData::StyleTransformData(const StyleTransformData& o) 35 StyleTransformData::StyleTransformData(const StyleTransformData& o)
37 : RefCounted<StyleTransformData>() 36 : RefCounted<StyleTransformData>()
38 , m_operations(o.m_operations) 37 , m_operations(o.m_operations)
39 , m_origin(o.m_origin) 38 , m_origin(o.m_origin)
40 , m_motion(o.m_motion) 39 , m_motion(o.m_motion)
40 , m_translate(o.m_translate)
41 , m_rotate(o.m_rotate)
42 , m_scale(o.m_scale)
41 { 43 {
42 } 44 }
43 45
44 bool StyleTransformData::operator==(const StyleTransformData& o) const 46 bool StyleTransformData::operator==(const StyleTransformData& o) const
45 { 47 {
46 return m_origin == o.m_origin && m_operations == o.m_operations && m_motion == o.m_motion; 48 return m_origin == o.m_origin
49 && m_operations == o.m_operations
50 && m_motion == o.m_motion
51 && m_translate == o.m_translate
52 && m_rotate == o.m_rotate
53 && m_scale == o.m_scale;
54 }
55
56 bool StyleTransformData::has3DTransformProperties() const
57 {
58 bool b = false;
59 b |= m_translate ? m_translate->is3DOperation() : false;
Timothy Loh 2015/06/05 00:56:00 m_translate && m_translate->is3DOperation()
Eric Willigers 2015/06/05 01:58:23 Perhaps if (m_translate && m_translate->is3DOperat
soonm 2015/06/10 04:09:32 Done.
60 b |= m_rotate ? m_rotate->is3DOperation() : false;
61 b |= m_scale ? m_scale->is3DOperation() : false;
62 return b;
63 }
64
65 void StyleTransformData::setTranslate(PassRefPtr<TranslateTransformOperation> tr anslate)
66 {
67 m_translate = translate;
68 }
69
70 void StyleTransformData::setTranslate(const Length& tx, const Length& ty, const double& tz)
71 {
72 TransformOperation::OperationType type;
73 if (tz == 0) {
74 if (ty.isZero())
75 type = TransformOperation::TranslateX;
76 else
77 type = TransformOperation::Translate;
78 } else {
79 type = TransformOperation::Translate3D;
80 }
81 m_translate = TranslateTransformOperation::create(tx, ty, tz, type);
82 }
83
84 void StyleTransformData::setRotate(const double& angle, const double& x, const d ouble& y, const double& z)
85 {
86 m_rotate = RotateTransformOperation::create(x, y, z, angle, TransformOperati on::Rotate3D);
87 }
88
89 void StyleTransformData::setRotate(PassRefPtr<RotateTransformOperation> rotate)
90 {
91 m_rotate = rotate;
92 }
93
94 void StyleTransformData::setScale(const double& sx, const double& sy, const doub le& sz)
95 {
96 TransformOperation::OperationType type;
97 if (sz == 0) {
98 if (sy == 0)
99 type = TransformOperation::ScaleX;
100 else
101 type = TransformOperation::Scale;
102 } else {
103 type = TransformOperation::Scale3D;
104 }
105 m_scale = ScaleTransformOperation::create(sx, sy, sz, type);
106 }
107
108 void StyleTransformData::setScale(PassRefPtr<ScaleTransformOperation> scale)
109 {
110 m_scale = scale;
47 } 111 }
48 112
49 } // namespace blink 113 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698