Drawing to accelerated 2D canvas causes compositor to recompute layer tree
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jul 2012 17:47:34 +0000 (17:47 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jul 2012 17:47:34 +0000 (17:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90630

Patch by Justin Novosad <junov@chromium.org> on 2012-07-06
Reviewed by Simon Fraser.

No new tests: covered by existing canvas/compositing layout tests

Before this change, there was no distinction between canvas changes
that require recomputing the compositor tree and canvas changes that
only require re-display. The new CanvasPixelsChanged member of enum
ContentChangeType requests re-display without re-layout.

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::didDraw):
* rendering/RenderBoxModelObject.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::contentChanged):

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

Source/WebCore/ChangeLog
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/rendering/RenderBoxModelObject.h
Source/WebCore/rendering/RenderLayerBacking.cpp

index 7bca590..539062d 100644 (file)
@@ -1,3 +1,23 @@
+2012-07-06  Justin Novosad  <junov@chromium.org>
+
+        Drawing to accelerated 2D canvas causes compositor to recompute layer tree
+        https://bugs.webkit.org/show_bug.cgi?id=90630
+
+        Reviewed by Simon Fraser.
+
+        No new tests: covered by existing canvas/compositing layout tests
+
+        Before this change, there was no distinction between canvas changes
+        that require recomputing the compositor tree and canvas changes that
+        only require re-display. The new CanvasPixelsChanged member of enum
+        ContentChangeType requests re-display without re-layout.
+
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::didDraw):
+        * rendering/RenderBoxModelObject.h:
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::contentChanged):
+
 2012-07-06  Pavel Feldman  <pfeldman@chromium.org>
 
         Web Inspector: get rid of this._lastMarkedRange in TextEditor.
index c65af24..aced0bd 100644 (file)
@@ -1768,7 +1768,7 @@ void CanvasRenderingContext2D::didDraw(const FloatRect& r, unsigned options)
     if (isAccelerated()) {
         RenderBox* renderBox = canvas()->renderBox();
         if (renderBox && renderBox->hasAcceleratedCompositing()) {
-            renderBox->contentChanged(CanvasChanged);
+            renderBox->contentChanged(CanvasPixelsChanged);
             canvas()->clearCopiedImage();
             return;
         }
index b14f53d..067f604 100644 (file)
@@ -44,6 +44,7 @@ enum ContentChangeType {
     ImageChanged,
     MaskImageChanged,
     CanvasChanged,
+    CanvasPixelsChanged,
     VideoChanged,
     FullScreenChanged
 };
index 7507323..1b6ea19 100644 (file)
@@ -1033,7 +1033,7 @@ void RenderLayerBacking::contentChanged(ContentChangeType changeType)
     }
 
 #if ENABLE(WEBGL) || ENABLE(ACCELERATED_2D_CANVAS)
-    if ((changeType == CanvasChanged) && isAcceleratedCanvas(renderer())) {
+    if ((changeType == CanvasChanged || changeType == CanvasPixelsChanged) && isAcceleratedCanvas(renderer())) {
         m_graphicsLayer->setContentsNeedsDisplay();
         return;
     }