Changeset 110761 in webkit


Ignore:
Timestamp:
Mar 14, 2012 3:02:00 PM (12 years ago)
Author:
leviw@chromium.org
Message:

Implement proper sub-pixel support in RenderFileUploadControl
https://bugs.webkit.org/show_bug.cgi?id=80881

Reviewed by Dimitri Glazkov.

Correcting improper usage of LayoutUnits when interacting with the graphics context
and platform code. Specifically:

  • pixel snapping the clip rect and paint offsets before sending values to the graphics context in paintObject.
  • using on-screen (pixel snapped) values to pass off to platform code to determine the max length of the filename to be drawn.

No new tests. No change in behavior.

  • rendering/RenderFileUploadControl.cpp:

(WebCore::nodeWidth):
(WebCore::RenderFileUploadControl::maxFilenameWidth):
(WebCore::RenderFileUploadControl::paintObject):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r110760 r110761  
     12012-03-14  Levi Weintraub  <leviw@chromium.org>
     2
     3        Implement proper sub-pixel support in RenderFileUploadControl
     4        https://bugs.webkit.org/show_bug.cgi?id=80881
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        Correcting improper usage of LayoutUnits when interacting with the graphics context
     9        and platform code. Specifically:
     10        - pixel snapping the clip rect and paint offsets before sending values to the
     11          graphics context in paintObject.
     12        - using on-screen (pixel snapped) values to pass off to platform code to determine
     13          the max length of the filename to be drawn.
     14
     15        No new tests. No change in behavior.
     16
     17        * rendering/RenderFileUploadControl.cpp:
     18        (WebCore::nodeWidth):
     19        (WebCore::RenderFileUploadControl::maxFilenameWidth):
     20        (WebCore::RenderFileUploadControl::paintObject):
     21
    1222012-03-14  Joseph Pecoraro  <pecoraro@apple.com>
    223
  • trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp

    r110598 r110761  
    9292static int nodeWidth(Node* node)
    9393{
    94     return node ? node->renderBox()->width() : zeroLayoutUnit;
     94    return node ? node->renderBox()->pixelSnappedWidth() : 0;
    9595}
    9696
     
    9898{
    9999    HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
    100     return max(0, contentWidth() - nodeWidth(uploadButton()) - afterButtonSpacing
     100    return max(0, contentBoxRect().pixelSnappedWidth() - nodeWidth(uploadButton()) - afterButtonSpacing
    101101        - (input->icon() ? iconWidth + iconFilenameSpacing : 0));
    102102}
     
    110110    GraphicsContextStateSaver stateSaver(*paintInfo.context, false);
    111111    if (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseChildBlockBackgrounds) {
    112         LayoutRect clipRect(paintOffset.x() + borderLeft(), paintOffset.y() + borderTop(),
     112        IntRect clipRect = pixelSnappedIntRect(paintOffset.x() + borderLeft(), paintOffset.y() + borderTop(),
    113113                         width() - borderLeft() - borderRight(), height() - borderBottom() - borderTop() + buttonShadowHeight);
    114114        if (clipRect.isEmpty())
     
    148148       
    149149        // Draw the filename
    150         paintInfo.context->drawBidiText(font, textRun, LayoutPoint(textX, textY));
     150        paintInfo.context->drawBidiText(font, textRun, IntPoint(roundToInt(textX), roundToInt(textY)));
    151151       
    152152        if (input->icon()) {
     
    160160
    161161            // Draw the file icon
    162             input->icon()->paint(paintInfo.context, LayoutRect(iconX, iconY, iconWidth, iconHeight));
     162            input->icon()->paint(paintInfo.context, IntRect(roundToInt(iconX), roundToInt(iconY), iconWidth, iconHeight));
    163163        }
    164164    }
Note: See TracChangeset for help on using the changeset viewer.