2009-02-11 Simon Fraser <simon.fraser@apple.com>
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Feb 2009 05:53:06 +0000 (05:53 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Feb 2009 05:53:06 +0000 (05:53 +0000)
        Reviewed by Dave Hyatt

        Fix the build on Leopard with ACCELERATED_COMPOSITING turned on.

        * WebCore.xcodeproj/project.pbxproj:
        FloatPoint3D needs to be a private header, since it's included by GraphicsLayer.h
        * platform/graphics/mac/GraphicsLayerCA.mm:
        (WebCore::getTransformFunctionValue):
        (WebCore::caValueFunctionSupported):
        (WebCore::GraphicsLayerCA::setAnchorPoint):
        (WebCore::GraphicsLayerCA::setPreserves3D):
        (WebCore::GraphicsLayerCA::setContentsToImage):
        (WebCore::GraphicsLayerCA::setBasicAnimation):
        (WebCore::GraphicsLayerCA::setKeyframeAnimation):
        * rendering/RenderLayer.h:
        (WebCore::RenderLayer::isRootLayer):
        Fix isRootLayer to return true for the renderView's layer, not the root
        renderer's layer.

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

WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/platform/graphics/mac/GraphicsLayerCA.mm
WebCore/rendering/RenderLayer.h

index e44614f..a9f41a6 100644 (file)
@@ -1,3 +1,24 @@
+2009-02-11  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Dave Hyatt
+
+        Fix the build on Leopard with ACCELERATED_COMPOSITING turned on.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        FloatPoint3D needs to be a private header, since it's included by GraphicsLayer.h
+        * platform/graphics/mac/GraphicsLayerCA.mm:
+        (WebCore::getTransformFunctionValue):
+        (WebCore::caValueFunctionSupported):
+        (WebCore::GraphicsLayerCA::setAnchorPoint):
+        (WebCore::GraphicsLayerCA::setPreserves3D):
+        (WebCore::GraphicsLayerCA::setContentsToImage):
+        (WebCore::GraphicsLayerCA::setBasicAnimation):
+        (WebCore::GraphicsLayerCA::setKeyframeAnimation):
+        * rendering/RenderLayer.h:
+        (WebCore::RenderLayer::isRootLayer):
+        Fix isRootLayer to return true for the renderView's layer, not the root
+        renderer's layer.
+
 2009-02-11  Adele Peterson  <adele@apple.com>
 
         Reviewed by Oliver Hunt.
index 463160f..6b897a7 100644 (file)
                B2CCEC480C6CA9F1006A5424 /* RenderSVGViewportContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CCEC460C6CA9F1006A5424 /* RenderSVGViewportContainer.h */; };
                B2D3FC8A0C2212CB00CF3618 /* JSSVGTransformListCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2D3FC890C2212CB00CF3618 /* JSSVGTransformListCustom.cpp */; };
                B2E27C9F0B0F2B0900F17C7B /* FloatPoint3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2E27C9D0B0F2B0900F17C7B /* FloatPoint3D.cpp */; };
-               B2E27CA00B0F2B0900F17C7B /* FloatPoint3D.h in Headers */ = {isa = PBXBuildFile; fileRef = B2E27C9E0B0F2B0900F17C7B /* FloatPoint3D.h */; };
+               B2E27CA00B0F2B0900F17C7B /* FloatPoint3D.h in Headers */ = {isa = PBXBuildFile; fileRef = B2E27C9E0B0F2B0900F17C7B /* FloatPoint3D.h */; settings = {ATTRIBUTES = (Private, ); }; };
                B2E4EC970D00C22B00432643 /* SVGZoomEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2E4EC940D00C22B00432643 /* SVGZoomEvent.cpp */; };
                B2E4EC980D00C22B00432643 /* SVGZoomEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = B2E4EC950D00C22B00432643 /* SVGZoomEvent.h */; };
                B2EBDC9C0AF77E3400AE4A68 /* SVGRenderTreeAsText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2EBDC9A0AF77E3400AE4A68 /* SVGRenderTreeAsText.cpp */; };
index ec6656d..1f6ed50 100644 (file)
 #import "WebLayer.h"
 #import "WebTiledLayer.h"
 #import <wtf/CurrentTime.h>
+#import <wtf/UnusedParam.h>
 
 using namespace std;
 
+#define HAVE_MODERN_QUARTZCORE (!defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD))
+
 namespace WebCore {
 
 // The threshold width or height above which a tiled layer will be used. This should be
@@ -124,24 +127,32 @@ static NSValue* getTransformFunctionValue(const GraphicsLayer::TransformValue& t
     
     switch (transformType) {
         case TransformOperation::ROTATE:
-            return [NSNumber numberWithDouble:op ? (float) (static_cast<RotateTransformOperation*>(op)->angle() * M_PI / 180) : 0];
-
+        case TransformOperation::ROTATE_X:
+        case TransformOperation::ROTATE_Y:
+            return [NSNumber numberWithDouble:op ? deg2rad(static_cast<RotateTransformOperation*>(op)->angle()) : 0];
         case TransformOperation::SCALE_X:
             return [NSNumber numberWithDouble:op ? static_cast<ScaleTransformOperation*>(op)->x() : 0];
         case TransformOperation::SCALE_Y:
             return [NSNumber numberWithDouble:op ? static_cast<ScaleTransformOperation*>(op)->y() : 0];
-
+        case TransformOperation::SCALE_Z:
+            return [NSNumber numberWithDouble:op ? static_cast<ScaleTransformOperation*>(op)->z() : 0];
         case TransformOperation::TRANSLATE_X:
             return [NSNumber numberWithDouble:op ? static_cast<TranslateTransformOperation*>(op)->x(size) : 0];
         case TransformOperation::TRANSLATE_Y:
-            return [NSNumber numberWithDouble:op ? static_cast<TranslateTransformOperation*>(op)->x(size) : 0];
-        
+            return [NSNumber numberWithDouble:op ? static_cast<TranslateTransformOperation*>(op)->y(size) : 0];
+        case TransformOperation::TRANSLATE_Z:
+            return [NSNumber numberWithDouble:op ? static_cast<TranslateTransformOperation*>(op)->z(size) : 0];
         case TransformOperation::SCALE:
         case TransformOperation::TRANSLATE:
         case TransformOperation::SKEW_X:
         case TransformOperation::SKEW_Y:
         case TransformOperation::SKEW:
         case TransformOperation::MATRIX:
+        case TransformOperation::SCALE_3D:
+        case TransformOperation::TRANSLATE_3D:
+        case TransformOperation::ROTATE_3D:
+        case TransformOperation::MATRIX_3D:
+        case TransformOperation::PERSPECTIVE:
         case TransformOperation::IDENTITY:
         case TransformOperation::NONE: {
             TransformationMatrix t;
@@ -156,6 +167,7 @@ static NSValue* getTransformFunctionValue(const GraphicsLayer::TransformValue& t
     return 0;
 }
 
+#if HAVE_MODERN_QUARTZCORE
 static NSString* getValueFunctionNameForTransformOperation(TransformOperation::OperationType transformType)
 {
     // Use literal strings to avoid link-time dependency on those symbols.
@@ -174,6 +186,7 @@ static NSString* getValueFunctionNameForTransformOperation(TransformOperation::O
             return nil;
     }
 }
+#endif
 
 static CAMediaTimingFunction* getCAMediaTimingFunction(const TimingFunction& timingFunction)
 {
@@ -224,7 +237,7 @@ static CALayer* getPresentationLayer(CALayer* layer)
 
 static bool caValueFunctionSupported()
 {
-    static bool sHaveValueFunction = [[CALayer class] instancesRespondToSelector:@selector(setValueFunction:)];
+    static bool sHaveValueFunction = [CAPropertyAnimation instancesRespondToSelector:@selector(setValueFunction:)];
     return sHaveValueFunction;
 }
 
@@ -473,8 +486,11 @@ void GraphicsLayerCA::setAnchorPoint(const FloatPoint3D& point)
     // set the value on the layer to the new transform.
     [primaryLayer() setAnchorPoint:FloatPoint(point.x(), point.y())];
 
-    if (zChanged) 
+    if (zChanged) {
+#if HAVE_MODERN_QUARTZCORE
         [primaryLayer() setAnchorPointZ:m_anchorPoint.z()];
+#endif
+    }
 
     // Position depends on anchor point, so update it now.
     setPosition(m_position);
@@ -601,9 +617,10 @@ void GraphicsLayerCA::setPreserves3D(bool preserves3D)
     
     BEGIN_BLOCK_OBJC_EXCEPTIONS
 
-    if (preserves3D && !m_transformLayer) {
+    Class transformLayerClass = NSClassFromString(@"CATransformLayer");
+    if (preserves3D && !m_transformLayer && transformLayerClass) {
         // Create the transform layer.
-        m_transformLayer.adoptNS([[CATransformLayer alloc] init]);
+        m_transformLayer.adoptNS([[transformLayerClass alloc] init]);
 
         // Turn off default animations.
         [m_transformLayer.get() setStyle:[NSDictionary dictionaryWithObject:nullActionsDictionary() forKey:@"actions"]];
@@ -615,7 +632,9 @@ void GraphicsLayerCA::setPreserves3D(bool preserves3D)
         [m_transformLayer.get() setBounds:[m_layer.get() bounds]];
         [m_transformLayer.get() setPosition:[m_layer.get() position]];
         [m_transformLayer.get() setAnchorPoint:[m_layer.get() anchorPoint]];
+#if HAVE_MODERN_QUARTZCORE
         [m_transformLayer.get() setAnchorPointZ:[m_layer.get() anchorPointZ]];
+#endif
         [m_transformLayer.get() setContentsRect:[m_layer.get() contentsRect]];
 #ifndef NDEBUG
         [m_transformLayer.get() setZPosition:[m_layer.get() zPosition]];
@@ -654,7 +673,9 @@ void GraphicsLayerCA::setPreserves3D(bool preserves3D)
         // Reset the layer position and transform.
         [m_layer.get() setPosition:[m_transformLayer.get() position]];
         [m_layer.get() setAnchorPoint:[m_transformLayer.get() anchorPoint]];
+#if HAVE_MODERN_QUARTZCORE
         [m_layer.get() setAnchorPointZ:[m_transformLayer.get() anchorPointZ]];
+#endif
         [m_layer.get() setContentsRect:[m_transformLayer.get() contentsRect]];
         [m_layer.get() setTransform:[m_transformLayer.get() transform]];
         [m_layer.get() setOpacity:[m_transformLayer.get() opacity]];
@@ -1043,7 +1064,7 @@ void GraphicsLayerCA::setContentsToImage(Image* image)
             CGImageRef theImage = image->nativeImageForCurrentFrame();
             // FIXME: maybe only do trilinear if the image is being scaled down,
             // but then what if the layer size changes?
-#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+#if HAVE_MODERN_QUARTZCORE
             [m_contentsLayer.get() setMinificationFilter:kCAFilterTrilinear];
 #endif
             if (needToFlip) {
@@ -1133,10 +1154,12 @@ void GraphicsLayerCA::setBasicAnimation(AnimatedPropertyID property, TransformOp
     // with an index > 0.
     [basicAnim setAdditive:property == AnimatedPropertyWebkitTransform];
     [basicAnim setFillMode:@"extended"];
-    if (caValueFunctionSupported()) {
-        if (NSString* valueFunctionName = getValueFunctionNameForTransformOperation(operationType))
-            [basicAnim setValueFunction:[CAValueFunction functionWithName:valueFunctionName]];
-    }
+#if HAVE_MODERN_QUARTZCORE
+    if (NSString* valueFunctionName = getValueFunctionNameForTransformOperation(operationType))
+        [basicAnim setValueFunction:[CAValueFunction functionWithName:valueFunctionName]];
+#else
+    UNUSED_PARAM(operationType);
+#endif
     
     // Set the delegate (and property value).
     int prop = isTransition ? property : AnimatedPropertyInvalid;
@@ -1200,10 +1223,12 @@ void GraphicsLayerCA::setKeyframeAnimation(AnimatedPropertyID property, Transfor
     // with an index > 0.
     [keyframeAnim setAdditive:(property == AnimatedPropertyWebkitTransform) ? YES : NO];
     [keyframeAnim setFillMode:@"extended"];
-    if (caValueFunctionSupported()) {
-        if (NSString* valueFunctionName = getValueFunctionNameForTransformOperation(operationType))
-            [keyframeAnim setValueFunction:[CAValueFunction functionWithName:valueFunctionName]];
-    }
+#if HAVE_MODERN_QUARTZCORE
+    if (NSString* valueFunctionName = getValueFunctionNameForTransformOperation(operationType))
+        [keyframeAnim setValueFunction:[CAValueFunction functionWithName:valueFunctionName]];
+#else
+    UNUSED_PARAM(operationType);
+#endif
 
     [keyframeAnim setKeyTimes:reinterpret_cast<id>(keys)];
     [keyframeAnim setValues:reinterpret_cast<id>(values)];
index 40034b8..4b7504a 100644 (file)
@@ -301,7 +301,7 @@ public:
     bool inResizeMode() const { return m_inResizeMode; }
     void setInResizeMode(bool b) { m_inResizeMode = b; }
 
-    bool isRootLayer() const { return renderer()->isRoot(); }
+    bool isRootLayer() const { return renderer()->isRenderView(); }
     
 #if USE(ACCELERATED_COMPOSITING)
     RenderLayerCompositor* compositor() const;