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

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: rebase with TOT Created 7 years, 8 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
Index: Source/core/rendering/RenderFileUploadControl.cpp
diff --git a/Source/core/rendering/RenderFileUploadControl.cpp b/Source/core/rendering/RenderFileUploadControl.cpp
index 437ced3d7d14b6ff4883bb7175a4fa0b7c732a42..4ef6872ff49fcef48e07980f698b6c97f49fbcb7 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,13 @@ 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);
+ FloatRect textRect(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, textRun, IntPoint(roundToInt(textX), roundToInt(textY)), textRect);
if (input->icon()) {
// Determine where the icon should be placed

Powered by Google App Engine
This is Rietveld 408576698