Changeset 130329 in webkit


Ignore:
Timestamp:
Oct 3, 2012, 3:07:59 PM (13 years ago)
Author:
eae@chromium.org
Message:

Round image sizes when zooming
https://bugs.webkit.org/show_bug.cgi?id=98205

Reviewed by Eric Seidel.

Source/WebCore:

We currently floor image sizes when zooming which can result in
images being rendered at one pixel less than the actual size.
This is especially likely to happen for very large images.

Test: fast/sub-pixel/zoomed-image-tiles.html

  • loader/cache/CachedImage.cpp:

(WebCore::CachedImage::imageSizeForRenderer):

LayoutTests:

Add test for zoomed large image tiles.

  • fast/images/zoomed-img-size.html:
  • fast/sub-pixel/zoomed-image-tiles-expected.html: Added.
  • fast/sub-pixel/zoomed-image-tiles.html: Added.
  • platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-absolute-size-2-expected.png:
  • platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-absolute-size-2-expected.txt:
  • platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-absolute-size-expected.png:
  • platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-absolute-size-expected.txt:
  • platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-percentage-size-expected.png:
  • platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-percentage-size-expected.txt:
  • platform/chromium/fast/images/zoomed-img-size-expected.txt: Added.
  • platform/gtk/TestExpectations:
  • platform/mac-lion/TestExpectations:
  • platform/mac-snowleopard/TestExpectations:
  • platform/mac-wk2/TestExpectations:
  • platform/mac/TestExpectations:
  • platform/qt-4.8/TestExpectations:
  • platform/qt/TestExpectations:
  • platform/win-wk2/TestExpectations:
  • platform/win-xp/TestExpectations:
  • platform/win/TestExpectations:
  • platform/wincairo/TestExpectations:
  • platform/wk2/TestExpectations:
Location:
trunk
Files:
3 added
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r130328 r130329  
     12012-10-03  Emil A Eklund  <eae@chromium.org>
     2
     3        Round image sizes when zooming
     4        https://bugs.webkit.org/show_bug.cgi?id=98205
     5
     6        Reviewed by Eric Seidel.
     7
     8        Add test for zoomed large image tiles.
     9
     10        * fast/images/zoomed-img-size.html:
     11        * fast/sub-pixel/zoomed-image-tiles-expected.html: Added.
     12        * fast/sub-pixel/zoomed-image-tiles.html: Added.
     13        * platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-absolute-size-2-expected.png:
     14        * platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-absolute-size-2-expected.txt:
     15        * platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-absolute-size-expected.png:
     16        * platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-absolute-size-expected.txt:
     17        * platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-percentage-size-expected.png:
     18        * platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-percentage-size-expected.txt:
     19        * platform/chromium/fast/images/zoomed-img-size-expected.txt: Added.
     20        * platform/gtk/TestExpectations:
     21        * platform/mac-lion/TestExpectations:
     22        * platform/mac-snowleopard/TestExpectations:
     23        * platform/mac-wk2/TestExpectations:
     24        * platform/mac/TestExpectations:
     25        * platform/qt-4.8/TestExpectations:
     26        * platform/qt/TestExpectations:
     27        * platform/win-wk2/TestExpectations:
     28        * platform/win-xp/TestExpectations:
     29        * platform/win/TestExpectations:
     30        * platform/wincairo/TestExpectations:
     31        * platform/wk2/TestExpectations:
     32
    1332012-10-03  Raphael Kubo da Costa  <raphael.kubo.da.costa@intel.com>
    234
  • trunk/LayoutTests/fast/images/zoomed-img-size.html

    r121012 r130329  
    77
    88      function update() {
     9        var el = document.getElementById('subpixel-test');
     10        var hasSubpixelSupport = el.getBoundingClientRect().width == 4.5;
     11        el.parentNode.removeChild(el);
     12   
    913        // These arrays will become unnecessary if we fix the rounding issues that make us not always report "37x33".
    10         var expectedWidths = [100, 50, 33, 25, 20, 36, 36, 36, 35, 37, 37, 37, 37, 37, 37];
    11         var expectedHeights = [100, 50, 33, 25, 20, 30, 30, 32, 32, 33, 33, 33, 33, 33, 33];
     14        var expectedWidths, expectedHeights;
     15        if (hasSubpixelSupport) {
     16            expectedWidths = [100, 50, 33, 25, 40, 36, 36, 38, 37, 37, 37, 38, 37, 37, 37];
     17            expectedHeights = [100, 50, 33, 25, 40, 33, 33, 34, 32, 33, 34, 34, 33, 33, 33];
     18        } else {
     19            expectedWidths = [100, 50, 33, 25, 20, 36, 36, 36, 35, 37, 37, 37, 37, 37, 37];
     20            expectedHeights = [100, 50, 33, 25, 20, 30, 30, 32, 32, 33, 33, 33, 33, 33, 33];
     21        }
    1222        for (i = 0; i < 15; ++i) {
    1323          var oval = document.getElementById('oval' + i);
     
    6070    <img id="oval14" src="resources/oval.png" style="zoom: 1234%">
    6171    <p>Zoom 1234% <span id="status14"></span>: <span id="sizes14"></span></p>
     72    <div id="subpixel-test" style="width: 4.5px; height: 10px;"></div>
    6273  </body>
    6374</html>
  • trunk/LayoutTests/platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-absolute-size-2-expected.txt

    r129656 r130329  
    1616                          text run at (0,0) width 478: "Both sides should have identical size after zooming"
    1717                  RenderTableRow {tr} at (0,67) size 490x24
    18                     RenderTableCell {td} at (1,67) size 243x24 [r=1 c=0 rs=1 cs=1]
    19                       RenderText {#text} at (96,5) size 51x14
    20                         text run at (96,5) width 51: "SVG Image"
    21                     RenderTableCell {td} at (245,67) size 244x24 [r=1 c=1 rs=1 cs=1]
    22                       RenderText {#text} at (95,5) size 54x14
    23                         text run at (95,5) width 54: "PNG Image"
     18                    RenderTableCell {td} at (1,67) size 242x24 [r=1 c=0 rs=1 cs=1]
     19                      RenderText {#text} at (96,5) size 50x14
     20                        text run at (96,5) width 50: "SVG Image"
     21                    RenderTableCell {td} at (244,67) size 245x24 [r=1 c=1 rs=1 cs=1]
     22                      RenderText {#text} at (96,5) size 53x14
     23                        text run at (96,5) width 53: "PNG Image"
    2424                  RenderTableRow {tr} at (0,92) size 490x82
    25                     RenderTableCell {td} at (1,92) size 243x82 [r=2 c=0 rs=1 cs=1]
    26                       RenderEmbeddedObject {object} at (100,5) size 138x69
     25                    RenderTableCell {td} at (1,92) size 242x82 [r=2 c=0 rs=1 cs=1]
     26                      RenderEmbeddedObject {object} at (99,5) size 138x69
    2727                        layer at (0,0) size 139x69
    2828                          RenderView at (0,0) size 138x69
     
    4343                            RenderSVGRect {rect} at (23,0) size 93x69 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=478.00] [height=358.00]
    4444                      RenderText {#text} at (0,0) size 0x0
    45                     RenderTableCell {td} at (245,92) size 244x82 [r=2 c=1 rs=1 cs=1]
    46                       RenderImage {img} at (5,5) size 138x69
     45                    RenderTableCell {td} at (244,92) size 245x82 [r=2 c=1 rs=1 cs=1]
     46                      RenderImage {img} at (5,5) size 139x69
    4747                      RenderText {#text} at (0,0) size 0x0
  • trunk/LayoutTests/platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-absolute-size-expected.txt

    r129656 r130329  
    1616                          text run at (0,0) width 478: "Both sides should have identical size after zooming"
    1717                  RenderTableRow {tr} at (0,67) size 490x24
    18                     RenderTableCell {td} at (1,67) size 244x24 [r=1 c=0 rs=1 cs=1]
    19                       RenderText {#text} at (97,5) size 50x14
    20                         text run at (97,5) width 50: "SVG Image"
    21                     RenderTableCell {td} at (246,67) size 243x24 [r=1 c=1 rs=1 cs=1]
    22                       RenderText {#text} at (95,5) size 53x14
    23                         text run at (95,5) width 53: "PNG Image"
     18                    RenderTableCell {td} at (1,67) size 243x24 [r=1 c=0 rs=1 cs=1]
     19                      RenderText {#text} at (96,5) size 51x14
     20                        text run at (96,5) width 51: "SVG Image"
     21                    RenderTableCell {td} at (245,67) size 244x24 [r=1 c=1 rs=1 cs=1]
     22                      RenderText {#text} at (95,5) size 54x14
     23                        text run at (95,5) width 54: "PNG Image"
    2424                  RenderTableRow {tr} at (0,92) size 490x82
    25                     RenderTableCell {td} at (1,92) size 244x82 [r=2 c=0 rs=1 cs=1]
    26                       RenderEmbeddedObject {object} at (100,4) size 139x70
     25                    RenderTableCell {td} at (1,92) size 243x82 [r=2 c=0 rs=1 cs=1]
     26                      RenderEmbeddedObject {object} at (99,4) size 139x70
    2727                        layer at (0,0) size 139x69
    2828                          RenderView at (0,0) size 139x69
     
    4343                            RenderSVGRect {rect} at (23,0) size 93x69 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=478.00] [height=358.00]
    4444                      RenderText {#text} at (0,0) size 0x0
    45                     RenderTableCell {td} at (246,92) size 243x82 [r=2 c=1 rs=1 cs=1]
    46                       RenderImage {img} at (5,5) size 138x69
     45                    RenderTableCell {td} at (245,92) size 244x82 [r=2 c=1 rs=1 cs=1]
     46                      RenderImage {img} at (5,5) size 139x69
    4747                      RenderText {#text} at (0,0) size 0x0
  • trunk/LayoutTests/platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-percentage-size-expected.txt

    r129763 r130329  
    11layer at (0,0) size 800x600
    22  RenderView at (0,0) size 800x600
    3 layer at (0,0) size 800x378
    4   RenderBlock {html} at (0,0) size 800x379
    5     RenderBody {body} at (5,5) size 790x368
    6       RenderTable {table} at (41,0) size 706x367
    7         RenderTableSection (anonymous) at (0,0) size 705x367
    8           RenderTableRow {tr} at (0,0) size 705x367
    9             RenderTableCell {td} at (0,0) size 705x367 [r=0 c=0 rs=1 cs=3]
    10               RenderTable {table} at (7,6) size 693x355
    11                 RenderTableSection (anonymous) at (0,0) size 692x355
     3layer at (0,0) size 800x379
     4  RenderBlock {html} at (0,0) size 800x380
     5    RenderBody {body} at (5,5) size 790x369
     6      RenderTable {table} at (41,0) size 706x368
     7        RenderTableSection (anonymous) at (0,0) size 705x368
     8          RenderTableRow {tr} at (0,0) size 705x368
     9            RenderTableCell {td} at (0,0) size 705x368 [r=0 c=0 rs=1 cs=3]
     10              RenderTable {table} at (7,6) size 693x356
     11                RenderTableSection (anonymous) at (0,0) size 692x356
    1212                  RenderTableRow {tr} at (0,1) size 692x65
    1313                    RenderTableCell {td} at (1,1) size 690x66 [r=0 c=0 rs=1 cs=2]
     
    2222                      RenderText {#text} at (145,5) size 54x14
    2323                        text run at (145,5) width 54: "PNG Image"
    24                   RenderTableRow {tr} at (0,92) size 692x262
     24                  RenderTableRow {tr} at (0,92) size 692x263
    2525                    RenderTableCell {td} at (1,92) size 345x262 [r=2 c=0 rs=1 cs=1]
    2626                      RenderEmbeddedObject {object} at (6,4) size 334x250
     
    4343                            RenderSVGRect {rect} at (0,0) size 333x250 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=478.00] [height=358.00]
    4444                      RenderText {#text} at (0,0) size 0x0
    45                     RenderTableCell {td} at (347,92) size 344x262 [r=2 c=1 rs=1 cs=1]
    46                       RenderImage {img} at (5,5) size 333x249
     45                    RenderTableCell {td} at (347,92) size 344x263 [r=2 c=1 rs=1 cs=1]
     46                      RenderImage {img} at (5,5) size 333x250
    4747                      RenderText {#text} at (0,0) size 0x0
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r130200 r130329  
    385385webkit.org/b/85532 fast/sub-pixel/vertical-align-middle-overflow.html [ Pass ]
    386386webkit.org/b/85532 fast/sub-pixel/sub-pixel-accumulates-to-layers.html [ Pass ]
     387webkit.org/b/85532 fast/sub-pixel/zoomed-image-tiles.html [ Skip ]
    387388
    388389# Mediastream implementation is not complete yet.
  • trunk/LayoutTests/platform/mac-lion/TestExpectations

    r129788 r130329  
    121121fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html
    122122fast/sub-pixel/snap-negative-location.html
     123fast/sub-pixel/zoomed-image-tiles.html
    123124
    124125# This media test always failed on Lion
  • trunk/LayoutTests/platform/mac-wk2/TestExpectations

    r130325 r130329  
    193193fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html
    194194fast/sub-pixel/snap-negative-location.html
     195fast/sub-pixel/zoomed-image-tiles.html
    195196
    196197# fast/events/pagehide-timeout.html, pageshow-pagehide-on-back-cached-with-frames.html, and
  • trunk/LayoutTests/platform/mac/TestExpectations

    r130107 r130329  
    701701fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html
    702702fast/sub-pixel/snap-negative-location.html
     703fast/sub-pixel/zoomed-image-tiles.html
    703704
    704705# No CORS support for media elements is implemented yet.
  • trunk/LayoutTests/platform/qt-4.8/TestExpectations

    r129788 r130329  
    116116fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html
    117117fast/sub-pixel/snap-negative-location.html
     118fast/sub-pixel/zoomed-image-tiles.html
    118119
    119120# SVG Fonts are only supported when using QRawFont, which is not
  • trunk/LayoutTests/platform/qt/TestExpectations

    r130323 r130329  
    324324fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html
    325325fast/sub-pixel/snap-negative-location.html
     326fast/sub-pixel/zoomed-image-tiles.html
    326327
    327328# USE(V8)
  • trunk/LayoutTests/platform/win-wk2/TestExpectations

    r129788 r130329  
    955955fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html
    956956fast/sub-pixel/snap-negative-location.html
     957fast/sub-pixel/zoomed-image-tiles.html
    957958
    958959# HiDPI tests require test infrastructure enhancements
  • trunk/LayoutTests/platform/win-xp/TestExpectations

    r129788 r130329  
    5454fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html
    5555fast/sub-pixel/snap-negative-location.html
     56fast/sub-pixel/zoomed-image-tiles.html
    5657
    5758# REGRESSION (r83928 or before): Some tests failing assertions in MarkStack::internalAppend / MarkStack::drain
  • trunk/LayoutTests/platform/win/TestExpectations

    r130227 r130329  
    17551755fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html
    17561756fast/sub-pixel/snap-negative-location.html
     1757fast/sub-pixel/zoomed-image-tiles.html
    17571758
    17581759# No CORS support for media elements is implemented yet.
  • trunk/LayoutTests/platform/wk2/TestExpectations

    r130325 r130329  
    107107fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html
    108108fast/sub-pixel/snap-negative-location.html
     109fast/sub-pixel/zoomed-image-tiles.html
    109110
    110111# [WK2][WTR] svg/animations/animate-text-nested-transforms.html fails
  • trunk/Source/WebCore/ChangeLog

    r130327 r130329  
     12012-10-03  Emil A Eklund  <eae@chromium.org>
     2
     3        Round image sizes when zooming
     4        https://bugs.webkit.org/show_bug.cgi?id=98205
     5
     6        Reviewed by Eric Seidel.
     7
     8        We currently floor image sizes when zooming which can result in
     9        images being rendered at one pixel less than the actual size.
     10        This is especially likely to happen for very large images.
     11
     12        Test: fast/sub-pixel/zoomed-image-tiles.html
     13
     14        * loader/cache/CachedImage.cpp:
     15        (WebCore::CachedImage::imageSizeForRenderer):
     16
    1172012-10-03  Hugo Parente Lima  <hugo.lima@openbossa.org>
    218
  • trunk/Source/WebCore/loader/cache/CachedImage.cpp

    r129462 r130329  
    264264    float heightScale = m_image->hasRelativeHeight() ? 1.0f : multiplier;
    265265    IntSize minimumSize(imageSize.width() > 0 ? 1 : 0, imageSize.height() > 0 ? 1 : 0);
     266#if ENABLE(SUBPIXEL_LAYOUT)
     267    imageSize.setWidth(lroundf(imageSize.width() * widthScale));
     268    imageSize.setHeight(lroundf(imageSize.height() * heightScale));
     269#else
    266270    imageSize.scale(widthScale, heightScale);
     271#endif
    267272    imageSize.clampToMinimumSize(minimumSize);
    268273    return imageSize;
Note: See TracChangeset for help on using the changeset viewer.