Title: [102644] trunk/Source/WebCore
Revision
102644
Author
simon.fra...@apple.com
Date
2011-12-12 17:05:32 -0800 (Mon, 12 Dec 2011)

Log Message

Make it possible to substitute a different CALayer implementation for the main root layer
https://bugs.webkit.org/show_bug.cgi?id=74369

Reviewed by Anders Carlsson.

Some platforms may wish to have the main root layer (which corresponds with
the main frame's RenderView's layer) implemented by a custom platform layer,
for example to contain a cache of tiles.

Make this possible on Mac by adding a new method to GraphicsLayerClient(),
and implementing it in RenderLayerBacking. This new behavior is not yet enabled.

Also clean up some WebLayer/WebTiledLayer code.

* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/GraphicsLayerClient.h:
(WebCore::GraphicsLayerClient::shouldUseTileCache): New client method that indicates that the GraphicsLayer
should host a tile cache layer instead of a normal layer.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::GraphicsLayerCA): Ask the client, if any, whether to create a tile cache layer.
* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/mac/PlatformCALayerMac.mm: NSClassFromString(@"CATransformLayer") was for Leopard;
we can just use the classname now. Handle LayerTypeTileCacheLayer.
(PlatformCALayer::PlatformCALayer):
* platform/graphics/ca/mac/WebTileCacheLayer.h: Copied from Source/WebCore/platform/graphics/mac/WebLayer.h.
* platform/graphics/ca/mac/WebTileCacheLayer.mm: Copied from Source/WebCore/platform/graphics/mac/WebLayer.h.
* platform/graphics/mac/WebLayer.h: Remove the setLayerNeedsDisplayInRect() hackery.
* platform/graphics/mac/WebLayer.mm: setLayerNeedsDisplayInRect() tried to share code between WebLayer and WebTiledLayer
by using Obj-C runtime methods to find the superclass. This causes infinite recursion if Web[Tiled]Layer is subclassed,
so remove it.
(-[WebLayer setNeedsDisplayInRect:]): Code moved here from setLayerNeedsDisplayInRect.
* platform/graphics/mac/WebTiledLayer.mm:
(-[WebTiledLayer setNeedsDisplayInRect:]): Code copied here from setLayerNeedsDisplayInRect.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::RenderLayerBacking): Find out, and cache if we're the main frame's layer.
(WebCore::RenderLayerBacking::shouldUseTileCache): Return m_usingTiledCacheLayer, which is always false for now.
(WebCore::RenderLayerBacking::createPrimaryGraphicsLayer): Use m_isMainFrameRenderViewLayer.
(WebCore::RenderLayerBacking::paintingGoesToWindow): The tile cache layer needs to paint itself.
* rendering/RenderLayerBacking.h:
* rendering/RenderLayerCompositor.h: m_compositeForFixedPosition was unused.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102643 => 102644)


--- trunk/Source/WebCore/ChangeLog	2011-12-13 00:59:36 UTC (rev 102643)
+++ trunk/Source/WebCore/ChangeLog	2011-12-13 01:05:32 UTC (rev 102644)
@@ -1,3 +1,46 @@
+2011-12-12  Simon Fraser  <simon.fra...@apple.com>
+
+        Make it possible to substitute a different CALayer implementation for the main root layer
+        https://bugs.webkit.org/show_bug.cgi?id=74369
+
+        Reviewed by Anders Carlsson.
+        
+        Some platforms may wish to have the main root layer (which corresponds with
+        the main frame's RenderView's layer) implemented by a custom platform layer,
+        for example to contain a cache of tiles.
+        
+        Make this possible on Mac by adding a new method to GraphicsLayerClient(),
+        and implementing it in RenderLayerBacking. This new behavior is not yet enabled.
+        
+        Also clean up some WebLayer/WebTiledLayer code.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/graphics/GraphicsLayerClient.h:
+        (WebCore::GraphicsLayerClient::shouldUseTileCache): New client method that indicates that the GraphicsLayer
+        should host a tile cache layer instead of a normal layer.
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::GraphicsLayerCA): Ask the client, if any, whether to create a tile cache layer.
+        * platform/graphics/ca/PlatformCALayer.h:
+        * platform/graphics/ca/mac/PlatformCALayerMac.mm: NSClassFromString(@"CATransformLayer") was for Leopard;
+        we can just use the classname now. Handle LayerTypeTileCacheLayer.
+        (PlatformCALayer::PlatformCALayer):
+        * platform/graphics/ca/mac/WebTileCacheLayer.h: Copied from Source/WebCore/platform/graphics/mac/WebLayer.h.
+        * platform/graphics/ca/mac/WebTileCacheLayer.mm: Copied from Source/WebCore/platform/graphics/mac/WebLayer.h.
+        * platform/graphics/mac/WebLayer.h: Remove the setLayerNeedsDisplayInRect() hackery.
+        * platform/graphics/mac/WebLayer.mm: setLayerNeedsDisplayInRect() tried to share code between WebLayer and WebTiledLayer
+        by using Obj-C runtime methods to find the superclass. This causes infinite recursion if Web[Tiled]Layer is subclassed,
+        so remove it.
+        (-[WebLayer setNeedsDisplayInRect:]): Code moved here from setLayerNeedsDisplayInRect.
+        * platform/graphics/mac/WebTiledLayer.mm:
+        (-[WebTiledLayer setNeedsDisplayInRect:]): Code copied here from setLayerNeedsDisplayInRect.
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::RenderLayerBacking): Find out, and cache if we're the main frame's layer.
+        (WebCore::RenderLayerBacking::shouldUseTileCache): Return m_usingTiledCacheLayer, which is always false for now.
+        (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer): Use m_isMainFrameRenderViewLayer.
+        (WebCore::RenderLayerBacking::paintingGoesToWindow): The tile cache layer needs to paint itself.
+        * rendering/RenderLayerBacking.h:
+        * rendering/RenderLayerCompositor.h: m_compositeForFixedPosition was unused.
+
 2011-12-12  Ryosuke Niwa  <rn...@webkit.org>
 
         REGRESSION(r102357): respondToUnappliedEditing exits early for CreateLinkCommand

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (102643 => 102644)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-12-13 00:59:36 UTC (rev 102643)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-12-13 01:05:32 UTC (rev 102644)
@@ -241,6 +241,8 @@
 		0F580CFE0F12DE9B0051D689 /* RenderLayerCompositor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F580CFA0F12DE9B0051D689 /* RenderLayerCompositor.cpp */; };
 		0F580CFF0F12DE9B0051D689 /* RenderLayerBacking.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F580CFB0F12DE9B0051D689 /* RenderLayerBacking.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0F580D000F12DE9B0051D689 /* RenderLayerBacking.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F580CFC0F12DE9B0051D689 /* RenderLayerBacking.cpp */; };
+		0F580FA31496939100FB5BD8 /* WebTileCacheLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F580FA11496939100FB5BD8 /* WebTileCacheLayer.h */; };
+		0F580FA41496939100FB5BD8 /* WebTileCacheLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F580FA21496939100FB5BD8 /* WebTileCacheLayer.mm */; };
 		0F5B7A5410F65D7A00376302 /* RenderEmbeddedObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F5B7A5210F65D7A00376302 /* RenderEmbeddedObject.cpp */; };
 		0F5B7A5510F65D7A00376302 /* RenderEmbeddedObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F5B7A5310F65D7A00376302 /* RenderEmbeddedObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0F6ECD450F252F3700BDE271 /* CSSPropertyLonghand.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F6ECD430F252F3700BDE271 /* CSSPropertyLonghand.h */; };
@@ -7320,6 +7322,8 @@
 		0F580CFA0F12DE9B0051D689 /* RenderLayerCompositor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderLayerCompositor.cpp; sourceTree = "<group>"; };
 		0F580CFB0F12DE9B0051D689 /* RenderLayerBacking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderLayerBacking.h; sourceTree = "<group>"; };
 		0F580CFC0F12DE9B0051D689 /* RenderLayerBacking.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderLayerBacking.cpp; sourceTree = "<group>"; };
+		0F580FA11496939100FB5BD8 /* WebTileCacheLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebTileCacheLayer.h; path = ca/mac/WebTileCacheLayer.h; sourceTree = "<group>"; };
+		0F580FA21496939100FB5BD8 /* WebTileCacheLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebTileCacheLayer.mm; path = ca/mac/WebTileCacheLayer.mm; sourceTree = "<group>"; };
 		0F5B7A5210F65D7A00376302 /* RenderEmbeddedObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderEmbeddedObject.cpp; sourceTree = "<group>"; };
 		0F5B7A5310F65D7A00376302 /* RenderEmbeddedObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderEmbeddedObject.h; sourceTree = "<group>"; };
 		0F6ECD430F252F3700BDE271 /* CSSPropertyLonghand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSPropertyLonghand.h; sourceTree = "<group>"; };
@@ -15036,6 +15040,8 @@
 				2917B565147349950052C9D0 /* LayerFlushSchedulerMac.cpp */,
 				4958781F12A57DDF007238AC /* PlatformCAAnimationMac.mm */,
 				4958782012A57DDF007238AC /* PlatformCALayerMac.mm */,
+				0F580FA11496939100FB5BD8 /* WebTileCacheLayer.h */,
+				0F580FA21496939100FB5BD8 /* WebTileCacheLayer.mm */,
 			);
 			name = mac;
 			sourceTree = "<group>";
@@ -24810,6 +24816,7 @@
 				8A195934147EA16E00D1EA61 /* DOMWebKitNamedFlowInternal.h in Headers */,
 				F35AE5AC14925F5B004D5776 /* DOMWrapperVisitor.h in Headers */,
 				26C17A3E1491D2D400D12BA2 /* FileSystemIOS.h in Headers */,
+				0F580FA31496939100FB5BD8 /* WebTileCacheLayer.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -27695,6 +27702,7 @@
 				26C17A3F1491D2D400D12BA2 /* FileSystemIOS.mm in Sources */,
 				8C1091981494FB1200B5D3FE /* CSSElementStyleDeclaration.cpp in Sources */,
 				4306E4E614955543007F17AC /* KillRingNone.cpp in Sources */,
+				0F580FA41496939100FB5BD8 /* WebTileCacheLayer.mm in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h (102643 => 102644)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h	2011-12-13 00:59:36 UTC (rev 102643)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h	2011-12-13 01:05:32 UTC (rev 102644)
@@ -54,6 +54,8 @@
 public:
     virtual ~GraphicsLayerClient() {}
 
+    virtual bool shouldUseTileCache(const GraphicsLayer*) const { return false; }
+    
     // Callback for when hardware-accelerated animation started.
     virtual void notifyAnimationStarted(const GraphicsLayer*, double time) = 0;
 

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (102643 => 102644)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2011-12-13 00:59:36 UTC (rev 102643)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2011-12-13 01:05:32 UTC (rev 102644)
@@ -249,8 +249,12 @@
     , m_allowTiledLayer(true)
     , m_uncommittedChanges(0)
 {
-    m_layer = PlatformCALayer::create(PlatformCALayer::LayerTypeWebLayer, this);
+    PlatformCALayer::LayerType layerType = PlatformCALayer::LayerTypeWebLayer;
+    if (client && client->shouldUseTileCache(this))
+        layerType = PlatformCALayer::LayerTypeTileCacheLayer;
 
+    m_layer = PlatformCALayer::create(layerType, this);
+
     updateDebugIndicators();
     noteLayerPropertyChanged(ContentsScaleChanged);
 }

Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (102643 => 102644)


--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2011-12-13 00:59:36 UTC (rev 102643)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2011-12-13 01:05:32 UTC (rev 102644)
@@ -54,7 +54,15 @@
     // LayerTypeRootLayer is used on some platforms. It has no backing store, so setNeedsDisplay
     // should not call CACFLayerSetNeedsDisplay, but rather just notify the renderer that it
     // has changed and should be re-rendered.
-    enum LayerType { LayerTypeLayer, LayerTypeWebLayer, LayerTypeTransformLayer, LayerTypeWebTiledLayer, LayerTypeRootLayer, LayerTypeCustom };
+    enum LayerType {
+        LayerTypeLayer,
+        LayerTypeWebLayer,
+        LayerTypeTransformLayer,
+        LayerTypeWebTiledLayer,
+        LayerTypeTileCacheLayer,
+        LayerTypeRootLayer,
+        LayerTypeCustom
+    };
     enum FilterType { Linear, Nearest, Trilinear };
 
     static PassRefPtr<PlatformCALayer> create(LayerType, PlatformCALayerClient*);

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (102643 => 102644)


--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2011-12-13 00:59:36 UTC (rev 102643)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2011-12-13 01:05:32 UTC (rev 102644)
@@ -35,6 +35,7 @@
 #import "GraphicsLayerCA.h"
 #import "WebLayer.h"
 #import "WebTiledLayer.h"
+#import "WebTileCacheLayer.h"
 #import <objc/objc-auto.h>
 #import <objc/objc-runtime.h>
 #import <QuartzCore/QuartzCore.h>
@@ -184,11 +185,14 @@
                 layerClass = [WebLayer class];
                 break;
             case LayerTypeTransformLayer:
-                layerClass = NSClassFromString(@"CATransformLayer");
+                layerClass = [CATransformLayer class];
                 break;
             case LayerTypeWebTiledLayer:
                 layerClass = [WebTiledLayer class];
                 break;
+            case LayerTypeTileCacheLayer:
+                layerClass = [WebTileCacheLayer class];
+                break;
             case LayerTypeCustom:
                 break;
         }

Copied: trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.h (from rev 102643, trunk/Source/WebCore/platform/graphics/mac/WebLayer.h) (0 => 102644)


--- trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.h	2011-12-13 01:05:32 UTC (rev 102644)
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2011 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. 
+ */
+
+#import "WebTiledLayer.h"
+
+@interface WebTileCacheLayer : WebTiledLayer
+
+@end

Copied: trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.mm (from rev 102643, trunk/Source/WebCore/platform/graphics/mac/WebLayer.h) (0 => 102644)


--- trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.mm	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.mm	2011-12-13 01:05:32 UTC (rev 102644)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2011 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. 
+ */
+
+#import "config.h"
+
+#import "WebTileCacheLayer.h"
+
+@implementation WebTileCacheLayer
+
+
+@end

Modified: trunk/Source/WebCore/platform/graphics/mac/WebLayer.h (102643 => 102644)


--- trunk/Source/WebCore/platform/graphics/mac/WebLayer.h	2011-12-13 00:59:36 UTC (rev 102643)
+++ trunk/Source/WebCore/platform/graphics/mac/WebLayer.h	2011-12-13 01:05:32 UTC (rev 102644)
@@ -50,7 +50,6 @@
 
 // Functions allows us to share implementation across WebTiledLayer and WebLayer
 void drawLayerContents(CGContextRef, CALayer *, WebCore::PlatformCALayer*);
-void setLayerNeedsDisplayInRect(CALayer *, WebCore::PlatformCALayerClient*, CGRect);
 
 #endif // USE(ACCELERATED_COMPOSITING)
 

Modified: trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm (102643 => 102644)


--- trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm	2011-12-13 00:59:36 UTC (rev 102643)
+++ trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm	2011-12-13 01:05:32 UTC (rev 102644)
@@ -122,34 +122,7 @@
     CGContextRestoreGState(context);
 }
 
-void setLayerNeedsDisplayInRect(CALayer *layer, WebCore::PlatformCALayerClient* layerContents, CGRect rect)
-{
-    if (layerContents && layerContents->platformCALayerDrawsContent()) {
-        struct objc_super layerSuper = { layer, class_getSuperclass(object_getClass(layer)) };
-#if defined(BUILDING_ON_LEOPARD)
-        rect = CGRectApplyAffineTransform(rect, [layer contentsTransform]);
-#else
-        if (layerContents->platformCALayerContentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesBottomUp)
-            rect.origin.y = [layer bounds].size.height - rect.origin.y - rect.size.height;
-#endif
-        objc_msgSendSuper(&layerSuper, @selector(setNeedsDisplayInRect:), rect);
 
-#ifndef NDEBUG
-        if (layerContents->platformCALayerShowRepaintCounter()) {
-            CGRect bounds = [layer bounds];
-            CGRect indicatorRect = CGRectMake(bounds.origin.x, bounds.origin.y, 46, 25);
-#if defined(BUILDING_ON_LEOPARD)
-            indicatorRect = CGRectApplyAffineTransform(indicatorRect, [layer contentsTransform]);
-#else
-            if (layerContents->platformCALayerContentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesBottomUp)
-                indicatorRect.origin.y = [layer bounds].size.height - indicatorRect.origin.y - indicatorRect.size.height;
-#endif
-            objc_msgSendSuper(&layerSuper, @selector(setNeedsDisplayInRect:), indicatorRect);
-        }
-#endif
-    }
-}
-
 - (id<CAAction>)actionForKey:(NSString *)key
 {
     // Fix for <rdar://problem/9015675>: Force the layer content to be updated when the tree is reparented.
@@ -168,9 +141,29 @@
 
 - (void)setNeedsDisplayInRect:(CGRect)dirtyRect
 {
-    PlatformCALayer* layer = PlatformCALayer::platformCALayer(self);
-    if (layer)
-        setLayerNeedsDisplayInRect(self, layer->owner(), dirtyRect);
+    PlatformCALayer* platformLayer = PlatformCALayer::platformCALayer(self);
+    if (!platformLayer) {
+        [super setNeedsDisplayInRect:dirtyRect];
+        return;
+    }
+
+    if (PlatformCALayerClient* layerOwner = platformLayer->owner()) {
+        if (layerOwner->platformCALayerDrawsContent()) {
+            if (layerOwner->platformCALayerContentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesBottomUp)
+                dirtyRect.origin.y = [self bounds].size.height - dirtyRect.origin.y - dirtyRect.size.height;
+
+            [super setNeedsDisplayInRect:dirtyRect];
+
+            if (layerOwner->platformCALayerShowRepaintCounter()) {
+                CGRect bounds = [self bounds];
+                CGRect indicatorRect = CGRectMake(bounds.origin.x, bounds.origin.y, 52, 27);
+                if (layerOwner->platformCALayerContentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesBottomUp)
+                    indicatorRect.origin.y = [self bounds].size.height - indicatorRect.origin.y - indicatorRect.size.height;
+
+                [super setNeedsDisplayInRect:indicatorRect];
+            }
+        }
+    }
 }
 
 - (void)display

Modified: trunk/Source/WebCore/platform/graphics/mac/WebTiledLayer.mm (102643 => 102644)


--- trunk/Source/WebCore/platform/graphics/mac/WebTiledLayer.mm	2011-12-13 00:59:36 UTC (rev 102643)
+++ trunk/Source/WebCore/platform/graphics/mac/WebTiledLayer.mm	2011-12-13 01:05:32 UTC (rev 102644)
@@ -66,9 +66,29 @@
 
 - (void)setNeedsDisplayInRect:(CGRect)dirtyRect
 {
-    PlatformCALayer* layer = PlatformCALayer::platformCALayer(self);
-    if (layer)
-        setLayerNeedsDisplayInRect(self, layer->owner(), dirtyRect);
+    PlatformCALayer* platformLayer = PlatformCALayer::platformCALayer(self);
+    if (!platformLayer) {
+        [super setNeedsDisplayInRect:dirtyRect];
+        return;
+    }
+
+    if (PlatformCALayerClient* layerOwner = platformLayer->owner()) {
+        if (layerOwner->platformCALayerDrawsContent()) {
+            if (layerOwner->platformCALayerContentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesBottomUp)
+                dirtyRect.origin.y = [self bounds].size.height - dirtyRect.origin.y - dirtyRect.size.height;
+
+            [super setNeedsDisplayInRect:dirtyRect];
+
+            if (layerOwner->platformCALayerShowRepaintCounter()) {
+                CGRect bounds = [self bounds];
+                CGRect indicatorRect = CGRectMake(bounds.origin.x, bounds.origin.y, 52, 27);
+                if (layerOwner->platformCALayerContentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesBottomUp)
+                    indicatorRect.origin.y = [self bounds].size.height - indicatorRect.origin.y - indicatorRect.size.height;
+
+                [super setNeedsDisplayInRect:indicatorRect];
+            }
+        }
+    }
 }
 
 - (void)display

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (102643 => 102644)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2011-12-13 00:59:36 UTC (rev 102643)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2011-12-13 01:05:32 UTC (rev 102644)
@@ -85,7 +85,18 @@
 RenderLayerBacking::RenderLayerBacking(RenderLayer* layer)
     : m_owningLayer(layer)
     , m_artificiallyInflatedBounds(false)
+    , m_isMainFrameRenderViewLayer(false)
+    , m_usingTiledCacheLayer(false)
 {
+    if (renderer()->isRenderView()) {
+        Frame* frame = toRenderView(renderer())->frameView()->frame();
+        Page* page = frame ? frame->page() : 0;
+        if (page && frame && page->mainFrame() == frame)
+            m_isMainFrameRenderViewLayer = true;
+    }
+    
+    m_usingTiledCacheLayer = false; // FIXME: At some point this will test m_isMainFrameRenderViewLayer and check a Setting.
+
     createPrimaryGraphicsLayer();
 }
 
@@ -110,6 +121,11 @@
     return graphicsLayer.release();
 }
 
+bool RenderLayerBacking::shouldUseTileCache(const GraphicsLayer*) const
+{
+    return m_usingTiledCacheLayer;
+}
+
 void RenderLayerBacking::createPrimaryGraphicsLayer()
 {
     String layerName;
@@ -117,12 +133,9 @@
     layerName = nameForLayer();
 #endif
     m_graphicsLayer = createGraphicsLayer(layerName);
-    if (renderer()->isRenderView()) {
-        Frame* frame = toRenderView(renderer())->frameView()->frame();
-        Page* page = frame ? frame->page() : 0;
-        if (page && frame && page->mainFrame() == frame)
-            m_graphicsLayer->setAppliesPageScale();
-    }
+
+    if (m_isMainFrameRenderViewLayer)
+        m_graphicsLayer->setAppliesPageScale();
     
     updateLayerOpacity(renderer()->style());
     updateLayerTransform(renderer()->style());
@@ -1042,6 +1055,9 @@
 
 bool RenderLayerBacking::paintingGoesToWindow() const
 {
+    if (m_usingTiledCacheLayer)
+        return false;
+
     if (m_owningLayer->isRootLayer())
         return compositor()->rootLayerAttachment() != RenderLayerCompositor::RootLayerAttachedViaEnclosingFrame;
     

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (102643 => 102644)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.h	2011-12-13 00:59:36 UTC (rev 102643)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h	2011-12-13 01:05:32 UTC (rev 102644)
@@ -123,6 +123,7 @@
     void updateAfterWidgetResize();
 
     // GraphicsLayerClient interface
+    virtual bool shouldUseTileCache(const GraphicsLayer*) const;
     virtual void notifyAnimationStarted(const GraphicsLayer*, double startTime);
     virtual void notifySyncRequired(const GraphicsLayer*);
 
@@ -176,6 +177,8 @@
     // Return the opacity value that this layer should use for compositing.
     float compositingOpacity(float rendererOpacity) const;
     
+    bool isMainFrameRenderViewLayer() const;
+    
     // Returns true if this compositing layer has no visible content.
     bool isSimpleContainerCompositingLayer() const;
     // Returns true if this layer has content that needs to be rendered by painting into the backing store.
@@ -214,6 +217,8 @@
     LayoutRect m_compositedBounds;
 
     bool m_artificiallyInflatedBounds;      // bounds had to be made non-zero to make transform-origin work
+    bool m_isMainFrameRenderViewLayer;
+    bool m_usingTiledCacheLayer;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (102643 => 102644)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2011-12-13 00:59:36 UTC (rev 102643)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2011-12-13 01:05:32 UTC (rev 102644)
@@ -317,7 +317,6 @@
     bool m_compositingLayersNeedRebuild;
     bool m_flushingLayers;
     bool m_forceCompositingMode;
-    bool m_compositeForFixedPosition;
 
     RootLayerAttachment m_rootLayerAttachment;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to