Changeset 164888 in webkit


Ignore:
Timestamp:
Feb 28, 2014 3:05:58 PM (10 years ago)
Author:
Alan Bujtas
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:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r164886 r164888  
     12014-02-28  Zalan Bujtas  <zalan@apple.com>
     2
     3        Subpixel rendering: Add subpixel support to border type of double, groove, ridge, inset and outset.
     4        https://bugs.webkit.org/show_bug.cgi?id=129226
     5
     6        Reviewed by Simon Fraser.
     7
     8        This is the conversion of double, inset, outset, groove and ridge border type
     9        painting to support device pixel precision width/height.
     10
     11        Regression is covered by existing tests.
     12
     13        * rendering/RenderObject.cpp:
     14        (WebCore::RenderObject::drawLineForBoxSide):
     15        * rendering/RenderObject.h:
     16
    1172014-02-28  Adenilson Cavalcanti  <cavalcantii@gmail.com>
    218
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r164594 r164888  
    723723}
    724724
    725 void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, LayoutUnit x1, LayoutUnit y1, LayoutUnit x2, LayoutUnit y2,
    726     BoxSide side, Color color, EBorderStyle borderStyle, int adjacentWidth1, int adjacentWidth2, bool antialias)
    727 {
     725void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, float x1, float y1, float x2, float y2,
     726    BoxSide side, Color color, EBorderStyle borderStyle, float adjacentWidth1, float adjacentWidth2, bool antialias)
     727{
     728    float deviceScaleFactor = document().deviceScaleFactor();
    728729    float thickness;
    729730    float length;
     
    735736        length = y2 - y1;
    736737    }
    737 
    738     if (borderStyle == DOUBLE && thickness < 3)
     738    // 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)).
     739    thickness = floorToDevicePixel(thickness, deviceScaleFactor);
     740    length = floorToDevicePixel(length, deviceScaleFactor);
     741
     742    if (borderStyle == DOUBLE && (thickness * deviceScaleFactor) < 3)
    739743        borderStyle = SOLID;
    740744
    741     float pixelSnappingFactor = document().deviceScaleFactor();
    742745    // FIXME: We really would like this check to be an ASSERT as we don't want to draw empty borders. However
    743746    // nothing guarantees that the following recursive calls to drawLineForBoxSide will have non-null dimensions.
    744     // FIXME: flooring is a temporary solution until the device pixel snapping is added here for all border types.
    745     if (borderStyle == SOLID) {
    746         thickness = roundToDevicePixel(thickness, pixelSnappingFactor);
    747         length = roundToDevicePixel(length, pixelSnappingFactor);
    748     } else {
    749         thickness = floorf(thickness);
    750         length = floorf(length);
    751     }
    752747    if (!thickness || !length)
    753748        return;
     
    768763                graphicsContext->setStrokeStyle(borderStyle == DASHED ? DashedStroke : DottedStroke);
    769764
     765                // FIXME: There's some odd adjustment in GraphicsContext::drawLine() that disables device pixel precision line drawing.
     766                int adjustedX = floorToInt((x1 + x2) / 2);
     767                int adjustedY = floorToInt((y1 + y2) / 2);
     768
    770769                switch (side) {
    771770                    case BSBottom:
    772771                    case BSTop:
    773                         graphicsContext->drawLine(IntPoint(x1, (y1 + y2) / 2), IntPoint(x2, (y1 + y2) / 2));
     772                        graphicsContext->drawLine(FloatPoint(x1, adjustedY), FloatPoint(x2, adjustedY));
    774773                        break;
    775774                    case BSRight:
    776775                    case BSLeft:
    777                         graphicsContext->drawLine(IntPoint((x1 + x2) / 2, y1), IntPoint((x1 + x2) / 2, y2));
     776                        graphicsContext->drawLine(FloatPoint(adjustedX, y1), FloatPoint(adjustedX, y2));
    778777                        break;
    779778                }
     
    784783        }
    785784        case DOUBLE: {
    786             int thirdOfThickness = (thickness + 1) / 3;
     785            float thirdOfThickness = ceilToDevicePixel(thickness / 3, deviceScaleFactor);
    787786            ASSERT(thirdOfThickness);
    788787
     
    798797                    case BSTop:
    799798                    case BSBottom:
    800                         graphicsContext->drawRect(IntRect(x1, y1, length, thirdOfThickness));
    801                         graphicsContext->drawRect(IntRect(x1, y2 - thirdOfThickness, length, thirdOfThickness));
     799                        graphicsContext->drawRect(pixelSnappedForPainting(x1, y1, length, thirdOfThickness, deviceScaleFactor));
     800                        graphicsContext->drawRect(pixelSnappedForPainting(x1, y2 - thirdOfThickness, length, thirdOfThickness, deviceScaleFactor));
    802801                        break;
    803802                    case BSLeft:
    804803                    case BSRight:
    805                         // FIXME: Why do we offset the border by 1 in this case but not the other one?
    806                         if (length > 1) {
    807                             graphicsContext->drawRect(IntRect(x1, y1 + 1, thirdOfThickness, length - 1));
    808                             graphicsContext->drawRect(IntRect(x2 - thirdOfThickness, y1 + 1, thirdOfThickness, length - 1));
    809                         }
     804                        graphicsContext->drawRect(pixelSnappedForPainting(x1, y1, thirdOfThickness, length, deviceScaleFactor));
     805                        graphicsContext->drawRect(pixelSnappedForPainting(x2 - thirdOfThickness, y1, thirdOfThickness, length, deviceScaleFactor));
    810806                        break;
    811807                }
     
    814810                graphicsContext->setStrokeStyle(oldStrokeStyle);
    815811            } else {
    816                 int adjacent1BigThird = ((adjacentWidth1 > 0) ? adjacentWidth1 + 1 : adjacentWidth1 - 1) / 3;
    817                 int adjacent2BigThird = ((adjacentWidth2 > 0) ? adjacentWidth2 + 1 : adjacentWidth2 - 1) / 3;
    818 
     812                float adjacent1BigThird = ceilToDevicePixel(adjacentWidth1 / 3, deviceScaleFactor);
     813                float adjacent2BigThird = ceilToDevicePixel(adjacentWidth2 / 3, deviceScaleFactor);
     814
     815                float offset1 = floorToDevicePixel(fabs(adjacentWidth1) * 2 / 3, deviceScaleFactor);
     816                float offset2 = floorToDevicePixel(fabs(adjacentWidth2) * 2 / 3, deviceScaleFactor);
     817
     818                float mitreOffset1 = adjacentWidth1 < 0 ? offset1 : 0;
     819                float mitreOffset2 = adjacentWidth1 > 0 ? offset1 : 0;
     820                float mitreOffset3 = adjacentWidth2 < 0 ? offset2 : 0;
     821                float mitreOffset4 = adjacentWidth2 > 0 ? offset2 : 0;
     822
     823                FloatRect paintBorderRect;
    819824                switch (side) {
    820825                    case BSTop:
    821                         drawLineForBoxSide(graphicsContext, x1 + std::max((-adjacentWidth1 * 2 + 1) / 3, 0),
    822                                    y1, x2 - std::max((-adjacentWidth2 * 2 + 1) / 3, 0), y1 + thirdOfThickness,
    823                                    side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
    824                         drawLineForBoxSide(graphicsContext, x1 + std::max((adjacentWidth1 * 2 + 1) / 3, 0),
    825                                    y2 - thirdOfThickness, x2 - std::max((adjacentWidth2 * 2 + 1) / 3, 0), y2,
    826                                    side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
     826                        paintBorderRect = pixelSnappedForPainting(LayoutRect(x1 + mitreOffset1, y1, (x2 - mitreOffset3) - (x1 + mitreOffset1), thirdOfThickness), deviceScaleFactor);
     827                        drawLineForBoxSide(graphicsContext, paintBorderRect.x(), paintBorderRect.y(), paintBorderRect.maxX(), paintBorderRect.maxY(), side, color, SOLID,
     828                            adjacent1BigThird, adjacent2BigThird, antialias);
     829
     830                        paintBorderRect = pixelSnappedForPainting(LayoutRect(x1 + mitreOffset2, y2 - thirdOfThickness, (x2 - mitreOffset4) - (x1 + mitreOffset2), thirdOfThickness), deviceScaleFactor);
     831                        drawLineForBoxSide(graphicsContext, paintBorderRect.x(), paintBorderRect.y(), paintBorderRect.maxX(), paintBorderRect.maxY(), side, color, SOLID,
     832                            adjacent1BigThird, adjacent2BigThird, antialias);
    827833                        break;
    828834                    case BSLeft:
    829                         drawLineForBoxSide(graphicsContext, x1, y1 + std::max((-adjacentWidth1 * 2 + 1) / 3, 0),
    830                                    x1 + thirdOfThickness, y2 - std::max((-adjacentWidth2 * 2 + 1) / 3, 0),
    831                                    side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
    832                         drawLineForBoxSide(graphicsContext, x2 - thirdOfThickness, y1 + std::max((adjacentWidth1 * 2 + 1) / 3, 0),
    833                                    x2, y2 - std::max((adjacentWidth2 * 2 + 1) / 3, 0),
    834                                    side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
     835                        paintBorderRect = pixelSnappedForPainting(LayoutRect(x1, y1 + mitreOffset1, thirdOfThickness, (y2 - mitreOffset3) - (y1 + mitreOffset1)), deviceScaleFactor);
     836                        drawLineForBoxSide(graphicsContext, paintBorderRect.x(), paintBorderRect.y(), paintBorderRect.maxX(), paintBorderRect.maxY(), side, color, SOLID,
     837                            adjacent1BigThird, adjacent2BigThird, antialias);
     838
     839                        paintBorderRect = pixelSnappedForPainting(LayoutRect(x2 - thirdOfThickness, y1 + mitreOffset2, thirdOfThickness, (y2 - mitreOffset4) - (y1 + mitreOffset2)), deviceScaleFactor);
     840                        drawLineForBoxSide(graphicsContext, paintBorderRect.x(), paintBorderRect.y(), paintBorderRect.maxX(), paintBorderRect.maxY(), side, color, SOLID,
     841                            adjacent1BigThird, adjacent2BigThird, antialias);
    835842                        break;
    836843                    case BSBottom:
    837                         drawLineForBoxSide(graphicsContext, x1 + std::max((adjacentWidth1 * 2 + 1) / 3, 0),
    838                                    y1, x2 - std::max((adjacentWidth2 * 2 + 1) / 3, 0), y1 + thirdOfThickness,
    839                                    side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
    840                         drawLineForBoxSide(graphicsContext, x1 + std::max((-adjacentWidth1 * 2 + 1) / 3, 0),
    841                                    y2 - thirdOfThickness, x2 - std::max((-adjacentWidth2 * 2 + 1) / 3, 0), y2,
    842                                    side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
     844                        paintBorderRect = pixelSnappedForPainting(LayoutRect(x1 + mitreOffset2, y1, (x2 - mitreOffset4) - (x1 + mitreOffset2), thirdOfThickness), deviceScaleFactor);
     845                        drawLineForBoxSide(graphicsContext, paintBorderRect.x(), paintBorderRect.y(), paintBorderRect.maxX(), paintBorderRect.maxY(), side, color, SOLID,
     846                            adjacent1BigThird, adjacent2BigThird, antialias);
     847
     848                        paintBorderRect = pixelSnappedForPainting(LayoutRect(x1 + mitreOffset1, y2 - thirdOfThickness, (x2 - mitreOffset3) - (x1 + mitreOffset1), thirdOfThickness), deviceScaleFactor);
     849                        drawLineForBoxSide(graphicsContext, paintBorderRect.x(), paintBorderRect.y(), paintBorderRect.maxX(), paintBorderRect.maxY(), side, color, SOLID,
     850                            adjacent1BigThird, adjacent2BigThird, antialias);
    843851                        break;
    844852                    case BSRight:
    845                         drawLineForBoxSide(graphicsContext, x1, y1 + std::max((adjacentWidth1 * 2 + 1) / 3, 0),
    846                                    x1 + thirdOfThickness, y2 - std::max((adjacentWidth2 * 2 + 1) / 3, 0),
    847                                    side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
    848                         drawLineForBoxSide(graphicsContext, x2 - thirdOfThickness, y1 + std::max((-adjacentWidth1 * 2 + 1) / 3, 0),
    849                                    x2, y2 - std::max((-adjacentWidth2 * 2 + 1) / 3, 0),
    850                                    side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
     853                        paintBorderRect = pixelSnappedForPainting(LayoutRect(x1, y1 + mitreOffset2, thirdOfThickness, (y2 - mitreOffset4) - (y1 + mitreOffset2)), deviceScaleFactor);
     854                        drawLineForBoxSide(graphicsContext, paintBorderRect.x(), paintBorderRect.y(), paintBorderRect.maxX(), paintBorderRect.maxY(), side, color, SOLID,
     855                            adjacent1BigThird, adjacent2BigThird, antialias);
     856
     857                        paintBorderRect = pixelSnappedForPainting(LayoutRect(x2 - thirdOfThickness, y1 + mitreOffset1, thirdOfThickness, (y2 - mitreOffset3) - (y1 + mitreOffset1)), deviceScaleFactor);
     858                        drawLineForBoxSide(graphicsContext, paintBorderRect.x(), paintBorderRect.y(), paintBorderRect.maxX(), paintBorderRect.maxY(), side, color, SOLID,
     859                            adjacent1BigThird, adjacent2BigThird, antialias);
    851860                        break;
    852861                    default:
     
    868877            }
    869878
    870             int adjacent1BigHalf = ((adjacentWidth1 > 0) ? adjacentWidth1 + 1 : adjacentWidth1 - 1) / 2;
    871             int adjacent2BigHalf = ((adjacentWidth2 > 0) ? adjacentWidth2 + 1 : adjacentWidth2 - 1) / 2;
     879            float adjacent1BigHalf = ceilToDevicePixel(adjacentWidth1 / 2, deviceScaleFactor);
     880            float adjacent2BigHalf = ceilToDevicePixel(adjacentWidth2 / 2, deviceScaleFactor);
     881
     882            float adjacent1SmallHalf = floorToDevicePixel(adjacentWidth1 / 2, deviceScaleFactor);
     883            float adjacent2SmallHalf = floorToDevicePixel(adjacentWidth2 / 2, deviceScaleFactor);
     884
     885            float offset1 = 0;
     886            float offset2 = 0;
     887            float offset3 = 0;
     888            float offset4 = 0;
     889
     890            if (((side == BSTop || side == BSLeft) && adjacentWidth1 < 0) || ((side == BSBottom || side == BSRight) && adjacentWidth1 > 0))
     891                offset1 = floorToDevicePixel(adjacentWidth1 / 2, deviceScaleFactor);
     892
     893            if (((side == BSTop || side == BSLeft) && adjacentWidth2 < 0) || ((side == BSBottom || side == BSRight) && adjacentWidth2 > 0))
     894                offset2 = ceilToDevicePixel(adjacentWidth2 / 2, deviceScaleFactor);
     895
     896            if (((side == BSTop || side == BSLeft) && adjacentWidth1 > 0) || ((side == BSBottom || side == BSRight) && adjacentWidth1 < 0))
     897                offset3 = floorToDevicePixel(fabs(adjacentWidth1) / 2, deviceScaleFactor);
     898
     899            if (((side == BSTop || side == BSLeft) && adjacentWidth2 > 0) || ((side == BSBottom || side == BSRight) && adjacentWidth2 < 0))
     900                offset4 = ceilToDevicePixel(adjacentWidth2 / 2, deviceScaleFactor);
     901
     902            float adjustedX = ceilToDevicePixel((x1 + x2) / 2, deviceScaleFactor);
     903            float adjustedY = ceilToDevicePixel((y1 + y2) / 2, deviceScaleFactor);
     904            /// Quads can't use the default snapping rect functions.
     905            x1 = roundToDevicePixel(x1, deviceScaleFactor);
     906            x2 = roundToDevicePixel(x2, deviceScaleFactor);
     907            y1 = roundToDevicePixel(y1, deviceScaleFactor);
     908            y2 = roundToDevicePixel(y2, deviceScaleFactor);
    872909
    873910            switch (side) {
    874911                case BSTop:
    875                     drawLineForBoxSide(graphicsContext, x1 + std::max(-adjacentWidth1, 0) / 2, y1, x2 - std::max(-adjacentWidth2, 0) / 2, (y1 + y2 + 1) / 2,
    876                                side, color, s1, adjacent1BigHalf, adjacent2BigHalf, antialias);
    877                     drawLineForBoxSide(graphicsContext, x1 + std::max(adjacentWidth1 + 1, 0) / 2, (y1 + y2 + 1) / 2, x2 - std::max(adjacentWidth2 + 1, 0) / 2, y2,
    878                                side, color, s2, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias);
     912                    drawLineForBoxSide(graphicsContext, x1 + offset1, y1, x2 - offset2, adjustedY, side, color, s1, adjacent1BigHalf, adjacent2BigHalf, antialias);
     913                    drawLineForBoxSide(graphicsContext, x1 + offset3, adjustedY, x2 - offset4, y2, side, color, s2, adjacent1SmallHalf, adjacent2SmallHalf, antialias);
    879914                    break;
    880915                case BSLeft:
    881                     drawLineForBoxSide(graphicsContext, x1, y1 + std::max(-adjacentWidth1, 0) / 2, (x1 + x2 + 1) / 2, y2 - std::max(-adjacentWidth2, 0) / 2,
    882                                side, color, s1, adjacent1BigHalf, adjacent2BigHalf, antialias);
    883                     drawLineForBoxSide(graphicsContext, (x1 + x2 + 1) / 2, y1 + std::max(adjacentWidth1 + 1, 0) / 2, x2, y2 - std::max(adjacentWidth2 + 1, 0) / 2,
    884                                side, color, s2, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias);
     916                    drawLineForBoxSide(graphicsContext, x1, y1 + offset1, adjustedX, y2 - offset2, side, color, s1, adjacent1BigHalf, adjacent2BigHalf, antialias);
     917                    drawLineForBoxSide(graphicsContext, adjustedX, y1 + offset3, x2, y2 - offset4, side, color, s2, adjacent1SmallHalf, adjacent2SmallHalf, antialias);
    885918                    break;
    886919                case BSBottom:
    887                     drawLineForBoxSide(graphicsContext, x1 + std::max(adjacentWidth1, 0) / 2, y1, x2 - std::max(adjacentWidth2, 0) / 2, (y1 + y2 + 1) / 2,
    888                                side, color, s2, adjacent1BigHalf, adjacent2BigHalf, antialias);
    889                     drawLineForBoxSide(graphicsContext, x1 + std::max(-adjacentWidth1 + 1, 0) / 2, (y1 + y2 + 1) / 2, x2 - std::max(-adjacentWidth2 + 1, 0) / 2, y2,
    890                                side, color, s1, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias);
     920                    drawLineForBoxSide(graphicsContext, x1 + offset1, y1, x2 - offset2, adjustedY, side, color, s2, adjacent1BigHalf, adjacent2BigHalf, antialias);
     921                    drawLineForBoxSide(graphicsContext, x1 + offset3, adjustedY, x2 - offset4, y2, side, color, s1, adjacent1SmallHalf, adjacent2SmallHalf, antialias);
    891922                    break;
    892923                case BSRight:
    893                     drawLineForBoxSide(graphicsContext, x1, y1 + std::max(adjacentWidth1, 0) / 2, (x1 + x2 + 1) / 2, y2 - std::max(adjacentWidth2, 0) / 2,
    894                                side, color, s2, adjacent1BigHalf, adjacent2BigHalf, antialias);
    895                     drawLineForBoxSide(graphicsContext, (x1 + x2 + 1) / 2, y1 + std::max(-adjacentWidth1 + 1, 0) / 2, x2, y2 - std::max(-adjacentWidth2 + 1, 0) / 2,
    896                                side, color, s1, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias);
     924                    drawLineForBoxSide(graphicsContext, x1, y1 + offset1, adjustedX, y2 - offset2, side, color, s2, adjacent1BigHalf, adjacent2BigHalf, antialias);
     925                    drawLineForBoxSide(graphicsContext, adjustedX, y1 + offset3, x2, y2 - offset4, side, color, s1, adjacent1SmallHalf, adjacent2SmallHalf, antialias);
    897926                    break;
    898927            }
     
    920949                bool wasAntialiased = graphicsContext->shouldAntialias();
    921950                graphicsContext->setShouldAntialias(antialias);
    922                 graphicsContext->drawRect(pixelSnappedForPainting(x1, y1, x2 - x1, y2 - y1, pixelSnappingFactor));
     951                graphicsContext->drawRect(pixelSnappedForPainting(x1, y1, x2 - x1, y2 - y1, deviceScaleFactor));
    923952                graphicsContext->setShouldAntialias(wasAntialiased);
    924953                graphicsContext->setStrokeStyle(oldStrokeStyle);
    925954                return;
    926955            }
     956
     957            // FIXME: These roundings should be replaced by ASSERT(device pixel positioned) when all the callers transitioned to device pixels.
     958            x1 = roundToDevicePixel(x1, deviceScaleFactor);
     959            y1 = roundToDevicePixel(y1, deviceScaleFactor);
     960            x2 = roundToDevicePixel(x2, deviceScaleFactor);
     961            y2 = roundToDevicePixel(y2, deviceScaleFactor);
    927962            FloatPoint quad[4];
    928963            switch (side) {
    929964                case BSTop:
    930                     quad[0] = FloatPoint(x1 + std::max(-adjacentWidth1, 0), y1);
    931                     quad[1] = FloatPoint(x1 + std::max(adjacentWidth1, 0), y2);
    932                     quad[2] = FloatPoint(x2 - std::max(adjacentWidth2, 0), y2);
    933                     quad[3] = FloatPoint(x2 - std::max(-adjacentWidth2, 0), y1);
     965                    quad[0] = FloatPoint(x1 + std::max<float>(-adjacentWidth1, 0), y1);
     966                    quad[1] = FloatPoint(x1 + std::max<float>(adjacentWidth1, 0), y2);
     967                    quad[2] = FloatPoint(x2 - std::max<float>(adjacentWidth2, 0), y2);
     968                    quad[3] = FloatPoint(x2 - std::max<float>(-adjacentWidth2, 0), y1);
    934969                    break;
    935970                case BSBottom:
    936                     quad[0] = FloatPoint(x1 + std::max(adjacentWidth1, 0), y1);
    937                     quad[1] = FloatPoint(x1 + std::max(-adjacentWidth1, 0), y2);
    938                     quad[2] = FloatPoint(x2 - std::max(-adjacentWidth2, 0), y2);
    939                     quad[3] = FloatPoint(x2 - std::max(adjacentWidth2, 0), y1);
     971                    quad[0] = FloatPoint(x1 + std::max<float>(adjacentWidth1, 0), y1);
     972                    quad[1] = FloatPoint(x1 + std::max<float>(-adjacentWidth1, 0), y2);
     973                    quad[2] = FloatPoint(x2 - std::max<float>(-adjacentWidth2, 0), y2);
     974                    quad[3] = FloatPoint(x2 - std::max<float>(adjacentWidth2, 0), y1);
    940975                    break;
    941976                case BSLeft:
    942                     quad[0] = FloatPoint(x1, y1 + std::max(-adjacentWidth1, 0));
    943                     quad[1] = FloatPoint(x1, y2 - std::max(-adjacentWidth2, 0));
    944                     quad[2] = FloatPoint(x2, y2 - std::max(adjacentWidth2, 0));
    945                     quad[3] = FloatPoint(x2, y1 + std::max(adjacentWidth1, 0));
     977                    quad[0] = FloatPoint(x1, y1 + std::max<float>(-adjacentWidth1, 0));
     978                    quad[1] = FloatPoint(x1, y2 - std::max<float>(-adjacentWidth2, 0));
     979                    quad[2] = FloatPoint(x2, y2 - std::max<float>(adjacentWidth2, 0));
     980                    quad[3] = FloatPoint(x2, y1 + std::max<float>(adjacentWidth1, 0));
    946981                    break;
    947982                case BSRight:
    948                     quad[0] = FloatPoint(x1, y1 + std::max(adjacentWidth1, 0));
    949                     quad[1] = FloatPoint(x1, y2 - std::max(adjacentWidth2, 0));
    950                     quad[2] = FloatPoint(x2, y2 - std::max(-adjacentWidth2, 0));
    951                     quad[3] = FloatPoint(x2, y1 + std::max(-adjacentWidth1, 0));
     983                    quad[0] = FloatPoint(x1, y1 + std::max<float>(adjacentWidth1, 0));
     984                    quad[1] = FloatPoint(x1, y2 - std::max<float>(adjacentWidth2, 0));
     985                    quad[2] = FloatPoint(x2, y2 - std::max<float>(-adjacentWidth2, 0));
     986                    quad[3] = FloatPoint(x2, y1 + std::max<float>(-adjacentWidth1, 0));
    952987                    break;
    953988            }
  • trunk/Source/WebCore/rendering/RenderObject.h

    r164594 r164888  
    877877    RespectImageOrientationEnum shouldRespectImageOrientation() const;
    878878
    879     void drawLineForBoxSide(GraphicsContext*, LayoutUnit x1, LayoutUnit y1, LayoutUnit x2, LayoutUnit y2, BoxSide,
    880                             Color, EBorderStyle, int adjbw1, int adjbw2, bool antialias = false);
     879    void drawLineForBoxSide(GraphicsContext*, float x1, float y1, float x2, float y2, BoxSide, Color, EBorderStyle, float adjbw1, float adjbw2, bool antialias = false);
    881880protected:
    882881    int columnNumberForOffset(int offset);
Note: See TracChangeset for help on using the changeset viewer.