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

Unified Diff: ui/views/controls/label.h

Issue 10807082: Add RenderText DirectionalityMode enum and support; etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restore Label::SetURL; derive the direction from display text. 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/label.h
diff --git a/ui/views/controls/label.h b/ui/views/controls/label.h
index 4be47262d47019f351674de2012d99ae58512059..1f070dab80c6957edaa67ab39caf4a92392f731b 100644
--- a/ui/views/controls/label.h
+++ b/ui/views/controls/label.h
@@ -13,6 +13,7 @@
#include "googleurl/src/gurl.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/font.h"
+#include "ui/gfx/render_text.h"
#include "ui/views/view.h"
namespace views {
@@ -30,21 +31,6 @@ class VIEWS_EXPORT Label : public View {
ALIGN_CENTER,
ALIGN_RIGHT };
- // The following enum is used to indicate whether using the Chrome UI's
- // directionality as the label's directionality, or auto-detecting the label's
- // directionality.
- //
- // If the label text originates from the Chrome UI, we should use the Chrome
- // UI's directionality as the label's directionality.
- //
- // If the text originates from a web page, its directionality is determined
- // based on its first character with strong directionality, disregarding what
- // directionality the Chrome UI is.
- enum DirectionalityMode {
- USE_UI_DIRECTIONALITY = 0,
- AUTO_DETECT_DIRECTIONALITY
- };
-
// The view class name.
static const char kViewClassName[];
@@ -101,25 +87,25 @@ class VIEWS_EXPORT Label : public View {
void ClearEmbellishing();
// Sets horizontal alignment. If the locale is RTL, and the directionality
- // mode is USE_UI_DIRECTIONALITY, the alignment is flipped around.
+ // mode is gfx::DERIVE_FROM_UI, the alignment is flipped around.
//
// Caveat: for labels originating from a web page, the directionality mode
- // should be reset to AUTO_DETECT_DIRECTIONALITY before the horizontal
- // alignment is set. Otherwise, the label's alignment specified as a parameter
- // will be flipped in RTL locales.
+ // should be reset to gfx::DERIVE_FROM_TEXT before the horizontal alignment is
+ // set. Otherwise, the label's alignment specified as a parameter will be
+ // flipped in RTL locales.
void SetHorizontalAlignment(Alignment alignment);
Alignment horizontal_alignment() const { return horiz_alignment_; }
// Sets the directionality mode. The directionality mode is initialized to
- // USE_UI_DIRECTIONALITY when the label is constructed. USE_UI_DIRECTIONALITY
+ // gfx::DERIVE_FROM_UI when the label is constructed. gfx::DERIVE_FROM_UI
// applies to every label that originates from the Chrome UI. However, if the
// label originates from a web page, its directionality is auto-detected.
- void set_directionality_mode(DirectionalityMode mode) {
+ void set_directionality_mode(gfx::DirectionalityMode mode) {
directionality_mode_ = mode;
}
- DirectionalityMode directionality_mode() const {
+ gfx::DirectionalityMode directionality_mode() const {
return directionality_mode_;
}
@@ -279,10 +265,9 @@ class VIEWS_EXPORT Label : public View {
scoped_ptr<Background> mouse_over_background_;
// Whether to collapse the label when it's not visible.
bool collapse_when_hidden_;
- // The following member variable is used to control whether the
- // directionality is auto-detected based on first strong directionality
- // character or is determined by chrome UI's locale.
- DirectionalityMode directionality_mode_;
+ // Controls whether the base text directionality is inherited from the text's
+ // first strong directionality character or from the UI's locale.
+ gfx::DirectionalityMode directionality_mode_;
// When embedded in a larger control that is focusable, setting this flag
// allows this view to be painted as focused even when it is itself not.
bool paint_as_focused_;

Powered by Google App Engine
This is Rietveld 408576698