summaryrefslogtreecommitdiffstats
path: root/views/controls/label.cc
diff options
context:
space:
mode:
authorxji@chromium.org <xji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-14 22:07:23 +0000
committerxji@chromium.org <xji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-14 22:07:23 +0000
commit8987b765bd29634520d43db146b287710d7c0255 (patch)
treeebb43d263fb326a55efbfa01aa4cbfc1886e964d /views/controls/label.cc
parentd97c72f00fcd2bdf29376a0b3cf6503d135b2923 (diff)
downloadchromium_src-8987b765bd29634520d43db146b287710d7c0255.zip
chromium_src-8987b765bd29634520d43db146b287710d7c0255.tar.gz
chromium_src-8987b765bd29634520d43db146b287710d7c0255.tar.bz2
This CL fix issue 11907 -- RTL: Focus is not on the text after checking "Delete all profile data"
Since the text_bounds computed in Label::CalculateDrawStringParams() are different for mutl-line text and single line text. Draw focus rectangle need to be handled differently (mirroring or no mirroring) as well. BUG=http://crbug.com/11907 Review URL: http://codereview.chromium.org/115370 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16111 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/label.cc')
-rw-r--r--views/controls/label.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/views/controls/label.cc b/views/controls/label.cc
index ceb9fa1..fde9a9e 100644
--- a/views/controls/label.cc
+++ b/views/controls/label.cc
@@ -162,8 +162,17 @@ void Label::Paint(ChromeCanvas* canvas) {
focus_rect.set_width(w);
focus_rect.set_height(h);
focus_rect.Inset(-kFocusBorderPadding, -kFocusBorderPadding);
- canvas->DrawFocusRect(MirroredLeftPointForRect(focus_rect), focus_rect.y(),
- focus_rect.width(), focus_rect.height());
+ // If the label is a single line of text, then the computed text bound
+ // corresponds directly to the text being drawn and no mirroring is needed
+ // for the RTL case. For multiline text, the text bound is an estimation
+ // and is recomputed in ChromeCanvas::SizeStringInt(). For multiline text
+ // in RTL, we need to take mirroring into account when computing the focus
+ // rectangle.
+ int x = focus_rect.x();
+ if (flags & ChromeCanvas::MULTI_LINE)
+ x = MirroredLeftPointForRect(focus_rect);
+ canvas->DrawFocusRect(x, focus_rect.y(), focus_rect.width(),
+ focus_rect.height());
}
}