Title: [164888] trunk/Source/WebCore
Revision
164888
Author
[email protected]
Date
2014-02-28 15:05:58 -0800 (Fri, 28 Feb 2014)

Log Message

Subpixel rendering: Add subpixel support to border type of double, groove, ridge, inset and outset.
https://bugs.webkit.org/show_bug.cgi?id=129226

Reviewed by Simon Fraser.

This is the conversion of double, inset, outset, groove and ridge border type
painting to support device pixel precision width/height.

Regression is covered by existing tests.

* rendering/RenderObject.cpp:
(WebCore::RenderObject::drawLineForBoxSide):
* rendering/RenderObject.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (164887 => 164888)


--- trunk/Source/WebCore/ChangeLog	2014-02-28 23:04:05 UTC (rev 164887)
+++ trunk/Source/WebCore/ChangeLog	2014-02-28 23:05:58 UTC (rev 164888)
@@ -1,3 +1,19 @@
+2014-02-28  Zalan Bujtas  <[email protected]>
+
+        Subpixel rendering: Add subpixel support to border type of double, groove, ridge, inset and outset.
+        https://bugs.webkit.org/show_bug.cgi?id=129226
+
+        Reviewed by Simon Fraser.
+
+        This is the conversion of double, inset, outset, groove and ridge border type
+        painting to support device pixel precision width/height.
+
+        Regression is covered by existing tests.
+
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::drawLineForBoxSide):
+        * rendering/RenderObject.h:
+
 2014-02-28  Adenilson Cavalcanti  <[email protected]>
 
         Filters should test for area instead of single dimension

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (164887 => 164888)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2014-02-28 23:04:05 UTC (rev 164887)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2014-02-28 23:05:58 UTC (rev 164888)
@@ -722,9 +722,10 @@
     return toRenderBlock(o);
 }
 
-void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, LayoutUnit x1, LayoutUnit y1, LayoutUnit x2, LayoutUnit y2,
-    BoxSide side, Color color, EBorderStyle borderStyle, int adjacentWidth1, int adjacentWidth2, bool antialias)
+void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, float x1, float y1, float x2, float y2,
+    BoxSide side, Color color, EBorderStyle borderStyle, float adjacentWidth1, float adjacentWidth2, bool antialias)
 {
+    float deviceScaleFactor = document().deviceScaleFactor();
     float thickness;
     float length;
     if (side == BSTop || side == BSBottom) {
@@ -734,21 +735,15 @@
         thickness = x2 - x1;
         length = y2 - y1;
     }
+    // FIXME: flooring is a temporary solution until the device pixel snapping is added here for all border types (including recursive calls such as groove->(inset/outset)).
+    thickness = floorToDevicePixel(thickness, deviceScaleFactor);
+    length = floorToDevicePixel(length, deviceScaleFactor);
 
-    if (borderStyle == DOUBLE && thickness < 3)
+    if (borderStyle == DOUBLE && (thickness * deviceScaleFactor) < 3)
         borderStyle = SOLID;
 
-    float pixelSnappingFactor = document().deviceScaleFactor();
     // FIXME: We really would like this check to be an ASSERT as we don't want to draw empty borders. However
     // nothing guarantees that the following recursive calls to drawLineForBoxSide will have non-null dimensions.
-    // FIXME: flooring is a temporary solution until the device pixel snapping is added here for all border types.
-    if (borderStyle == SOLID) {
-        thickness = roundToDevicePixel(thickness, pixelSnappingFactor);
-        length = roundToDevicePixel(length, pixelSnappingFactor);
-    } else {
-        thickness = floorf(thickness);
-        length = floorf(length);
-    }
     if (!thickness || !length)
         return;
 
@@ -767,14 +762,18 @@
                 graphicsContext->setStrokeThickness(thickness);
                 graphicsContext->setStrokeStyle(borderStyle == DASHED ? DashedStroke : DottedStroke);
 
+                // FIXME: There's some odd adjustment in GraphicsContext::drawLine() that disables device pixel precision line drawing.
+                int adjustedX = floorToInt((x1 + x2) / 2);
+                int adjustedY = floorToInt((y1 + y2) / 2);
+
                 switch (side) {
                     case BSBottom:
                     case BSTop:
-                        graphicsContext->drawLine(IntPoint(x1, (y1 + y2) / 2), IntPoint(x2, (y1 + y2) / 2));
+                        graphicsContext->drawLine(FloatPoint(x1, adjustedY), FloatPoint(x2, adjustedY));
                         break;
                     case BSRight:
                     case BSLeft:
-                        graphicsContext->drawLine(IntPoint((x1 + x2) / 2, y1), IntPoint((x1 + x2) / 2, y2));
+                        graphicsContext->drawLine(FloatPoint(adjustedX, y1), FloatPoint(adjustedX, y2));
                         break;
                 }
                 graphicsContext->setShouldAntialias(wasAntialiased);
@@ -783,7 +782,7 @@
             break;
         }
         case DOUBLE: {
-            int thirdOfThickness = (thickness + 1) / 3;
+            float thirdOfThickness = ceilToDevicePixel(thickness / 3, deviceScaleFactor);
             ASSERT(thirdOfThickness);
 
             if (adjacentWidth1 == 0 && adjacentWidth2 == 0) {
@@ -797,57 +796,67 @@
                 switch (side) {
                     case BSTop:
                     case BSBottom:
-                        graphicsContext->drawRect(IntRect(x1, y1, length, thirdOfThickness));
-                        graphicsContext->drawRect(IntRect(x1, y2 - thirdOfThickness, length, thirdOfThickness));
+                        graphicsContext->drawRect(pixelSnappedForPainting(x1, y1, length, thirdOfThickness, deviceScaleFactor));
+                        graphicsContext->drawRect(pixelSnappedForPainting(x1, y2 - thirdOfThickness, length, thirdOfThickness, deviceScaleFactor));
                         break;
                     case BSLeft:
                     case BSRight:
-                        // FIXME: Why do we offset the border by 1 in this case but not the other one?
-                        if (length > 1) {
-                            graphicsContext->drawRect(IntRect(x1, y1 + 1, thirdOfThickness, length - 1));
-                            graphicsContext->drawRect(IntRect(x2 - thirdOfThickness, y1 + 1, thirdOfThickness, length - 1));
-                        }
+                        graphicsContext->drawRect(pixelSnappedForPainting(x1, y1, thirdOfThickness, length, deviceScaleFactor));
+                        graphicsContext->drawRect(pixelSnappedForPainting(x2 - thirdOfThickness, y1, thirdOfThickness, length, deviceScaleFactor));
                         break;
                 }
 
                 graphicsContext->setShouldAntialias(wasAntialiased);
                 graphicsContext->setStrokeStyle(oldStrokeStyle);
             } else {
-                int adjacent1BigThird = ((adjacentWidth1 > 0) ? adjacentWidth1 + 1 : adjacentWidth1 - 1) / 3;
-                int adjacent2BigThird = ((adjacentWidth2 > 0) ? adjacentWidth2 + 1 : adjacentWidth2 - 1) / 3;
+                float adjacent1BigThird = ceilToDevicePixel(adjacentWidth1 / 3, deviceScaleFactor);
+                float adjacent2BigThird = ceilToDevicePixel(adjacentWidth2 / 3, deviceScaleFactor);
 
+                float offset1 = floorToDevicePixel(fabs(adjacentWidth1) * 2 / 3, deviceScaleFactor);
+                float offset2 = floorToDevicePixel(fabs(adjacentWidth2) * 2 / 3, deviceScaleFactor);
+
+                float mitreOffset1 = adjacentWidth1 < 0 ? offset1 : 0;
+                float mitreOffset2 = adjacentWidth1 > 0 ? offset1 : 0;
+                float mitreOffset3 = adjacentWidth2 < 0 ? offset2 : 0;
+                float mitreOffset4 = adjacentWidth2 > 0 ? offset2 : 0;
+
+                FloatRect paintBorderRect;
                 switch (side) {
                     case BSTop:
-                        drawLineForBoxSide(graphicsContext, x1 + std::max((-adjacentWidth1 * 2 + 1) / 3, 0),
-                                   y1, x2 - std::max((-adjacentWidth2 * 2 + 1) / 3, 0), y1 + thirdOfThickness,
-                                   side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
-                        drawLineForBoxSide(graphicsContext, x1 + std::max((adjacentWidth1 * 2 + 1) / 3, 0),
-                                   y2 - thirdOfThickness, x2 - std::max((adjacentWidth2 * 2 + 1) / 3, 0), y2,
-                                   side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
+                        paintBorderRect = pixelSnappedForPainting(LayoutRect(x1 + mitreOffset1, y1, (x2 - mitreOffset3) - (x1 + mitreOffset1), thirdOfThickness), deviceScaleFactor);
+                        drawLineForBoxSide(graphicsContext, paintBorderRect.x(), paintBorderRect.y(), paintBorderRect.maxX(), paintBorderRect.maxY(), side, color, SOLID,
+                            adjacent1BigThird, adjacent2BigThird, antialias);
+
+                        paintBorderRect = pixelSnappedForPainting(LayoutRect(x1 + mitreOffset2, y2 - thirdOfThickness, (x2 - mitreOffset4) - (x1 + mitreOffset2), thirdOfThickness), deviceScaleFactor);
+                        drawLineForBoxSide(graphicsContext, paintBorderRect.x(), paintBorderRect.y(), paintBorderRect.maxX(), paintBorderRect.maxY(), side, color, SOLID,
+                            adjacent1BigThird, adjacent2BigThird, antialias);
                         break;
                     case BSLeft:
-                        drawLineForBoxSide(graphicsContext, x1, y1 + std::max((-adjacentWidth1 * 2 + 1) / 3, 0),
-                                   x1 + thirdOfThickness, y2 - std::max((-adjacentWidth2 * 2 + 1) / 3, 0),
-                                   side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
-                        drawLineForBoxSide(graphicsContext, x2 - thirdOfThickness, y1 + std::max((adjacentWidth1 * 2 + 1) / 3, 0),
-                                   x2, y2 - std::max((adjacentWidth2 * 2 + 1) / 3, 0),
-                                   side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
+                        paintBorderRect = pixelSnappedForPainting(LayoutRect(x1, y1 + mitreOffset1, thirdOfThickness, (y2 - mitreOffset3) - (y1 + mitreOffset1)), deviceScaleFactor);
+                        drawLineForBoxSide(graphicsContext, paintBorderRect.x(), paintBorderRect.y(), paintBorderRect.maxX(), paintBorderRect.maxY(), side, color, SOLID,
+                            adjacent1BigThird, adjacent2BigThird, antialias);
+
+                        paintBorderRect = pixelSnappedForPainting(LayoutRect(x2 - thirdOfThickness, y1 + mitreOffset2, thirdOfThickness, (y2 - mitreOffset4) - (y1 + mitreOffset2)), deviceScaleFactor);
+                        drawLineForBoxSide(graphicsContext, paintBorderRect.x(), paintBorderRect.y(), paintBorderRect.maxX(), paintBorderRect.maxY(), side, color, SOLID,
+                            adjacent1BigThird, adjacent2BigThird, antialias);
                         break;
                     case BSBottom:
-                        drawLineForBoxSide(graphicsContext, x1 + std::max((adjacentWidth1 * 2 + 1) / 3, 0),
-                                   y1, x2 - std::max((adjacentWidth2 * 2 + 1) / 3, 0), y1 + thirdOfThickness,
-                                   side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
-                        drawLineForBoxSide(graphicsContext, x1 + std::max((-adjacentWidth1 * 2 + 1) / 3, 0),
-                                   y2 - thirdOfThickness, x2 - std::max((-adjacentWidth2 * 2 + 1) / 3, 0), y2,
-                                   side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
+                        paintBorderRect = pixelSnappedForPainting(LayoutRect(x1 + mitreOffset2, y1, (x2 - mitreOffset4) - (x1 + mitreOffset2), thirdOfThickness), deviceScaleFactor);
+                        drawLineForBoxSide(graphicsContext, paintBorderRect.x(), paintBorderRect.y(), paintBorderRect.maxX(), paintBorderRect.maxY(), side, color, SOLID,
+                            adjacent1BigThird, adjacent2BigThird, antialias);
+
+                        paintBorderRect = pixelSnappedForPainting(LayoutRect(x1 + mitreOffset1, y2 - thirdOfThickness, (x2 - mitreOffset3) - (x1 + mitreOffset1), thirdOfThickness), deviceScaleFactor);
+                        drawLineForBoxSide(graphicsContext, paintBorderRect.x(), paintBorderRect.y(), paintBorderRect.maxX(), paintBorderRect.maxY(), side, color, SOLID,
+                            adjacent1BigThird, adjacent2BigThird, antialias);
                         break;
                     case BSRight:
-                        drawLineForBoxSide(graphicsContext, x1, y1 + std::max((adjacentWidth1 * 2 + 1) / 3, 0),
-                                   x1 + thirdOfThickness, y2 - std::max((adjacentWidth2 * 2 + 1) / 3, 0),
-                                   side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
-                        drawLineForBoxSide(graphicsContext, x2 - thirdOfThickness, y1 + std::max((-adjacentWidth1 * 2 + 1) / 3, 0),
-                                   x2, y2 - std::max((-adjacentWidth2 * 2 + 1) / 3, 0),
-                                   side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
+                        paintBorderRect = pixelSnappedForPainting(LayoutRect(x1, y1 + mitreOffset2, thirdOfThickness, (y2 - mitreOffset4) - (y1 + mitreOffset2)), deviceScaleFactor);
+                        drawLineForBoxSide(graphicsContext, paintBorderRect.x(), paintBorderRect.y(), paintBorderRect.maxX(), paintBorderRect.maxY(), side, color, SOLID,
+                            adjacent1BigThird, adjacent2BigThird, antialias);
+
+                        paintBorderRect = pixelSnappedForPainting(LayoutRect(x2 - thirdOfThickness, y1 + mitreOffset1, thirdOfThickness, (y2 - mitreOffset3) - (y1 + mitreOffset1)), deviceScaleFactor);
+                        drawLineForBoxSide(graphicsContext, paintBorderRect.x(), paintBorderRect.y(), paintBorderRect.maxX(), paintBorderRect.maxY(), side, color, SOLID,
+                            adjacent1BigThird, adjacent2BigThird, antialias);
                         break;
                     default:
                         break;
@@ -867,33 +876,53 @@
                 s2 = INSET;
             }
 
-            int adjacent1BigHalf = ((adjacentWidth1 > 0) ? adjacentWidth1 + 1 : adjacentWidth1 - 1) / 2;
-            int adjacent2BigHalf = ((adjacentWidth2 > 0) ? adjacentWidth2 + 1 : adjacentWidth2 - 1) / 2;
+            float adjacent1BigHalf = ceilToDevicePixel(adjacentWidth1 / 2, deviceScaleFactor);
+            float adjacent2BigHalf = ceilToDevicePixel(adjacentWidth2 / 2, deviceScaleFactor);
 
+            float adjacent1SmallHalf = floorToDevicePixel(adjacentWidth1 / 2, deviceScaleFactor);
+            float adjacent2SmallHalf = floorToDevicePixel(adjacentWidth2 / 2, deviceScaleFactor);
+
+            float offset1 = 0;
+            float offset2 = 0;
+            float offset3 = 0;
+            float offset4 = 0;
+
+            if (((side == BSTop || side == BSLeft) && adjacentWidth1 < 0) || ((side == BSBottom || side == BSRight) && adjacentWidth1 > 0))
+                offset1 = floorToDevicePixel(adjacentWidth1 / 2, deviceScaleFactor);
+
+            if (((side == BSTop || side == BSLeft) && adjacentWidth2 < 0) || ((side == BSBottom || side == BSRight) && adjacentWidth2 > 0))
+                offset2 = ceilToDevicePixel(adjacentWidth2 / 2, deviceScaleFactor);
+
+            if (((side == BSTop || side == BSLeft) && adjacentWidth1 > 0) || ((side == BSBottom || side == BSRight) && adjacentWidth1 < 0))
+                offset3 = floorToDevicePixel(fabs(adjacentWidth1) / 2, deviceScaleFactor);
+
+            if (((side == BSTop || side == BSLeft) && adjacentWidth2 > 0) || ((side == BSBottom || side == BSRight) && adjacentWidth2 < 0))
+                offset4 = ceilToDevicePixel(adjacentWidth2 / 2, deviceScaleFactor);
+
+            float adjustedX = ceilToDevicePixel((x1 + x2) / 2, deviceScaleFactor);
+            float adjustedY = ceilToDevicePixel((y1 + y2) / 2, deviceScaleFactor);
+            /// Quads can't use the default snapping rect functions.
+            x1 = roundToDevicePixel(x1, deviceScaleFactor);
+            x2 = roundToDevicePixel(x2, deviceScaleFactor);
+            y1 = roundToDevicePixel(y1, deviceScaleFactor);
+            y2 = roundToDevicePixel(y2, deviceScaleFactor);
+
             switch (side) {
                 case BSTop:
-                    drawLineForBoxSide(graphicsContext, x1 + std::max(-adjacentWidth1, 0) / 2, y1, x2 - std::max(-adjacentWidth2, 0) / 2, (y1 + y2 + 1) / 2,
-                               side, color, s1, adjacent1BigHalf, adjacent2BigHalf, antialias);
-                    drawLineForBoxSide(graphicsContext, x1 + std::max(adjacentWidth1 + 1, 0) / 2, (y1 + y2 + 1) / 2, x2 - std::max(adjacentWidth2 + 1, 0) / 2, y2,
-                               side, color, s2, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias);
+                    drawLineForBoxSide(graphicsContext, x1 + offset1, y1, x2 - offset2, adjustedY, side, color, s1, adjacent1BigHalf, adjacent2BigHalf, antialias);
+                    drawLineForBoxSide(graphicsContext, x1 + offset3, adjustedY, x2 - offset4, y2, side, color, s2, adjacent1SmallHalf, adjacent2SmallHalf, antialias);
                     break;
                 case BSLeft:
-                    drawLineForBoxSide(graphicsContext, x1, y1 + std::max(-adjacentWidth1, 0) / 2, (x1 + x2 + 1) / 2, y2 - std::max(-adjacentWidth2, 0) / 2,
-                               side, color, s1, adjacent1BigHalf, adjacent2BigHalf, antialias);
-                    drawLineForBoxSide(graphicsContext, (x1 + x2 + 1) / 2, y1 + std::max(adjacentWidth1 + 1, 0) / 2, x2, y2 - std::max(adjacentWidth2 + 1, 0) / 2,
-                               side, color, s2, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias);
+                    drawLineForBoxSide(graphicsContext, x1, y1 + offset1, adjustedX, y2 - offset2, side, color, s1, adjacent1BigHalf, adjacent2BigHalf, antialias);
+                    drawLineForBoxSide(graphicsContext, adjustedX, y1 + offset3, x2, y2 - offset4, side, color, s2, adjacent1SmallHalf, adjacent2SmallHalf, antialias);
                     break;
                 case BSBottom:
-                    drawLineForBoxSide(graphicsContext, x1 + std::max(adjacentWidth1, 0) / 2, y1, x2 - std::max(adjacentWidth2, 0) / 2, (y1 + y2 + 1) / 2,
-                               side, color, s2, adjacent1BigHalf, adjacent2BigHalf, antialias);
-                    drawLineForBoxSide(graphicsContext, x1 + std::max(-adjacentWidth1 + 1, 0) / 2, (y1 + y2 + 1) / 2, x2 - std::max(-adjacentWidth2 + 1, 0) / 2, y2,
-                               side, color, s1, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias);
+                    drawLineForBoxSide(graphicsContext, x1 + offset1, y1, x2 - offset2, adjustedY, side, color, s2, adjacent1BigHalf, adjacent2BigHalf, antialias);
+                    drawLineForBoxSide(graphicsContext, x1 + offset3, adjustedY, x2 - offset4, y2, side, color, s1, adjacent1SmallHalf, adjacent2SmallHalf, antialias);
                     break;
                 case BSRight:
-                    drawLineForBoxSide(graphicsContext, x1, y1 + std::max(adjacentWidth1, 0) / 2, (x1 + x2 + 1) / 2, y2 - std::max(adjacentWidth2, 0) / 2,
-                               side, color, s2, adjacent1BigHalf, adjacent2BigHalf, antialias);
-                    drawLineForBoxSide(graphicsContext, (x1 + x2 + 1) / 2, y1 + std::max(-adjacentWidth1 + 1, 0) / 2, x2, y2 - std::max(-adjacentWidth2 + 1, 0) / 2,
-                               side, color, s1, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias);
+                    drawLineForBoxSide(graphicsContext, x1, y1 + offset1, adjustedX, y2 - offset2, side, color, s2, adjacent1BigHalf, adjacent2BigHalf, antialias);
+                    drawLineForBoxSide(graphicsContext, adjustedX, y1 + offset3, x2, y2 - offset4, side, color, s1, adjacent1SmallHalf, adjacent2SmallHalf, antialias);
                     break;
             }
             break;
@@ -919,36 +948,42 @@
                 // this matters for rects in transformed contexts.
                 bool wasAntialiased = graphicsContext->shouldAntialias();
                 graphicsContext->setShouldAntialias(antialias);
-                graphicsContext->drawRect(pixelSnappedForPainting(x1, y1, x2 - x1, y2 - y1, pixelSnappingFactor));
+                graphicsContext->drawRect(pixelSnappedForPainting(x1, y1, x2 - x1, y2 - y1, deviceScaleFactor));
                 graphicsContext->setShouldAntialias(wasAntialiased);
                 graphicsContext->setStrokeStyle(oldStrokeStyle);
                 return;
             }
+
+            // FIXME: These roundings should be replaced by ASSERT(device pixel positioned) when all the callers transitioned to device pixels.
+            x1 = roundToDevicePixel(x1, deviceScaleFactor);
+            y1 = roundToDevicePixel(y1, deviceScaleFactor);
+            x2 = roundToDevicePixel(x2, deviceScaleFactor);
+            y2 = roundToDevicePixel(y2, deviceScaleFactor);
             FloatPoint quad[4];
             switch (side) {
                 case BSTop:
-                    quad[0] = FloatPoint(x1 + std::max(-adjacentWidth1, 0), y1);
-                    quad[1] = FloatPoint(x1 + std::max(adjacentWidth1, 0), y2);
-                    quad[2] = FloatPoint(x2 - std::max(adjacentWidth2, 0), y2);
-                    quad[3] = FloatPoint(x2 - std::max(-adjacentWidth2, 0), y1);
+                    quad[0] = FloatPoint(x1 + std::max<float>(-adjacentWidth1, 0), y1);
+                    quad[1] = FloatPoint(x1 + std::max<float>(adjacentWidth1, 0), y2);
+                    quad[2] = FloatPoint(x2 - std::max<float>(adjacentWidth2, 0), y2);
+                    quad[3] = FloatPoint(x2 - std::max<float>(-adjacentWidth2, 0), y1);
                     break;
                 case BSBottom:
-                    quad[0] = FloatPoint(x1 + std::max(adjacentWidth1, 0), y1);
-                    quad[1] = FloatPoint(x1 + std::max(-adjacentWidth1, 0), y2);
-                    quad[2] = FloatPoint(x2 - std::max(-adjacentWidth2, 0), y2);
-                    quad[3] = FloatPoint(x2 - std::max(adjacentWidth2, 0), y1);
+                    quad[0] = FloatPoint(x1 + std::max<float>(adjacentWidth1, 0), y1);
+                    quad[1] = FloatPoint(x1 + std::max<float>(-adjacentWidth1, 0), y2);
+                    quad[2] = FloatPoint(x2 - std::max<float>(-adjacentWidth2, 0), y2);
+                    quad[3] = FloatPoint(x2 - std::max<float>(adjacentWidth2, 0), y1);
                     break;
                 case BSLeft:
-                    quad[0] = FloatPoint(x1, y1 + std::max(-adjacentWidth1, 0));
-                    quad[1] = FloatPoint(x1, y2 - std::max(-adjacentWidth2, 0));
-                    quad[2] = FloatPoint(x2, y2 - std::max(adjacentWidth2, 0));
-                    quad[3] = FloatPoint(x2, y1 + std::max(adjacentWidth1, 0));
+                    quad[0] = FloatPoint(x1, y1 + std::max<float>(-adjacentWidth1, 0));
+                    quad[1] = FloatPoint(x1, y2 - std::max<float>(-adjacentWidth2, 0));
+                    quad[2] = FloatPoint(x2, y2 - std::max<float>(adjacentWidth2, 0));
+                    quad[3] = FloatPoint(x2, y1 + std::max<float>(adjacentWidth1, 0));
                     break;
                 case BSRight:
-                    quad[0] = FloatPoint(x1, y1 + std::max(adjacentWidth1, 0));
-                    quad[1] = FloatPoint(x1, y2 - std::max(adjacentWidth2, 0));
-                    quad[2] = FloatPoint(x2, y2 - std::max(-adjacentWidth2, 0));
-                    quad[3] = FloatPoint(x2, y1 + std::max(-adjacentWidth1, 0));
+                    quad[0] = FloatPoint(x1, y1 + std::max<float>(adjacentWidth1, 0));
+                    quad[1] = FloatPoint(x1, y2 - std::max<float>(adjacentWidth2, 0));
+                    quad[2] = FloatPoint(x2, y2 - std::max<float>(-adjacentWidth2, 0));
+                    quad[3] = FloatPoint(x2, y1 + std::max<float>(-adjacentWidth1, 0));
                     break;
             }
 

Modified: trunk/Source/WebCore/rendering/RenderObject.h (164887 => 164888)


--- trunk/Source/WebCore/rendering/RenderObject.h	2014-02-28 23:04:05 UTC (rev 164887)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2014-02-28 23:05:58 UTC (rev 164888)
@@ -876,8 +876,7 @@
 
     RespectImageOrientationEnum shouldRespectImageOrientation() const;
 
-    void drawLineForBoxSide(GraphicsContext*, LayoutUnit x1, LayoutUnit y1, LayoutUnit x2, LayoutUnit y2, BoxSide,
-                            Color, EBorderStyle, int adjbw1, int adjbw2, bool antialias = false);
+    void drawLineForBoxSide(GraphicsContext*, float x1, float y1, float x2, float y2, BoxSide, Color, EBorderStyle, float adjbw1, float adjbw2, bool antialias = false);
 protected:
     int columnNumberForOffset(int offset);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to