Changeset 87387 in webkit


Ignore:
Timestamp:
May 26, 2011 8:34:48 AM (13 years ago)
Author:
Simon Fraser
Message:

2011-05-25 Simon Fraser <Simon Fraser>

Reviewed by Dan Bernstein.

Always antialias borders, outlines and rules when scaling
https://bugs.webkit.org/show_bug.cgi?id=61502

r84273 changed the behavior of drawLineForBoxSide() to never antialias by default.
This actually disabled antialiasing in some circumstances where it used to be enabled,
for example collapsed table border drawing.

Fix by allowing antialiasing for collapsed table borders, column rules and span
outlines when the context is scaled.

Test: fast/borders/border-antialiasing.html

  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::paintColumnRules):
  • rendering/RenderInline.cpp: (WebCore::RenderInline::paintOutline): (WebCore::RenderInline::paintOutlineForLine):
  • rendering/RenderTableCell.cpp: (WebCore::RenderTableCell::paintCollapsedBorder):
Location:
trunk
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r87385 r87387  
     12011-05-25  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        Always antialias table borders when scaling
     6        https://bugs.webkit.org/show_bug.cgi?id=61502
     7       
     8        Pixel tests for the drawing of collapsed table borders, column rules
     9        and inline outlines when scaled.
     10
     11        * fast/borders/border-antialiasing.html: Added.
     12        * platform/mac/fast/borders/border-antialiasing-expected.png: Added.
     13        * platform/mac/fast/borders/border-antialiasing-expected.txt: Added.
     14
    1152011-05-26  Csaba Osztrogonác  <ossy@webkit.org>
    216
  • trunk/Source/WebCore/ChangeLog

    r87383 r87387  
     12011-05-25  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        Always antialias borders, outlines and rules when scaling
     6        https://bugs.webkit.org/show_bug.cgi?id=61502
     7       
     8        r84273 changed the behavior of drawLineForBoxSide() to never antialias by default.
     9        This actually disabled antialiasing in some circumstances where it used to be enabled,
     10        for example collapsed table border drawing.
     11       
     12        Fix by allowing antialiasing for collapsed table borders, column rules and span
     13        outlines when the context is scaled.
     14
     15        Test: fast/borders/border-antialiasing.html
     16
     17        * rendering/RenderBlock.cpp:
     18        (WebCore::RenderBlock::paintColumnRules):
     19        * rendering/RenderInline.cpp:
     20        (WebCore::RenderInline::paintOutline):
     21        (WebCore::RenderInline::paintOutlineForLine):
     22        * rendering/RenderTableCell.cpp:
     23        (WebCore::RenderTableCell::paintCollapsedBorder):
     24
    1252011-05-26  Vsevolod Vlasov  <vsevik@chromium.org>
    226
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r87303 r87387  
    22742274void RenderBlock::paintColumnRules(PaintInfo& paintInfo, int tx, int ty)
    22752275{
     2276    if (paintInfo.context->paintingDisabled())
     2277        return;
     2278
    22762279    const Color& ruleColor = style()->visitedDependentColor(CSSPropertyWebkitColumnRuleColor);
    22772280    bool ruleTransparent = style()->columnRuleIsTransparent();
     
    22892292    int ruleAdd = logicalLeftOffsetForContent();
    22902293    int ruleLogicalLeft = style()->isLeftToRightDirection() ? 0 : contentLogicalWidth();
     2294
     2295    const AffineTransform& currentCTM = paintInfo.context->getCTM();
     2296    bool antialias = !currentCTM.isIdentityOrTranslationOrFlipped();
     2297
    22912298    for (unsigned i = 0; i < colCount; i++) {
    22922299        IntRect colRect = columnRectAt(colInfo, i);
     
    23102317            int ruleBottom = isHorizontalWritingMode() ? ruleTop + contentHeight() : ruleTop + ruleWidth;
    23112318            drawLineForBoxSide(paintInfo.context, ruleLeft, ruleTop, ruleRight, ruleBottom,
    2312                                style()->isLeftToRightDirection() ? BSLeft : BSRight, ruleColor, ruleStyle, 0, 0);
     2319                               style()->isLeftToRightDirection() ? BSLeft : BSRight, ruleColor, ruleStyle, 0, 0, antialias);
    23132320        }
    23142321       
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r87303 r87387  
    13801380    }
    13811381
     1382    if (graphicsContext->paintingDisabled())
     1383        return;
     1384
    13821385    if (styleToUse->outlineStyleIsAuto() || styleToUse->outlineStyle() == BNONE)
    13831386        return;
     
    14231426    int ow = styleToUse->outlineWidth();
    14241427    EBorderStyle os = styleToUse->outlineStyle();
     1428
     1429    const AffineTransform& currentCTM = graphicsContext->getCTM();
     1430    bool antialias = !currentCTM.isIdentityOrTranslationOrFlipped();
    14251431
    14261432    int offset = style()->outlineOffset();
     
    14401446               outlineColor, os,
    14411447               (lastline.isEmpty() || thisline.x() < lastline.x() || (lastline.maxX() - 1) <= thisline.x() ? ow : -ow),
    1442                (nextline.isEmpty() || thisline.x() <= nextline.x() || (nextline.maxX() - 1) <= thisline.x() ? ow : -ow));
     1448               (nextline.isEmpty() || thisline.x() <= nextline.x() || (nextline.maxX() - 1) <= thisline.x() ? ow : -ow),
     1449               antialias);
    14431450   
    14441451    // right edge
     
    14511458               outlineColor, os,
    14521459               (lastline.isEmpty() || lastline.maxX() < thisline.maxX() || (thisline.maxX() - 1) <= lastline.x() ? ow : -ow),
    1453                (nextline.isEmpty() || nextline.maxX() <= thisline.maxX() || (thisline.maxX() - 1) <= nextline.x() ? ow : -ow));
     1460               (nextline.isEmpty() || nextline.maxX() <= thisline.maxX() || (thisline.maxX() - 1) <= nextline.x() ? ow : -ow),
     1461               antialias);
    14541462    // upper edge
    14551463    if (thisline.x() < lastline.x())
     
    14581466                   t - ow,
    14591467                   min(r+ow, (lastline.isEmpty() ? 1000000 : tx + lastline.x())),
    1460                    t ,
     1468                   t,
    14611469                   BSTop, outlineColor, os,
    14621470                   ow,
    1463                    (!lastline.isEmpty() && tx + lastline.x() + 1 < r + ow) ? -ow : ow);
     1471                   (!lastline.isEmpty() && tx + lastline.x() + 1 < r + ow) ? -ow : ow,
     1472                   antialias);
    14641473   
    14651474    if (lastline.maxX() < thisline.maxX())
     
    14681477                   t - ow,
    14691478                   r + ow,
    1470                    t ,
     1479                   t,
    14711480                   BSTop, outlineColor, os,
    14721481                   (!lastline.isEmpty() && l - ow < tx + lastline.maxX()) ? -ow : ow,
    1473                    ow);
     1482                   ow, antialias);
    14741483   
    14751484    // lower edge
     
    14821491                   BSBottom, outlineColor, os,
    14831492                   ow,
    1484                    (!nextline.isEmpty() && tx + nextline.x() + 1 < r + ow) ? -ow : ow);
     1493                   (!nextline.isEmpty() && tx + nextline.x() + 1 < r + ow) ? -ow : ow,
     1494                   antialias);
    14851495   
    14861496    if (nextline.maxX() < thisline.maxX())
     
    14921502                   BSBottom, outlineColor, os,
    14931503                   (!nextline.isEmpty() && l - ow < tx + nextline.maxX()) ? -ow : ow,
    1494                    ow);
     1504                   ow, antialias);
    14951505}
    14961506
  • trunk/Source/WebCore/rendering/RenderTableCell.cpp

    r87303 r87387  
    915915void RenderTableCell::paintCollapsedBorder(GraphicsContext* graphicsContext, const IntRect& paintRect)
    916916{
    917     if (!table()->currentBorderStyle())
     917    if (!table()->currentBorderStyle() || graphicsContext->paintingDisabled())
    918918        return;
    919919   
     
    951951    borders.addBorder(leftVal, BSLeft, renderLeft, x, y, x + leftWidth, y + h, leftStyle);
    952952    borders.addBorder(rightVal, BSRight, renderRight, x + w - rightWidth, y, x + w, y + h, rightStyle);
     953
     954    const AffineTransform& currentCTM = graphicsContext->getCTM();
     955    bool antialias = !currentCTM.isIdentityOrTranslationOrFlipped();
    953956   
    954957    for (CollapsedBorder* border = borders.nextBorder(); border; border = borders.nextBorder()) {
    955958        if (border->borderValue == *table()->currentBorderStyle())
    956959            drawLineForBoxSide(graphicsContext, border->x1, border->y1, border->x2, border->y2, border->side,
    957                                border->borderValue.color(), border->style, 0, 0);
     960                               border->borderValue.color(), border->style, 0, 0, antialias);
    958961    }
    959962}
Note: See TracChangeset for help on using the changeset viewer.