Changeset 117855 in webkit


Ignore:
Timestamp:
May 21, 2012 5:24:49 PM (12 years ago)
Author:
eae@chromium.org
Message:

Fix bug in paintNinePieceImage exposed by subpixel change
https://bugs.webkit.org/show_bug.cgi?id=87060

Reviewed by Levi Weintraub.

Source/WebCore:

Fix rounding in paintNinePieceImage where the left/right images where
drawn on subpixel bounds.

Covered by existing tests.

  • rendering/RenderBoxModelObject.cpp:

(WebCore::RenderBoxModelObject::paintNinePieceImage):

LayoutTests:

  • platform/chromium-linux/fast/borders/inline-mask-overlay-image-outset-expected.png: Removed.
  • platform/chromium-linux/fast/borders/inline-mask-overlay-image-outset-vertical-rl-expected.png:
  • platform/chromium-win/fast/borders/border-image-side-reduction-expected.png:
  • platform/chromium-win/fast/borders/inline-mask-overlay-image-outset-expected.png:
Location:
trunk
Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r117846 r117855  
     12012-05-21  Emil A Eklund  <eae@chromium.org>
     2
     3        Fix bug in paintNinePieceImage exposed by subpixel change
     4        https://bugs.webkit.org/show_bug.cgi?id=87060
     5
     6        Reviewed by Levi Weintraub.
     7
     8        * platform/chromium-linux/fast/borders/inline-mask-overlay-image-outset-expected.png: Removed.
     9        * platform/chromium-linux/fast/borders/inline-mask-overlay-image-outset-vertical-rl-expected.png:
     10        * platform/chromium-win/fast/borders/border-image-side-reduction-expected.png:
     11        * platform/chromium-win/fast/borders/inline-mask-overlay-image-outset-expected.png:
     12
    1132012-05-21  Levi Weintraub  <leviw@chromium.org>
    214
  • trunk/Source/WebCore/ChangeLog

    r117832 r117855  
     12012-05-21  Emil A Eklund  <eae@chromium.org>
     2
     3        Fix bug in paintNinePieceImage exposed by subpixel change
     4        https://bugs.webkit.org/show_bug.cgi?id=87060
     5
     6        Reviewed by Levi Weintraub.
     7
     8        Fix rounding in paintNinePieceImage where the left/right images where
     9        drawn on subpixel bounds.
     10
     11        Covered by existing tests.
     12
     13        * rendering/RenderBoxModelObject.cpp:
     14        (WebCore::RenderBoxModelObject::paintNinePieceImage):
     15
    1162012-05-21  Emil A Eklund  <eae@chromium.org>
    217
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r117482 r117855  
    12711271    ENinePieceImageRule vRule = ninePieceImage.verticalRule();
    12721272
    1273     LayoutUnit topWidth = computeBorderImageSide(ninePieceImage.borderSlices().top(), style->borderTopWidth(), topSlice, borderImageRect.height(), renderView);
    1274     LayoutUnit rightWidth = computeBorderImageSide(ninePieceImage.borderSlices().right(), style->borderRightWidth(), rightSlice, borderImageRect.width(), renderView);
    1275     LayoutUnit bottomWidth = computeBorderImageSide(ninePieceImage.borderSlices().bottom(), style->borderBottomWidth(), bottomSlice, borderImageRect.height(), renderView);
    1276     LayoutUnit leftWidth = computeBorderImageSide(ninePieceImage.borderSlices().left(), style->borderLeftWidth(), leftSlice, borderImageRect.width(), renderView);
     1273    int topWidth = computeBorderImageSide(ninePieceImage.borderSlices().top(), style->borderTopWidth(), topSlice, borderImageRect.height(), renderView);
     1274    int rightWidth = computeBorderImageSide(ninePieceImage.borderSlices().right(), style->borderRightWidth(), rightSlice, borderImageRect.width(), renderView);
     1275    int bottomWidth = computeBorderImageSide(ninePieceImage.borderSlices().bottom(), style->borderBottomWidth(), bottomSlice, borderImageRect.height(), renderView);
     1276    int leftWidth = computeBorderImageSide(ninePieceImage.borderSlices().left(), style->borderLeftWidth(), leftSlice, borderImageRect.width(), renderView);
    12771277   
    12781278    // Reduce the widths if they're too large.
     
    12801280    // offset for the side, let f = min(Lwidth/(Wleft+Wright), Lheight/(Wtop+Wbottom)). If f < 1, then all W are reduced by
    12811281    // multiplying them by f.
    1282     LayoutUnit borderSideWidth = max<LayoutUnit>(1, leftWidth + rightWidth);
    1283     LayoutUnit borderSideHeight = max<LayoutUnit>(1, topWidth + bottomWidth);
     1282    int borderSideWidth = max(1, leftWidth + rightWidth);
     1283    int borderSideHeight = max(1, topWidth + bottomWidth);
    12841284    float borderSideScaleFactor = min((float)borderImageRect.width() / borderSideWidth, (float)borderImageRect.height() / borderSideHeight);
    12851285    if (borderSideScaleFactor < 1) {
     
    13171317        // The rect to use from within the image is obtained from our slice, and is (0, 0, leftSlice, topSlice)
    13181318        if (drawTop)
    1319             graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(borderImageRect.location(), LayoutSize(leftWidth, topWidth)),
     1319            graphicsContext->drawImage(image.get(), colorSpace, IntRect(borderImageRect.location(), IntSize(leftWidth, topWidth)),
    13201320                                       LayoutRect(0, 0, leftSlice, topSlice), op);
    13211321
     
    13231323        // The rect to use from within the image is (0, imageHeight - bottomSlice, leftSlice, botomSlice)
    13241324        if (drawBottom)
    1325             graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(borderImageRect.x(), borderImageRect.maxY() - bottomWidth, leftWidth, bottomWidth),
     1325            graphicsContext->drawImage(image.get(), colorSpace, IntRect(borderImageRect.x(), borderImageRect.maxY() - bottomWidth, leftWidth, bottomWidth),
    13261326                                       LayoutRect(0, imageHeight - bottomSlice, leftSlice, bottomSlice), op);
    13271327
     
    13401340        // The rect to use from within the image is obtained from our slice, and is (imageWidth - rightSlice, 0, rightSlice, topSlice)
    13411341        if (drawTop)
    1342             graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(borderImageRect.maxX() - rightWidth, borderImageRect.y(), rightWidth, topWidth),
     1342            graphicsContext->drawImage(image.get(), colorSpace, IntRect(borderImageRect.maxX() - rightWidth, borderImageRect.y(), rightWidth, topWidth),
    13431343                                       LayoutRect(imageWidth - rightSlice, 0, rightSlice, topSlice), op);
    13441344
     
    13461346        // The rect to use from within the image is (imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice)
    13471347        if (drawBottom)
    1348             graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(borderImageRect.maxX() - rightWidth, borderImageRect.maxY() - bottomWidth, rightWidth, bottomWidth),
     1348            graphicsContext->drawImage(image.get(), colorSpace, IntRect(borderImageRect.maxX() - rightWidth, borderImageRect.maxY() - bottomWidth, rightWidth, bottomWidth),
    13491349                                       LayoutRect(imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice), op);
    13501350
Note: See TracChangeset for help on using the changeset viewer.