Title: [117855] trunk
Revision
117855
Author
[email protected]
Date
2012-05-21 17:24:49 -0700 (Mon, 21 May 2012)

Log 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:

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (117854 => 117855)


--- trunk/LayoutTests/ChangeLog	2012-05-22 00:23:16 UTC (rev 117854)
+++ trunk/LayoutTests/ChangeLog	2012-05-22 00:24:49 UTC (rev 117855)
@@ -1,3 +1,15 @@
+2012-05-21  Emil A Eklund  <[email protected]>
+
+        Fix bug in paintNinePieceImage exposed by subpixel change
+        https://bugs.webkit.org/show_bug.cgi?id=87060
+
+        Reviewed by Levi Weintraub.
+
+        * 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:
+
 2012-05-21  Levi Weintraub  <[email protected]>
 
         Unreviewed. More rebaselines following r117815.

Deleted: trunk/LayoutTests/platform/chromium-linux/fast/borders/inline-mask-overlay-image-outset-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/fast/borders/inline-mask-overlay-image-outset-vertical-rl-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-win/fast/borders/border-image-side-reduction-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-win/fast/borders/inline-mask-overlay-image-outset-expected.png


(Binary files differ)

Modified: trunk/Source/WebCore/ChangeLog (117854 => 117855)


--- trunk/Source/WebCore/ChangeLog	2012-05-22 00:23:16 UTC (rev 117854)
+++ trunk/Source/WebCore/ChangeLog	2012-05-22 00:24:49 UTC (rev 117855)
@@ -1,5 +1,20 @@
 2012-05-21  Emil A Eklund  <[email protected]>
 
+        Fix bug in paintNinePieceImage exposed by subpixel change
+        https://bugs.webkit.org/show_bug.cgi?id=87060
+
+        Reviewed by Levi Weintraub.
+
+        Fix rounding in paintNinePieceImage where the left/right images where
+        drawn on subpixel bounds.
+
+        Covered by existing tests.
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintNinePieceImage):
+
+2012-05-21  Emil A Eklund  <[email protected]>
+
         Move padding/margin/offset writing mode logic from RenderStyle to LengthBox
         https://bugs.webkit.org/show_bug.cgi?id=86970
 

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (117854 => 117855)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2012-05-22 00:23:16 UTC (rev 117854)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2012-05-22 00:24:49 UTC (rev 117855)
@@ -1270,17 +1270,17 @@
     ENinePieceImageRule hRule = ninePieceImage.horizontalRule();
     ENinePieceImageRule vRule = ninePieceImage.verticalRule();
 
-    LayoutUnit topWidth = computeBorderImageSide(ninePieceImage.borderSlices().top(), style->borderTopWidth(), topSlice, borderImageRect.height(), renderView);
-    LayoutUnit rightWidth = computeBorderImageSide(ninePieceImage.borderSlices().right(), style->borderRightWidth(), rightSlice, borderImageRect.width(), renderView);
-    LayoutUnit bottomWidth = computeBorderImageSide(ninePieceImage.borderSlices().bottom(), style->borderBottomWidth(), bottomSlice, borderImageRect.height(), renderView);
-    LayoutUnit leftWidth = computeBorderImageSide(ninePieceImage.borderSlices().left(), style->borderLeftWidth(), leftSlice, borderImageRect.width(), renderView);
+    int topWidth = computeBorderImageSide(ninePieceImage.borderSlices().top(), style->borderTopWidth(), topSlice, borderImageRect.height(), renderView);
+    int rightWidth = computeBorderImageSide(ninePieceImage.borderSlices().right(), style->borderRightWidth(), rightSlice, borderImageRect.width(), renderView);
+    int bottomWidth = computeBorderImageSide(ninePieceImage.borderSlices().bottom(), style->borderBottomWidth(), bottomSlice, borderImageRect.height(), renderView);
+    int leftWidth = computeBorderImageSide(ninePieceImage.borderSlices().left(), style->borderLeftWidth(), leftSlice, borderImageRect.width(), renderView);
     
     // Reduce the widths if they're too large.
     // The spec says: Given Lwidth as the width of the border image area, Lheight as its height, and Wside as the border image width
     // offset for the side, let f = min(Lwidth/(Wleft+Wright), Lheight/(Wtop+Wbottom)). If f < 1, then all W are reduced by
     // multiplying them by f.
-    LayoutUnit borderSideWidth = max<LayoutUnit>(1, leftWidth + rightWidth);
-    LayoutUnit borderSideHeight = max<LayoutUnit>(1, topWidth + bottomWidth);
+    int borderSideWidth = max(1, leftWidth + rightWidth);
+    int borderSideHeight = max(1, topWidth + bottomWidth);
     float borderSideScaleFactor = min((float)borderImageRect.width() / borderSideWidth, (float)borderImageRect.height() / borderSideHeight);
     if (borderSideScaleFactor < 1) {
         topWidth *= borderSideScaleFactor;
@@ -1316,13 +1316,13 @@
         // The top left corner rect is (tx, ty, leftWidth, topWidth)
         // The rect to use from within the image is obtained from our slice, and is (0, 0, leftSlice, topSlice)
         if (drawTop)
-            graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(borderImageRect.location(), LayoutSize(leftWidth, topWidth)),
+            graphicsContext->drawImage(image.get(), colorSpace, IntRect(borderImageRect.location(), IntSize(leftWidth, topWidth)),
                                        LayoutRect(0, 0, leftSlice, topSlice), op);
 
         // The bottom left corner rect is (tx, ty + h - bottomWidth, leftWidth, bottomWidth)
         // The rect to use from within the image is (0, imageHeight - bottomSlice, leftSlice, botomSlice)
         if (drawBottom)
-            graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(borderImageRect.x(), borderImageRect.maxY() - bottomWidth, leftWidth, bottomWidth),
+            graphicsContext->drawImage(image.get(), colorSpace, IntRect(borderImageRect.x(), borderImageRect.maxY() - bottomWidth, leftWidth, bottomWidth),
                                        LayoutRect(0, imageHeight - bottomSlice, leftSlice, bottomSlice), op);
 
         // Paint the left edge.
@@ -1339,13 +1339,13 @@
         // The top right corner rect is (tx + w - rightWidth, ty, rightWidth, topWidth)
         // The rect to use from within the image is obtained from our slice, and is (imageWidth - rightSlice, 0, rightSlice, topSlice)
         if (drawTop)
-            graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(borderImageRect.maxX() - rightWidth, borderImageRect.y(), rightWidth, topWidth),
+            graphicsContext->drawImage(image.get(), colorSpace, IntRect(borderImageRect.maxX() - rightWidth, borderImageRect.y(), rightWidth, topWidth),
                                        LayoutRect(imageWidth - rightSlice, 0, rightSlice, topSlice), op);
 
         // The bottom right corner rect is (tx + w - rightWidth, ty + h - bottomWidth, rightWidth, bottomWidth)
         // The rect to use from within the image is (imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice)
         if (drawBottom)
-            graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(borderImageRect.maxX() - rightWidth, borderImageRect.maxY() - bottomWidth, rightWidth, bottomWidth),
+            graphicsContext->drawImage(image.get(), colorSpace, IntRect(borderImageRect.maxX() - rightWidth, borderImageRect.maxY() - bottomWidth, rightWidth, bottomWidth),
                                        LayoutRect(imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice), op);
 
         // Paint the right edge.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to