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

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

Issue 10702047: Merge 144791 - Fix tab title fading direction in RTL locales. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1180/src/
Patch Set: 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 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 if (text_width <= display_width) 842 if (text_width <= display_width)
843 return; 843 return;
844 844
845 int gradient_width = CalculateFadeGradientWidth(GetFont(), display_width); 845 int gradient_width = CalculateFadeGradientWidth(GetFont(), display_width);
846 if (gradient_width == 0) 846 if (gradient_width == 0)
847 return; 847 return;
848 848
849 bool fade_left = fade_head(); 849 bool fade_left = fade_head();
850 bool fade_right = fade_tail(); 850 bool fade_right = fade_tail();
851 // Under RTL, |fade_right| == |fade_head|. 851 // Under RTL, |fade_right| == |fade_head|.
852 if (GetTextDirection() == base::i18n::RIGHT_TO_LEFT) 852 // TODO(asvitkine): This is currently not based on GetTextDirection() because
853 // RenderTextWin does not return a direction that's based on
854 // the text content.
855 if (horizontal_alignment() == ALIGN_RIGHT)
853 std::swap(fade_left, fade_right); 856 std::swap(fade_left, fade_right);
854 857
855 gfx::Rect solid_part = display_rect(); 858 gfx::Rect solid_part = display_rect();
856 gfx::Rect left_part; 859 gfx::Rect left_part;
857 gfx::Rect right_part; 860 gfx::Rect right_part;
858 if (fade_left) { 861 if (fade_left) {
859 left_part = solid_part; 862 left_part = solid_part;
860 left_part.Inset(0, 0, solid_part.width() - gradient_width, 0); 863 left_part.Inset(0, 0, solid_part.width() - gradient_width, 0);
861 solid_part.Inset(gradient_width, 0, 0, 0); 864 solid_part.Inset(gradient_width, 0, 0, 0);
862 } 865 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 if (cursor_enabled() && cursor_visible() && focused()) { 964 if (cursor_enabled() && cursor_visible() && focused()) {
962 const Rect& bounds = GetUpdatedCursorBounds(); 965 const Rect& bounds = GetUpdatedCursorBounds();
963 if (bounds.width() != 0) 966 if (bounds.width() != 0)
964 canvas->FillRect(bounds, cursor_color_); 967 canvas->FillRect(bounds, cursor_color_);
965 else 968 else
966 canvas->DrawRect(bounds, cursor_color_); 969 canvas->DrawRect(bounds, cursor_color_);
967 } 970 }
968 } 971 }
969 972
970 } // namespace gfx 973 } // 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