Title: [130554] trunk/Source/WebCore
Revision
130554
Author
[email protected]
Date
2012-10-05 14:51:17 -0700 (Fri, 05 Oct 2012)

Log Message

Don't assume that TileCache layers are opaque
https://bugs.webkit.org/show_bug.cgi?id=98555

Reviewed by Dean Jackson.

TileCache previously set all its tile CALayers as opaque.
However, we will need non-opaque tile caches when we use this
tile cache for tiled layers, so add a member function to
control tile opacity.

RenderLayerBacking already calls m_graphicsLayer->setContentsOpaque()
using the FrameView's notion of opaqueness, so this change will
cause the main tile cache to be non-opaque if external forces have
set the FrameView to be non-opaque.

Also tweak the layer border widths on tiled layers.

* platform/graphics/ca/mac/TileCache.h:
(TileCache):
(WebCore::TileCache::tilesAreOpaque):
* platform/graphics/ca/mac/TileCache.mm:
(WebCore::TileCache::TileCache):
(WebCore::TileCache::setTilesOpaque):
(WebCore::TileCache::createTileLayer):
* platform/graphics/ca/mac/WebTileCacheLayer.mm:
(-[WebTileCacheLayer setOpaque:]):
(-[WebTileCacheLayer isOpaque]):
(-[WebTileCacheLayer setBorderWidth:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (130553 => 130554)


--- trunk/Source/WebCore/ChangeLog	2012-10-05 21:39:15 UTC (rev 130553)
+++ trunk/Source/WebCore/ChangeLog	2012-10-05 21:51:17 UTC (rev 130554)
@@ -1,3 +1,34 @@
+2012-10-05  Simon Fraser  <[email protected]>
+
+        Don't assume that TileCache layers are opaque
+        https://bugs.webkit.org/show_bug.cgi?id=98555
+
+        Reviewed by Dean Jackson.
+
+        TileCache previously set all its tile CALayers as opaque.
+        However, we will need non-opaque tile caches when we use this
+        tile cache for tiled layers, so add a member function to
+        control tile opacity.
+        
+        RenderLayerBacking already calls m_graphicsLayer->setContentsOpaque()
+        using the FrameView's notion of opaqueness, so this change will
+        cause the main tile cache to be non-opaque if external forces have
+        set the FrameView to be non-opaque.
+        
+        Also tweak the layer border widths on tiled layers.
+
+        * platform/graphics/ca/mac/TileCache.h:
+        (TileCache):
+        (WebCore::TileCache::tilesAreOpaque):
+        * platform/graphics/ca/mac/TileCache.mm:
+        (WebCore::TileCache::TileCache):
+        (WebCore::TileCache::setTilesOpaque):
+        (WebCore::TileCache::createTileLayer):
+        * platform/graphics/ca/mac/WebTileCacheLayer.mm:
+        (-[WebTileCacheLayer setOpaque:]):
+        (-[WebTileCacheLayer isOpaque]):
+        (-[WebTileCacheLayer setBorderWidth:]):
+
 2012-10-05  Tony Chang  <[email protected]>
 
         Fix margin box ascent computation in flexbox

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h (130553 => 130554)


--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h	2012-10-05 21:39:15 UTC (rev 130553)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h	2012-10-05 21:51:17 UTC (rev 130554)
@@ -65,6 +65,9 @@
     bool acceleratesDrawing() const { return m_acceleratesDrawing; }
     void setAcceleratesDrawing(bool);
 
+    void setTilesOpaque(bool);
+    bool tilesAreOpaque() const { return m_tilesAreOpaque; }
+
     CALayer *tileContainerLayer() const { return m_tileContainerLayer.get(); }
 
     void setTileDebugBorderWidth(float);
@@ -122,6 +125,7 @@
     bool m_isInWindow;
     bool m_scrollingPerformanceLoggingEnabled;
     bool m_acceleratesDrawing;
+    bool m_tilesAreOpaque;
 
     RetainPtr<CGColorRef> m_tileDebugBorderColor;
     float m_tileDebugBorderWidth;

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm (130553 => 130554)


--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm	2012-10-05 21:39:15 UTC (rev 130553)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm	2012-10-05 21:51:17 UTC (rev 130554)
@@ -61,6 +61,7 @@
     , m_isInWindow(false)
     , m_scrollingPerformanceLoggingEnabled(false)
     , m_acceleratesDrawing(false)
+    , m_tilesAreOpaque(false)
     , m_tileDebugBorderWidth(0)
 {
     [CATransaction begin];
@@ -206,6 +207,19 @@
 #endif
 }
 
+void TileCache::setTilesOpaque(bool opaque)
+{
+    if (opaque == m_tilesAreOpaque)
+        return;
+
+    m_tilesAreOpaque = opaque;
+
+    for (TileMap::iterator it = m_tiles.begin(), end = m_tiles.end(); it != end; ++it) {
+        WebTileLayer* tileLayer = it->second.get();
+        [tileLayer setOpaque:opaque];
+    }
+}
+
 void TileCache::visibleRectChanged(const IntRect& visibleRect)
 {
     if (m_visibleRect == visibleRect)
@@ -442,7 +456,7 @@
     [layer.get() setBorderColor:m_tileDebugBorderColor.get()];
     [layer.get() setBorderWidth:m_tileDebugBorderWidth];
     [layer.get() setEdgeAntialiasingMask:0];
-    [layer.get() setOpaque:YES];
+    [layer.get() setOpaque:m_tilesAreOpaque];
 #ifndef NDEBUG
     [layer.get() setName:@"Tile"];
 #endif

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.mm (130553 => 130554)


--- trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.mm	2012-10-05 21:39:15 UTC (rev 130553)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.mm	2012-10-05 21:51:17 UTC (rev 130554)
@@ -78,6 +78,16 @@
     _tileCache->tileCacheLayerBoundsChanged();
 }
 
+- (void)setOpaque:(BOOL)opaque
+{
+    _tileCache->setTilesOpaque(opaque);
+}
+
+- (BOOL)isOpaque
+{
+    return _tileCache->tilesAreOpaque();
+}
+
 - (void)setNeedsDisplay
 {
     _tileCache->setNeedsDisplay();
@@ -127,7 +137,8 @@
 
 - (void)setBorderWidth:(CGFloat)borderWidth
 {
-    _tileCache->setTileDebugBorderWidth(borderWidth);
+    // Tiles adjoin, so halve the border width.
+    _tileCache->setTileDebugBorderWidth(borderWidth / 2);
 }
 
 @end
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to