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

Unified Diff: ui/gfx/render_text.cc

Issue 384953003: RenderText: handle center-aligned text in UpdateCachedBoundsAndOffset() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text.cc
diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc
index fb7364b66f2b538f5733867b11afc11330755c6d..62ed10bb560d03e89abd1126e1a314ed5aeea49c 100644
--- a/ui/gfx/render_text.cc
+++ b/ui/gfx/render_text.cc
@@ -1342,9 +1342,11 @@ void RenderText::UpdateCachedBoundsAndOffset() {
// Reduce the pan offset to show additional overflow text when the display
// width increases.
const int negate_rtl = horizontal_alignment_ == ALIGN_RIGHT ? -1 : 1;
msw 2014/07/11 22:33:04 nit: consider combining the two scale factors.
- const int offset = negate_rtl * display_offset_.x();
+ const int double_center = horizontal_alignment_ == ALIGN_CENTER ? 2 : 1;
msw 2014/07/11 22:33:04 nit: consider |scale_center|
+ const int offset = negate_rtl * double_center * display_offset_.x();
if (display_width > (content_width + offset)) {
msw 2014/07/11 22:33:04 I don't think this condition will capture all the
mohsen 2014/07/14 20:57:01 In your example, no extra empty space will be show
msw 2014/07/16 01:41:43 I think this is wrong, the alignment offset
- delta_x = negate_rtl * (display_width - (content_width + offset));
+ delta_x = negate_rtl * (display_width - (content_width + offset)) /
+ double_center;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698