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

Side by Side Diff: ui/gfx/render_text.cc

Issue 10689013: Fix tab title fading direction in RTL locales. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: update Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/render_text.h" 5 #include "ui/gfx/render_text.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/i18n/break_iterator.h" 9 #include "base/i18n/break_iterator.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 if (text_width <= display_width) 847 if (text_width <= display_width)
848 return; 848 return;
849 849
850 int gradient_width = CalculateFadeGradientWidth(GetFont(), display_width); 850 int gradient_width = CalculateFadeGradientWidth(GetFont(), display_width);
851 if (gradient_width == 0) 851 if (gradient_width == 0)
852 return; 852 return;
853 853
854 bool fade_left = fade_head(); 854 bool fade_left = fade_head();
855 bool fade_right = fade_tail(); 855 bool fade_right = fade_tail();
856 // Under RTL, |fade_right| == |fade_head|. 856 // Under RTL, |fade_right| == |fade_head|.
857 if (GetTextDirection() == base::i18n::RIGHT_TO_LEFT) 857 // TODO(asvitkine): This is currently not based on GetTextDirection() because
858 // RenderTextWin does not return a direction that's based on
859 // the text content.
860 if (horizontal_alignment() == ALIGN_RIGHT)
858 std::swap(fade_left, fade_right); 861 std::swap(fade_left, fade_right);
859 862
860 gfx::Rect solid_part = display_rect(); 863 gfx::Rect solid_part = display_rect();
861 gfx::Rect left_part; 864 gfx::Rect left_part;
862 gfx::Rect right_part; 865 gfx::Rect right_part;
863 if (fade_left) { 866 if (fade_left) {
864 left_part = solid_part; 867 left_part = solid_part;
865 left_part.Inset(0, 0, solid_part.width() - gradient_width, 0); 868 left_part.Inset(0, 0, solid_part.width() - gradient_width, 0);
866 solid_part.Inset(gradient_width, 0, 0, 0); 869 solid_part.Inset(gradient_width, 0, 0, 0);
867 } 870 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 if (cursor_enabled() && cursor_visible() && focused()) { 969 if (cursor_enabled() && cursor_visible() && focused()) {
967 const Rect& bounds = GetUpdatedCursorBounds(); 970 const Rect& bounds = GetUpdatedCursorBounds();
968 if (bounds.width() != 0) 971 if (bounds.width() != 0)
969 canvas->FillRect(bounds, cursor_color_); 972 canvas->FillRect(bounds, cursor_color_);
970 else 973 else
971 canvas->DrawRect(bounds, cursor_color_); 974 canvas->DrawRect(bounds, cursor_color_);
972 } 975 }
973 } 976 }
974 977
975 } // namespace gfx 978 } // namespace gfx
OLDNEW
« 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