- WebCore/ChangeLog +75 lines
Lines 1-3 WebCore/ChangeLog_sec1
1
2009-02-10  Chris Marrin  <cmarrin@apple.com>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        https://bugs.webkit.org/show_bug.cgi?id=23883
6
7
        Added new TransformOperation subclasses and methods to existing ones
8
        to support 3D.
9
10
        * WebCore.xcodeproj/project.pbxproj:
11
        * platform/graphics/transforms/IdentityTransformOperation.h:
12
        (WebCore::IdentityTransformOperation::isAffine):
13
        * platform/graphics/transforms/Matrix3DTransformOperation.cpp: Added.
14
        (WebCore::Matrix3DTransformOperation::blend):
15
        * platform/graphics/transforms/Matrix3DTransformOperation.h: Added.
16
        (WebCore::Matrix3DTransformOperation::create):
17
        (WebCore::Matrix3DTransformOperation::isIdentity):
18
        (WebCore::Matrix3DTransformOperation::isAffine):
19
        (WebCore::Matrix3DTransformOperation::getOperationType):
20
        (WebCore::Matrix3DTransformOperation::isSameType):
21
        (WebCore::Matrix3DTransformOperation::operator==):
22
        (WebCore::Matrix3DTransformOperation::apply):
23
        (WebCore::Matrix3DTransformOperation::Matrix3DTransformOperation):
24
        * platform/graphics/transforms/MatrixTransformOperation.h:
25
        (WebCore::MatrixTransformOperation::isAffine):
26
        (WebCore::MatrixTransformOperation::apply):
27
        * platform/graphics/transforms/PerspectiveTransformOperation.cpp: Added.
28
        (WebCore::PerspectiveTransformOperation::blend):
29
        * platform/graphics/transforms/PerspectiveTransformOperation.h: Added.
30
        (WebCore::PerspectiveTransformOperation::create):
31
        (WebCore::PerspectiveTransformOperation::isIdentity):
32
        (WebCore::PerspectiveTransformOperation::isAffine):
33
        (WebCore::PerspectiveTransformOperation::getOperationType):
34
        (WebCore::PerspectiveTransformOperation::isSameType):
35
        (WebCore::PerspectiveTransformOperation::operator==):
36
        (WebCore::PerspectiveTransformOperation::apply):
37
        (WebCore::PerspectiveTransformOperation::PerspectiveTransformOperation):
38
        * platform/graphics/transforms/RotateTransformOperation.cpp:
39
        (WebCore::RotateTransformOperation::blend):
40
        * platform/graphics/transforms/RotateTransformOperation.h:
41
        (WebCore::RotateTransformOperation::create):
42
        (WebCore::RotateTransformOperation::angle):
43
        (WebCore::RotateTransformOperation::isAffine):
44
        (WebCore::RotateTransformOperation::operator==):
45
        (WebCore::RotateTransformOperation::apply):
46
        (WebCore::RotateTransformOperation::RotateTransformOperation):
47
        * platform/graphics/transforms/ScaleTransformOperation.cpp:
48
        (WebCore::ScaleTransformOperation::blend):
49
        * platform/graphics/transforms/ScaleTransformOperation.h:
50
        (WebCore::ScaleTransformOperation::create):
51
        (WebCore::ScaleTransformOperation::z):
52
        (WebCore::ScaleTransformOperation::isIdentity):
53
        (WebCore::ScaleTransformOperation::isAffine):
54
        (WebCore::ScaleTransformOperation::operator==):
55
        (WebCore::ScaleTransformOperation::apply):
56
        (WebCore::ScaleTransformOperation::ScaleTransformOperation):
57
        * platform/graphics/transforms/SkewTransformOperation.h:
58
        (WebCore::SkewTransformOperation::isAffine):
59
        * platform/graphics/transforms/TransformOperation.h:
60
        (WebCore::TransformOperation::):
61
        (WebCore::TransformOperation::is3DOperation):
62
        * platform/graphics/transforms/TransformOperations.h:
63
        (WebCore::TransformOperations::isAffine):
64
        (WebCore::TransformOperations::has3DOperation):
65
        * platform/graphics/transforms/TranslateTransformOperation.cpp:
66
        (WebCore::TranslateTransformOperation::blend):
67
        * platform/graphics/transforms/TranslateTransformOperation.h:
68
        (WebCore::TranslateTransformOperation::create):
69
        (WebCore::TranslateTransformOperation::z):
70
        (WebCore::TranslateTransformOperation::isIdentity):
71
        (WebCore::TranslateTransformOperation::isAffine):
72
        (WebCore::TranslateTransformOperation::operator==):
73
        (WebCore::TranslateTransformOperation::apply):
74
        (WebCore::TranslateTransformOperation::TranslateTransformOperation):
75
1
2009-02-10  David Hyatt  <hyatt@apple.com>
76
2009-02-10  David Hyatt  <hyatt@apple.com>
2
77
3
        Rename xPos() and yPos() on RenderLayer to x() and y() to match RenderBox.  Rename setPos to setLocation.
78
        Rename xPos() and yPos() on RenderLayer to x() and y() to match RenderBox.  Rename setPos to setLocation.
- WebCore/WebCore.xcodeproj/project.pbxproj +16 lines
Lines 655-660 WebCore/WebCore.xcodeproj/project.pbxproj_sec1
655
		498391590F1E776900C23782 /* WebKitCSSMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = 498391560F1E776900C23782 /* WebKitCSSMatrix.h */; };
655
		498391590F1E776900C23782 /* WebKitCSSMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = 498391560F1E776900C23782 /* WebKitCSSMatrix.h */; };
656
		498391630F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 498391610F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.cpp */; };
656
		498391630F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 498391610F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.cpp */; };
657
		498391640F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 498391620F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.h */; };
657
		498391640F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 498391620F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.h */; };
658
		49D5DC2B0F423A73008F20FD /* Matrix3DTransformOperation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49D5DC270F423A73008F20FD /* Matrix3DTransformOperation.cpp */; };
659
		49D5DC2C0F423A73008F20FD /* Matrix3DTransformOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 49D5DC280F423A73008F20FD /* Matrix3DTransformOperation.h */; };
660
		49D5DC2D0F423A73008F20FD /* PerspectiveTransformOperation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49D5DC290F423A73008F20FD /* PerspectiveTransformOperation.cpp */; };
661
		49D5DC2E0F423A73008F20FD /* PerspectiveTransformOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 49D5DC2A0F423A73008F20FD /* PerspectiveTransformOperation.h */; };
658
		49E911C30EF86D47009D0CAF /* TransformationMatrix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49E911B30EF86D47009D0CAF /* TransformationMatrix.cpp */; };
662
		49E911C30EF86D47009D0CAF /* TransformationMatrix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49E911B30EF86D47009D0CAF /* TransformationMatrix.cpp */; };
659
		49E911C40EF86D47009D0CAF /* TransformationMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = 49E911B40EF86D47009D0CAF /* TransformationMatrix.h */; settings = {ATTRIBUTES = (Private, ); }; };
663
		49E911C40EF86D47009D0CAF /* TransformationMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = 49E911B40EF86D47009D0CAF /* TransformationMatrix.h */; settings = {ATTRIBUTES = (Private, ); }; };
660
		49E911C50EF86D47009D0CAF /* IdentityTransformOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 49E911B50EF86D47009D0CAF /* IdentityTransformOperation.h */; };
664
		49E911C50EF86D47009D0CAF /* IdentityTransformOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 49E911B50EF86D47009D0CAF /* IdentityTransformOperation.h */; };
Lines 5579-5584 WebCore/WebCore.xcodeproj/project.pbxproj_sec2
5579
		498391570F1E776900C23782 /* WebKitCSSMatrix.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebKitCSSMatrix.idl; sourceTree = "<group>"; };
5583
		498391570F1E776900C23782 /* WebKitCSSMatrix.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebKitCSSMatrix.idl; sourceTree = "<group>"; };
5580
		498391610F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitCSSMatrixConstructor.cpp; sourceTree = "<group>"; };
5584
		498391610F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitCSSMatrixConstructor.cpp; sourceTree = "<group>"; };
5581
		498391620F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitCSSMatrixConstructor.h; sourceTree = "<group>"; };
5585
		498391620F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitCSSMatrixConstructor.h; sourceTree = "<group>"; };
5586
		49D5DC270F423A73008F20FD /* Matrix3DTransformOperation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Matrix3DTransformOperation.cpp; path = transforms/Matrix3DTransformOperation.cpp; sourceTree = "<group>"; };
5587
		49D5DC280F423A73008F20FD /* Matrix3DTransformOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Matrix3DTransformOperation.h; path = transforms/Matrix3DTransformOperation.h; sourceTree = "<group>"; };
5588
		49D5DC290F423A73008F20FD /* PerspectiveTransformOperation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PerspectiveTransformOperation.cpp; path = transforms/PerspectiveTransformOperation.cpp; sourceTree = "<group>"; };
5589
		49D5DC2A0F423A73008F20FD /* PerspectiveTransformOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PerspectiveTransformOperation.h; path = transforms/PerspectiveTransformOperation.h; sourceTree = "<group>"; };
5582
		49E911B30EF86D47009D0CAF /* TransformationMatrix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TransformationMatrix.cpp; path = transforms/TransformationMatrix.cpp; sourceTree = "<group>"; };
5590
		49E911B30EF86D47009D0CAF /* TransformationMatrix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TransformationMatrix.cpp; path = transforms/TransformationMatrix.cpp; sourceTree = "<group>"; };
5583
		49E911B40EF86D47009D0CAF /* TransformationMatrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TransformationMatrix.h; path = transforms/TransformationMatrix.h; sourceTree = "<group>"; };
5591
		49E911B40EF86D47009D0CAF /* TransformationMatrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TransformationMatrix.h; path = transforms/TransformationMatrix.h; sourceTree = "<group>"; };
5584
		49E911B50EF86D47009D0CAF /* IdentityTransformOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IdentityTransformOperation.h; path = transforms/IdentityTransformOperation.h; sourceTree = "<group>"; };
5592
		49E911B50EF86D47009D0CAF /* IdentityTransformOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IdentityTransformOperation.h; path = transforms/IdentityTransformOperation.h; sourceTree = "<group>"; };
Lines 9732-9737 WebCore/WebCore.xcodeproj/project.pbxproj_sec3
9732
		49E911B20EF86D27009D0CAF /* transforms */ = {
9740
		49E911B20EF86D27009D0CAF /* transforms */ = {
9733
			isa = PBXGroup;
9741
			isa = PBXGroup;
9734
			children = (
9742
			children = (
9743
				49D5DC270F423A73008F20FD /* Matrix3DTransformOperation.cpp */,
9744
				49D5DC280F423A73008F20FD /* Matrix3DTransformOperation.h */,
9745
				49D5DC290F423A73008F20FD /* PerspectiveTransformOperation.cpp */,
9746
				49D5DC2A0F423A73008F20FD /* PerspectiveTransformOperation.h */,
9735
				49E911B50EF86D47009D0CAF /* IdentityTransformOperation.h */,
9747
				49E911B50EF86D47009D0CAF /* IdentityTransformOperation.h */,
9736
				49E911B60EF86D47009D0CAF /* MatrixTransformOperation.cpp */,
9748
				49E911B60EF86D47009D0CAF /* MatrixTransformOperation.cpp */,
9737
				49E911B70EF86D47009D0CAF /* MatrixTransformOperation.h */,
9749
				49E911B70EF86D47009D0CAF /* MatrixTransformOperation.h */,
Lines 16757-16762 WebCore/WebCore.xcodeproj/project.pbxproj_sec4
16757
				2E3AC84E0F3D06D100633F04 /* WorkerContextProxy.h in Headers */,
16769
				2E3AC84E0F3D06D100633F04 /* WorkerContextProxy.h in Headers */,
16758
				2E3AC8500F3D06F700633F04 /* WorkerObjectProxy.h in Headers */,
16770
				2E3AC8500F3D06F700633F04 /* WorkerObjectProxy.h in Headers */,
16759
				A883DF280F3D045D00F19BF6 /* VisibleSelection.h in Headers */,
16771
				A883DF280F3D045D00F19BF6 /* VisibleSelection.h in Headers */,
16772
				49D5DC2C0F423A73008F20FD /* Matrix3DTransformOperation.h in Headers */,
16773
				49D5DC2E0F423A73008F20FD /* PerspectiveTransformOperation.h in Headers */,
16760
			);
16774
			);
16761
			runOnlyForDeploymentPostprocessing = 0;
16775
			runOnlyForDeploymentPostprocessing = 0;
16762
		};
16776
		};
Lines 18743-18748 WebCore/WebCore.xcodeproj/project.pbxproj_sec5
18743
				BCC065870F3CE2A700CD2D87 /* JSClientRect.cpp in Sources */,
18757
				BCC065870F3CE2A700CD2D87 /* JSClientRect.cpp in Sources */,
18744
				BCC065890F3CE2A700CD2D87 /* JSClientRectList.cpp in Sources */,
18758
				BCC065890F3CE2A700CD2D87 /* JSClientRectList.cpp in Sources */,
18745
				A883DF270F3D045D00F19BF6 /* VisibleSelection.cpp in Sources */,
18759
				A883DF270F3D045D00F19BF6 /* VisibleSelection.cpp in Sources */,
18760
				49D5DC2B0F423A73008F20FD /* Matrix3DTransformOperation.cpp in Sources */,
18761
				49D5DC2D0F423A73008F20FD /* PerspectiveTransformOperation.cpp in Sources */,
18746
			);
18762
			);
18747
			runOnlyForDeploymentPostprocessing = 0;
18763
			runOnlyForDeploymentPostprocessing = 0;
18748
		};
18764
		};
- WebCore/platform/graphics/transforms/IdentityTransformOperation.h +1 lines
Lines 38-43 public: WebCore/platform/graphics/transforms/IdentityTransformOperation.h_sec1
38
        
38
        
39
private:
39
private:
40
    virtual bool isIdentity() const { return true; }
40
    virtual bool isIdentity() const { return true; }
41
    virtual bool isAffine() const { return true; }
41
    virtual OperationType getOperationType() const { return IDENTITY; }
42
    virtual OperationType getOperationType() const { return IDENTITY; }
42
    virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == IDENTITY; }
43
    virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == IDENTITY; }
43
44
- WebCore/platform/graphics/transforms/Matrix3DTransformOperation.cpp +54 lines
Line 0 WebCore/platform/graphics/transforms/Matrix3DTransformOperation.cpp_sec1
1
/*
2
 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3
 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Library General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 2 of the License, or (at your option) any later version.
9
 *
10
 * This library is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * Library General Public License for more details.
14
 *
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
17
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
 * Boston, MA 02110-1301, USA.
19
 *
20
 */
21
22
#include "config.h"
23
#include "Matrix3DTransformOperation.h"
24
25
#if ENABLE(3D_TRANSFORMS)
26
27
#include <algorithm>
28
29
namespace WebCore {
30
31
PassRefPtr<TransformOperation> Matrix3DTransformOperation::blend(const TransformOperation* from, double progress, bool blendToIdentity)
32
{
33
    if (from && !from->isSameType(*this))
34
        return this;
35
36
    // Convert the TransformOperations into matrices
37
    IntSize size;
38
    TransformationMatrix fromT;
39
    TransformationMatrix toT;
40
    if (from)
41
        from->apply(fromT, size);
42
43
    apply(toT, size);
44
45
    if (blendToIdentity)
46
        std::swap(fromT, toT);
47
48
    toT.blend(fromT, progress);
49
    return Matrix3DTransformOperation::create(toT);
50
}
51
52
} // namespace WebCore
53
54
#endif // ENABLE(3D_TRANSFORMS)
- WebCore/platform/graphics/transforms/Matrix3DTransformOperation.h +76 lines
Line 0 WebCore/platform/graphics/transforms/Matrix3DTransformOperation.h_sec1
1
/*
2
 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3
 *           (C) 2000 Antti Koivisto (koivisto@kde.org)
4
 *           (C) 2000 Dirk Mueller (mueller@kde.org)
5
 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6
 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7
 *
8
 * This library is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU Library General Public
10
 * License as published by the Free Software Foundation; either
11
 * version 2 of the License, or (at your option) any later version.
12
 *
13
 * This library is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 * Library General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Library General Public License
19
 * along with this library; see the file COPYING.LIB.  If not, write to
20
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
 * Boston, MA 02110-1301, USA.
22
 *
23
 */
24
25
#ifndef Matrix3DTransformOperation_h
26
#define Matrix3DTransformOperation_h
27
28
#include "TransformOperation.h"
29
30
#if ENABLE(3D_TRANSFORMS)
31
32
namespace WebCore {
33
34
class Matrix3DTransformOperation : public TransformOperation {
35
public:
36
    static PassRefPtr<Matrix3DTransformOperation> create(const TransformationMatrix& matrix)
37
    {
38
        return adoptRef(new Matrix3DTransformOperation(matrix));
39
    }
40
41
private:    
42
    virtual bool isIdentity() const { return m_matrix.isIdentity(); }
43
    virtual bool isAffine() const { return m_matrix.isAffine(); }
44
45
    virtual OperationType getOperationType() const { return MATRIX_3D; }
46
    virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == MATRIX_3D; }
47
48
    virtual bool operator==(const TransformOperation& o) const
49
    {
50
        if (!isSameType(o))
51
            return false;
52
        const Matrix3DTransformOperation* m = static_cast<const Matrix3DTransformOperation*>(&o);
53
        return m_matrix == m->m_matrix;
54
    }
55
56
    virtual bool apply(TransformationMatrix& transform, const IntSize&) const
57
    {
58
        transform.multLeft(TransformationMatrix(m_matrix));
59
        return false;
60
    }
61
62
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
63
    
64
    Matrix3DTransformOperation(const TransformationMatrix& mat)
65
    {
66
        m_matrix = mat;
67
    }
68
69
    TransformationMatrix m_matrix;
70
};
71
72
} // namespace WebCore
73
74
#endif // ENABLE(3D_TRANSFORMS)
75
76
#endif // Matrix3DTransformOperation_h
- WebCore/platform/graphics/transforms/MatrixTransformOperation.h -1 / +3 lines
Lines 44-49 public: WebCore/platform/graphics/transforms/MatrixTransformOperation.h_sec1
44
44
45
private:
45
private:
46
    virtual bool isIdentity() const { return m_a == 1 && m_b == 0 && m_c == 0 && m_d == 1 && m_e == 0 && m_f == 0; }
46
    virtual bool isIdentity() const { return m_a == 1 && m_b == 0 && m_c == 0 && m_d == 1 && m_e == 0 && m_f == 0; }
47
    virtual bool isAffine() const { return true; }
48
47
    virtual OperationType getOperationType() const { return MATRIX; }
49
    virtual OperationType getOperationType() const { return MATRIX; }
48
    virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == MATRIX; }
50
    virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == MATRIX; }
49
51
Lines 59-65 private: WebCore/platform/graphics/transforms/MatrixTransformOperation.h_sec2
59
    virtual bool apply(TransformationMatrix& transform, const IntSize&) const
61
    virtual bool apply(TransformationMatrix& transform, const IntSize&) const
60
    {
62
    {
61
        TransformationMatrix matrix(m_a, m_b, m_c, m_d, m_e, m_f);
63
        TransformationMatrix matrix(m_a, m_b, m_c, m_d, m_e, m_f);
62
        transform = matrix * transform;
64
        transform.multLeft(TransformationMatrix(matrix));
63
        return false;
65
        return false;
64
    }
66
    }
65
67
- WebCore/platform/graphics/transforms/PerspectiveTransformOperation.cpp +59 lines
Line 0 WebCore/platform/graphics/transforms/PerspectiveTransformOperation.cpp_sec1
1
/*
2
 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3
 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Library General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 2 of the License, or (at your option) any later version.
9
 *
10
 * This library is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * Library General Public License for more details.
14
 *
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
17
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
 * Boston, MA 02110-1301, USA.
19
 *
20
 */
21
22
#include "config.h"
23
#include "PerspectiveTransformOperation.h"
24
25
#if ENABLE(3D_TRANSFORMS)
26
27
#include <algorithm>
28
29
namespace WebCore {
30
31
PassRefPtr<TransformOperation> PerspectiveTransformOperation::blend(const TransformOperation* from, double progress, bool blendToIdentity)
32
{
33
    if (from && !from->isSameType(*this))
34
        return this;
35
    
36
    if (blendToIdentity)
37
        return PerspectiveTransformOperation::create(m_p + (1. - m_p) * progress);
38
    
39
    const PerspectiveTransformOperation* fromOp = static_cast<const PerspectiveTransformOperation*>(from);
40
    double fromP = fromOp ? fromOp->m_p : 0;
41
    double toP = m_p;
42
    
43
    if (blendToIdentity)
44
        std::swap(fromP, toP);
45
    
46
    TransformationMatrix fromT;
47
    TransformationMatrix toT;
48
    fromT.applyPerspective((float) fromP);
49
    toT.applyPerspective((float) toP);
50
    toT.blend(fromT, progress);
51
    TransformationMatrix::DecomposedType decomp;
52
    toT.decompose(decomp);
53
    
54
    return PerspectiveTransformOperation::create(decomp.perspectiveZ ? -1.0 / decomp.perspectiveZ : 0.0);
55
}
56
57
} // namespace WebCore
58
59
#endif // ENABLE(3D_TRANSFORMS)
- WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h +75 lines
Line 0 WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h_sec1
1
/*
2
 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3
 *           (C) 2000 Antti Koivisto (koivisto@kde.org)
4
 *           (C) 2000 Dirk Mueller (mueller@kde.org)
5
 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6
 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7
 *
8
 * This library is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU Library General Public
10
 * License as published by the Free Software Foundation; either
11
 * version 2 of the License, or (at your option) any later version.
12
 *
13
 * This library is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 * Library General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Library General Public License
19
 * along with this library; see the file COPYING.LIB.  If not, write to
20
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
 * Boston, MA 02110-1301, USA.
22
 *
23
 */
24
25
#ifndef PerspectiveTransformOperation_h
26
#define PerspectiveTransformOperation_h
27
28
#include "TransformOperation.h"
29
30
#if ENABLE(3D_TRANSFORMS)
31
32
namespace WebCore {
33
34
class PerspectiveTransformOperation : public TransformOperation {
35
public:
36
    static PassRefPtr<PerspectiveTransformOperation> create(double p)
37
    {
38
        return adoptRef(new PerspectiveTransformOperation(p));
39
    }
40
    
41
private:
42
    virtual bool isIdentity() const { return m_p == 0; }
43
    virtual bool isAffine() const { return m_p == 0; }
44
    virtual OperationType getOperationType() const { return PERSPECTIVE; }
45
    virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == PERSPECTIVE; }
46
47
    virtual bool operator==(const TransformOperation& o) const
48
    {
49
        if (!isSameType(o))
50
            return false;
51
        const PerspectiveTransformOperation* p = static_cast<const PerspectiveTransformOperation*>(&o);
52
        return m_p == p->m_p;
53
    }
54
55
    virtual bool apply(TransformationMatrix& transform, const IntSize&) const
56
    {
57
        transform.applyPerspective((float)m_p);
58
        return false;
59
    }
60
61
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
62
63
    PerspectiveTransformOperation(double p)
64
        : m_p(p)
65
    {
66
    }
67
68
    double m_p;
69
};
70
71
} // namespace WebCore
72
73
#endif // ENABLE(3D_TRANSFORMS)
74
75
#endif // PerspectiveTransformOperation_h
- WebCore/platform/graphics/transforms/RotateTransformOperation.cpp -3 / +61 lines
Lines 30-40 PassRefPtr<TransformOperation> RotateTra WebCore/platform/graphics/transforms/RotateTransformOperation.cpp_sec1
30
        return this;
30
        return this;
31
    
31
    
32
    if (blendToIdentity)
32
    if (blendToIdentity)
33
        return RotateTransformOperation::create(m_angle - m_angle * progress, m_type);
33
        return RotateTransformOperation::create(m_x, m_y, m_z, m_angle - m_angle * progress, m_type);
34
    
34
    
35
    const RotateTransformOperation* fromOp = static_cast<const RotateTransformOperation*>(from);
35
    const RotateTransformOperation* fromOp = static_cast<const RotateTransformOperation*>(from);
36
    double fromAngle = fromOp ? fromOp->m_angle : 0;
36
    
37
    return RotateTransformOperation::create(fromAngle + (m_angle - fromAngle) * progress, m_type);
37
    // Optimize for single axis rotation
38
    if (!fromOp || (fromOp->m_x == 0 && fromOp->m_y == 0 && fromOp->m_z == 1) || 
39
                   (fromOp->m_x == 0 && fromOp->m_y == 1 && fromOp->m_z == 0) || 
40
                   (fromOp->m_x == 1 && fromOp->m_y == 0 && fromOp->m_z == 0)) {
41
        double fromAngle = fromOp ? fromOp->m_angle : 0;
42
        return RotateTransformOperation::create(fromOp ? fromOp->m_x : m_x, 
43
                                                fromOp ? fromOp->m_y : m_y, 
44
                                                fromOp ? fromOp->m_z : m_z, 
45
                                                fromAngle + (m_angle - fromAngle) * progress, m_type);
46
    }
47
48
    const RotateTransformOperation* toOp = this;
49
    
50
    if (blendToIdentity)
51
        std::swap(fromOp, toOp);
52
    
53
    // Create the 2 rotation matrices
54
    TransformationMatrix fromT;
55
    TransformationMatrix toT;
56
    fromT.rotate3d((float)(fromOp ? fromOp->m_x : 0),
57
                   (float)(fromOp ? fromOp->m_y : 0),
58
                   (float)(fromOp ? fromOp->m_z : 1),
59
                   (float)(fromOp ? fromOp->m_angle : 0));
60
61
    toT.rotate3d((float)(toOp ? toOp->m_x : 0),
62
                 (float)(toOp ? toOp->m_y : 0),
63
                 (float)(toOp ? toOp->m_z : 1),
64
                 (float)(toOp ? toOp->m_angle : 0));
65
    
66
    // Blend them
67
    toT.blend(fromT, progress);
68
    
69
    // Extract the result as a quaternion
70
    TransformationMatrix::DecomposedType decomp;
71
    toT.decompose(decomp);
72
    
73
    // Convert that to Axis/Angle form
74
    float x = (float) -decomp.quaternionX;
75
    float y = (float) -decomp.quaternionY;
76
    float z = (float) -decomp.quaternionZ;
77
    float length = sqrtf(x * x + y * y + z * z);
78
    float angle = 0.0f;
79
    
80
    if (length > 0.00001f) {
81
        x /= length;
82
        y /= length;
83
        z /= length;
84
        angle = (float)(acos(decomp.quaternionW) * 2.0 * 360.0 / M_PI / 2.0);
85
    }
86
    else {
87
        x = 0.0f;
88
        y = 0.0f;
89
        z = 1.0f;
90
    }
91
#if ENABLE(3D_TRANSFORMS)
92
    return RotateTransformOperation::create(x, y, z, angle, ROTATE_3D);
93
#else
94
    return RotateTransformOperation::create(0, 0, z, angle, ROTATE_Z);
95
#endif
38
}
96
}
39
97
40
} // namespace WebCore
98
} // namespace WebCore
- WebCore/platform/graphics/transforms/RotateTransformOperation.h -8 / +27 lines
Lines 33-42 class RotateTransformOperation : public WebCore/platform/graphics/transforms/RotateTransformOperation.h_sec1
33
public:
33
public:
34
    static PassRefPtr<RotateTransformOperation> create(double angle, OperationType type)
34
    static PassRefPtr<RotateTransformOperation> create(double angle, OperationType type)
35
    {
35
    {
36
        return adoptRef(new RotateTransformOperation(angle, type));
36
        return adoptRef(new RotateTransformOperation(0, 0, 1, angle, type));
37
    }
37
    }
38
38
39
    static PassRefPtr<RotateTransformOperation> create(double x, double y, double z, double angle, OperationType type)
40
    {
41
        return adoptRef(new RotateTransformOperation(x, y, z, angle, type));
42
    }
43
44
    double angle() const { return m_angle; }
45
46
private:
39
    virtual bool isIdentity() const { return m_angle == 0; }
47
    virtual bool isIdentity() const { return m_angle == 0; }
48
    virtual bool isAffine() const { return m_x == 0.0 && m_y == 0.0; }
49
40
    virtual OperationType getOperationType() const { return m_type; }
50
    virtual OperationType getOperationType() const { return m_type; }
41
    virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == m_type; }
51
    virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == m_type; }
42
52
Lines 45-70 public: WebCore/platform/graphics/transforms/RotateTransformOperation.h_sec2
45
        if (!isSameType(o))
55
        if (!isSameType(o))
46
            return false;
56
            return false;
47
        const RotateTransformOperation* r = static_cast<const RotateTransformOperation*>(&o);
57
        const RotateTransformOperation* r = static_cast<const RotateTransformOperation*>(&o);
48
        return m_angle == r->m_angle;
58
        return m_x == r->m_x && m_y == r->m_y && m_z == r->m_z && m_angle == r->m_angle;
49
    }
59
    }
50
60
51
    virtual bool apply(TransformationMatrix& transform, const IntSize& /*borderBoxSize*/) const
61
    virtual bool apply(TransformationMatrix& transform, const IntSize& /*borderBoxSize*/) const
52
    {
62
    {
53
        transform.rotate(m_angle);
63
        transform.rotate3d((float)m_x, (float)m_y, (float)m_z, (float)m_angle);
54
        return false;
64
        return false;
55
    }
65
    }
56
66
57
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
67
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
58
68
59
    double angle() const { return m_angle; }
69
    RotateTransformOperation(double x, double y, double z, double angle, OperationType type)
60
70
        : m_x(x)
61
private:
71
        , m_y(y)
62
    RotateTransformOperation(double angle, OperationType type)
72
        , m_z(z)
63
        : m_angle(angle)
73
        , m_angle(angle)
64
        , m_type(type)
74
        , m_type(type)
65
    {
75
    {
76
#if ENABLE(3D_TRANSFORMS)
77
        ASSERT(type == ROTATE_X || type == ROTATE_Y || type == ROTATE_Z || type == ROTATE_3D);
78
#else
79
        ASSERT(type == ROTATE_Z);
80
        ASSERT(x == 0 && y == 0);
81
#endif
66
    }
82
    }
67
83
84
    double m_x;
85
    double m_y;
86
    double m_z;
68
    double m_angle;
87
    double m_angle;
69
    OperationType m_type;
88
    OperationType m_type;
70
};
89
};
- WebCore/platform/graphics/transforms/ScaleTransformOperation.cpp -2 / +7 lines
Lines 30-41 PassRefPtr<TransformOperation> ScaleTran WebCore/platform/graphics/transforms/ScaleTransformOperation.cpp_sec1
30
        return this;
30
        return this;
31
    
31
    
32
    if (blendToIdentity)
32
    if (blendToIdentity)
33
        return ScaleTransformOperation::create(m_x + (1. - m_x) * progress, m_y + (1. - m_y) * progress, m_type);
33
        return ScaleTransformOperation::create(m_x + (1. - m_x) * progress,
34
                                               m_y + (1. - m_y) * progress,
35
                                               m_z + (1. - m_z) * progress, m_type);
34
    
36
    
35
    const ScaleTransformOperation* fromOp = static_cast<const ScaleTransformOperation*>(from);
37
    const ScaleTransformOperation* fromOp = static_cast<const ScaleTransformOperation*>(from);
36
    double fromX = fromOp ? fromOp->m_x : 1.;
38
    double fromX = fromOp ? fromOp->m_x : 1.;
37
    double fromY = fromOp ? fromOp->m_y : 1.;
39
    double fromY = fromOp ? fromOp->m_y : 1.;
38
    return ScaleTransformOperation::create(fromX + (m_x - fromX) * progress, fromY + (m_y - fromY) * progress, m_type);
40
    double fromZ = fromOp ? fromOp->m_z : 1.;
41
    return ScaleTransformOperation::create(fromX + (m_x - fromX) * progress,
42
                                           fromY + (m_y - fromY) * progress,
43
                                           fromZ + (m_z - fromZ) * progress, m_type);
39
}
44
}
40
45
41
} // namespace WebCore
46
} // namespace WebCore
- WebCore/platform/graphics/transforms/ScaleTransformOperation.h -5 / +21 lines
Lines 33-46 class ScaleTransformOperation : public T WebCore/platform/graphics/transforms/ScaleTransformOperation.h_sec1
33
public:
33
public:
34
    static PassRefPtr<ScaleTransformOperation> create(double sx, double sy, OperationType type)
34
    static PassRefPtr<ScaleTransformOperation> create(double sx, double sy, OperationType type)
35
    {
35
    {
36
        return adoptRef(new ScaleTransformOperation(sx, sy, type));
36
        return adoptRef(new ScaleTransformOperation(sx, sy, 1, type));
37
    }
38
39
    static PassRefPtr<ScaleTransformOperation> create(double sx, double sy, double sz, OperationType type)
40
    {
41
        return adoptRef(new ScaleTransformOperation(sx, sy, sz, type));
37
    }
42
    }
38
43
39
    double x() const { return m_x; }
44
    double x() const { return m_x; }
40
    double y() const { return m_y; }
45
    double y() const { return m_y; }
46
    double z() const { return m_z; }
41
47
42
private:
48
private:
43
    virtual bool isIdentity() const { return m_x == 1 &&  m_y == 1; }
49
    virtual bool isIdentity() const { return m_x == 1 &&  m_y == 1 &&  m_z == 1; }
50
    virtual bool isAffine() const { return m_z == 1; }
51
44
    virtual OperationType getOperationType() const { return m_type; }
52
    virtual OperationType getOperationType() const { return m_type; }
45
    virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == m_type; }
53
    virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == m_type; }
46
54
Lines 49-74 private: WebCore/platform/graphics/transforms/ScaleTransformOperation.h_sec2
49
        if (!isSameType(o))
57
        if (!isSameType(o))
50
            return false;
58
            return false;
51
        const ScaleTransformOperation* s = static_cast<const ScaleTransformOperation*>(&o);
59
        const ScaleTransformOperation* s = static_cast<const ScaleTransformOperation*>(&o);
52
        return m_x == s->m_x && m_y == s->m_y;
60
        return m_x == s->m_x && m_y == s->m_y && m_z == s->m_z;
53
    }
61
    }
54
62
55
    virtual bool apply(TransformationMatrix& transform, const IntSize&) const
63
    virtual bool apply(TransformationMatrix& transform, const IntSize&) const
56
    {
64
    {
57
        transform.scaleNonUniform(m_x, m_y);
65
        transform.scale3d(m_x, m_y, m_z);
58
        return false;
66
        return false;
59
    }
67
    }
60
68
61
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
69
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
62
70
63
    ScaleTransformOperation(double sx, double sy, OperationType type)
71
    ScaleTransformOperation(double sx, double sy, double sz, OperationType type)
64
        : m_x(sx)
72
        : m_x(sx)
65
        , m_y(sy)
73
        , m_y(sy)
74
        , m_z(sz)
66
        , m_type(type)
75
        , m_type(type)
67
    {
76
    {
77
#if ENABLE(3D_TRANSFORMS)
78
        ASSERT(type == SCALE_X || type == SCALE_Y || type == SCALE_Z || type == SCALE || type == SCALE_3D);
79
#else
80
        ASSERT(type == SCALE_X || type == SCALE_Y || type == SCALE);
81
        ASSERT(sz == 1);
82
#endif
68
    }
83
    }
69
        
84
        
70
    double m_x;
85
    double m_x;
71
    double m_y;
86
    double m_y;
87
    double m_z;
72
    OperationType m_type;
88
    OperationType m_type;
73
};
89
};
74
90
- WebCore/platform/graphics/transforms/SkewTransformOperation.h +1 lines
Lines 38-43 public: WebCore/platform/graphics/transforms/SkewTransformOperation.h_sec1
38
38
39
private:
39
private:
40
    virtual bool isIdentity() const { return m_angleX == 0 && m_angleY == 0; }
40
    virtual bool isIdentity() const { return m_angleX == 0 && m_angleY == 0; }
41
    virtual bool isAffine() const { return true; }
41
    virtual OperationType getOperationType() const { return m_type; }
42
    virtual OperationType getOperationType() const { return m_type; }
42
    virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == m_type; }
43
    virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == m_type; }
43
44
- WebCore/platform/graphics/transforms/TransformOperation.h -2 / +28 lines
Lines 39-47 public: WebCore/platform/graphics/transforms/TransformOperation.h_sec1
39
    enum OperationType {
39
    enum OperationType {
40
        SCALE_X, SCALE_Y, SCALE, 
40
        SCALE_X, SCALE_Y, SCALE, 
41
        TRANSLATE_X, TRANSLATE_Y, TRANSLATE, 
41
        TRANSLATE_X, TRANSLATE_Y, TRANSLATE, 
42
        ROTATE, 
42
        ROTATE,
43
        ROTATE_Z = ROTATE,
43
        SKEW_X, SKEW_Y, SKEW, 
44
        SKEW_X, SKEW_Y, SKEW, 
44
        MATRIX, IDENTITY, NONE
45
        MATRIX,
46
#if ENABLE(3D_TRANSFORMS)
47
        SCALE_Z, SCALE_3D,
48
        TRANSLATE_Z, TRANSLATE_3D,
49
        ROTATE_X, ROTATE_Y, ROTATE_3D,
50
        MATRIX_3D,
51
        PERSPECTIVE,
52
#endif
53
        IDENTITY, NONE
45
    };
54
    };
46
55
47
    virtual ~TransformOperation() { }
56
    virtual ~TransformOperation() { }
Lines 50-55 public: WebCore/platform/graphics/transforms/TransformOperation.h_sec2
50
    bool operator!=(const TransformOperation& o) const { return !(*this == o); }
59
    bool operator!=(const TransformOperation& o) const { return !(*this == o); }
51
60
52
    virtual bool isIdentity() const = 0;
61
    virtual bool isIdentity() const = 0;
62
    virtual bool isAffine() const = 0;
53
63
54
    virtual bool apply(TransformationMatrix&, const IntSize& borderBoxSize) const = 0;
64
    virtual bool apply(TransformationMatrix&, const IntSize& borderBoxSize) const = 0;
55
65
Lines 57-62 public: WebCore/platform/graphics/transforms/TransformOperation.h_sec3
57
67
58
    virtual OperationType getOperationType() const = 0;
68
    virtual OperationType getOperationType() const = 0;
59
    virtual bool isSameType(const TransformOperation&) const { return false; }
69
    virtual bool isSameType(const TransformOperation&) const { return false; }
70
    
71
#if ENABLE(3D_TRANSFORMS)
72
    bool is3DOperation() const
73
    {
74
        OperationType opType = getOperationType();
75
        return opType == SCALE_Z ||
76
               opType == SCALE_3D ||
77
               opType == TRANSLATE_Z ||
78
               opType == TRANSLATE_3D ||
79
               opType == ROTATE_X ||
80
               opType == ROTATE_Y ||
81
               opType == ROTATE_3D ||
82
               opType == MATRIX_3D ||
83
               opType == PERSPECTIVE;
84
    }
85
#endif
60
};
86
};
61
87
62
} // namespace WebCore
88
} // namespace WebCore
- WebCore/platform/graphics/transforms/TransformOperations.h +22 lines
Lines 47-52 public: WebCore/platform/graphics/transforms/TransformOperations.h_sec1
47
            m_operations[i]->apply(t, sz);
47
            m_operations[i]->apply(t, sz);
48
    }
48
    }
49
    
49
    
50
    // Returns true if the operations can all be represented as affine transforms (even if
51
    // they use 3d operations)
52
    bool isAffine() const
53
    {
54
        for (unsigned i = 0; i < m_operations.size(); ++i)
55
            if (!m_operations[i]->isAffine())
56
                return false;
57
        return true;
58
    }
59
    
60
#if ENABLE(3D_TRANSFORMS)
61
    // Return true if any of the operation types are 3D operation types (even if the
62
    // values describe affine transforms)
63
    bool has3DOperation() const
64
    {
65
        for (unsigned i = 0; i < m_operations.size(); ++i)
66
            if (m_operations[i]->is3DOperation())
67
                return true;
68
        return false;
69
    }
70
#endif
71
    
50
    Vector<RefPtr<TransformOperation> >& operations() { return m_operations; }
72
    Vector<RefPtr<TransformOperation> >& operations() { return m_operations; }
51
    const Vector<RefPtr<TransformOperation> >& operations() const { return m_operations; }
73
    const Vector<RefPtr<TransformOperation> >& operations() const { return m_operations; }
52
74
- WebCore/platform/graphics/transforms/TranslateTransformOperation.cpp -2 / +5 lines
Lines 30-41 PassRefPtr<TransformOperation> Translate WebCore/platform/graphics/transforms/TranslateTransformOperation.cpp_sec1
30
        return this;
30
        return this;
31
    
31
    
32
    if (blendToIdentity)
32
    if (blendToIdentity)
33
        return TranslateTransformOperation::create(Length(m_x.type()).blend(m_x, progress), Length(m_y.type()).blend(m_y, progress), m_type);
33
        return TranslateTransformOperation::create(Length(m_x.type()).blend(m_x, progress), 
34
                                                   Length(m_y.type()).blend(m_y, progress), 
35
                                                   Length(m_z.type()).blend(m_z, progress), m_type);
34
36
35
    const TranslateTransformOperation* fromOp = static_cast<const TranslateTransformOperation*>(from);
37
    const TranslateTransformOperation* fromOp = static_cast<const TranslateTransformOperation*>(from);
36
    Length fromX = fromOp ? fromOp->m_x : Length(m_x.type());
38
    Length fromX = fromOp ? fromOp->m_x : Length(m_x.type());
37
    Length fromY = fromOp ? fromOp->m_y : Length(m_y.type());
39
    Length fromY = fromOp ? fromOp->m_y : Length(m_y.type());
38
    return TranslateTransformOperation::create(m_x.blend(fromX, progress), m_y.blend(fromY, progress), m_type);
40
    Length fromZ = fromOp ? fromOp->m_z : Length(m_z.type());
41
    return TranslateTransformOperation::create(m_x.blend(fromX, progress), m_y.blend(fromY, progress), m_z.blend(fromZ, progress), m_type);
39
}
42
}
40
43
41
} // namespace WebCore
44
} // namespace WebCore
- WebCore/platform/graphics/transforms/TranslateTransformOperation.h -5 / +20 lines
Lines 34-47 class TranslateTransformOperation : publ WebCore/platform/graphics/transforms/TranslateTransformOperation.h_sec1
34
public:
34
public:
35
    static PassRefPtr<TranslateTransformOperation> create(const Length& tx, const Length& ty, OperationType type)
35
    static PassRefPtr<TranslateTransformOperation> create(const Length& tx, const Length& ty, OperationType type)
36
    {
36
    {
37
        return adoptRef(new TranslateTransformOperation(tx, ty, type));
37
        return adoptRef(new TranslateTransformOperation(tx, ty, Length(0, Fixed), type));
38
    }
39
40
    static PassRefPtr<TranslateTransformOperation> create(const Length& tx, const Length& ty, const Length& tz, OperationType type)
41
    {
42
        return adoptRef(new TranslateTransformOperation(tx, ty, tz, type));
38
    }
43
    }
39
44
40
    double x(const IntSize& borderBoxSize) const { return m_x.calcFloatValue(borderBoxSize.width()); }
45
    double x(const IntSize& borderBoxSize) const { return m_x.calcFloatValue(borderBoxSize.width()); }
41
    double y(const IntSize& borderBoxSize) const { return m_y.calcFloatValue(borderBoxSize.height()); }
46
    double y(const IntSize& borderBoxSize) const { return m_y.calcFloatValue(borderBoxSize.height()); }
47
    double z(const IntSize&) const { return m_z.calcFloatValue(1); }
42
48
43
private:
49
private:
44
    virtual bool isIdentity() const { return m_x.calcFloatValue(1) == 0 && m_y.calcFloatValue(1) == 0; }
50
    virtual bool isIdentity() const { return m_x.calcFloatValue(1) == 0 && m_y.calcFloatValue(1) == 0 && m_z.calcFloatValue(1) == 0; }
51
    virtual bool isAffine() const { return m_z.calcFloatValue(1) == 0; }
52
45
    virtual OperationType getOperationType() const { return m_type; }
53
    virtual OperationType getOperationType() const { return m_type; }
46
    virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == m_type; }
54
    virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == m_type; }
47
55
Lines 50-75 private: WebCore/platform/graphics/transforms/TranslateTransformOperation.h_sec2
50
        if (!isSameType(o))
58
        if (!isSameType(o))
51
            return false;
59
            return false;
52
        const TranslateTransformOperation* t = static_cast<const TranslateTransformOperation*>(&o);
60
        const TranslateTransformOperation* t = static_cast<const TranslateTransformOperation*>(&o);
53
        return m_x == t->m_x && m_y == t->m_y;
61
        return m_x == t->m_x && m_y == t->m_y && m_z == t->m_z;
54
    }
62
    }
55
63
56
    virtual bool apply(TransformationMatrix& transform, const IntSize& borderBoxSize) const
64
    virtual bool apply(TransformationMatrix& transform, const IntSize& borderBoxSize) const
57
    {
65
    {
58
        transform.translate(m_x.calcFloatValue(borderBoxSize.width()), m_y.calcFloatValue(borderBoxSize.height()));
66
        transform.translate3d((float) x(borderBoxSize), (float) y(borderBoxSize), (float) z(borderBoxSize));
59
        return m_x.type() == Percent || m_y.type() == Percent;
67
        return m_x.type() == Percent || m_y.type() == Percent;
60
    }
68
    }
61
69
62
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
70
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
63
71
64
    TranslateTransformOperation(const Length& tx, const Length& ty, OperationType type)
72
    TranslateTransformOperation(const Length& tx, const Length& ty, const Length& tz, OperationType type)
65
        : m_x(tx)
73
        : m_x(tx)
66
        , m_y(ty)
74
        , m_y(ty)
75
        , m_z(tz)
67
        , m_type(type)
76
        , m_type(type)
68
    {
77
    {
78
#if ENABLE(3D_TRANSFORMS)
79
        ASSERT(type == TRANSLATE_X || type == TRANSLATE_Y || type == TRANSLATE_Z || type == TRANSLATE || type == TRANSLATE_3D);
80
#else
81
        ASSERT(type == TRANSLATE_X || type == TRANSLATE_Y || type == TRANSLATE);
82
#endif
69
    }
83
    }
70
84
71
    Length m_x;
85
    Length m_x;
72
    Length m_y;
86
    Length m_y;
87
    Length m_z;
73
    OperationType m_type;
88
    OperationType m_type;
74
};
89
};
75
90
- WebKitTools/ChangeLog +10 lines
Lines 1-3 WebKitTools/ChangeLog_sec1
1
2009-02-10  Chris Marrin  <cmarrin@apple.com>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        * Scripts/build-webkit:
6
7
        https://bugs.webkit.org/show_bug.cgi?id=23883
8
9
        Added support --3d-transforms. Defaults to off
10
1
2009-02-10  Adam Roben  <aroben@apple.com>
11
2009-02-10  Adam Roben  <aroben@apple.com>
2
12
3
        Fix Bug 23869: Pixel tests can't be run on Windows
13
        Fix Bug 23869: Pixel tests can't be run on Windows
- WebKitTools/Scripts/build-webkit -1 / +6 lines
Lines 61-66 my $showHelp = 0; WebKitTools/Scripts/build-webkit_sec1
61
my $clean = 0;
61
my $clean = 0;
62
my $buildUniversal = 0;
62
my $buildUniversal = 0;
63
my $buildSixtyFourBit = 0;
63
my $buildSixtyFourBit = 0;
64
my $threeDTransformsSupport = 0;
64
65
65
my $programName = basename($0);
66
my $programName = basename($0);
66
my $usage = <<EOF;
67
my $usage = <<EOF;
Lines 71-76 Usage: $programName [options] [options t WebKitTools/Scripts/build-webkit_sec2
71
  --clean                       Cleanup the build directory
72
  --clean                       Cleanup the build directory
72
  --universal                   Build 2-way universal (PPC and Intel 32-bit)
73
  --universal                   Build 2-way universal (PPC and Intel 32-bit)
73
  --64-bit                      Build 64-bit, combine with --universal to build 4-way universal
74
  --64-bit                      Build 64-bit, combine with --universal to build 4-way universal
75
  --[no-]3d-transforms          Toggle 3D Transforms support (default: $threeDTransformsSupport)
74
  --[no-]channel-messaging          Toggle MessageChannel and MessagePort support (default: $channelMessagingSupport)
76
  --[no-]channel-messaging          Toggle MessageChannel and MessagePort support (default: $channelMessagingSupport)
75
  --[no-]offline-web-applications   Toggle Offline Web Application Support (default : $offlineWebApplicationSupport)
77
  --[no-]offline-web-applications   Toggle Offline Web Application Support (default : $offlineWebApplicationSupport)
76
  --[no-]database               Toggle Database Support (default: $databaseSupport)
78
  --[no-]database               Toggle Database Support (default: $databaseSupport)
Lines 91-97 Usage: $programName [options] [options t WebKitTools/Scripts/build-webkit_sec3
91
  --[no-]coverage               Toggle code coverage support (default: $coverageSupport)
93
  --[no-]coverage               Toggle code coverage support (default: $coverageSupport)
92
EOF
94
EOF
93
95
94
GetOptions('channel-messaging!' => \$channelMessagingSupport,
96
GetOptions(
97
           '3d-transforms!' => \$threeDTransformsSupport,
98
           'channel-messaging!' => \$channelMessagingSupport,
95
           'database!' => \$databaseSupport,
99
           'database!' => \$databaseSupport,
96
           'dom-storage!' => \$domStorageSupport,
100
           'dom-storage!' => \$domStorageSupport,
97
           'icon-database!' => \$iconDatabaseSupport,
101
           'icon-database!' => \$iconDatabaseSupport,
Lines 139-144 if (isWx()) { WebKitTools/Scripts/build-webkit_sec4
139
my $productDir = productDir();
143
my $productDir = productDir();
140
my @overrideFeatureDefinesOption = ();
144
my @overrideFeatureDefinesOption = ();
141
145
146
push @overrideFeatureDefinesOption, "ENABLE_3D_TRANSFORMS" if $threeDTransformsSupport;
142
push @overrideFeatureDefinesOption, "ENABLE_CHANNEL_MESSAGING" if $channelMessagingSupport;
147
push @overrideFeatureDefinesOption, "ENABLE_CHANNEL_MESSAGING" if $channelMessagingSupport;
143
push @overrideFeatureDefinesOption, "ENABLE_DATABASE" if $databaseSupport;
148
push @overrideFeatureDefinesOption, "ENABLE_DATABASE" if $databaseSupport;
144
push @overrideFeatureDefinesOption, "ENABLE_DOM_STORAGE" if $domStorageSupport;
149
push @overrideFeatureDefinesOption, "ENABLE_DOM_STORAGE" if $domStorageSupport;

Return to Bug 23883