Changeset 73744 in webkit


Ignore:
Timestamp:
Dec 10, 2010 10:47:54 AM (13 years ago)
Author:
mihaip@chromium.org
Message:

2010-12-08 Mihai Parparita <mihaip@chromium.org>

Reviewed by Darin Adler.

fast/canvas/canvas-getImageData-negative-source.html fails on Mac
https://bugs.webkit.org/show_bug.cgi?id=47901

Add test for rounding behavior. Remove now-passing tests from
test_expectations.txt.

  • fast/canvas/canvas-getImageData-rounding-expected.txt: Added.
  • fast/canvas/canvas-getImageData-rounding.html: Added.
  • platform/chromium/test_expectations.txt:

2010-12-08 Mihai Parparita <mihaip@chromium.org>

Reviewed by Darin Adler.

fast/canvas/canvas-getImageData-negative-source.html fails on Mac
https://bugs.webkit.org/show_bug.cgi?id=47901

Test: fast/canvas/canvas-getImageData-rounding.html

static_cast<unsigned> is generally not what we want in
convertLogicalToDevice. It produces inconsistent results when compiling
for 32-bit vs. 64-bit, and in any case we weren't getting correct
rounding behavior for source rectangles (e.g. we should get a source rect
of width 2 if the source X is 0.9 and the source width is 0.2, but we
were getting only one of width 1).

  • html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::convertLogicalToDevice): (WebCore::HTMLCanvasElement::convertToValidDeviceSize):
  • html/HTMLCanvasElement.h:
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r73743 r73744  
     12010-12-08  Mihai Parparita  <mihaip@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        fast/canvas/canvas-getImageData-negative-source.html fails on Mac
     6        https://bugs.webkit.org/show_bug.cgi?id=47901
     7       
     8        Add test for rounding behavior. Remove now-passing tests from
     9        test_expectations.txt.
     10
     11        * fast/canvas/canvas-getImageData-rounding-expected.txt: Added.
     12        * fast/canvas/canvas-getImageData-rounding.html: Added.
     13        * platform/chromium/test_expectations.txt:
     14
    1152010-12-10  Alejandro G. Castro  <alex@igalia.com>
    216
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r73742 r73744  
    24162416BUGWK45991 MAC : canvas/philip/tests/2d.shadow.enable.y.html = TEXT
    24172417BUGWK45991 MAC : canvas/philip/tests/2d.strokeRect.zero.4.html = TEXT
    2418 BUGWK45991 MAC : canvas/philip/tests/2d.imageData.get.source.outside.html = TEXT
    24192418BUGWK45991 WIN : canvas/philip/tests/2d.gradient.radial.touch2.html = TEXT
    24202419BUGWK40147 : canvas/philip/tests/toDataURL.jpeg.alpha.html = TEXT
    24212420BUG61824 : canvas/philip/tests/2d.pattern.image.string.html = TEXT
    2422 
    2423 // Failures after WebKit roll 70949:71000
    2424 BUGWK45991 MAC : canvas/philip/tests/2d.imageData.get.source.negative.html = TEXT
    24252421
    24262422// Flaky tests
     
    29242920
    29252921BUG59647 WIN : svg/dom/length-list-parser.html = PASS CRASH
    2926 
    2927 BUGWK47901 MAC : fast/canvas/canvas-getImageData-negative-source.html = TEXT
    29282922
    29292923// We don't support layoutTestController.nodesFromRect so this test just times out
  • trunk/WebCore/ChangeLog

    r73736 r73744  
     12010-12-08  Mihai Parparita  <mihaip@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        fast/canvas/canvas-getImageData-negative-source.html fails on Mac
     6        https://bugs.webkit.org/show_bug.cgi?id=47901
     7
     8        Test: fast/canvas/canvas-getImageData-rounding.html
     9       
     10        static_cast<unsigned> is generally not what we want in
     11        convertLogicalToDevice. It produces inconsistent results when compiling
     12        for 32-bit vs. 64-bit, and in any case we weren't getting correct
     13        rounding behavior for source rectangles (e.g. we should get a source rect
     14        of width 2 if the source X is 0.9 and the source width is 0.2, but we
     15        were getting only one of width 1).
     16
     17        * html/HTMLCanvasElement.cpp:
     18        (WebCore::HTMLCanvasElement::convertLogicalToDevice):
     19        (WebCore::HTMLCanvasElement::convertToValidDeviceSize):
     20        * html/HTMLCanvasElement.h:
     21
    1222010-12-10  Hironori Bono  <hbono@chromium.org>
    223
  • trunk/WebCore/html/HTMLCanvasElement.cpp

    r70143 r73744  
    323323IntRect HTMLCanvasElement::convertLogicalToDevice(const FloatRect& logicalRect) const
    324324{
    325     return IntRect(convertLogicalToDevice(logicalRect.location()), convertLogicalToDevice(logicalRect.size()));
     325    float left = floorf(logicalRect.left() * m_pageScaleFactor);
     326    float top = floorf(logicalRect.top() * m_pageScaleFactor);
     327    float right = ceilf(logicalRect.right() * m_pageScaleFactor);
     328    float bottom = ceilf(logicalRect.bottom() * m_pageScaleFactor);
     329   
     330    return IntRect(IntPoint(left, top), convertToValidDeviceSize(right - left, bottom - top));
    326331}
    327332
    328333IntSize HTMLCanvasElement::convertLogicalToDevice(const FloatSize& logicalSize) const
    329334{
    330     float wf = ceilf(logicalSize.width() * m_pageScaleFactor);
    331     float hf = ceilf(logicalSize.height() * m_pageScaleFactor);
    332 
    333     if (!(wf >= 1 && hf >= 1 && wf * hf <= MaxCanvasArea))
     335    return convertToValidDeviceSize(logicalSize.width() * m_pageScaleFactor, logicalSize.height() * m_pageScaleFactor);
     336}
     337
     338IntSize HTMLCanvasElement::convertToValidDeviceSize(float width, float height) const
     339{
     340    width = ceilf(width);
     341    height = ceilf(height);
     342   
     343    if (width < 1 || height < 1 || width * height > MaxCanvasArea)
    334344        return IntSize();
    335345
    336346#if PLATFORM(SKIA)
    337     if (wf > MaxSkiaDim || hf > MaxSkiaDim)
     347    if (width > MaxSkiaDim || height > MaxSkiaDim)
    338348        return IntSize();
    339349#endif
    340350
    341     return IntSize(static_cast<unsigned>(wf), static_cast<unsigned>(hf));
    342 }
    343 
    344 IntPoint HTMLCanvasElement::convertLogicalToDevice(const FloatPoint& logicalPos) const
    345 {
    346     float xf = logicalPos.x() * m_pageScaleFactor;
    347     float yf = logicalPos.y() * m_pageScaleFactor;
    348 
    349     return IntPoint(static_cast<unsigned>(xf), static_cast<unsigned>(yf));
     351    return IntSize(width, height);
    350352}
    351353
  • trunk/WebCore/html/HTMLCanvasElement.h

    r68221 r73744  
    108108    IntRect convertLogicalToDevice(const FloatRect&) const;
    109109    IntSize convertLogicalToDevice(const FloatSize&) const;
    110     IntPoint convertLogicalToDevice(const FloatPoint&) const;
     110    IntSize convertToValidDeviceSize(float width, float height) const;
    111111
    112112    const SecurityOrigin& securityOrigin() const;
Note: See TracChangeset for help on using the changeset viewer.