Reviewed by Simon Fraser.
authorcmarrin@apple.com <cmarrin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Feb 2009 20:13:46 +0000 (20:13 +0000)
committercmarrin@apple.com <cmarrin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Feb 2009 20:13:46 +0000 (20:13 +0000)
        https://bugs.webkit.org/show_bug.cgi?id=23883

        Added new TransformOperation subclasses and methods to existing ones
        to support 3D.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@40861 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/platform/graphics/transforms/Matrix3DTransformOperation.cpp [new file with mode: 0644]
WebCore/platform/graphics/transforms/Matrix3DTransformOperation.h [new file with mode: 0644]
WebCore/platform/graphics/transforms/MatrixTransformOperation.cpp
WebCore/platform/graphics/transforms/MatrixTransformOperation.h
WebCore/platform/graphics/transforms/PerspectiveTransformOperation.cpp [new file with mode: 0644]
WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h [new file with mode: 0644]
WebCore/platform/graphics/transforms/RotateTransformOperation.cpp
WebCore/platform/graphics/transforms/RotateTransformOperation.h
WebCore/platform/graphics/transforms/ScaleTransformOperation.cpp
WebCore/platform/graphics/transforms/ScaleTransformOperation.h
WebCore/platform/graphics/transforms/TransformOperation.h
WebCore/platform/graphics/transforms/TransformOperations.h
WebCore/platform/graphics/transforms/TranslateTransformOperation.cpp
WebCore/platform/graphics/transforms/TranslateTransformOperation.h
WebKitTools/ChangeLog
WebKitTools/Scripts/build-webkit

index 583587a..ca6a855 100644 (file)
@@ -1,3 +1,78 @@
+2009-02-10  Chris Marrin  <cmarrin@apple.com>
+
+        Reviewed by Simon Fraser.
+
+        https://bugs.webkit.org/show_bug.cgi?id=23883
+
+        Added new TransformOperation subclasses and methods to existing ones
+        to support 3D.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/graphics/transforms/IdentityTransformOperation.h:
+        (WebCore::IdentityTransformOperation::isAffine):
+        * platform/graphics/transforms/Matrix3DTransformOperation.cpp: Added.
+        (WebCore::Matrix3DTransformOperation::blend):
+        * platform/graphics/transforms/Matrix3DTransformOperation.h: Added.
+        (WebCore::Matrix3DTransformOperation::create):
+        (WebCore::Matrix3DTransformOperation::isIdentity):
+        (WebCore::Matrix3DTransformOperation::isAffine):
+        (WebCore::Matrix3DTransformOperation::getOperationType):
+        (WebCore::Matrix3DTransformOperation::isSameType):
+        (WebCore::Matrix3DTransformOperation::operator==):
+        (WebCore::Matrix3DTransformOperation::apply):
+        (WebCore::Matrix3DTransformOperation::Matrix3DTransformOperation):
+        * platform/graphics/transforms/MatrixTransformOperation.h:
+        (WebCore::MatrixTransformOperation::isAffine):
+        (WebCore::MatrixTransformOperation::apply):
+        * platform/graphics/transforms/PerspectiveTransformOperation.cpp: Added.
+        (WebCore::PerspectiveTransformOperation::blend):
+        * platform/graphics/transforms/PerspectiveTransformOperation.h: Added.
+        (WebCore::PerspectiveTransformOperation::create):
+        (WebCore::PerspectiveTransformOperation::isIdentity):
+        (WebCore::PerspectiveTransformOperation::isAffine):
+        (WebCore::PerspectiveTransformOperation::getOperationType):
+        (WebCore::PerspectiveTransformOperation::isSameType):
+        (WebCore::PerspectiveTransformOperation::operator==):
+        (WebCore::PerspectiveTransformOperation::apply):
+        (WebCore::PerspectiveTransformOperation::PerspectiveTransformOperation):
+        * platform/graphics/transforms/RotateTransformOperation.cpp:
+        (WebCore::RotateTransformOperation::blend):
+        * platform/graphics/transforms/RotateTransformOperation.h:
+        (WebCore::RotateTransformOperation::create):
+        (WebCore::RotateTransformOperation::angle):
+        (WebCore::RotateTransformOperation::isAffine):
+        (WebCore::RotateTransformOperation::operator==):
+        (WebCore::RotateTransformOperation::apply):
+        (WebCore::RotateTransformOperation::RotateTransformOperation):
+        * platform/graphics/transforms/ScaleTransformOperation.cpp:
+        (WebCore::ScaleTransformOperation::blend):
+        * platform/graphics/transforms/ScaleTransformOperation.h:
+        (WebCore::ScaleTransformOperation::create):
+        (WebCore::ScaleTransformOperation::z):
+        (WebCore::ScaleTransformOperation::isIdentity):
+        (WebCore::ScaleTransformOperation::isAffine):
+        (WebCore::ScaleTransformOperation::operator==):
+        (WebCore::ScaleTransformOperation::apply):
+        (WebCore::ScaleTransformOperation::ScaleTransformOperation):
+        * platform/graphics/transforms/SkewTransformOperation.h:
+        (WebCore::SkewTransformOperation::isAffine):
+        * platform/graphics/transforms/TransformOperation.h:
+        (WebCore::TransformOperation::):
+        (WebCore::TransformOperation::is3DOperation):
+        * platform/graphics/transforms/TransformOperations.h:
+        (WebCore::TransformOperations::isAffine):
+        (WebCore::TransformOperations::has3DOperation):
+        * platform/graphics/transforms/TranslateTransformOperation.cpp:
+        (WebCore::TranslateTransformOperation::blend):
+        * platform/graphics/transforms/TranslateTransformOperation.h:
+        (WebCore::TranslateTransformOperation::create):
+        (WebCore::TranslateTransformOperation::z):
+        (WebCore::TranslateTransformOperation::isIdentity):
+        (WebCore::TranslateTransformOperation::isAffine):
+        (WebCore::TranslateTransformOperation::operator==):
+        (WebCore::TranslateTransformOperation::apply):
+        (WebCore::TranslateTransformOperation::TranslateTransformOperation):
+
 2009-02-11  David Hyatt  <hyatt@apple.com>
 
         Move createAnonymousBlock() to RenderBlock.  Since anonymous blocks are always parented to some other block,
index 5ab056c..54bd616 100644 (file)
                498391590F1E776900C23782 /* WebKitCSSMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = 498391560F1E776900C23782 /* WebKitCSSMatrix.h */; };
                498391630F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 498391610F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.cpp */; };
                498391640F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 498391620F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.h */; };
+               49D5DC2B0F423A73008F20FD /* Matrix3DTransformOperation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49D5DC270F423A73008F20FD /* Matrix3DTransformOperation.cpp */; };
+               49D5DC2C0F423A73008F20FD /* Matrix3DTransformOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 49D5DC280F423A73008F20FD /* Matrix3DTransformOperation.h */; };
+               49D5DC2D0F423A73008F20FD /* PerspectiveTransformOperation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49D5DC290F423A73008F20FD /* PerspectiveTransformOperation.cpp */; };
+               49D5DC2E0F423A73008F20FD /* PerspectiveTransformOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 49D5DC2A0F423A73008F20FD /* PerspectiveTransformOperation.h */; };
                49E911C30EF86D47009D0CAF /* TransformationMatrix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49E911B30EF86D47009D0CAF /* TransformationMatrix.cpp */; };
                49E911C40EF86D47009D0CAF /* TransformationMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = 49E911B40EF86D47009D0CAF /* TransformationMatrix.h */; settings = {ATTRIBUTES = (Private, ); }; };
                49E911C50EF86D47009D0CAF /* IdentityTransformOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 49E911B50EF86D47009D0CAF /* IdentityTransformOperation.h */; };
                498391570F1E776900C23782 /* WebKitCSSMatrix.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebKitCSSMatrix.idl; sourceTree = "<group>"; };
                498391610F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitCSSMatrixConstructor.cpp; sourceTree = "<group>"; };
                498391620F1E8EE100C23782 /* JSWebKitCSSMatrixConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitCSSMatrixConstructor.h; sourceTree = "<group>"; };
+               49D5DC270F423A73008F20FD /* Matrix3DTransformOperation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Matrix3DTransformOperation.cpp; path = transforms/Matrix3DTransformOperation.cpp; sourceTree = "<group>"; };
+               49D5DC280F423A73008F20FD /* Matrix3DTransformOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Matrix3DTransformOperation.h; path = transforms/Matrix3DTransformOperation.h; sourceTree = "<group>"; };
+               49D5DC290F423A73008F20FD /* PerspectiveTransformOperation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PerspectiveTransformOperation.cpp; path = transforms/PerspectiveTransformOperation.cpp; sourceTree = "<group>"; };
+               49D5DC2A0F423A73008F20FD /* PerspectiveTransformOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PerspectiveTransformOperation.h; path = transforms/PerspectiveTransformOperation.h; sourceTree = "<group>"; };
                49E911B30EF86D47009D0CAF /* TransformationMatrix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TransformationMatrix.cpp; path = transforms/TransformationMatrix.cpp; sourceTree = "<group>"; };
                49E911B40EF86D47009D0CAF /* TransformationMatrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TransformationMatrix.h; path = transforms/TransformationMatrix.h; sourceTree = "<group>"; };
                49E911B50EF86D47009D0CAF /* IdentityTransformOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IdentityTransformOperation.h; path = transforms/IdentityTransformOperation.h; sourceTree = "<group>"; };
                        isa = PBXGroup;
                        children = (
                                49E911B50EF86D47009D0CAF /* IdentityTransformOperation.h */,
+                               49D5DC270F423A73008F20FD /* Matrix3DTransformOperation.cpp */,
+                               49D5DC280F423A73008F20FD /* Matrix3DTransformOperation.h */,
                                49E911B60EF86D47009D0CAF /* MatrixTransformOperation.cpp */,
                                49E911B70EF86D47009D0CAF /* MatrixTransformOperation.h */,
+                               49D5DC290F423A73008F20FD /* PerspectiveTransformOperation.cpp */,
+                               49D5DC2A0F423A73008F20FD /* PerspectiveTransformOperation.h */,
                                49E911B80EF86D47009D0CAF /* RotateTransformOperation.cpp */,
                                49E911B90EF86D47009D0CAF /* RotateTransformOperation.h */,
                                49E911BA0EF86D47009D0CAF /* ScaleTransformOperation.cpp */,
                A83B790E0CCAFF97000B0825 /* CSS */ = {
                        isa = PBXGroup;
                        children = (
-                               BCC065830F3CE2A700CD2D87 /* JSClientRect.cpp */,
-                               BCC065840F3CE2A700CD2D87 /* JSClientRect.h */,
-                               BCC065850F3CE2A700CD2D87 /* JSClientRectList.cpp */,
-                               BCC065860F3CE2A700CD2D87 /* JSClientRectList.h */,
-                               930705D709E0C9B700B17FE4 /* JSCounter.cpp */,
-                               930705D909E0C9BF00B17FE4 /* JSCounter.h */,
                                BC46C1F00C0DDC8F0020CFC3 /* JSCSSCharsetRule.cpp */,
                                BC46C1F10C0DDC8F0020CFC3 /* JSCSSCharsetRule.h */,
                                BC46C1F20C0DDC8F0020CFC3 /* JSCSSFontFaceRule.cpp */,
                                BC686C790E0C330100DE8A08 /* JSCSSVariablesDeclaration.h */,
                                BC686C7A0E0C330100DE8A08 /* JSCSSVariablesRule.cpp */,
                                BC686C7B0E0C330100DE8A08 /* JSCSSVariablesRule.h */,
+                               BCC065830F3CE2A700CD2D87 /* JSClientRect.cpp */,
+                               BCC065840F3CE2A700CD2D87 /* JSClientRect.h */,
+                               BCC065850F3CE2A700CD2D87 /* JSClientRectList.cpp */,
+                               BCC065860F3CE2A700CD2D87 /* JSClientRectList.h */,
+                               930705D709E0C9B700B17FE4 /* JSCounter.cpp */,
+                               930705D909E0C9BF00B17FE4 /* JSCounter.h */,
                                BC3C39B40C0D3D8D005F4D7A /* JSMediaList.cpp */,
                                BC3C39B50C0D3D8D005F4D7A /* JSMediaList.h */,
+                               BC3452550D7E02850016574A /* JSRGBColor.lut.h */,
                                BCFE2F0F0C1B58370020235F /* JSRect.cpp */,
                                BCFE2F100C1B58370020235F /* JSRect.h */,
-                               BC3452550D7E02850016574A /* JSRGBColor.lut.h */,
                                BCE013980C0BEF180043860A /* JSStyleSheet.cpp */,
                                BCE013990C0BEF180043860A /* JSStyleSheet.h */,
                                A84EBD820CB8C97700079609 /* JSStyleSheetList.cpp */,
                                BC4BF9E30D11E133007D247F /* ClassNames.h */,
                                BC904B720D10998F00680D32 /* ClassNodeList.cpp */,
                                BC904B730D10998F00680D32 /* ClassNodeList.h */,
+                               BCC065770F3CE1B700CD2D87 /* ClientRect.cpp */,
+                               BCC065780F3CE1B700CD2D87 /* ClientRect.h */,
+                               BCC065790F3CE1B700CD2D87 /* ClientRect.idl */,
+                               BCC0657A0F3CE1B700CD2D87 /* ClientRectList.cpp */,
+                               BCC0657B0F3CE1B700CD2D87 /* ClientRectList.h */,
+                               BCC0657C0F3CE1B700CD2D87 /* ClientRectList.idl */,
                                A784941A0B5FE507001E237A /* Clipboard.cpp */,
                                85031B280A44EFC700F992E0 /* Clipboard.h */,
                                BCA83E360D7CDC4E003421A8 /* Clipboard.idl */,
                                F523D30902DE4476018635CA /* XMLTokenizer.cpp */,
                                F523D30A02DE4476018635CA /* XMLTokenizer.h */,
                                54C50F7A0E801DF3009832A0 /* XMLTokenizerLibxml2.cpp */,
-                               BCC065770F3CE1B700CD2D87 /* ClientRect.cpp */,
-                               BCC065780F3CE1B700CD2D87 /* ClientRect.h */,
-                               BCC065790F3CE1B700CD2D87 /* ClientRect.idl */,
-                               BCC0657A0F3CE1B700CD2D87 /* ClientRectList.cpp */,
-                               BCC0657B0F3CE1B700CD2D87 /* ClientRectList.h */,
-                               BCC0657C0F3CE1B700CD2D87 /* ClientRectList.idl */,
                        );
                        path = dom;
                        sourceTree = "<group>";
                                14D824080AF93AEB0004F057 /* ChromeClient.h in Headers */,
                                BC4BF9E50D11E133007D247F /* ClassNames.h in Headers */,
                                BC904B770D10998F00680D32 /* ClassNodeList.h in Headers */,
+                               BCC0657E0F3CE1B700CD2D87 /* ClientRect.h in Headers */,
+                               BCC065810F3CE1B700CD2D87 /* ClientRectList.h in Headers */,
                                85031B3E0A44EFC700F992E0 /* Clipboard.h in Headers */,
                                4B8AF4AA0B1CE02B00687690 /* ClipboardAccessPolicy.h in Headers */,
                                85031B400A44EFC700F992E0 /* ClipboardEvent.h in Headers */,
                                65DF323C09D1DE65000BE325 /* JSCanvasPattern.h in Headers */,
                                65DF323E09D1DE65000BE325 /* JSCanvasRenderingContext2D.h in Headers */,
                                65DF31F409D1CC60000BE325 /* JSCharacterData.h in Headers */,
+                               BCC065880F3CE2A700CD2D87 /* JSClientRect.h in Headers */,
+                               BCC0658A0F3CE2A700CD2D87 /* JSClientRectList.h in Headers */,
                                BCA83E500D7CE1E9003421A8 /* JSClipboard.h in Headers */,
                                93F9B6E10BA0FB7200854064 /* JSComment.h in Headers */,
                                BC98543E0CD3D98C00069BC1 /* JSConsole.h in Headers */,
                                1A8F6BC60DB55CDC001DB794 /* ManifestParser.h in Headers */,
                                A8C4A80509D563270003AC8D /* MappedAttribute.h in Headers */,
                                A8C4A84C09D5649D0003AC8D /* MappedAttributeEntry.h in Headers */,
+                               49D5DC2C0F423A73008F20FD /* Matrix3DTransformOperation.h in Headers */,
                                49E911C70EF86D47009D0CAF /* MatrixTransformOperation.h in Headers */,
                                ABFE7E130D32FAF60066F4D2 /* MediaControlElements.h in Headers */,
                                AB40484E0E083FA8007D6920 /* MediaDocument.h in Headers */,
                                A8FA6E5D0E4CFDED00D5CF49 /* Pattern.h in Headers */,
                                B22279710D00BF220071B782 /* PatternAttributes.h in Headers */,
                                B27535820B053814002CE64F /* Pen.h in Headers */,
+                               49D5DC2E0F423A73008F20FD /* PerspectiveTransformOperation.h in Headers */,
                                935C476809AC4D4300A6AAB4 /* PlatformKeyboardEvent.h in Headers */,
                                932871C00B20DEB70049035A /* PlatformMenuDescription.h in Headers */,
                                935C476909AC4D4300A6AAB4 /* PlatformMouseEvent.h in Headers */,
                                BCEA4864097D93020094C9E4 /* RenderBR.h in Headers */,
                                BCEA4860097D93020094C9E4 /* RenderBlock.h in Headers */,
                                BCEA4862097D93020094C9E4 /* RenderBox.h in Headers */,
+                               BC96DB430F3A880E00573CB3 /* RenderBoxModelObject.h in Headers */,
                                BCEA4866097D93020094C9E4 /* RenderButton.h in Headers */,
                                9392F1420AD185F400691BD4 /* RenderCounter.h in Headers */,
                                A8EA73C40A1900E300A8EF5F /* RenderFieldset.h in Headers */,
                                656581B209D14EE6000E61D7 /* UserAgentStyleSheets.h in Headers */,
                                7284ADDE0E6FEB31002EEFBD /* UserStyleSheetLoader.h in Headers */,
                                93309E20099E64920056E581 /* VisiblePosition.h in Headers */,
+                               A883DF280F3D045D00F19BF6 /* VisibleSelection.h in Headers */,
                                E44613B60CD6344E00FADA75 /* VoidCallback.h in Headers */,
                                B25599490D00D8BA00BB825C /* WKArithmeticFilter.h in Headers */,
                                B255994C0D00D8BA00BB825C /* WKComponentMergeFilter.h in Headers */,
                                BC8243E90D0CFD7500460C8F /* WindowFeatures.h in Headers */,
                                E1CA5CA00E8CD73B00E8EF90 /* Worker.h in Headers */,
                                E1C2C43E0EAD0133007E61FB /* WorkerContext.h in Headers */,
+                               2E3AC84E0F3D06D100633F04 /* WorkerContextProxy.h in Headers */,
                                E1C363010EAF2CC6007410BC /* WorkerLocation.h in Headers */,
                                E14799A70ECDE3A400292BF3 /* WorkerMessagingProxy.h in Headers */,
                                E1271A0B0EEEC77A00F61213 /* WorkerNavigator.h in Headers */,
+                               2E3AC8500F3D06F700633F04 /* WorkerObjectProxy.h in Headers */,
                                18A0537D0F26859C00A51705 /* WorkerRunLoop.h in Headers */,
                                E1A643F20EC0972500779668 /* WorkerScriptController.h in Headers */,
                                E1C2C4240EACE0BC007E61FB /* WorkerThread.h in Headers */,
                                1A569D230D7E2B82007C3983 /* runtime_object.h in Headers */,
                                1A569D250D7E2B82007C3983 /* runtime_root.h in Headers */,
                                93309E1E099E64920056E581 /* visible_units.h in Headers */,
-                               BC96DB430F3A880E00573CB3 /* RenderBoxModelObject.h in Headers */,
-                               BCC0657E0F3CE1B700CD2D87 /* ClientRect.h in Headers */,
-                               BCC065810F3CE1B700CD2D87 /* ClientRectList.h in Headers */,
-                               BCC065880F3CE2A700CD2D87 /* JSClientRect.h in Headers */,
-                               BCC0658A0F3CE2A700CD2D87 /* JSClientRectList.h in Headers */,
-                               2E3AC84E0F3D06D100633F04 /* WorkerContextProxy.h in Headers */,
-                               2E3AC8500F3D06F700633F04 /* WorkerObjectProxy.h in Headers */,
-                               A883DF280F3D045D00F19BF6 /* VisibleSelection.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        buildActionMask = 2147483647;
                        files = (
                                A7094AFC0F27AEE300596CEC /* CanvasPixelArray.idl in Resources */,
+                               BCC0657F0F3CE1B700CD2D87 /* ClientRect.idl in Resources */,
+                               BCC065820F3CE1B700CD2D87 /* ClientRectList.idl in Resources */,
                                B25599480D00D8BA00BB825C /* WKArithmeticFilter.cikernel in Resources */,
                                B255994B0D00D8BA00BB825C /* WKComponentMergeFilter.cikernel in Resources */,
                                B255994E0D00D8BA00BB825C /* WKDiffuseLightingFilter.cikernel in Resources */,
                                85136CA80AED665900F90A3D /* westResizeCursor.png in Resources */,
                                1AB1AE7A0C051FDE00139F4F /* zoomInCursor.png in Resources */,
                                1AB1AE7B0C051FDE00139F4F /* zoomOutCursor.png in Resources */,
-                               BCC0657F0F3CE1B700CD2D87 /* ClientRect.idl in Resources */,
-                               BCC065820F3CE1B700CD2D87 /* ClientRectList.idl in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                ABAF22080C03B1C700B0BCF0 /* ChromeMac.mm in Sources */,
                                BC4BF9E40D11E133007D247F /* ClassNames.cpp in Sources */,
                                BC904B760D10998F00680D32 /* ClassNodeList.cpp in Sources */,
+                               BCC0657D0F3CE1B700CD2D87 /* ClientRect.cpp in Sources */,
+                               BCC065800F3CE1B700CD2D87 /* ClientRectList.cpp in Sources */,
                                A784941B0B5FE507001E237A /* Clipboard.cpp in Sources */,
                                85031B3F0A44EFC700F992E0 /* ClipboardEvent.cpp in Sources */,
                                93F19AFF08245E59001E9ABC /* ClipboardMac.mm in Sources */,
                                65DF323D09D1DE65000BE325 /* JSCanvasRenderingContext2D.cpp in Sources */,
                                1A9EF4570A1B957D00332B63 /* JSCanvasRenderingContext2DCustom.cpp in Sources */,
                                65DF31F309D1CC60000BE325 /* JSCharacterData.cpp in Sources */,
+                               BCC065870F3CE2A700CD2D87 /* JSClientRect.cpp in Sources */,
+                               BCC065890F3CE2A700CD2D87 /* JSClientRectList.cpp in Sources */,
                                BCA83E4F0D7CE1E9003421A8 /* JSClipboard.cpp in Sources */,
                                BCA83E520D7CE205003421A8 /* JSClipboardCustom.cpp in Sources */,
                                93F9B6E00BA0FB7200854064 /* JSComment.cpp in Sources */,
                                93E227E10AF589AD00D48324 /* MainResourceLoader.cpp in Sources */,
                                1A8F6BC50DB55CDC001DB794 /* ManifestParser.cpp in Sources */,
                                A8C4A80609D563270003AC8D /* MappedAttribute.cpp in Sources */,
+                               49D5DC2B0F423A73008F20FD /* Matrix3DTransformOperation.cpp in Sources */,
                                49E911C60EF86D47009D0CAF /* MatrixTransformOperation.cpp in Sources */,
                                ABFE7E120D32FAF60066F4D2 /* MediaControlElements.cpp in Sources */,
                                AB40484D0E083FA8007D6920 /* MediaDocument.cpp in Sources */,
                                A8FA6E5E0E4CFDED00D5CF49 /* Pattern.cpp in Sources */,
                                A80A38FE0E50CC8200A25EBC /* PatternCG.cpp in Sources */,
                                B27535810B053814002CE64F /* Pen.cpp in Sources */,
+                               49D5DC2D0F423A73008F20FD /* PerspectiveTransformOperation.cpp in Sources */,
                                935C477109AC4D7300A6AAB4 /* PlatformMouseEventMac.mm in Sources */,
                                BC94D1080C274F88006BC617 /* PlatformScreenMac.mm in Sources */,
                                A9C6E4EB0D745E2B006442E9 /* Plugin.cpp in Sources */,
                                BCEA4863097D93020094C9E4 /* RenderBR.cpp in Sources */,
                                BCEA485F097D93020094C9E4 /* RenderBlock.cpp in Sources */,
                                BCEA4861097D93020094C9E4 /* RenderBox.cpp in Sources */,
+                               BC96DB460F3A882200573CB3 /* RenderBoxModelObject.cpp in Sources */,
                                BCEA4865097D93020094C9E4 /* RenderButton.cpp in Sources */,
                                9392F1440AD185FE00691BD4 /* RenderCounter.cpp in Sources */,
                                A8EA73C30A1900E300A8EF5F /* RenderFieldset.cpp in Sources */,
                                65DF326109D1E199000BE325 /* UserAgentStyleSheetsData.cpp in Sources */,
                                7284ADDD0E6FEB31002EEFBD /* UserStyleSheetLoader.cpp in Sources */,
                                93309E1F099E64920056E581 /* VisiblePosition.cpp in Sources */,
+                               A883DF270F3D045D00F19BF6 /* VisibleSelection.cpp in Sources */,
                                B255994A0D00D8BA00BB825C /* WKArithmeticFilter.m in Sources */,
                                B255994D0D00D8BA00BB825C /* WKComponentMergeFilter.m in Sources */,
                                B25599500D00D8BA00BB825C /* WKDiffuseLightingFilter.m in Sources */,
                                1A569D220D7E2B82007C3983 /* runtime_object.cpp in Sources */,
                                1A569D240D7E2B82007C3983 /* runtime_root.cpp in Sources */,
                                93309E1D099E64920056E581 /* visible_units.cpp in Sources */,
-                               BC96DB460F3A882200573CB3 /* RenderBoxModelObject.cpp in Sources */,
-                               BCC0657D0F3CE1B700CD2D87 /* ClientRect.cpp in Sources */,
-                               BCC065800F3CE1B700CD2D87 /* ClientRectList.cpp in Sources */,
-                               BCC065870F3CE2A700CD2D87 /* JSClientRect.cpp in Sources */,
-                               BCC065890F3CE2A700CD2D87 /* JSClientRectList.cpp in Sources */,
-                               A883DF270F3D045D00F19BF6 /* VisibleSelection.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
diff --git a/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.cpp b/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.cpp
new file mode 100644 (file)
index 0000000..101bed8
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "Matrix3DTransformOperation.h"
+
+#if ENABLE(3D_TRANSFORMS)
+
+#include <algorithm>
+
+using namespace std;
+
+namespace WebCore {
+
+PassRefPtr<TransformOperation> Matrix3DTransformOperation::blend(const TransformOperation* from, double progress, bool blendToIdentity)
+{
+    if (from && !from->isSameType(*this))
+        return this;
+
+    // Convert the TransformOperations into matrices
+    IntSize size;
+    TransformationMatrix fromT;
+    TransformationMatrix toT;
+    if (from)
+        from->apply(fromT, size);
+
+    apply(toT, size);
+
+    if (blendToIdentity)
+        swap(fromT, toT);
+
+    toT.blend(fromT, progress);
+    return Matrix3DTransformOperation::create(toT);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(3D_TRANSFORMS)
diff --git a/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.h b/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.h
new file mode 100644 (file)
index 0000000..484a6c9
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef Matrix3DTransformOperation_h
+#define Matrix3DTransformOperation_h
+
+#include "TransformOperation.h"
+
+#if ENABLE(3D_TRANSFORMS)
+
+namespace WebCore {
+
+class Matrix3DTransformOperation : public TransformOperation {
+public:
+    static PassRefPtr<Matrix3DTransformOperation> create(const TransformationMatrix& matrix)
+    {
+        return adoptRef(new Matrix3DTransformOperation(matrix));
+    }
+
+private:    
+    virtual bool isIdentity() const { return m_matrix.isIdentity(); }
+
+    virtual OperationType getOperationType() const { return MATRIX_3D; }
+    virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == MATRIX_3D; }
+
+    virtual bool operator==(const TransformOperation& o) const
+    {
+        if (!isSameType(o))
+            return false;
+        const Matrix3DTransformOperation* m = static_cast<const Matrix3DTransformOperation*>(&o);
+        return m_matrix == m->m_matrix;
+    }
+
+    virtual bool apply(TransformationMatrix& transform, const IntSize&) const
+    {
+        transform.multLeft(TransformationMatrix(m_matrix));
+        return false;
+    }
+
+    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
+    
+    Matrix3DTransformOperation(const TransformationMatrix& mat)
+    {
+        m_matrix = mat;
+    }
+
+    TransformationMatrix m_matrix;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(3D_TRANSFORMS)
+
+#endif // Matrix3DTransformOperation_h
index 153d96d..4934fa6 100644 (file)
@@ -24,6 +24,8 @@
 
 #include <algorithm>
 
+using namespace std;
+
 namespace WebCore {
 
 PassRefPtr<TransformOperation> MatrixTransformOperation::blend(const TransformOperation* from, double progress, bool blendToIdentity)
@@ -41,7 +43,7 @@ PassRefPtr<TransformOperation> MatrixTransformOperation::blend(const TransformOp
     }
     
     if (blendToIdentity)
-        std::swap(fromT, toT);
+        swap(fromT, toT);
 
     toT.blend(fromT, progress);
     return MatrixTransformOperation::create(toT.a(), toT.b(), toT.c(), toT.d(), toT.e(), toT.f());
index b2e5d88..ee47a11 100644 (file)
@@ -44,6 +44,7 @@ public:
 
 private:
     virtual bool isIdentity() const { return m_a == 1 && m_b == 0 && m_c == 0 && m_d == 1 && m_e == 0 && m_f == 0; }
+
     virtual OperationType getOperationType() const { return MATRIX; }
     virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == MATRIX; }
 
@@ -59,7 +60,7 @@ private:
     virtual bool apply(TransformationMatrix& transform, const IntSize&) const
     {
         TransformationMatrix matrix(m_a, m_b, m_c, m_d, m_e, m_f);
-        transform = matrix * transform;
+        transform.multLeft(TransformationMatrix(matrix));
         return false;
     }
 
diff --git a/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.cpp b/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.cpp
new file mode 100644 (file)
index 0000000..6a2ec37
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "PerspectiveTransformOperation.h"
+
+#if ENABLE(3D_TRANSFORMS)
+
+#include <algorithm>
+
+using namespace std;
+
+namespace WebCore {
+
+PassRefPtr<TransformOperation> PerspectiveTransformOperation::blend(const TransformOperation* from, double progress, bool blendToIdentity)
+{
+    if (from && !from->isSameType(*this))
+        return this;
+    
+    if (blendToIdentity)
+        return PerspectiveTransformOperation::create(m_p + (1. - m_p) * progress);
+    
+    const PerspectiveTransformOperation* fromOp = static_cast<const PerspectiveTransformOperation*>(from);
+    double fromP = fromOp ? fromOp->m_p : 0;
+    double toP = m_p;
+    
+    if (blendToIdentity)
+        swap(fromP, toP);
+    
+    TransformationMatrix fromT;
+    TransformationMatrix toT;
+    fromT.applyPerspective(fromP);
+    toT.applyPerspective(toP);
+    toT.blend(fromT, progress);
+    TransformationMatrix::DecomposedType decomp;
+    toT.decompose(decomp);
+    
+    return PerspectiveTransformOperation::create(decomp.perspectiveZ ? -1.0 / decomp.perspectiveZ : 0.0);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(3D_TRANSFORMS)
diff --git a/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h b/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h
new file mode 100644 (file)
index 0000000..ee1cb42
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef PerspectiveTransformOperation_h
+#define PerspectiveTransformOperation_h
+
+#include "TransformOperation.h"
+
+#if ENABLE(3D_TRANSFORMS)
+
+namespace WebCore {
+
+class PerspectiveTransformOperation : public TransformOperation {
+public:
+    static PassRefPtr<PerspectiveTransformOperation> create(double p)
+    {
+        return adoptRef(new PerspectiveTransformOperation(p));
+    }
+    
+private:
+    virtual bool isIdentity() const { return m_p == 0; }
+    virtual OperationType getOperationType() const { return PERSPECTIVE; }
+    virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == PERSPECTIVE; }
+
+    virtual bool operator==(const TransformOperation& o) const
+    {
+        if (!isSameType(o))
+            return false;
+        const PerspectiveTransformOperation* p = static_cast<const PerspectiveTransformOperation*>(&o);
+        return m_p == p->m_p;
+    }
+
+    virtual bool apply(TransformationMatrix& transform, const IntSize&) const
+    {
+        transform.applyPerspective(m_p);
+        return false;
+    }
+
+    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
+
+    PerspectiveTransformOperation(double p)
+        : m_p(p)
+    {
+    }
+
+    double m_p;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(3D_TRANSFORMS)
+
+#endif // PerspectiveTransformOperation_h
index 4887cee..18d79ae 100644 (file)
 #include "config.h"
 #include "RotateTransformOperation.h"
 
+#include <wtf/MathExtras.h>
+
+using namespace std;
+
 namespace WebCore {
 
 PassRefPtr<TransformOperation> RotateTransformOperation::blend(const TransformOperation* from, double progress, bool blendToIdentity)
@@ -30,11 +34,69 @@ PassRefPtr<TransformOperation> RotateTransformOperation::blend(const TransformOp
         return this;
     
     if (blendToIdentity)
-        return RotateTransformOperation::create(m_angle - m_angle * progress, m_type);
+        return RotateTransformOperation::create(m_x, m_y, m_z, m_angle - m_angle * progress, m_type);
     
     const RotateTransformOperation* fromOp = static_cast<const RotateTransformOperation*>(from);
-    double fromAngle = fromOp ? fromOp->m_angle : 0;
-    return RotateTransformOperation::create(fromAngle + (m_angle - fromAngle) * progress, m_type);
+    
+    // Optimize for single axis rotation
+    if (!fromOp || (fromOp->m_x == 0 && fromOp->m_y == 0 && fromOp->m_z == 1) || 
+                   (fromOp->m_x == 0 && fromOp->m_y == 1 && fromOp->m_z == 0) || 
+                   (fromOp->m_x == 1 && fromOp->m_y == 0 && fromOp->m_z == 0)) {
+        double fromAngle = fromOp ? fromOp->m_angle : 0;
+        return RotateTransformOperation::create(fromOp ? fromOp->m_x : m_x, 
+                                                fromOp ? fromOp->m_y : m_y, 
+                                                fromOp ? fromOp->m_z : m_z, 
+                                                fromAngle + (m_angle - fromAngle) * progress, m_type);
+    }
+
+    const RotateTransformOperation* toOp = this;
+    
+    if (blendToIdentity)
+        swap(fromOp, toOp);
+    
+    // Create the 2 rotation matrices
+    TransformationMatrix fromT;
+    TransformationMatrix toT;
+    fromT.rotate3d((float)(fromOp ? fromOp->m_x : 0),
+                   (float)(fromOp ? fromOp->m_y : 0),
+                   (float)(fromOp ? fromOp->m_z : 1),
+                   (float)(fromOp ? fromOp->m_angle : 0));
+
+    toT.rotate3d((float)(toOp ? toOp->m_x : 0),
+                 (float)(toOp ? toOp->m_y : 0),
+                 (float)(toOp ? toOp->m_z : 1),
+                 (float)(toOp ? toOp->m_angle : 0));
+    
+    // Blend them
+    toT.blend(fromT, progress);
+    
+    // Extract the result as a quaternion
+    TransformationMatrix::DecomposedType decomp;
+    toT.decompose(decomp);
+    
+    // Convert that to Axis/Angle form
+    double x = -decomp.quaternionX;
+    double y = -decomp.quaternionY;
+    double z = -decomp.quaternionZ;
+    double length = sqrt(x * x + y * y + z * z);
+    double angle = 0;
+    
+    if (length > 0.00001f) {
+        x /= length;
+        y /= length;
+        z /= length;
+        angle = rad2deg(acos(decomp.quaternionW) * 2.0);
+    }
+    else {
+        x = 0.0f;
+        y = 0.0f;
+        z = 1.0f;
+    }
+#if ENABLE(3D_TRANSFORMS)
+    return RotateTransformOperation::create(x, y, z, angle, ROTATE_3D);
+#else
+    return RotateTransformOperation::create(0, 0, z, angle, ROTATE_Z);
+#endif
 }
 
 } // namespace WebCore
index adc6c4c..596d646 100644 (file)
@@ -33,10 +33,19 @@ class RotateTransformOperation : public TransformOperation {
 public:
     static PassRefPtr<RotateTransformOperation> create(double angle, OperationType type)
     {
-        return adoptRef(new RotateTransformOperation(angle, type));
+        return adoptRef(new RotateTransformOperation(0, 0, 1, angle, type));
     }
 
+    static PassRefPtr<RotateTransformOperation> create(double x, double y, double z, double angle, OperationType type)
+    {
+        return adoptRef(new RotateTransformOperation(x, y, z, angle, type));
+    }
+
+    double angle() const { return m_angle; }
+
+private:
     virtual bool isIdentity() const { return m_angle == 0; }
+
     virtual OperationType getOperationType() const { return m_type; }
     virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == m_type; }
 
@@ -45,26 +54,35 @@ public:
         if (!isSameType(o))
             return false;
         const RotateTransformOperation* r = static_cast<const RotateTransformOperation*>(&o);
-        return m_angle == r->m_angle;
+        return m_x == r->m_x && m_y == r->m_y && m_z == r->m_z && m_angle == r->m_angle;
     }
 
     virtual bool apply(TransformationMatrix& transform, const IntSize& /*borderBoxSize*/) const
     {
-        transform.rotate(m_angle);
+        transform.rotate3d(m_x, m_y, m_z, m_angle);
         return false;
     }
 
     virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
 
-    double angle() const { return m_angle; }
-
-private:
-    RotateTransformOperation(double angle, OperationType type)
-        : m_angle(angle)
+    RotateTransformOperation(double x, double y, double z, double angle, OperationType type)
+        : m_x(x)
+        , m_y(y)
+        , m_z(z)
+        , m_angle(angle)
         , m_type(type)
     {
+#if ENABLE(3D_TRANSFORMS)
+        ASSERT(type == ROTATE_X || type == ROTATE_Y || type == ROTATE_Z || type == ROTATE_3D);
+#else
+        ASSERT(type == ROTATE_Z);
+        ASSERT(x == 0 && y == 0);
+#endif
     }
 
+    double m_x;
+    double m_y;
+    double m_z;
     double m_angle;
     OperationType m_type;
 };
index 49a8fd8..45d119c 100644 (file)
@@ -30,12 +30,17 @@ PassRefPtr<TransformOperation> ScaleTransformOperation::blend(const TransformOpe
         return this;
     
     if (blendToIdentity)
-        return ScaleTransformOperation::create(m_x + (1. - m_x) * progress, m_y + (1. - m_y) * progress, m_type);
+        return ScaleTransformOperation::create(m_x + (1. - m_x) * progress,
+                                               m_y + (1. - m_y) * progress,
+                                               m_z + (1. - m_z) * progress, m_type);
     
     const ScaleTransformOperation* fromOp = static_cast<const ScaleTransformOperation*>(from);
     double fromX = fromOp ? fromOp->m_x : 1.;
     double fromY = fromOp ? fromOp->m_y : 1.;
-    return ScaleTransformOperation::create(fromX + (m_x - fromX) * progress, fromY + (m_y - fromY) * progress, m_type);
+    double fromZ = fromOp ? fromOp->m_z : 1.;
+    return ScaleTransformOperation::create(fromX + (m_x - fromX) * progress,
+                                           fromY + (m_y - fromY) * progress,
+                                           fromZ + (m_z - fromZ) * progress, m_type);
 }
 
 } // namespace WebCore
index 19ef040..c8d29e7 100644 (file)
@@ -33,14 +33,21 @@ class ScaleTransformOperation : public TransformOperation {
 public:
     static PassRefPtr<ScaleTransformOperation> create(double sx, double sy, OperationType type)
     {
-        return adoptRef(new ScaleTransformOperation(sx, sy, type));
+        return adoptRef(new ScaleTransformOperation(sx, sy, 1, type));
+    }
+
+    static PassRefPtr<ScaleTransformOperation> create(double sx, double sy, double sz, OperationType type)
+    {
+        return adoptRef(new ScaleTransformOperation(sx, sy, sz, type));
     }
 
     double x() const { return m_x; }
     double y() const { return m_y; }
+    double z() const { return m_z; }
 
 private:
-    virtual bool isIdentity() const { return m_x == 1 &&  m_y == 1; }
+    virtual bool isIdentity() const { return m_x == 1 &&  m_y == 1 &&  m_z == 1; }
+
     virtual OperationType getOperationType() const { return m_type; }
     virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == m_type; }
 
@@ -49,26 +56,34 @@ private:
         if (!isSameType(o))
             return false;
         const ScaleTransformOperation* s = static_cast<const ScaleTransformOperation*>(&o);
-        return m_x == s->m_x && m_y == s->m_y;
+        return m_x == s->m_x && m_y == s->m_y && m_z == s->m_z;
     }
 
     virtual bool apply(TransformationMatrix& transform, const IntSize&) const
     {
-        transform.scaleNonUniform(m_x, m_y);
+        transform.scale3d(m_x, m_y, m_z);
         return false;
     }
 
     virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
 
-    ScaleTransformOperation(double sx, double sy, OperationType type)
+    ScaleTransformOperation(double sx, double sy, double sz, OperationType type)
         : m_x(sx)
         , m_y(sy)
+        , m_z(sz)
         , m_type(type)
     {
+#if ENABLE(3D_TRANSFORMS)
+        ASSERT(type == SCALE_X || type == SCALE_Y || type == SCALE_Z || type == SCALE || type == SCALE_3D);
+#else
+        ASSERT(type == SCALE_X || type == SCALE_Y || type == SCALE);
+        ASSERT(sz == 1);
+#endif
     }
         
     double m_x;
     double m_y;
+    double m_z;
     OperationType m_type;
 };
 
index 65a0def..ea4a4f3 100644 (file)
@@ -39,9 +39,18 @@ public:
     enum OperationType {
         SCALE_X, SCALE_Y, SCALE, 
         TRANSLATE_X, TRANSLATE_Y, TRANSLATE, 
-        ROTATE, 
+        ROTATE,
+        ROTATE_Z = ROTATE,
         SKEW_X, SKEW_Y, SKEW, 
-        MATRIX, IDENTITY, NONE
+        MATRIX,
+#if ENABLE(3D_TRANSFORMS)
+        SCALE_Z, SCALE_3D,
+        TRANSLATE_Z, TRANSLATE_3D,
+        ROTATE_X, ROTATE_Y, ROTATE_3D,
+        MATRIX_3D,
+        PERSPECTIVE,
+#endif
+        IDENTITY, NONE
     };
 
     virtual ~TransformOperation() { }
@@ -51,12 +60,29 @@ public:
 
     virtual bool isIdentity() const = 0;
 
+    // Return true if the borderBoxSize was used in the computation, false otherwise.
     virtual bool apply(TransformationMatrix&, const IntSize& borderBoxSize) const = 0;
 
     virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false) = 0;
 
     virtual OperationType getOperationType() const = 0;
     virtual bool isSameType(const TransformOperation&) const { return false; }
+    
+#if ENABLE(3D_TRANSFORMS)
+    bool is3DOperation() const
+    {
+        OperationType opType = getOperationType();
+        return opType == SCALE_Z ||
+               opType == SCALE_3D ||
+               opType == TRANSLATE_Z ||
+               opType == TRANSLATE_3D ||
+               opType == ROTATE_X ||
+               opType == ROTATE_Y ||
+               opType == ROTATE_3D ||
+               opType == MATRIX_3D ||
+               opType == PERSPECTIVE;
+    }
+#endif
 };
 
 } // namespace WebCore
index f929417..a8c4270 100644 (file)
@@ -47,6 +47,18 @@ public:
             m_operations[i]->apply(t, sz);
     }
     
+#if ENABLE(3D_TRANSFORMS)
+    // Return true if any of the operation types are 3D operation types (even if the
+    // values describe affine transforms)
+    bool has3DOperation() const
+    {
+        for (unsigned i = 0; i < m_operations.size(); ++i)
+            if (m_operations[i]->is3DOperation())
+                return true;
+        return false;
+    }
+#endif
+    
     Vector<RefPtr<TransformOperation> >& operations() { return m_operations; }
     const Vector<RefPtr<TransformOperation> >& operations() const { return m_operations; }
 
index 47471c4..a8ad131 100644 (file)
@@ -30,12 +30,15 @@ PassRefPtr<TransformOperation> TranslateTransformOperation::blend(const Transfor
         return this;
     
     if (blendToIdentity)
-        return TranslateTransformOperation::create(Length(m_x.type()).blend(m_x, progress), Length(m_y.type()).blend(m_y, progress), m_type);
+        return TranslateTransformOperation::create(Length(m_x.type()).blend(m_x, progress), 
+                                                   Length(m_y.type()).blend(m_y, progress), 
+                                                   Length(m_z.type()).blend(m_z, progress), m_type);
 
     const TranslateTransformOperation* fromOp = static_cast<const TranslateTransformOperation*>(from);
     Length fromX = fromOp ? fromOp->m_x : Length(m_x.type());
     Length fromY = fromOp ? fromOp->m_y : Length(m_y.type());
-    return TranslateTransformOperation::create(m_x.blend(fromX, progress), m_y.blend(fromY, progress), m_type);
+    Length fromZ = fromOp ? fromOp->m_z : Length(m_z.type());
+    return TranslateTransformOperation::create(m_x.blend(fromX, progress), m_y.blend(fromY, progress), m_z.blend(fromZ, progress), m_type);
 }
 
 } // namespace WebCore
index 470c638..243b4a3 100644 (file)
@@ -34,14 +34,21 @@ class TranslateTransformOperation : public TransformOperation {
 public:
     static PassRefPtr<TranslateTransformOperation> create(const Length& tx, const Length& ty, OperationType type)
     {
-        return adoptRef(new TranslateTransformOperation(tx, ty, type));
+        return adoptRef(new TranslateTransformOperation(tx, ty, Length(0, Fixed), type));
+    }
+
+    static PassRefPtr<TranslateTransformOperation> create(const Length& tx, const Length& ty, const Length& tz, OperationType type)
+    {
+        return adoptRef(new TranslateTransformOperation(tx, ty, tz, type));
     }
 
     double x(const IntSize& borderBoxSize) const { return m_x.calcFloatValue(borderBoxSize.width()); }
     double y(const IntSize& borderBoxSize) const { return m_y.calcFloatValue(borderBoxSize.height()); }
+    double z(const IntSize&) const { return m_z.calcFloatValue(1); }
 
 private:
-    virtual bool isIdentity() const { return m_x.calcFloatValue(1) == 0 && m_y.calcFloatValue(1) == 0; }
+    virtual bool isIdentity() const { return m_x.calcFloatValue(1) == 0 && m_y.calcFloatValue(1) == 0 && m_z.calcFloatValue(1) == 0; }
+
     virtual OperationType getOperationType() const { return m_type; }
     virtual bool isSameType(const TransformOperation& o) const { return o.getOperationType() == m_type; }
 
@@ -50,26 +57,33 @@ private:
         if (!isSameType(o))
             return false;
         const TranslateTransformOperation* t = static_cast<const TranslateTransformOperation*>(&o);
-        return m_x == t->m_x && m_y == t->m_y;
+        return m_x == t->m_x && m_y == t->m_y && m_z == t->m_z;
     }
 
     virtual bool apply(TransformationMatrix& transform, const IntSize& borderBoxSize) const
     {
-        transform.translate(m_x.calcFloatValue(borderBoxSize.width()), m_y.calcFloatValue(borderBoxSize.height()));
+        transform.translate3d(x(borderBoxSize), y(borderBoxSize), z(borderBoxSize));
         return m_x.type() == Percent || m_y.type() == Percent;
     }
 
     virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false);
 
-    TranslateTransformOperation(const Length& tx, const Length& ty, OperationType type)
+    TranslateTransformOperation(const Length& tx, const Length& ty, const Length& tz, OperationType type)
         : m_x(tx)
         , m_y(ty)
+        , m_z(tz)
         , m_type(type)
     {
+#if ENABLE(3D_TRANSFORMS)
+        ASSERT(type == TRANSLATE_X || type == TRANSLATE_Y || type == TRANSLATE_Z || type == TRANSLATE || type == TRANSLATE_3D);
+#else
+        ASSERT(type == TRANSLATE_X || type == TRANSLATE_Y || type == TRANSLATE);
+#endif
     }
 
     Length m_x;
     Length m_y;
+    Length m_z;
     OperationType m_type;
 };
 
index d19eabd..e065447 100644 (file)
@@ -1,3 +1,13 @@
+2009-02-10  Chris Marrin  <cmarrin@apple.com>
+
+        Reviewed by Simon Fraser.
+
+        * Scripts/build-webkit:
+
+        https://bugs.webkit.org/show_bug.cgi?id=23883
+
+        Added support --3d-transforms. Defaults to off
+
 2009-02-11  Adam Roben  <aroben@apple.com>
 
         Fix crashes in http/tests/history/redirect-301.pl and friends on
index dfacb71..37ada10 100755 (executable)
@@ -61,6 +61,7 @@ my $showHelp = 0;
 my $clean = 0;
 my $buildUniversal = 0;
 my $buildSixtyFourBit = 0;
+my $threeDTransformsSupport = 0;
 
 my $programName = basename($0);
 my $usage = <<EOF;
@@ -71,6 +72,7 @@ Usage: $programName [options] [options to pass to build system]
   --clean                       Cleanup the build directory
   --universal                   Build 2-way universal (PPC and Intel 32-bit)
   --64-bit                      Build 64-bit, combine with --universal to build 4-way universal
+  --[no-]3d-transforms          Toggle 3D Transforms support (default: $threeDTransformsSupport)
   --[no-]channel-messaging          Toggle MessageChannel and MessagePort support (default: $channelMessagingSupport)
   --[no-]offline-web-applications   Toggle Offline Web Application Support (default : $offlineWebApplicationSupport)
   --[no-]database               Toggle Database Support (default: $databaseSupport)
@@ -91,7 +93,9 @@ Usage: $programName [options] [options to pass to build system]
   --[no-]coverage               Toggle code coverage support (default: $coverageSupport)
 EOF
 
-GetOptions('channel-messaging!' => \$channelMessagingSupport,
+GetOptions(
+           '3d-transforms!' => \$threeDTransformsSupport,
+           'channel-messaging!' => \$channelMessagingSupport,
            'database!' => \$databaseSupport,
            'dom-storage!' => \$domStorageSupport,
            'icon-database!' => \$iconDatabaseSupport,
@@ -139,6 +143,7 @@ if (isWx()) {
 my $productDir = productDir();
 my @overrideFeatureDefinesOption = ();
 
+push @overrideFeatureDefinesOption, "ENABLE_3D_TRANSFORMS" if $threeDTransformsSupport;
 push @overrideFeatureDefinesOption, "ENABLE_CHANNEL_MESSAGING" if $channelMessagingSupport;
 push @overrideFeatureDefinesOption, "ENABLE_DATABASE" if $databaseSupport;
 push @overrideFeatureDefinesOption, "ENABLE_DOM_STORAGE" if $domStorageSupport;