Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1526)

Unified Diff: Source/core/rendering/RenderFileUploadControl.cpp

Issue 14160005: Track the region where text is painted. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixed build on win and mac Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderEmbeddedObject.cpp ('k') | Source/core/rendering/RenderImage.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderFileUploadControl.cpp
diff --git a/Source/core/rendering/RenderFileUploadControl.cpp b/Source/core/rendering/RenderFileUploadControl.cpp
index a96c85556b5ebea9eeb6c2fca0b09fd58dd06ed2..f84199709fc73c7f2c5aa70d4733137a9ed4f227 100644
--- a/Source/core/rendering/RenderFileUploadControl.cpp
+++ b/Source/core/rendering/RenderFileUploadControl.cpp
@@ -131,11 +131,12 @@ void RenderFileUploadControl::paintObject(PaintInfo& paintInfo, const LayoutPoin
LayoutUnit buttonWidth = nodeWidth(button);
LayoutUnit buttonAndIconWidth = buttonWidth + afterButtonSpacing
+ (input->icon() ? iconWidth + iconFilenameSpacing : 0);
+ float textWidth = font.width(textRun);
LayoutUnit textX;
if (style()->isLeftToRightDirection())
textX = contentLeft + buttonAndIconWidth;
else
- textX = contentLeft + contentWidth() - buttonAndIconWidth - font.width(textRun);
+ textX = contentLeft + contentWidth() - buttonAndIconWidth - textWidth;
LayoutUnit textY = 0;
// We want to match the button's baseline
@@ -144,11 +145,16 @@ void RenderFileUploadControl::paintObject(PaintInfo& paintInfo, const LayoutPoin
textY = paintOffset.y() + borderTop() + paddingTop() + buttonRenderer->baselinePosition(AlphabeticBaseline, true, HorizontalLine, PositionOnContainingLine);
else
textY = baselinePosition(AlphabeticBaseline, true, HorizontalLine, PositionOnContainingLine);
+ TextRunPaintInfo textRunPaintInfo(textRun);
+ textRunPaintInfo.bounds = FloatRect(textX,
+ textY - style()->fontMetrics().ascent(),
+ textWidth,
+ style()->fontMetrics().height());
paintInfo.context->setFillColor(style()->visitedDependentColor(CSSPropertyColor), style()->colorSpace());
// Draw the filename
- paintInfo.context->drawBidiText(font, textRun, IntPoint(roundToInt(textX), roundToInt(textY)));
+ paintInfo.context->drawBidiText(font, textRunPaintInfo, IntPoint(roundToInt(textX), roundToInt(textY)));
if (input->icon()) {
// Determine where the icon should be placed
« no previous file with comments | « Source/core/rendering/RenderEmbeddedObject.cpp ('k') | Source/core/rendering/RenderImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698