Title: [127790] trunk/Source/WebKit/chromium
Revision
127790
Author
[email protected]
Date
2012-09-06 15:48:43 -0700 (Thu, 06 Sep 2012)

Log Message

[chromium] Remove GraphicsContext references from ContentLayerChromiumTest
https://bugs.webkit.org/show_bug.cgi?id=96002

Reviewed by James Robinson.

This is a compositor unit test, so it shouldn't reference things
outside of the compositor like GraphicsContext. The
OpaqueRectTrackingContentLayerDelegateTest already tests opaque
tracking right at the time of paint. This test is about verifying that
transformed canvases work properly, so can just fake the opaque rect
coming back from the paint.

* tests/ContentLayerChromiumTest.cpp:
(WebKit::MockContentLayerChromiumClient::MockContentLayerChromiumClient):
(WebKit::TEST):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (127789 => 127790)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-09-06 22:23:29 UTC (rev 127789)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-09-06 22:48:43 UTC (rev 127790)
@@ -1,3 +1,21 @@
+2012-09-06  Adrienne Walker  <[email protected]>
+
+        [chromium] Remove GraphicsContext references from ContentLayerChromiumTest
+        https://bugs.webkit.org/show_bug.cgi?id=96002
+
+        Reviewed by James Robinson.
+
+        This is a compositor unit test, so it shouldn't reference things
+        outside of the compositor like GraphicsContext. The
+        OpaqueRectTrackingContentLayerDelegateTest already tests opaque
+        tracking right at the time of paint. This test is about verifying that
+        transformed canvases work properly, so can just fake the opaque rect
+        coming back from the paint.
+
+        * tests/ContentLayerChromiumTest.cpp:
+        (WebKit::MockContentLayerChromiumClient::MockContentLayerChromiumClient):
+        (WebKit::TEST):
+
 2012-09-06  Jeff Timanus  <[email protected]>
 
         [Chromium] Remove contentsScale and related logic from GraphicsLayerChromium.

Modified: trunk/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp (127789 => 127790)


--- trunk/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp	2012-09-06 22:23:29 UTC (rev 127789)
+++ trunk/Source/WebKit/chromium/tests/ContentLayerChromiumTest.cpp	2012-09-06 22:48:43 UTC (rev 127790)
@@ -30,8 +30,6 @@
 #include "CCGeometryTestUtils.h"
 #include "CCRenderingStats.h"
 #include "ContentLayerChromiumClient.h"
-#include "GraphicsContext.h"
-#include "OpaqueRectTrackingContentLayerDelegate.h"
 #include "skia/ext/platform_canvas.h"
 #include <gtest/gtest.h>
 #include <public/WebFloatRect.h>
@@ -44,49 +42,20 @@
 
 namespace {
 
-class OpaqueRectDrawingGraphicsContextPainter : public GraphicsContextPainter {
-public:
-    explicit OpaqueRectDrawingGraphicsContextPainter(const IntRect& opaqueRect, const IntRect& contentRect)
-        : m_opaqueRect(opaqueRect)
-        , m_contentRect(contentRect)
-    {
-    }
-
-    virtual ~OpaqueRectDrawingGraphicsContextPainter()
-    {
-    }
-
-    virtual void paint(GraphicsContext& context, const IntRect& clip) OVERRIDE
-    {
-        Color alpha(0, 0, 0, 0);
-        context.fillRect(m_contentRect, alpha, ColorSpaceDeviceRGB);
-
-        Color white(255, 255, 255, 255);
-        context.fillRect(m_opaqueRect, white, ColorSpaceDeviceRGB);
-    }
-
-private:
-    IntRect m_opaqueRect;
-    IntRect m_contentRect;
-};
-
 class MockContentLayerChromiumClient : public ContentLayerChromiumClient {
 public:
-    explicit MockContentLayerChromiumClient(OpaqueRectTrackingContentLayerDelegate* client)
-        : m_client(client)
+    explicit MockContentLayerChromiumClient(IntRect opaqueLayerRect)
+        : m_opaqueLayerRect(opaqueLayerRect)
     {
     }
 
-    virtual void paintContents(SkCanvas* canvas, const IntRect& clip, FloatRect& opaque) OVERRIDE
+    virtual void paintContents(SkCanvas*, const IntRect&, FloatRect& opaque) OVERRIDE
     {
-        WebFloatRect resultingOpaqueRect(opaque.x(), opaque.y(), opaque.width(), opaque.height());
-        WebRect webClipRect(clip.x(), clip.y(), clip.width(), clip.height());
-        m_client->paintContents(canvas, webClipRect, resultingOpaqueRect);
-        opaque = FloatRect(resultingOpaqueRect.x, resultingOpaqueRect.y, resultingOpaqueRect.width, resultingOpaqueRect.height);
+        opaque = FloatRect(m_opaqueLayerRect);
     }
 
 private:
-    OpaqueRectTrackingContentLayerDelegate* m_client;
+    IntRect m_opaqueLayerRect;
 };
 
 TEST(ContentLayerChromiumTest, ContentLayerPainterWithDeviceScale)
@@ -97,9 +66,7 @@
     IntRect opaqueRectInContentSpace = opaqueRectInLayerSpace;
     opaqueRectInContentSpace.scale(contentsScale);
     OwnPtr<SkCanvas> canvas = adoptPtr(skia::CreateBitmapCanvas(contentRect.width(), contentRect.height(), false));
-    OpaqueRectDrawingGraphicsContextPainter painter(opaqueRectInLayerSpace, contentRect);
-    OpaqueRectTrackingContentLayerDelegate opaqueRectTrackingContentLayerDelegate(&painter);
-    MockContentLayerChromiumClient client(&opaqueRectTrackingContentLayerDelegate);
+    MockContentLayerChromiumClient client(opaqueRectInLayerSpace);
     RefPtr<BitmapCanvasLayerTextureUpdater> updater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(&client));
 
     IntRect resultingOpaqueRect;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to