[Chromium] Incorrect opaque region tracking for PlatformContextSkia::drawRRect
authorfmalita@chromium.org <fmalita@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jan 2013 16:57:55 +0000 (16:57 +0000)
committerfmalita@chromium.org <fmalita@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jan 2013 16:57:55 +0000 (16:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=106898

Reviewed by Stephen White.

Source/WebCore:

Since drawRRect() doesn't cover the whole bounding rect, it needs to pass a didDrawBounded
notification down to the opaque region tracker (instead of didDrawRect as it currently
does).

Test: platform/chromium/compositing/rounded-corners.html

* platform/graphics/skia/PlatformContextSkia.h:
(WebCore::PlatformContextSkia::drawRRect):

Source/WebKit/chromium:

* tests/PlatformContextSkiaTest.cpp:
(WebCore::TEST):
(WebCore):

LayoutTests:

* platform/chromium-linux/platform/chromium/compositing/rounded-corners-expected.png: Added.
* platform/chromium-linux/platform/chromium/compositing/rounded-corners-expected.txt: Added.
* platform/chromium/TestExpectations:
* platform/chromium/compositing/rounded-corners.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/platform/chromium-linux/platform/chromium/compositing/rounded-corners-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux/platform/chromium/compositing/rounded-corners-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/chromium/compositing/rounded-corners.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/skia/PlatformContextSkia.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp

index a0ecfbd..4747cc1 100644 (file)
@@ -1,3 +1,15 @@
+2013-01-15  Florin Malita  <fmalita@chromium.org>
+
+        [Chromium] Incorrect opaque region tracking for PlatformContextSkia::drawRRect
+        https://bugs.webkit.org/show_bug.cgi?id=106898
+
+        Reviewed by Stephen White.
+
+        * platform/chromium-linux/platform/chromium/compositing/rounded-corners-expected.png: Added.
+        * platform/chromium-linux/platform/chromium/compositing/rounded-corners-expected.txt: Added.
+        * platform/chromium/TestExpectations:
+        * platform/chromium/compositing/rounded-corners.html: Added.
+
 2013-01-15  Vsevolod Vlasov  <vsevik@chromium.org>
 
         Unreviewed failing test skip.
diff --git a/LayoutTests/platform/chromium-linux/platform/chromium/compositing/rounded-corners-expected.png b/LayoutTests/platform/chromium-linux/platform/chromium/compositing/rounded-corners-expected.png
new file mode 100644 (file)
index 0000000..0514734
Binary files /dev/null and b/LayoutTests/platform/chromium-linux/platform/chromium/compositing/rounded-corners-expected.png differ
diff --git a/LayoutTests/platform/chromium-linux/platform/chromium/compositing/rounded-corners-expected.txt b/LayoutTests/platform/chromium-linux/platform/chromium/compositing/rounded-corners-expected.txt
new file mode 100644 (file)
index 0000000..5146ce4
--- /dev/null
@@ -0,0 +1,7 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x216
+  RenderBlock {HTML} at (0,0) size 800x216
+    RenderBody {BODY} at (8,8) size 784x200
+layer at (8,8) size 200x200
+  RenderBlock {DIV} at (0,0) size 200x200 [bgcolor=#008000]
index a85b111..5e53cb8 100644 (file)
@@ -4210,6 +4210,9 @@ webkit.org/b/104489 [ Win ] http/tests/w3c/webperf/submission/Intel/user-timing/
 webkit.org/b/104489 [ Win ] http/tests/w3c/webperf/submission/Intel/user-timing/test_user_timing_clearMarks.html [ Failure Pass ]
 webkit.org/b/104489 [ Win ] http/tests/w3c/webperf/submission/Intel/user-timing/test_user_timing_measure_associate_with_navigation_timing.html [ Failure Pass ]
 
+# Needs platform-specific results
+webkit.org/b/106898 platform/chromium/compositing/rounded-corners.html [ Pass Missing ]
+
 # Flaky since r136945
 webkit.org/b/94002 [ Win Mac Debug ] inspector/debugger/live-edit-breakpoints.html [ Failure Timeout ]
 webkit.org/b/94002 [ Mac Debug ] inspector/debugger/live-edit.html [ Crash Pass Timeout ]
diff --git a/LayoutTests/platform/chromium/compositing/rounded-corners.html b/LayoutTests/platform/chromium/compositing/rounded-corners.html
new file mode 100644 (file)
index 0000000..4a06b39
--- /dev/null
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+    <!-- Test for https://bugs.webkit.org/show_bug.cgi?id=106898 -->
+    <div style="width: 200px; height: 200px; background: green; border-radius: 25%; -webkit-transform: translateZ(0);"></div>
+</body>
+</html>
index 22df728..544c4c6 100644 (file)
@@ -1,3 +1,19 @@
+2013-01-15  Florin Malita  <fmalita@chromium.org>
+
+        [Chromium] Incorrect opaque region tracking for PlatformContextSkia::drawRRect
+        https://bugs.webkit.org/show_bug.cgi?id=106898
+
+        Reviewed by Stephen White.
+
+        Since drawRRect() doesn't cover the whole bounding rect, it needs to pass a didDrawBounded
+        notification down to the opaque region tracker (instead of didDrawRect as it currently
+        does).
+
+        Test: platform/chromium/compositing/rounded-corners.html
+
+        * platform/graphics/skia/PlatformContextSkia.h:
+        (WebCore::PlatformContextSkia::drawRRect):
+
 2013-01-15  Allan Sandfeld Jensen  <allan.jensen@digia.com>
 
         [Qt] WebGL does not require accelerated compositing
index 465a4ac..8be69f6 100644 (file)
@@ -489,7 +489,7 @@ inline void PlatformContextSkia::drawRRect(const SkRRect& rect, const SkPaint& p
     m_canvas->drawRRect(rect, paint);
 
     if (m_trackOpaqueRegion)
-        m_opaqueRegion.didDrawRect(this, rect.getBounds(), paint, 0);
+        m_opaqueRegion.didDrawBounded(this, rect.getBounds(), paint);
 }
 
 inline void PlatformContextSkia::drawPosText(const void* text, size_t byteLength,
index 0b3c270..0b30259 100644 (file)
@@ -1,3 +1,14 @@
+2013-01-15  Florin Malita  <fmalita@chromium.org>
+
+        [Chromium] Incorrect opaque region tracking for PlatformContextSkia::drawRRect
+        https://bugs.webkit.org/show_bug.cgi?id=106898
+
+        Reviewed by Stephen White.
+
+        * tests/PlatformContextSkiaTest.cpp:
+        (WebCore::TEST):
+        (WebCore):
+
 2012-12-28  Vsevolod Vlasov  <vsevik@chromium.org>
 
         Web Inspector: Support inspector file system access with isolated file system through InspectorFrontendHost.
index 529aa7f..dd320d3 100644 (file)
@@ -664,6 +664,53 @@ TEST(PlatformContextSkiaTest, trackOpaqueOvalTest)
     EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect());
 }
 
+TEST(PlatformContextSkiaTest, trackOpaqueRoundedRectTest)
+{
+    SkBitmap bitmap;
+    bitmap.setConfig(SkBitmap::kARGB_8888_Config, 200, 200);
+    bitmap.allocPixels();
+    bitmap.eraseColor(0);
+    SkCanvas canvas(bitmap);
+
+    PlatformContextSkia platformContext(&canvas);
+    platformContext.setTrackOpaqueRegion(true);
+    GraphicsContext context(&platformContext);
+
+    Color opaque(1.0f, 0.0f, 0.0f, 1.0f);
+    Color alpha(0.0f, 0.0f, 0.0f, 0.0f);
+    IntSize radii(10, 10);
+
+    EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), platformContext.opaqueRegion().asRect());
+    EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect());
+
+    context.fillRoundedRect(IntRect(10, 10, 90, 90), radii, radii, radii, radii, opaque, ColorSpaceDeviceRGB);
+    EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), platformContext.opaqueRegion().asRect());
+    EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect());
+
+    context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);
+    EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect());
+    EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect());
+
+    context.setCompositeOperation(CompositeSourceIn);
+    context.setShouldAntialias(false);
+
+    context.fillRoundedRect(IntRect(10, 10, 50, 30), radii, radii, radii, radii, opaque, ColorSpaceDeviceRGB);
+    EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect());
+    EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect());
+
+    context.fillRoundedRect(IntRect(10, 10, 30, 50), radii, radii, radii, radii, alpha, ColorSpaceDeviceRGB);
+    EXPECT_EQ_RECT(IntRect(40, 10, 60, 90), platformContext.opaqueRegion().asRect());
+    EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect());
+
+    context.fillRoundedRect(IntRect(10, 0, 50, 30), radii, radii, radii, radii, alpha, ColorSpaceDeviceRGB);
+    EXPECT_EQ_RECT(IntRect(40, 30, 60, 70), platformContext.opaqueRegion().asRect());
+    EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect());
+
+    context.fillRoundedRect(IntRect(30, 0, 70, 50), radii, radii, radii, radii, opaque, ColorSpaceDeviceRGB);
+    EXPECT_EQ_RECT(IntRect(40, 30, 60, 70), platformContext.opaqueRegion().asRect());
+    EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect());
+}
+
 TEST(PlatformContextSkiaTest, trackOpaqueIRectTest)
 {
     SkBitmap bitmap;