Title: [87307] trunk
Revision
87307
Author
[email protected]
Date
2011-05-25 11:45:56 -0700 (Wed, 25 May 2011)

Log Message

2011-05-25  Julien Chaffraix  <[email protected]>

        Reviewed by James Robinson.

        http://philip.html5.org/tests/canvas/suite/tests/2d.composite.uncovered.fill.source-in.html fails
        https://bugs.webkit.org/show_bug.cgi?id=39027

        And:

        - Fix LayoutTests/canvas/philip/tests/2d.composite.uncovered.fill.source-out.html
          https://bugs.webkit.org/show_bug.cgi?id=48295

        - Fix LayoutTests/canvas/philip/tests/2d.composite.uncovered.pattern.source-in.html
          https://bugs.webkit.org/show_bug.cgi?id=48304

        - Fix LayoutTests/canvas/philip/tests/2d.composite.uncovered.pattern.source-out.html
        https://bugs.webkit.org/show_bug.cgi?id=48305

        * canvas/philip/tests/2d.composite.uncovered.pattern.source-in-expected.txt:
        * canvas/philip/tests/2d.composite.uncovered.pattern.source-out-expected.txt:
        Those 2 tests need a trailing line that was added as part of this change.

        * fast/canvas/canvas-composite-alpha.html: Updated the test result to match the specification.
        The changes are fairly simple:
          - Clear up the destination rectangle as it should be always transparent now (source is transparent
            outside the source rectangle).
          - Clear the composition rectangle if source or destination is transparent.
          - Fixed the test when run in the browser.
        Validated the changes against FF and Opera (IE 9 cannot render this test).

        * platform/chromium/test_expectations.txt:
        * platform/gtk/Skipped:
        * platform/mac/Skipped:
        * platform/qt/Skipped:
        Re-enable 4 tests.
2011-05-25  Julien Chaffraix  <[email protected]>

        Reviewed by James Robinson.

        http://philip.html5.org/tests/canvas/suite/tests/2d.composite.uncovered.fill.source-in.html fails
        https://bugs.webkit.org/show_bug.cgi?id=39027

        And:

        - Fix LayoutTests/canvas/philip/tests/2d.composite.uncovered.fill.source-out.html
          https://bugs.webkit.org/show_bug.cgi?id=48295

        - Fix LayoutTests/canvas/philip/tests/2d.composite.uncovered.pattern.source-in.html
          https://bugs.webkit.org/show_bug.cgi?id=48304

        - Fix LayoutTests/canvas/philip/tests/2d.composite.uncovered.pattern.source-out.html
        https://bugs.webkit.org/show_bug.cgi?id=48305

        Those 4 tests have the same root cause for failing. Instead of splitting them in 2 fixes, I squashed
        them together as the fix is common.

        Based on an older work by Ariya Hidayat.

        * html/canvas/CanvasRenderingContext2D.cpp:
        (WebCore::CanvasRenderingContext2D::fill):
        (WebCore::CanvasRenderingContext2D::fillRect): Added call displayTransparencyEverywhere for those 2
        cases if we have to.

        (WebCore::CanvasRenderingContext2D::shouldDisplayTransparencyEverywhere): This method returns true if
        the spec says to display transparency everywhere. We only do so for source-in and source-out for now.
        (WebCore::CanvasRenderingContext2D::displayTransparencyEverywhere): This method implements the spec
        (which matches other browsers' behavior) and "display transparency elsewhere".

        * html/canvas/CanvasRenderingContext2D.h: Added the two previous methods.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (87306 => 87307)


--- trunk/LayoutTests/ChangeLog	2011-05-25 17:58:48 UTC (rev 87306)
+++ trunk/LayoutTests/ChangeLog	2011-05-25 18:45:56 UTC (rev 87307)
@@ -1,3 +1,39 @@
+2011-05-25  Julien Chaffraix  <[email protected]>
+
+        Reviewed by James Robinson.
+
+        http://philip.html5.org/tests/canvas/suite/tests/2d.composite.uncovered.fill.source-in.html fails
+        https://bugs.webkit.org/show_bug.cgi?id=39027
+
+        And:
+
+        - Fix LayoutTests/canvas/philip/tests/2d.composite.uncovered.fill.source-out.html
+          https://bugs.webkit.org/show_bug.cgi?id=48295
+
+        - Fix LayoutTests/canvas/philip/tests/2d.composite.uncovered.pattern.source-in.html
+          https://bugs.webkit.org/show_bug.cgi?id=48304
+
+        - Fix LayoutTests/canvas/philip/tests/2d.composite.uncovered.pattern.source-out.html
+        https://bugs.webkit.org/show_bug.cgi?id=48305
+
+        * canvas/philip/tests/2d.composite.uncovered.pattern.source-in-expected.txt:
+        * canvas/philip/tests/2d.composite.uncovered.pattern.source-out-expected.txt:
+        Those 2 tests need a trailing line that was added as part of this change.
+
+        * fast/canvas/canvas-composite-alpha.html: Updated the test result to match the specification.
+        The changes are fairly simple:
+          - Clear up the destination rectangle as it should be always transparent now (source is transparent
+            outside the source rectangle).
+          - Clear the composition rectangle if source or destination is transparent.
+          - Fixed the test when run in the browser.
+        Validated the changes against FF and Opera (IE 9 cannot render this test).
+
+        * platform/chromium/test_expectations.txt:
+        * platform/gtk/Skipped:
+        * platform/mac/Skipped:
+        * platform/qt/Skipped:
+        Re-enable 4 tests.
+
 2011-05-20  Robert Hogan  <[email protected]>
 
         Reviewed by Geoffrey Garen.

Modified: trunk/LayoutTests/canvas/philip/tests/2d.composite.uncovered.pattern.source-in-expected.txt (87306 => 87307)


--- trunk/LayoutTests/canvas/philip/tests/2d.composite.uncovered.pattern.source-in-expected.txt	2011-05-25 17:58:48 UTC (rev 87306)
+++ trunk/LayoutTests/canvas/philip/tests/2d.composite.uncovered.pattern.source-in-expected.txt	2011-05-25 18:45:56 UTC (rev 87307)
@@ -1 +1,2 @@
 Passed
+

Modified: trunk/LayoutTests/canvas/philip/tests/2d.composite.uncovered.pattern.source-out-expected.txt (87306 => 87307)


--- trunk/LayoutTests/canvas/philip/tests/2d.composite.uncovered.pattern.source-out-expected.txt	2011-05-25 17:58:48 UTC (rev 87306)
+++ trunk/LayoutTests/canvas/philip/tests/2d.composite.uncovered.pattern.source-out-expected.txt	2011-05-25 18:45:56 UTC (rev 87307)
@@ -1 +1,2 @@
 Passed
+

Modified: trunk/LayoutTests/fast/canvas/canvas-composite-alpha.html (87306 => 87307)


--- trunk/LayoutTests/fast/canvas/canvas-composite-alpha.html	2011-05-25 17:58:48 UTC (rev 87306)
+++ trunk/LayoutTests/fast/canvas/canvas-composite-alpha.html	2011-05-25 18:45:56 UTC (rev 87307)
@@ -49,38 +49,38 @@
               { source: [255, 0, 255, 191], composition: [219, 35, 255, 222], destination: [0, 255, 255, 127] }
           ],
           [
-              { source: [0, 0, 0, 0], composition: [255, 0, 0, 255], destination: [0, 255, 0, 255] },
+              { source: [0, 0, 0, 0], composition: [255, 0, 0, 255], destination: [0, 0, 0, 0] },
               { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
-              { source: [0, 0, 0, 0], composition: [255, 0, 0, 1], destination: [0, 255, 0, 1] },
-              { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [255, 0, 0, 255] },
-              { source: [0, 0, 0, 0], composition: [0, 255, 0, 1], destination: [255, 0, 0, 255] },
-              { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [0, 255, 0, 255] },
-              { source: [0, 0, 0, 0], composition: [255, 0, 0, 64], destination: [0, 255, 0, 127] },
-              { source: [0, 0, 0, 0], composition: [255, 0, 0, 127], destination: [0, 255, 0, 127] },
-              { source: [0, 0, 0, 0], composition: [255, 0, 0, 127], destination: [0, 255, 0, 255] },
-              { source: [0, 0, 0, 0], composition: [128, 0, 0, 127], destination: [0, 126, 0, 127] },
-              { source: [0, 0, 0, 0], composition: [126, 0, 0, 127], destination: [0, 127, 0, 255] },
-              { source: [0, 0, 0, 0], composition: [255, 0, 0, 32], destination: [255, 0, 0, 63] },
-              { source: [0, 0, 0, 0], composition: [255, 127, 0, 8], destination: [255, 64, 0, 63] },
-              { source: [0, 0, 0, 0], composition: [255, 0, 0, 96], destination: [0, 255, 0, 127] },
-              { source: [0, 0, 0, 0], composition: [255, 0, 255, 96], destination: [0, 255, 255, 127] }
+              { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
+              { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
+              { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
+              { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
+              { source: [0, 0, 0, 0], composition: [255, 0, 0, 64], destination: [0, 0, 0, 0] },
+              { source: [0, 0, 0, 0], composition: [255, 0, 0, 127], destination: [0, 0, 0, 0] },
+              { source: [0, 0, 0, 0], composition: [255, 0, 0, 127], destination: [0, 0, 0, 0] },
+              { source: [0, 0, 0, 0], composition: [128, 0, 0, 127], destination: [0, 0, 0, 0] },
+              { source: [0, 0, 0, 0], composition: [126, 0, 0, 127], destination: [0, 0, 0, 0] },
+              { source: [0, 0, 0, 0], composition: [255, 0, 0, 32], destination: [0, 0, 0, 0] },
+              { source: [0, 0, 0, 0], composition: [255, 127, 0, 8], destination: [0, 0, 0, 0] },
+              { source: [0, 0, 0, 0], composition: [255, 0, 0, 96], destination: [0, 0, 0, 0] },
+              { source: [0, 0, 0, 0], composition: [255, 0, 255, 96], destination: [0, 0, 0, 0] }
           ],
           [
-              { source: [255, 0, 0, 255], composition: [0, 0, 0, 0], destination: [0, 255, 0, 255] },
+              { source: [255, 0, 0, 255], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
               { source: [255, 0, 0, 255], composition: [255, 0, 0, 255], destination: [0, 0, 0, 0] },
-              { source: [255, 0, 0, 255], composition: [255, 0, 0, 254], destination: [0, 255, 0, 1] },
-              { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [255, 0, 0, 255] },
-              { source: [0, 255, 0, 1], composition: [0, 0, 0, 0], destination: [255, 0, 0, 255] },
-              { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [0, 255, 0, 255] },
-              { source: [255, 0, 0, 127], composition: [255, 0, 0, 64], destination: [0, 255, 0, 127] },
-              { source: [255, 0, 0, 255], composition: [255, 0, 0, 128], destination: [0, 255, 0, 127] },
-              { source: [255, 0, 0, 127], composition: [0, 0, 0, 0], destination: [0, 255, 0, 255] },
-              { source: [127, 0, 0, 255], composition: [127, 0, 0, 128], destination: [0, 126, 0, 127] },
-              { source: [126, 0, 0, 127], composition: [0, 0, 0, 0], destination: [0, 127, 0, 255] },
-              { source: [255, 0, 0, 127], composition: [255, 0, 0, 96], destination: [255, 0, 0, 63] },
-              { source: [255, 127, 0, 32], composition: [255, 132, 0, 25], destination: [255, 64, 0, 63] },
-              { source: [255, 0, 0, 191], composition: [255, 0, 0, 96], destination: [0, 255, 0, 127] },
-              { source: [255, 0, 255, 191], composition: [255, 0, 255, 96], destination: [0, 255, 255, 127] }
+              { source: [255, 0, 0, 255], composition: [255, 0, 0, 254], destination: [0, 0, 0, 0] },
+              { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
+              { source: [0, 255, 0, 1], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
+              { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
+              { source: [255, 0, 0, 127], composition: [255, 0, 0, 64], destination: [0, 0, 0, 0] },
+              { source: [255, 0, 0, 255], composition: [255, 0, 0, 128], destination: [0, 0, 0, 0] },
+              { source: [255, 0, 0, 127], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
+              { source: [127, 0, 0, 255], composition: [127, 0, 0, 128], destination: [0, 0, 0, 0] },
+              { source: [126, 0, 0, 127], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
+              { source: [255, 0, 0, 127], composition: [255, 0, 0, 96], destination: [0, 0, 0, 0] },
+              { source: [255, 127, 0, 32], composition: [255, 132, 0, 25], destination: [0, 0, 0, 0] },
+              { source: [255, 0, 0, 191], composition: [255, 0, 0, 96], destination: [0, 0, 0, 0] },
+              { source: [255, 0, 255, 191], composition: [255, 0, 255, 96], destination: [0, 0, 0, 0] }
           ],
           [
               { source: [0, 0, 0, 0], composition: [255, 0, 0, 255], destination: [0, 255, 0, 255] },
@@ -433,7 +433,8 @@
       {
           drawTable(useFillRect);
           drawTable(usePathAndFill);
-          layoutTestController.notifyDone();
+          if (window.layoutTestController)
+              layoutTestController.notifyDone();
       }
     </script>
     <style type="text/css">

Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (87306 => 87307)


--- trunk/LayoutTests/platform/chromium/test_expectations.txt	2011-05-25 17:58:48 UTC (rev 87306)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt	2011-05-25 18:45:56 UTC (rev 87307)
@@ -2004,8 +2004,6 @@
 BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.fill.copy.html = TEXT
 BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.fill.destination-atop.html = TEXT
 BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.fill.destination-in.html = TEXT
-BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.fill.source-in.html = TEXT
-BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.fill.source-out.html = TEXT
 BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.image.copy.html = TEXT
 BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.image.destination-atop.html = TEXT
 BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.image.destination-in.html = TEXT
@@ -2014,8 +2012,6 @@
 BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.pattern.copy.html = TEXT
 BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.pattern.destination-atop.html = TEXT
 BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.pattern.destination-in.html = TEXT
-BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.pattern.source-in.html = TEXT
-BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.pattern.source-out.html = TEXT
 BUGWK39168 : canvas/philip/tests/2d.fillStyle.parse.system.html = TEXT
 BUGWK45991 : canvas/philip/tests/2d.pattern.image.undefined.html = TEXT
 BUGWK45991 : canvas/philip/tests/2d.text.draw.baseline.bottom.html = TEXT

Modified: trunk/LayoutTests/platform/gtk/Skipped (87306 => 87307)


--- trunk/LayoutTests/platform/gtk/Skipped	2011-05-25 17:58:48 UTC (rev 87306)
+++ trunk/LayoutTests/platform/gtk/Skipped	2011-05-25 18:45:56 UTC (rev 87307)
@@ -1001,8 +1001,6 @@
 canvas/philip/tests/2d.composite.uncovered.fill.copy.html
 canvas/philip/tests/2d.composite.uncovered.fill.destination-atop.html
 canvas/philip/tests/2d.composite.uncovered.fill.destination-in.html
-canvas/philip/tests/2d.composite.uncovered.fill.source-in.html
-canvas/philip/tests/2d.composite.uncovered.fill.source-out.html
 canvas/philip/tests/2d.composite.uncovered.image.copy.html
 canvas/philip/tests/2d.composite.uncovered.image.destination-atop.html
 canvas/philip/tests/2d.composite.uncovered.image.destination-in.html
@@ -1011,8 +1009,6 @@
 canvas/philip/tests/2d.composite.uncovered.pattern.copy.html
 canvas/philip/tests/2d.composite.uncovered.pattern.destination-atop.html
 canvas/philip/tests/2d.composite.uncovered.pattern.destination-in.html
-canvas/philip/tests/2d.composite.uncovered.pattern.source-in.html
-canvas/philip/tests/2d.composite.uncovered.pattern.source-out.html
 canvas/philip/tests/2d.drawImage.broken.html
 canvas/philip/tests/2d.imageData.create1.type.html
 canvas/philip/tests/2d.imageData.create2.type.html

Modified: trunk/LayoutTests/platform/mac/Skipped (87306 => 87307)


--- trunk/LayoutTests/platform/mac/Skipped	2011-05-25 17:58:48 UTC (rev 87306)
+++ trunk/LayoutTests/platform/mac/Skipped	2011-05-25 18:45:56 UTC (rev 87307)
@@ -157,8 +157,6 @@
 canvas/philip/tests/2d.composite.uncovered.fill.copy.html
 canvas/philip/tests/2d.composite.uncovered.fill.destination-atop.html
 canvas/philip/tests/2d.composite.uncovered.fill.destination-in.html
-canvas/philip/tests/2d.composite.uncovered.fill.source-in.html
-canvas/philip/tests/2d.composite.uncovered.fill.source-out.html
 canvas/philip/tests/2d.composite.uncovered.image.copy.html
 canvas/philip/tests/2d.composite.uncovered.image.destination-atop.html
 canvas/philip/tests/2d.composite.uncovered.image.destination-in.html
@@ -167,8 +165,6 @@
 canvas/philip/tests/2d.composite.uncovered.pattern.copy.html
 canvas/philip/tests/2d.composite.uncovered.pattern.destination-atop.html
 canvas/philip/tests/2d.composite.uncovered.pattern.destination-in.html
-canvas/philip/tests/2d.composite.uncovered.pattern.source-in.html
-canvas/philip/tests/2d.composite.uncovered.pattern.source-out.html
 canvas/philip/tests/2d.imageData.object.round.html
 canvas/philip/tests/2d.imageData.object.wrap.html
 

Modified: trunk/LayoutTests/platform/qt/Skipped (87306 => 87307)


--- trunk/LayoutTests/platform/qt/Skipped	2011-05-25 17:58:48 UTC (rev 87306)
+++ trunk/LayoutTests/platform/qt/Skipped	2011-05-25 18:45:56 UTC (rev 87307)
@@ -1820,8 +1820,6 @@
 canvas/philip/tests/2d.composite.uncovered.fill.copy.html
 canvas/philip/tests/2d.composite.uncovered.fill.destination-atop.html
 canvas/philip/tests/2d.composite.uncovered.fill.destination-in.html
-canvas/philip/tests/2d.composite.uncovered.fill.source-in.html
-canvas/philip/tests/2d.composite.uncovered.fill.source-out.html
 canvas/philip/tests/2d.composite.uncovered.image.copy.html
 canvas/philip/tests/2d.composite.uncovered.image.destination-atop.html
 canvas/philip/tests/2d.composite.uncovered.image.destination-in.html
@@ -1830,8 +1828,6 @@
 canvas/philip/tests/2d.composite.uncovered.pattern.copy.html
 canvas/philip/tests/2d.composite.uncovered.pattern.destination-atop.html
 canvas/philip/tests/2d.composite.uncovered.pattern.destination-in.html
-canvas/philip/tests/2d.composite.uncovered.pattern.source-in.html
-canvas/philip/tests/2d.composite.uncovered.pattern.source-out.html
 canvas/philip/tests/2d.drawImage.broken.html
 canvas/philip/tests/2d.gradient.radial.cone.behind.html
 canvas/philip/tests/2d.gradient.radial.cone.beside.html

Modified: trunk/Source/WebCore/ChangeLog (87306 => 87307)


--- trunk/Source/WebCore/ChangeLog	2011-05-25 17:58:48 UTC (rev 87306)
+++ trunk/Source/WebCore/ChangeLog	2011-05-25 18:45:56 UTC (rev 87307)
@@ -1,3 +1,38 @@
+2011-05-25  Julien Chaffraix  <[email protected]>
+
+        Reviewed by James Robinson.
+
+        http://philip.html5.org/tests/canvas/suite/tests/2d.composite.uncovered.fill.source-in.html fails
+        https://bugs.webkit.org/show_bug.cgi?id=39027
+
+        And:
+
+        - Fix LayoutTests/canvas/philip/tests/2d.composite.uncovered.fill.source-out.html
+          https://bugs.webkit.org/show_bug.cgi?id=48295
+
+        - Fix LayoutTests/canvas/philip/tests/2d.composite.uncovered.pattern.source-in.html
+          https://bugs.webkit.org/show_bug.cgi?id=48304
+
+        - Fix LayoutTests/canvas/philip/tests/2d.composite.uncovered.pattern.source-out.html
+        https://bugs.webkit.org/show_bug.cgi?id=48305
+
+        Those 4 tests have the same root cause for failing. Instead of splitting them in 2 fixes, I squashed
+        them together as the fix is common.
+
+        Based on an older work by Ariya Hidayat.
+
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::fill):
+        (WebCore::CanvasRenderingContext2D::fillRect): Added call displayTransparencyEverywhere for those 2
+        cases if we have to.
+
+        (WebCore::CanvasRenderingContext2D::shouldDisplayTransparencyEverywhere): This method returns true if
+        the spec says to display transparency everywhere. We only do so for source-in and source-out for now.
+        (WebCore::CanvasRenderingContext2D::displayTransparencyEverywhere): This method implements the spec
+        (which matches other browsers' behavior) and "display transparency elsewhere".
+
+        * html/canvas/CanvasRenderingContext2D.h: Added the two previous methods.
+
 2011-05-25  Levi Weintraub  <[email protected]>
 
         Reviewed by Eric Seidel.

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (87306 => 87307)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2011-05-25 17:58:48 UTC (rev 87306)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2011-05-25 18:45:56 UTC (rev 87307)
@@ -940,6 +940,9 @@
         return;
 
     if (!m_path.isEmpty()) {
+        if (shouldDisplayTransparencyElsewhere())
+            displayTransparencyElsewhere<Path>(m_path);
+
         c->fillPath(m_path);
         didDraw(m_path.boundingRect());
     }
@@ -1044,6 +1047,9 @@
 
     FloatRect rect(x, y, width, height);
 
+    if (shouldDisplayTransparencyElsewhere())
+        displayTransparencyElsewhere<IntRect>(enclosingIntRect(rect));
+
     c->fillRect(rect);
     didDraw(rect);
 }
@@ -1490,6 +1496,28 @@
     setGlobalCompositeOperation(operation);
 }
 
+bool CanvasRenderingContext2D::shouldDisplayTransparencyElsewhere() const
+{
+    // See 4.8.11.1.3 Compositing
+    // CompositeSourceAtop is not listed here as the platforms already implement the specification's behavior.
+    return state().m_globalComposite == CompositeSourceIn || state().m_globalComposite == CompositeSourceOut;
+}
+
+template<class T> void CanvasRenderingContext2D::displayTransparencyElsewhere(const T& area)
+{
+    ASSERT(shouldDisplayTransparencyElsewhere());
+
+    FloatRect canvasRect(0, 0, canvas()->width(), canvas()->height());
+    canvasRect = state().m_transform.inverse().mapRect(canvasRect);
+
+    GraphicsContext* c = drawingContext();
+    c->save();
+    c->clipOut(area);
+    c->setCompositeOperation(CompositeClear);
+    c->fillRect(canvasRect);
+    c->restore();
+}
+
 void CanvasRenderingContext2D::prepareGradientForDashboard(CanvasGradient* gradient) const
 {
 #if ENABLE(DASHBOARD_SUPPORT)

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h (87306 => 87307)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h	2011-05-25 17:58:48 UTC (rev 87306)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h	2011-05-25 18:45:56 UTC (rev 87307)
@@ -292,6 +292,9 @@
     void clearPathForDashboardBackwardCompatibilityMode();
 #endif
 
+    bool shouldDisplayTransparencyElsewhere() const;
+    template<class T> void displayTransparencyElsewhere(const T& area);
+
     void prepareGradientForDashboard(CanvasGradient* gradient) const;
 
     Vector<State, 1> m_stateStack;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to