Changeset 87307 in webkit


Ignore:
Timestamp:
May 25, 2011 11:45:56 AM (13 years ago)
Author:
jchaffraix@webkit.org
Message:

2011-05-25 Julien Chaffraix <jchaffraix@codeaurora.org>

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:

  • 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 <jchaffraix@codeaurora.org>

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:

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.
Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r87306 r87307  
     12011-05-25  Julien Chaffraix  <jchaffraix@codeaurora.org>
     2
     3        Reviewed by James Robinson.
     4
     5        http://philip.html5.org/tests/canvas/suite/tests/2d.composite.uncovered.fill.source-in.html fails
     6        https://bugs.webkit.org/show_bug.cgi?id=39027
     7
     8        And:
     9
     10        - Fix LayoutTests/canvas/philip/tests/2d.composite.uncovered.fill.source-out.html
     11          https://bugs.webkit.org/show_bug.cgi?id=48295
     12
     13        - Fix LayoutTests/canvas/philip/tests/2d.composite.uncovered.pattern.source-in.html
     14          https://bugs.webkit.org/show_bug.cgi?id=48304
     15
     16        - Fix LayoutTests/canvas/philip/tests/2d.composite.uncovered.pattern.source-out.html
     17        https://bugs.webkit.org/show_bug.cgi?id=48305
     18
     19        * canvas/philip/tests/2d.composite.uncovered.pattern.source-in-expected.txt:
     20        * canvas/philip/tests/2d.composite.uncovered.pattern.source-out-expected.txt:
     21        Those 2 tests need a trailing line that was added as part of this change.
     22
     23        * fast/canvas/canvas-composite-alpha.html: Updated the test result to match the specification.
     24        The changes are fairly simple:
     25          - Clear up the destination rectangle as it should be always transparent now (source is transparent
     26            outside the source rectangle).
     27          - Clear the composition rectangle if source or destination is transparent.
     28          - Fixed the test when run in the browser.
     29        Validated the changes against FF and Opera (IE 9 cannot render this test).
     30
     31        * platform/chromium/test_expectations.txt:
     32        * platform/gtk/Skipped:
     33        * platform/mac/Skipped:
     34        * platform/qt/Skipped:
     35        Re-enable 4 tests.
     36
    1372011-05-20  Robert Hogan  <robert@webkit.org>
    238
  • trunk/LayoutTests/canvas/philip/tests/2d.composite.uncovered.pattern.source-in-expected.txt

    r71481 r87307  
    11Passed
     2
  • trunk/LayoutTests/canvas/philip/tests/2d.composite.uncovered.pattern.source-out-expected.txt

    r71481 r87307  
    11Passed
     2
  • trunk/LayoutTests/fast/canvas/canvas-composite-alpha.html

    r44041 r87307  
    5050          ],
    5151          [
    52               { source: [0, 0, 0, 0], composition: [255, 0, 0, 255], destination: [0, 255, 0, 255] },
    53               { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
    54               { source: [0, 0, 0, 0], composition: [255, 0, 0, 1], destination: [0, 255, 0, 1] },
    55               { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [255, 0, 0, 255] },
    56               { source: [0, 0, 0, 0], composition: [0, 255, 0, 1], destination: [255, 0, 0, 255] },
    57               { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [0, 255, 0, 255] },
    58               { source: [0, 0, 0, 0], composition: [255, 0, 0, 64], destination: [0, 255, 0, 127] },
    59               { source: [0, 0, 0, 0], composition: [255, 0, 0, 127], destination: [0, 255, 0, 127] },
    60               { source: [0, 0, 0, 0], composition: [255, 0, 0, 127], destination: [0, 255, 0, 255] },
    61               { source: [0, 0, 0, 0], composition: [128, 0, 0, 127], destination: [0, 126, 0, 127] },
    62               { source: [0, 0, 0, 0], composition: [126, 0, 0, 127], destination: [0, 127, 0, 255] },
    63               { source: [0, 0, 0, 0], composition: [255, 0, 0, 32], destination: [255, 0, 0, 63] },
    64               { source: [0, 0, 0, 0], composition: [255, 127, 0, 8], destination: [255, 64, 0, 63] },
    65               { source: [0, 0, 0, 0], composition: [255, 0, 0, 96], destination: [0, 255, 0, 127] },
    66               { source: [0, 0, 0, 0], composition: [255, 0, 255, 96], destination: [0, 255, 255, 127] }
    67           ],
    68           [
    69               { source: [255, 0, 0, 255], composition: [0, 0, 0, 0], destination: [0, 255, 0, 255] },
    70               { source: [255, 0, 0, 255], composition: [255, 0, 0, 255], destination: [0, 0, 0, 0] },
    71               { source: [255, 0, 0, 255], composition: [255, 0, 0, 254], destination: [0, 255, 0, 1] },
    72               { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [255, 0, 0, 255] },
    73               { source: [0, 255, 0, 1], composition: [0, 0, 0, 0], destination: [255, 0, 0, 255] },
    74               { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [0, 255, 0, 255] },
    75               { source: [255, 0, 0, 127], composition: [255, 0, 0, 64], destination: [0, 255, 0, 127] },
    76               { source: [255, 0, 0, 255], composition: [255, 0, 0, 128], destination: [0, 255, 0, 127] },
    77               { source: [255, 0, 0, 127], composition: [0, 0, 0, 0], destination: [0, 255, 0, 255] },
    78               { source: [127, 0, 0, 255], composition: [127, 0, 0, 128], destination: [0, 126, 0, 127] },
    79               { source: [126, 0, 0, 127], composition: [0, 0, 0, 0], destination: [0, 127, 0, 255] },
    80               { source: [255, 0, 0, 127], composition: [255, 0, 0, 96], destination: [255, 0, 0, 63] },
    81               { source: [255, 127, 0, 32], composition: [255, 132, 0, 25], destination: [255, 64, 0, 63] },
    82               { source: [255, 0, 0, 191], composition: [255, 0, 0, 96], destination: [0, 255, 0, 127] },
    83               { source: [255, 0, 255, 191], composition: [255, 0, 255, 96], destination: [0, 255, 255, 127] }
     52              { source: [0, 0, 0, 0], composition: [255, 0, 0, 255], destination: [0, 0, 0, 0] },
     53              { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
     54              { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
     55              { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
     56              { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
     57              { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
     58              { source: [0, 0, 0, 0], composition: [255, 0, 0, 64], destination: [0, 0, 0, 0] },
     59              { source: [0, 0, 0, 0], composition: [255, 0, 0, 127], destination: [0, 0, 0, 0] },
     60              { source: [0, 0, 0, 0], composition: [255, 0, 0, 127], destination: [0, 0, 0, 0] },
     61              { source: [0, 0, 0, 0], composition: [128, 0, 0, 127], destination: [0, 0, 0, 0] },
     62              { source: [0, 0, 0, 0], composition: [126, 0, 0, 127], destination: [0, 0, 0, 0] },
     63              { source: [0, 0, 0, 0], composition: [255, 0, 0, 32], destination: [0, 0, 0, 0] },
     64              { source: [0, 0, 0, 0], composition: [255, 127, 0, 8], destination: [0, 0, 0, 0] },
     65              { source: [0, 0, 0, 0], composition: [255, 0, 0, 96], destination: [0, 0, 0, 0] },
     66              { source: [0, 0, 0, 0], composition: [255, 0, 255, 96], destination: [0, 0, 0, 0] }
     67          ],
     68          [
     69              { source: [255, 0, 0, 255], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
     70              { source: [255, 0, 0, 255], composition: [255, 0, 0, 255], destination: [0, 0, 0, 0] },
     71              { source: [255, 0, 0, 255], composition: [255, 0, 0, 254], destination: [0, 0, 0, 0] },
     72              { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
     73              { source: [0, 255, 0, 1], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
     74              { source: [0, 0, 0, 0], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
     75              { source: [255, 0, 0, 127], composition: [255, 0, 0, 64], destination: [0, 0, 0, 0] },
     76              { source: [255, 0, 0, 255], composition: [255, 0, 0, 128], destination: [0, 0, 0, 0] },
     77              { source: [255, 0, 0, 127], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
     78              { source: [127, 0, 0, 255], composition: [127, 0, 0, 128], destination: [0, 0, 0, 0] },
     79              { source: [126, 0, 0, 127], composition: [0, 0, 0, 0], destination: [0, 0, 0, 0] },
     80              { source: [255, 0, 0, 127], composition: [255, 0, 0, 96], destination: [0, 0, 0, 0] },
     81              { source: [255, 127, 0, 32], composition: [255, 132, 0, 25], destination: [0, 0, 0, 0] },
     82              { source: [255, 0, 0, 191], composition: [255, 0, 0, 96], destination: [0, 0, 0, 0] },
     83              { source: [255, 0, 255, 191], composition: [255, 0, 255, 96], destination: [0, 0, 0, 0] }
    8484          ],
    8585          [
     
    434434          drawTable(useFillRect);
    435435          drawTable(usePathAndFill);
    436           layoutTestController.notifyDone();
     436          if (window.layoutTestController)
     437              layoutTestController.notifyDone();
    437438      }
    438439    </script>
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r87306 r87307  
    20052005BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.fill.destination-atop.html = TEXT
    20062006BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.fill.destination-in.html = TEXT
    2007 BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.fill.source-in.html = TEXT
    2008 BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.fill.source-out.html = TEXT
    20092007BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.image.copy.html = TEXT
    20102008BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.image.destination-atop.html = TEXT
     
    20152013BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.pattern.destination-atop.html = TEXT
    20162014BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.pattern.destination-in.html = TEXT
    2017 BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.pattern.source-in.html = TEXT
    2018 BUGWK39177 : canvas/philip/tests/2d.composite.uncovered.pattern.source-out.html = TEXT
    20192015BUGWK39168 : canvas/philip/tests/2d.fillStyle.parse.system.html = TEXT
    20202016BUGWK45991 : canvas/philip/tests/2d.pattern.image.undefined.html = TEXT
  • trunk/LayoutTests/platform/gtk/Skipped

    r87306 r87307  
    10021002canvas/philip/tests/2d.composite.uncovered.fill.destination-atop.html
    10031003canvas/philip/tests/2d.composite.uncovered.fill.destination-in.html
    1004 canvas/philip/tests/2d.composite.uncovered.fill.source-in.html
    1005 canvas/philip/tests/2d.composite.uncovered.fill.source-out.html
    10061004canvas/philip/tests/2d.composite.uncovered.image.copy.html
    10071005canvas/philip/tests/2d.composite.uncovered.image.destination-atop.html
     
    10121010canvas/philip/tests/2d.composite.uncovered.pattern.destination-atop.html
    10131011canvas/philip/tests/2d.composite.uncovered.pattern.destination-in.html
    1014 canvas/philip/tests/2d.composite.uncovered.pattern.source-in.html
    1015 canvas/philip/tests/2d.composite.uncovered.pattern.source-out.html
    10161012canvas/philip/tests/2d.drawImage.broken.html
    10171013canvas/philip/tests/2d.imageData.create1.type.html
  • trunk/LayoutTests/platform/mac/Skipped

    r87274 r87307  
    158158canvas/philip/tests/2d.composite.uncovered.fill.destination-atop.html
    159159canvas/philip/tests/2d.composite.uncovered.fill.destination-in.html
    160 canvas/philip/tests/2d.composite.uncovered.fill.source-in.html
    161 canvas/philip/tests/2d.composite.uncovered.fill.source-out.html
    162160canvas/philip/tests/2d.composite.uncovered.image.copy.html
    163161canvas/philip/tests/2d.composite.uncovered.image.destination-atop.html
     
    168166canvas/philip/tests/2d.composite.uncovered.pattern.destination-atop.html
    169167canvas/philip/tests/2d.composite.uncovered.pattern.destination-in.html
    170 canvas/philip/tests/2d.composite.uncovered.pattern.source-in.html
    171 canvas/philip/tests/2d.composite.uncovered.pattern.source-out.html
    172168canvas/philip/tests/2d.imageData.object.round.html
    173169canvas/philip/tests/2d.imageData.object.wrap.html
  • trunk/LayoutTests/platform/qt/Skipped

    r87306 r87307  
    18211821canvas/philip/tests/2d.composite.uncovered.fill.destination-atop.html
    18221822canvas/philip/tests/2d.composite.uncovered.fill.destination-in.html
    1823 canvas/philip/tests/2d.composite.uncovered.fill.source-in.html
    1824 canvas/philip/tests/2d.composite.uncovered.fill.source-out.html
    18251823canvas/philip/tests/2d.composite.uncovered.image.copy.html
    18261824canvas/philip/tests/2d.composite.uncovered.image.destination-atop.html
     
    18311829canvas/philip/tests/2d.composite.uncovered.pattern.destination-atop.html
    18321830canvas/philip/tests/2d.composite.uncovered.pattern.destination-in.html
    1833 canvas/philip/tests/2d.composite.uncovered.pattern.source-in.html
    1834 canvas/philip/tests/2d.composite.uncovered.pattern.source-out.html
    18351831canvas/philip/tests/2d.drawImage.broken.html
    18361832canvas/philip/tests/2d.gradient.radial.cone.behind.html
  • trunk/Source/WebCore/ChangeLog

    r87303 r87307  
     12011-05-25  Julien Chaffraix  <jchaffraix@codeaurora.org>
     2
     3        Reviewed by James Robinson.
     4
     5        http://philip.html5.org/tests/canvas/suite/tests/2d.composite.uncovered.fill.source-in.html fails
     6        https://bugs.webkit.org/show_bug.cgi?id=39027
     7
     8        And:
     9
     10        - Fix LayoutTests/canvas/philip/tests/2d.composite.uncovered.fill.source-out.html
     11          https://bugs.webkit.org/show_bug.cgi?id=48295
     12
     13        - Fix LayoutTests/canvas/philip/tests/2d.composite.uncovered.pattern.source-in.html
     14          https://bugs.webkit.org/show_bug.cgi?id=48304
     15
     16        - Fix LayoutTests/canvas/philip/tests/2d.composite.uncovered.pattern.source-out.html
     17        https://bugs.webkit.org/show_bug.cgi?id=48305
     18
     19        Those 4 tests have the same root cause for failing. Instead of splitting them in 2 fixes, I squashed
     20        them together as the fix is common.
     21
     22        Based on an older work by Ariya Hidayat.
     23
     24        * html/canvas/CanvasRenderingContext2D.cpp:
     25        (WebCore::CanvasRenderingContext2D::fill):
     26        (WebCore::CanvasRenderingContext2D::fillRect): Added call displayTransparencyEverywhere for those 2
     27        cases if we have to.
     28
     29        (WebCore::CanvasRenderingContext2D::shouldDisplayTransparencyEverywhere): This method returns true if
     30        the spec says to display transparency everywhere. We only do so for source-in and source-out for now.
     31        (WebCore::CanvasRenderingContext2D::displayTransparencyEverywhere): This method implements the spec
     32        (which matches other browsers' behavior) and "display transparency elsewhere".
     33
     34        * html/canvas/CanvasRenderingContext2D.h: Added the two previous methods.
     35
    1362011-05-25  Levi Weintraub  <leviw@chromium.org>
    237
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp

    r87171 r87307  
    941941
    942942    if (!m_path.isEmpty()) {
     943        if (shouldDisplayTransparencyElsewhere())
     944            displayTransparencyElsewhere<Path>(m_path);
     945
    943946        c->fillPath(m_path);
    944947        didDraw(m_path.boundingRect());
     
    10451048    FloatRect rect(x, y, width, height);
    10461049
     1050    if (shouldDisplayTransparencyElsewhere())
     1051        displayTransparencyElsewhere<IntRect>(enclosingIntRect(rect));
     1052
    10471053    c->fillRect(rect);
    10481054    didDraw(rect);
     
    14891495{
    14901496    setGlobalCompositeOperation(operation);
     1497}
     1498
     1499bool CanvasRenderingContext2D::shouldDisplayTransparencyElsewhere() const
     1500{
     1501    // See 4.8.11.1.3 Compositing
     1502    // CompositeSourceAtop is not listed here as the platforms already implement the specification's behavior.
     1503    return state().m_globalComposite == CompositeSourceIn || state().m_globalComposite == CompositeSourceOut;
     1504}
     1505
     1506template<class T> void CanvasRenderingContext2D::displayTransparencyElsewhere(const T& area)
     1507{
     1508    ASSERT(shouldDisplayTransparencyElsewhere());
     1509
     1510    FloatRect canvasRect(0, 0, canvas()->width(), canvas()->height());
     1511    canvasRect = state().m_transform.inverse().mapRect(canvasRect);
     1512
     1513    GraphicsContext* c = drawingContext();
     1514    c->save();
     1515    c->clipOut(area);
     1516    c->setCompositeOperation(CompositeClear);
     1517    c->fillRect(canvasRect);
     1518    c->restore();
    14911519}
    14921520
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h

    r85501 r87307  
    293293#endif
    294294
     295    bool shouldDisplayTransparencyElsewhere() const;
     296    template<class T> void displayTransparencyElsewhere(const T& area);
     297
    295298    void prepareGradientForDashboard(CanvasGradient* gradient) const;
    296299
Note: See TracChangeset for help on using the changeset viewer.