Modified: trunk/Source/WebCore/ChangeLog (110760 => 110761)
--- trunk/Source/WebCore/ChangeLog 2012-03-14 21:56:46 UTC (rev 110760)
+++ trunk/Source/WebCore/ChangeLog 2012-03-14 22:02:00 UTC (rev 110761)
@@ -1,3 +1,24 @@
+2012-03-14 Levi Weintraub <[email protected]>
+
+ 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):
+
2012-03-14 Joseph Pecoraro <[email protected]>
[JSC] Web Inspector: CRASH running $0, $1, etc before they are set
Modified: trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp (110760 => 110761)
--- trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp 2012-03-14 21:56:46 UTC (rev 110760)
+++ trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp 2012-03-14 22:02:00 UTC (rev 110761)
@@ -91,13 +91,13 @@
static int nodeWidth(Node* node)
{
- return node ? node->renderBox()->width() : zeroLayoutUnit;
+ return node ? node->renderBox()->pixelSnappedWidth() : 0;
}
int RenderFileUploadControl::maxFilenameWidth() const
{
HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
- return max(0, contentWidth() - nodeWidth(uploadButton()) - afterButtonSpacing
+ return max(0, contentBoxRect().pixelSnappedWidth() - nodeWidth(uploadButton()) - afterButtonSpacing
- (input->icon() ? iconWidth + iconFilenameSpacing : 0));
}
@@ -109,7 +109,7 @@
// Push a clip.
GraphicsContextStateSaver stateSaver(*paintInfo.context, false);
if (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseChildBlockBackgrounds) {
- LayoutRect clipRect(paintOffset.x() + borderLeft(), paintOffset.y() + borderTop(),
+ IntRect clipRect = pixelSnappedIntRect(paintOffset.x() + borderLeft(), paintOffset.y() + borderTop(),
width() - borderLeft() - borderRight(), height() - borderBottom() - borderTop() + buttonShadowHeight);
if (clipRect.isEmpty())
return;
@@ -147,7 +147,7 @@
paintInfo.context->setFillColor(style()->visitedDependentColor(CSSPropertyColor), style()->colorSpace());
// Draw the filename
- paintInfo.context->drawBidiText(font, textRun, LayoutPoint(textX, textY));
+ paintInfo.context->drawBidiText(font, textRun, IntPoint(roundToInt(textX), roundToInt(textY)));
if (input->icon()) {
// Determine where the icon should be placed
@@ -159,7 +159,7 @@
iconX = contentLeft + contentWidth() - buttonWidth - afterButtonSpacing - iconWidth;
// Draw the file icon
- input->icon()->paint(paintInfo.context, LayoutRect(iconX, iconY, iconWidth, iconHeight));
+ input->icon()->paint(paintInfo.context, IntRect(roundToInt(iconX), roundToInt(iconY), iconWidth, iconHeight));
}
}