Title: [122354] trunk
Revision
122354
Author
[email protected]
Date
2012-07-11 12:29:30 -0700 (Wed, 11 Jul 2012)

Log Message

TileCache layers have wrong border debug color
https://bugs.webkit.org/show_bug.cgi?id=90922

Reviewed by Simon Fraser.

Source/WebCore:

Commit r122152 updated the layer hierarchy when a tile
cache is being used by the view. As part of that, GraphicsLayerClient::shouldUseTileCache()
was changed to return false in some situations (the idea was that it
should only be called from the createGraphicsLayer method). However
there were two other call points: one that sets the debug colors on
borders, the other was a call that keeps the document background in sync.

Add a new method usingTileCache() that returns the current state. Also fix
a FIXME where the debug code always called into the client rather than
caching the value on the GraphicsLayer.

Test: compositing/document-background-color.html

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::GraphicsLayer):
(WebCore::GraphicsLayer::updateDebugIndicators): check the local variable when
setting the debug colors.
* platform/graphics/GraphicsLayer.h:
(GraphicsLayer): new bool member variable m_usingTileCache.
* platform/graphics/GraphicsLayerClient.h:
(WebCore::GraphicsLayerClient::usingTileCache): new virtual method to query if
this client is actually using the tile cache.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::GraphicsLayerCA): set the member variable m_usingTileCache
if the GraphicsLayerClient says we are.
* rendering/RenderLayerBacking.h:
(WebCore::RenderLayerBacking::usingTileCache):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::documentBackgroundColorDidChange): call usingTileCache()
rather than shouldUseTileCache(), because the latter's value might not always reflect
the existence of a cache.

LayoutTests:

Make sure that the document background color is updated
when using a Tile Cache.

* compositing/document-background-color-expected.html: Added.
* compositing/document-background-color.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (122353 => 122354)


--- trunk/LayoutTests/ChangeLog	2012-07-11 18:53:12 UTC (rev 122353)
+++ trunk/LayoutTests/ChangeLog	2012-07-11 19:29:30 UTC (rev 122354)
@@ -1,3 +1,16 @@
+2012-07-11  Dean Jackson  <[email protected]>
+
+        TileCache layers have wrong border debug color
+        https://bugs.webkit.org/show_bug.cgi?id=90922
+
+        Reviewed by Simon Fraser.
+
+        Make sure that the document background color is updated
+        when using a Tile Cache.
+
+        * compositing/document-background-color-expected.html: Added.
+        * compositing/document-background-color.html: Added.
+
 2012-07-11  Allan Sandfeld Jensen  <[email protected]>
 
         NodesFromRect doesn't work on SVG root elements.

Added: trunk/LayoutTests/compositing/document-background-color-expected.html (0 => 122354)


--- trunk/LayoutTests/compositing/document-background-color-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/document-background-color-expected.html	2012-07-11 19:29:30 UTC (rev 122354)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+  html {
+    background-color: green;
+  }
+</style>
+</head>
+<body>
+</body>
+</html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/compositing/document-background-color-expected.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/compositing/document-background-color.html (0 => 122354)


--- trunk/LayoutTests/compositing/document-background-color.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/document-background-color.html	2012-07-11 19:29:30 UTC (rev 122354)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+  html {
+    background-color: red;
+  }
+</style>
+<script>
+window.addEventListener("load", function () {
+  document.querySelector("html").style.backgroundColor = "green";
+}, false);
+</script>
+</head>
+<body>
+</body>
+</html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/compositing/document-background-color.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (122353 => 122354)


--- trunk/Source/WebCore/ChangeLog	2012-07-11 18:53:12 UTC (rev 122353)
+++ trunk/Source/WebCore/ChangeLog	2012-07-11 19:29:30 UTC (rev 122354)
@@ -1,3 +1,42 @@
+2012-07-11  Dean Jackson  <[email protected]>
+
+        TileCache layers have wrong border debug color
+        https://bugs.webkit.org/show_bug.cgi?id=90922
+
+        Reviewed by Simon Fraser.
+
+        Commit r122152 updated the layer hierarchy when a tile
+        cache is being used by the view. As part of that, GraphicsLayerClient::shouldUseTileCache()
+        was changed to return false in some situations (the idea was that it
+        should only be called from the createGraphicsLayer method). However
+        there were two other call points: one that sets the debug colors on
+        borders, the other was a call that keeps the document background in sync.
+
+        Add a new method usingTileCache() that returns the current state. Also fix
+        a FIXME where the debug code always called into the client rather than
+        caching the value on the GraphicsLayer.
+
+        Test: compositing/document-background-color.html
+
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::GraphicsLayer):
+        (WebCore::GraphicsLayer::updateDebugIndicators): check the local variable when
+        setting the debug colors.
+        * platform/graphics/GraphicsLayer.h:
+        (GraphicsLayer): new bool member variable m_usingTileCache.
+        * platform/graphics/GraphicsLayerClient.h:
+        (WebCore::GraphicsLayerClient::usingTileCache): new virtual method to query if
+        this client is actually using the tile cache.
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::GraphicsLayerCA): set the member variable m_usingTileCache
+        if the GraphicsLayerClient says we are.
+        * rendering/RenderLayerBacking.h:
+        (WebCore::RenderLayerBacking::usingTileCache):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::documentBackgroundColorDidChange): call usingTileCache()
+        rather than shouldUseTileCache(), because the latter's value might not always reflect
+        the existence of a cache.
+
 2012-07-11  Ryosuke Niwa  <[email protected]>
 
         Clang build fix after r122345.

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (122353 => 122354)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2012-07-11 18:53:12 UTC (rev 122353)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2012-07-11 19:29:30 UTC (rev 122354)
@@ -79,6 +79,7 @@
     , m_acceleratesDrawing(false)
     , m_maintainsPixelAlignment(false)
     , m_appliesPageScale(false)
+    , m_usingTileCache(false)
     , m_paintingPhase(GraphicsLayerPaintAll)
     , m_contentsOrientation(CompositingCoordinatesTopDown)
     , m_parent(0)
@@ -340,9 +341,7 @@
 {
     if (GraphicsLayer::showDebugBorders()) {
         if (drawsContent()) {
-            // FIXME: It's weird to ask the client if this layer is a tile cache layer.
-            // Maybe we should just cache that information inside GraphicsLayer?
-            if (m_client->shouldUseTileCache(this)) // tile cache layer: dark blue
+            if (m_usingTileCache) // tile cache layer: dark blue
                 setDebugBorder(Color(0, 0, 128, 128), 0.5);
             else if (m_usingTiledLayer)
                 setDebugBorder(Color(255, 128, 0, 128), 2); // tiled layer: orange

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (122353 => 122354)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2012-07-11 18:53:12 UTC (rev 122353)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2012-07-11 19:29:30 UTC (rev 122354)
@@ -466,6 +466,7 @@
     bool m_acceleratesDrawing : 1;
     bool m_maintainsPixelAlignment : 1;
     bool m_appliesPageScale : 1; // Set for the layer which has the page scale applied to it.
+    bool m_usingTileCache : 1;
 
     GraphicsLayerPaintingPhase m_paintingPhase;
     CompositingCoordinatesOrientation m_contentsOrientation; // affects orientation of layer contents

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h (122353 => 122354)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h	2012-07-11 18:53:12 UTC (rev 122353)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h	2012-07-11 19:29:30 UTC (rev 122354)
@@ -56,6 +56,7 @@
     virtual ~GraphicsLayerClient() {}
 
     virtual bool shouldUseTileCache(const GraphicsLayer*) const { return false; }
+    virtual bool usingTileCache(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 (122353 => 122354)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2012-07-11 18:53:12 UTC (rev 122353)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2012-07-11 19:29:30 UTC (rev 122354)
@@ -268,8 +268,10 @@
     , m_uncommittedChanges(0)
 {
     PlatformCALayer::LayerType layerType = PlatformCALayer::LayerTypeWebLayer;
-    if (client && client->shouldUseTileCache(this))
+    if (client && client->shouldUseTileCache(this)) {
         layerType = PlatformCALayer::LayerTypeTileCacheLayer;
+        m_usingTileCache = true;
+    }
 
     m_layer = PlatformCALayer::create(layerType, this);
 

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (122353 => 122354)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.h	2012-07-11 18:53:12 UTC (rev 122353)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h	2012-07-11 19:29:30 UTC (rev 122354)
@@ -130,6 +130,7 @@
 
     // GraphicsLayerClient interface
     virtual bool shouldUseTileCache(const GraphicsLayer*) const;
+    virtual bool usingTileCache(const GraphicsLayer*) const { return m_usingTiledCacheLayer; }
     virtual void notifyAnimationStarted(const GraphicsLayer*, double startTime);
     virtual void notifySyncRequired(const GraphicsLayer*);
 

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (122353 => 122354)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2012-07-11 18:53:12 UTC (rev 122353)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2012-07-11 19:29:30 UTC (rev 122354)
@@ -1910,7 +1910,7 @@
         return;
 
     GraphicsLayer* graphicsLayer = backing->graphicsLayer();
-    if (!graphicsLayer->client()->shouldUseTileCache(graphicsLayer))
+    if (!graphicsLayer->client()->usingTileCache(graphicsLayer))
         return;
 
     Color backgroundColor = m_renderView->frameView()->documentBackgroundColor();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to