Changeset 110761 in webkit
- Timestamp:
- Mar 14, 2012 3:02:00 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r110760 r110761 1 2012-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 1 22 2012-03-14 Joseph Pecoraro <pecoraro@apple.com> 2 23 -
trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp
r110598 r110761 92 92 static int nodeWidth(Node* node) 93 93 { 94 return node ? node->renderBox()-> width() : zeroLayoutUnit;94 return node ? node->renderBox()->pixelSnappedWidth() : 0; 95 95 } 96 96 … … 98 98 { 99 99 HTMLInputElement* input = static_cast<HTMLInputElement*>(node()); 100 return max(0, content Width() - nodeWidth(uploadButton()) - afterButtonSpacing100 return max(0, contentBoxRect().pixelSnappedWidth() - nodeWidth(uploadButton()) - afterButtonSpacing 101 101 - (input->icon() ? iconWidth + iconFilenameSpacing : 0)); 102 102 } … … 110 110 GraphicsContextStateSaver stateSaver(*paintInfo.context, false); 111 111 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(), 113 113 width() - borderLeft() - borderRight(), height() - borderBottom() - borderTop() + buttonShadowHeight); 114 114 if (clipRect.isEmpty()) … … 148 148 149 149 // Draw the filename 150 paintInfo.context->drawBidiText(font, textRun, LayoutPoint(textX, textY));150 paintInfo.context->drawBidiText(font, textRun, IntPoint(roundToInt(textX), roundToInt(textY))); 151 151 152 152 if (input->icon()) { … … 160 160 161 161 // 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)); 163 163 } 164 164 }
Note: See TracChangeset
for help on using the changeset viewer.