Title: [142586] trunk
Revision
142586
Author
[email protected]
Date
2013-02-11 23:24:46 -0800 (Mon, 11 Feb 2013)

Log Message

[EFL][WebGL] WebGL content is not painted after resizing the viewport.
https://bugs.webkit.org/show_bug.cgi?id=106358

Patch by Viatcheslav Ostapenko <[email protected]> on 2013-02-11
Reviewed by Noam Rosenthal.

Source/WebCore:

When page size changes and layer parameters get updated LayerTreeRenderer::setLayerState
clears the layer backing store and detaches the canvas surface from the layer. If the layer
size is not changed then the canvas is not recreated. This leaves the canvas detached from
the layer, but still referenced from m_surfaceBackingStores.
Don't assign layer backing store to layer in assignImageBackingToLayer if there is a canvas
surface already attached to the layer.

Test: fast/canvas/webgl/webgl-layer-update.html

* platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp:
(WebCore::CoordinatedGraphicsScene::setLayerState):
(WebCore::CoordinatedGraphicsScene::assignImageBackingToLayer):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h:

LayoutTests:

Add test checking that canvas painting is correct if layer parameters were changed,
but webgl canvas didn't change.

* fast/canvas/webgl/webgl-layer-update-expected.png: Added.
* fast/canvas/webgl/webgl-layer-update-expected.txt: Added.
* fast/canvas/webgl/webgl-layer-update.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (142585 => 142586)


--- trunk/LayoutTests/ChangeLog	2013-02-12 07:19:05 UTC (rev 142585)
+++ trunk/LayoutTests/ChangeLog	2013-02-12 07:24:46 UTC (rev 142586)
@@ -1,3 +1,17 @@
+2013-02-11  Viatcheslav Ostapenko  <[email protected]>
+
+        [EFL][WebGL] WebGL content is not painted after resizing the viewport.
+        https://bugs.webkit.org/show_bug.cgi?id=106358
+
+        Reviewed by Noam Rosenthal.
+
+        Add test checking that canvas painting is correct if layer parameters were changed,
+        but webgl canvas didn't change.
+
+        * fast/canvas/webgl/webgl-layer-update-expected.png: Added.
+        * fast/canvas/webgl/webgl-layer-update-expected.txt: Added.
+        * fast/canvas/webgl/webgl-layer-update.html: Added.
+
 2013-02-11  KwangYong Choi  <[email protected]>
 
         [EFL] Some placeholder paint order tests are passing now

Added: trunk/LayoutTests/fast/canvas/webgl/webgl-layer-update-expected.png (0 => 142586)


--- trunk/LayoutTests/fast/canvas/webgl/webgl-layer-update-expected.png	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/webgl-layer-update-expected.png	2013-02-12 07:24:46 UTC (rev 142586)
@@ -0,0 +1,5 @@
+\x89PNG
+
+
+IHDR X')tEXtchecksum9c2f54963e22de0c950a6cd3a9582fd9\\xB1\xFB\x8F
+\xDAIDATx\x9C\xED\xD9\xC1	\xC3P\xC1\xEF\xE0b|s9\xAE1\xA5\x9C\xB4\xE0\xC0\x82p\x98i\xE0鸠m\xADs\xD0yM\xF0o@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@l\xDA=\x86v\x9F\xEB3}p\xD7T`\xADk\xBD\xA7\xA6置\xE9\x80x\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`Ķ\xB5Ή\xDDcb\xF4\xD1>\xD3w\xEDC\xBBr\xF8[^\x841\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81X1\x81\xFB<N	\xEB\x8Cd\xF3PIEND\xAEB`\x82
\ No newline at end of file

Added: trunk/LayoutTests/fast/canvas/webgl/webgl-layer-update-expected.txt (0 => 142586)


--- trunk/LayoutTests/fast/canvas/webgl/webgl-layer-update-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/webgl-layer-update-expected.txt	2013-02-12 07:24:46 UTC (rev 142586)
@@ -0,0 +1,2 @@
+This test is only useful as a pixel test. You should see red canvas of size 100x100.
+

Added: trunk/LayoutTests/fast/canvas/webgl/webgl-layer-update.html (0 => 142586)


--- trunk/LayoutTests/fast/canvas/webgl/webgl-layer-update.html	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/webgl-layer-update.html	2013-02-12 07:24:46 UTC (rev 142586)
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html>
+<script>
+    function doUpdate()
+    {
+        document.getElementsByTagName('canvas')[0].style.top = "60px";
+
+        if (window.testRunner) {
+            testRunner.display();
+            testRunner.notifyDone();
+        }
+    }
+
+    function init()
+    {
+        if (window.testRunner)
+            doUpdate();
+        else {
+            // Delay canvas layer update if test runs without testRunner to
+            // allow first layer update to be processed on UI side.
+            window.setTimeout(doUpdate, 100);
+        }
+    }
+</script>
+<body _onload_="init()">
+<script>
+if (window.testRunner)
+    testRunner.waitUntilDone();
+</script>
+<span id="description" style="color: white">
+This test is only useful as a pixel test. You should see red canvas of size 100x100.
+</span>
+<br>
+<style>
+canvas {
+    outline: 1px solid blue;
+}
+body {
+    background-color: darkblue;
+}
+</style>
+<script>
+
+if (window.testRunner) {
+    testRunner.overridePreference("WebKitWebGLEnabled", "1");
+    testRunner.dumpAsText(true);
+    document.getElementById("description").style.position = "absolute";
+    document.getElementById("description").style.top = "-5000px"; 
+}
+
+var can = document.createElement('canvas');
+can.width = can.height = 100;
+can.style.position = "absolute";
+can.style.left = "40px";
+can.style.top = "40px";
+document.body.appendChild(can);
+var ctx = can.getContext("experimental-webgl");
+ctx.clearColor(1, 0, 0, 1);
+ctx.clear(ctx.COLOR_BUFFER_BIT);
+
+if (window.testRunner)
+    testRunner.display();
+</script>
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (142585 => 142586)


--- trunk/Source/WebCore/ChangeLog	2013-02-12 07:19:05 UTC (rev 142585)
+++ trunk/Source/WebCore/ChangeLog	2013-02-12 07:24:46 UTC (rev 142586)
@@ -1,3 +1,24 @@
+2013-02-11  Viatcheslav Ostapenko  <[email protected]>
+
+        [EFL][WebGL] WebGL content is not painted after resizing the viewport.
+        https://bugs.webkit.org/show_bug.cgi?id=106358
+
+        Reviewed by Noam Rosenthal.
+
+        When page size changes and layer parameters get updated LayerTreeRenderer::setLayerState
+        clears the layer backing store and detaches the canvas surface from the layer. If the layer
+        size is not changed then the canvas is not recreated. This leaves the canvas detached from
+        the layer, but still referenced from m_surfaceBackingStores.
+        Don't assign layer backing store to layer in assignImageBackingToLayer if there is a canvas
+        surface already attached to the layer.
+
+        Test: fast/canvas/webgl/webgl-layer-update.html
+
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp:
+        (WebCore::CoordinatedGraphicsScene::setLayerState):
+        (WebCore::CoordinatedGraphicsScene::assignImageBackingToLayer):
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h:
+
 2013-02-11  Eric Carlson  <[email protected]>
 
         [Mac] Track language selection should be sticky

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp (142585 => 142586)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp	2013-02-12 07:19:05 UTC (rev 142585)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp	2013-02-12 07:24:46 UTC (rev 142586)
@@ -344,7 +344,7 @@
     else
         m_fixedLayers.remove(id);
 
-    assignImageBackingToLayer(layer, layerInfo.imageID);
+    assignImageBackingToLayer(id, layer, layerInfo.imageID);
     prepareContentBackingStore(layer);
 
     // Never make the root layer clip.
@@ -526,8 +526,13 @@
     m_releasedImageBackings.append(m_imageBackings.take(imageID));
 }
 
-void CoordinatedGraphicsScene::assignImageBackingToLayer(GraphicsLayer* layer, CoordinatedImageBackingID imageID)
+void CoordinatedGraphicsScene::assignImageBackingToLayer(CoordinatedLayerID id, GraphicsLayer* layer, CoordinatedImageBackingID imageID)
 {
+#if USE(GRAPHICS_SURFACE)
+    if (m_surfaceBackingStores.contains(id))
+        return;
+#endif
+
     if (imageID == InvalidCoordinatedImageBackingID) {
         layer->setContentsToMedia(0);
         return;

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h (142585 => 142586)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h	2013-02-12 07:19:05 UTC (rev 142585)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h	2013-02-12 07:24:46 UTC (rev 142586)
@@ -162,7 +162,7 @@
     void createLayer(CoordinatedLayerID);
     void deleteLayer(CoordinatedLayerID);
 
-    void assignImageBackingToLayer(GraphicsLayer*, CoordinatedImageBackingID);
+    void assignImageBackingToLayer(CoordinatedLayerID, GraphicsLayer*, CoordinatedImageBackingID);
     void removeReleasedImageBackingsIfNeeded();
     void ensureRootLayer();
     void commitPendingBackingStoreOperations();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to