diff options
-rw-r--r-- | ui/gfx/pango_util.cc | 6 | ||||
-rw-r--r-- | ui/gfx/pango_util.h | 7 | ||||
-rw-r--r-- | ui/gfx/render_text.cc | 43 | ||||
-rw-r--r-- | ui/gfx/render_text.h | 30 | ||||
-rw-r--r-- | ui/gfx/render_text_linux.cc | 23 | ||||
-rw-r--r-- | ui/gfx/render_text_linux.h | 1 | ||||
-rw-r--r-- | ui/gfx/render_text_mac.cc | 7 | ||||
-rw-r--r-- | ui/gfx/render_text_mac.h | 1 | ||||
-rw-r--r-- | ui/gfx/render_text_unittest.cc | 96 | ||||
-rw-r--r-- | ui/gfx/render_text_win.cc | 12 | ||||
-rw-r--r-- | ui/gfx/render_text_win.h | 1 | ||||
-rw-r--r-- | ui/gfx/text_constants.h | 45 | ||||
-rw-r--r-- | ui/ui.gyp | 1 | ||||
-rw-r--r-- | ui/views/controls/textfield/native_textfield_views.cc | 1 | ||||
-rw-r--r-- | ui/views/controls/textfield/textfield_views_model.cc | 1 | ||||
-rw-r--r-- | ui/views/controls/textfield/textfield_views_model.h | 1 |
16 files changed, 182 insertions, 94 deletions
diff --git a/ui/gfx/pango_util.cc b/ui/gfx/pango_util.cc index ca129b1..638f77c 100644 --- a/ui/gfx/pango_util.cc +++ b/ui/gfx/pango_util.cc @@ -204,9 +204,11 @@ static void SetupPangoLayoutWithoutFont( cairo_font_options = NULL; } - // Callers of DrawStringInt handle RTL layout themselves, so tell pango to not - // scope out RTL characters. + // Set Pango's base text direction explicitly from |text_direction|. pango_layout_set_auto_dir(layout, FALSE); + pango_context_set_base_dir(pango_layout_get_context(layout), + (text_direction == base::i18n::RIGHT_TO_LEFT ? + PANGO_DIRECTION_RTL : PANGO_DIRECTION_LTR)); if (width > 0) pango_layout_set_width(layout, width * PANGO_SCALE); diff --git a/ui/gfx/pango_util.h b/ui/gfx/pango_util.h index f14c0e6..533d2b0 100644 --- a/ui/gfx/pango_util.h +++ b/ui/gfx/pango_util.h @@ -64,10 +64,9 @@ void UI_EXPORT DrawTextOntoCairoSurface(cairo_t* cr, // They are shared with internal skia interfaces. // ---------------------------------------------------------------------------- -// Setup pango layout |layout|, including set layout text as |text|, font -// description based on |font|, width as |width| in PANGO_SCALE for RTL lcoale, -// and set up whether auto-detect directionality, alignment, ellipsis, word -// wrapping, resolution etc. +// Setup pango |layout|; set the |text|, the font description based on |font|, +// the |width| in PANGO_SCALE for RTL locale, the base |text_direction|, +// alignment, ellipsis, word wrapping, resolution, etc. void SetupPangoLayout(PangoLayout* layout, const string16& text, const gfx::Font& font, diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc index 85dc029..e4b4f64 100644 --- a/ui/gfx/render_text.cc +++ b/ui/gfx/render_text.cc @@ -15,6 +15,7 @@ #include "ui/gfx/canvas.h" #include "ui/gfx/insets.h" #include "ui/gfx/skia_util.h" +#include "ui/gfx/text_constants.h" namespace { @@ -394,6 +395,10 @@ void RenderText::SetText(const string16& text) { // or SetCursorPosition in upper layer. SetSelectionModel(SelectionModel()); + // Invalidate the cached text direction if it depends on the text contents. + if (directionality_mode_ == DIRECTIONALITY_FROM_TEXT) + text_direction_ = base::i18n::UNKNOWN_DIRECTION; + ResetLayout(); } @@ -596,6 +601,42 @@ void RenderText::ApplyDefaultStyle() { ResetLayout(); } +void RenderText::SetDirectionalityMode(DirectionalityMode mode) { + if (mode == directionality_mode_) + return; + + directionality_mode_ = mode; + text_direction_ = base::i18n::UNKNOWN_DIRECTION; + ResetLayout(); +} + +base::i18n::TextDirection RenderText::GetTextDirection() { + if (text_direction_ == base::i18n::UNKNOWN_DIRECTION) { + switch (directionality_mode_) { + case DIRECTIONALITY_FROM_TEXT: + // Derive the direction from the display text, which differs from text() + // in the case of obscured (password) textfields. + text_direction_ = + base::i18n::GetFirstStrongCharacterDirection(GetDisplayText()); + break; + case DIRECTIONALITY_FROM_UI: + text_direction_ = base::i18n::IsRTL() ? base::i18n::RIGHT_TO_LEFT : + base::i18n::LEFT_TO_RIGHT; + break; + case DIRECTIONALITY_FORCE_LTR: + text_direction_ = base::i18n::LEFT_TO_RIGHT; + break; + case DIRECTIONALITY_FORCE_RTL: + text_direction_ = base::i18n::RIGHT_TO_LEFT; + break; + default: + NOTREACHED(); + } + } + + return text_direction_; +} + VisualCursorDirection RenderText::GetVisualDirectionOfLogicalEnd() { return GetTextDirection() == base::i18n::LEFT_TO_RIGHT ? CURSOR_RIGHT : CURSOR_LEFT; @@ -701,6 +742,8 @@ void RenderText::SetTextShadows(const ShadowValues& shadows) { RenderText::RenderText() : horizontal_alignment_(base::i18n::IsRTL() ? ALIGN_RIGHT : ALIGN_LEFT), + directionality_mode_(DIRECTIONALITY_FROM_TEXT), + text_direction_(base::i18n::UNKNOWN_DIRECTION), cursor_enabled_(true), cursor_visible_(false), insert_mode_(true), diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h index a6265b0..bebe109 100644 --- a/ui/gfx/render_text.h +++ b/ui/gfx/render_text.h @@ -22,6 +22,7 @@ #include "ui/gfx/rect.h" #include "ui/gfx/selection_model.h" #include "ui/gfx/shadow_value.h" +#include "ui/gfx/text_constants.h" class SkCanvas; class SkDrawLooper; @@ -90,23 +91,6 @@ struct UI_EXPORT StyleRange { typedef std::vector<StyleRange> StyleRanges; -// TODO(msw): Distinguish between logical character stops and glyph stops? -// CHARACTER_BREAK cursor movements should stop at neighboring characters. -// WORD_BREAK cursor movements should stop at the nearest word boundaries. -// LINE_BREAK cursor movements should stop at the text ends as shown on screen. -enum BreakType { - CHARACTER_BREAK, - WORD_BREAK, - LINE_BREAK, -}; - -// Horizontal text alignment styles. -enum HorizontalAlignment { - ALIGN_LEFT, - ALIGN_CENTER, - ALIGN_RIGHT, -}; - // RenderText represents an abstract model of styled text and its corresponding // visual layout. Support is built in for a cursor, a selection, simple styling, // complex scripts, and bi-directional text. Implementations provide mechanisms @@ -246,8 +230,9 @@ class UI_EXPORT RenderText { // Apply |default_style_| over the entire text range. void ApplyDefaultStyle(); - // Returns the dominant direction of the current text. - virtual base::i18n::TextDirection GetTextDirection() = 0; + // Set the text directionality mode and get the text direction yielded. + void SetDirectionalityMode(DirectionalityMode mode); + base::i18n::TextDirection GetTextDirection(); // Returns the visual movement direction corresponding to the logical end // of the text, considering only the dominant direction returned by @@ -439,6 +424,13 @@ class UI_EXPORT RenderText { // Horizontal alignment of the text with respect to |display_rect_|. HorizontalAlignment horizontal_alignment_; + // The text directionality mode, defaults to DIRECTIONALITY_FROM_TEXT. + DirectionalityMode directionality_mode_; + + // The cached text direction, potentially computed from the text or UI locale. + // Use GetTextDirection(), do not use this potentially invalid value directly! + base::i18n::TextDirection text_direction_; + // A list of fonts used to render |text_|. FontList font_list_; diff --git a/ui/gfx/render_text_linux.cc b/ui/gfx/render_text_linux.cc index 4c10062..9619dc1 100644 --- a/ui/gfx/render_text_linux.cc +++ b/ui/gfx/render_text_linux.cc @@ -80,15 +80,6 @@ RenderTextLinux::~RenderTextLinux() { ResetLayout(); } -base::i18n::TextDirection RenderTextLinux::GetTextDirection() { - EnsureLayout(); - - PangoDirection base_dir = pango_find_base_dir(layout_text_, -1); - if (base_dir == PANGO_DIRECTION_RTL || base_dir == PANGO_DIRECTION_WEAK_RTL) - return base::i18n::RIGHT_TO_LEFT; - return base::i18n::LEFT_TO_RIGHT; -} - Size RenderTextLinux::GetStringSize() { EnsureLayout(); int width = 0, height = 0; @@ -288,13 +279,13 @@ void RenderTextLinux::EnsureLayout() { layout_ = pango_cairo_create_layout(cr); cairo_destroy(cr); cairo_surface_destroy(surface); - SetupPangoLayoutWithFontDescription( - layout_, - GetDisplayText(), - font_list().GetFontDescriptionString(), - display_rect().width(), - base::i18n::GetFirstStrongCharacterDirection(text()), - Canvas::DefaultCanvasTextAlignment()); + + SetupPangoLayoutWithFontDescription(layout_, + GetDisplayText(), + font_list().GetFontDescriptionString(), + display_rect().width(), + GetTextDirection(), + Canvas::DefaultCanvasTextAlignment()); // No width set so that the x-axis position is relative to the start of the // text. ToViewPoint and ToTextPoint take care of the position conversion diff --git a/ui/gfx/render_text_linux.h b/ui/gfx/render_text_linux.h index 59501f7..190f2dd 100644 --- a/ui/gfx/render_text_linux.h +++ b/ui/gfx/render_text_linux.h @@ -19,7 +19,6 @@ class RenderTextLinux : public RenderText { virtual ~RenderTextLinux(); // Overridden from RenderText: - virtual base::i18n::TextDirection GetTextDirection() OVERRIDE; virtual Size GetStringSize() OVERRIDE; virtual int GetBaseline() OVERRIDE; virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE; diff --git a/ui/gfx/render_text_mac.cc b/ui/gfx/render_text_mac.cc index fcf0cf8..1b313f7 100644 --- a/ui/gfx/render_text_mac.cc +++ b/ui/gfx/render_text_mac.cc @@ -87,10 +87,6 @@ RenderTextMac::RenderTextMac() : common_baseline_(0), runs_valid_(false) { RenderTextMac::~RenderTextMac() { } -base::i18n::TextDirection RenderTextMac::GetTextDirection() { - return base::i18n::LEFT_TO_RIGHT; -} - Size RenderTextMac::GetStringSize() { EnsureLayout(); return string_size_; @@ -183,6 +179,9 @@ void RenderTextMac::EnsureLayout() { base::mac::ScopedCFTypeRef<CFMutableAttributedStringRef> attr_text_mutable( CFAttributedStringCreateMutableCopy(NULL, 0, attr_text)); + // TODO(asvitkine|msw): Respect GetTextDirection(), which may not match the + // natural text direction. See kCTTypesetterOptionForcedEmbeddingLevel, etc. + ApplyStyles(attr_text_mutable, ct_font); line_.reset(CTLineCreateWithAttributedString(attr_text_mutable)); diff --git a/ui/gfx/render_text_mac.h b/ui/gfx/render_text_mac.h index 1d558ad..97ac971 100644 --- a/ui/gfx/render_text_mac.h +++ b/ui/gfx/render_text_mac.h @@ -26,7 +26,6 @@ class RenderTextMac : public RenderText { virtual ~RenderTextMac(); // Overridden from RenderText: - virtual base::i18n::TextDirection GetTextDirection() OVERRIDE; virtual Size GetStringSize() OVERRIDE; virtual int GetBaseline() OVERRIDE; virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE; diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc index bd0b24c..8ac129c 100644 --- a/ui/gfx/render_text_unittest.cc +++ b/ui/gfx/render_text_unittest.cc @@ -8,6 +8,7 @@ #include "base/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/gfx/text_constants.h" #if defined(OS_WIN) #include "base/win/windows_version.h" @@ -21,6 +22,15 @@ namespace gfx { namespace { +// Various weak, LTR, RTL, and Bidi string cases with three characters each. +const wchar_t kWeak[] = L" . "; +const wchar_t kLtr[] = L"abc"; +const wchar_t kLtrRtl[] = L"a"L"\x5d0\x5d1"; +const wchar_t kLtrRtlLtr[] = L"a"L"\x5d1"L"b"; +const wchar_t kRtl[] = L"\x5d0\x5d1\x5d2"; +const wchar_t kRtlLtr[] = L"\x5d0\x5d1"L"a"; +const wchar_t kRtlLtrRtl[] = L"\x5d0"L"a"L"\x5d1"; + // Checks whether |range| contains |index|. This is not the same as calling // |range.Contains(ui::Range(index))| - as that would return true when // |index| == |range.end()|. @@ -219,12 +229,12 @@ TEST_F(RenderTextTest, ApplyStyleRange) { static void SetTextWith2ExtraStyles(RenderText* render_text) { render_text->SetText(ASCIIToUTF16("abcdefghi")); - gfx::StyleRange strike; + StyleRange strike; strike.strike = true; strike.range = ui::Range(0, 3); render_text->ApplyStyleRange(strike); - gfx::StyleRange underline; + StyleRange underline; underline.underline = true; underline.range = ui::Range(3, 6); render_text->ApplyStyleRange(underline); @@ -383,39 +393,54 @@ TEST_F(RenderTextTest, PasswordCensorship) { } TEST_F(RenderTextTest, GetTextDirection) { - const bool was_rtl = base::i18n::IsRTL(); - // Ensure that text direction is set by the first strong character direction. + struct { + const wchar_t* text; + const base::i18n::TextDirection text_direction; + } cases[] = { + // Blank strings and those with no/weak directionality default to LTR. + { L"", base::i18n::LEFT_TO_RIGHT }, + { kWeak, base::i18n::LEFT_TO_RIGHT }, + // Strings that begin with strong LTR characters. + { kLtr, base::i18n::LEFT_TO_RIGHT }, + { kLtrRtl, base::i18n::LEFT_TO_RIGHT }, + { kLtrRtlLtr, base::i18n::LEFT_TO_RIGHT }, + // Strings that begin with strong RTL characters. + { kRtl, base::i18n::RIGHT_TO_LEFT }, + { kRtlLtr, base::i18n::RIGHT_TO_LEFT }, + { kRtlLtrRtl, base::i18n::RIGHT_TO_LEFT }, + }; + scoped_ptr<RenderText> render_text(RenderText::CreateInstance()); + const bool was_rtl = base::i18n::IsRTL(); + for (size_t i = 0; i < 2; ++i) { // Toggle the application default text direction (to try each direction). SetRTL(!base::i18n::IsRTL()); + const base::i18n::TextDirection ui_direction = base::i18n::IsRTL() ? + base::i18n::RIGHT_TO_LEFT : base::i18n::LEFT_TO_RIGHT; - // Blank strings (and those without directionality) default to LTR. - render_text->SetText(string16()); - EXPECT_EQ(base::i18n::LEFT_TO_RIGHT, render_text->GetTextDirection()); - render_text->SetText(ASCIIToUTF16(" ")); - EXPECT_EQ(base::i18n::LEFT_TO_RIGHT, render_text->GetTextDirection()); - - // Pure LTR. - render_text->SetText(ASCIIToUTF16("abc")); - EXPECT_EQ(base::i18n::LEFT_TO_RIGHT, render_text->GetTextDirection()); - // LTR-RTL - render_text->SetText(WideToUTF16(L"abc\x05d0\x05d1\x05d2")); - EXPECT_EQ(base::i18n::LEFT_TO_RIGHT, render_text->GetTextDirection()); - // LTR-RTL-LTR. - render_text->SetText(WideToUTF16(L"a"L"\x05d1"L"b")); - EXPECT_EQ(base::i18n::LEFT_TO_RIGHT, render_text->GetTextDirection()); - // Pure RTL. - render_text->SetText(WideToUTF16(L"\x05d0\x05d1\x05d2")); - EXPECT_EQ(base::i18n::RIGHT_TO_LEFT, render_text->GetTextDirection()); - // RTL-LTR - render_text->SetText(WideToUTF16(L"\x05d0\x05d1\x05d2"L"abc")); - EXPECT_EQ(base::i18n::RIGHT_TO_LEFT, render_text->GetTextDirection()); - // RTL-LTR-RTL. - render_text->SetText(WideToUTF16(L"\x05d0"L"a"L"\x05d1")); - EXPECT_EQ(base::i18n::RIGHT_TO_LEFT, render_text->GetTextDirection()); + // Ensure that directionality modes yield the correct text directions. + for (size_t j = 0; j < ARRAYSIZE_UNSAFE(cases); j++) { + render_text->SetText(WideToUTF16(cases[j].text)); + render_text->SetDirectionalityMode(DIRECTIONALITY_FROM_TEXT); + EXPECT_EQ(render_text->GetTextDirection(), cases[j].text_direction); + render_text->SetDirectionalityMode(DIRECTIONALITY_FROM_UI); + EXPECT_EQ(render_text->GetTextDirection(), ui_direction); + render_text->SetDirectionalityMode(DIRECTIONALITY_FORCE_LTR); + EXPECT_EQ(render_text->GetTextDirection(), base::i18n::LEFT_TO_RIGHT); + render_text->SetDirectionalityMode(DIRECTIONALITY_FORCE_RTL); + EXPECT_EQ(render_text->GetTextDirection(), base::i18n::RIGHT_TO_LEFT); + } } + EXPECT_EQ(was_rtl, base::i18n::IsRTL()); + + // Ensure that text changes update the direction for DIRECTIONALITY_FROM_TEXT. + render_text->SetDirectionalityMode(DIRECTIONALITY_FROM_TEXT); + render_text->SetText(WideToUTF16(kLtr)); + EXPECT_EQ(render_text->GetTextDirection(), base::i18n::LEFT_TO_RIGHT); + render_text->SetText(WideToUTF16(kRtl)); + EXPECT_EQ(render_text->GetTextDirection(), base::i18n::RIGHT_TO_LEFT); } void RunMoveCursorLeftRightTest(RenderText* render_text, @@ -731,14 +756,8 @@ TEST_F(RenderTextTest, EdgeSelectionModels) { } TEST_F(RenderTextTest, SelectAll) { - const wchar_t* const cases[] = { - L"abc", - L"a"L"\x5d0\x5d1", - L"a"L"\x5d1"L"b", - L"\x5d0\x5d1\x5d2", - L"\x5d0\x5d1"L"a", - L"\x5d0"L"a"L"\x5d1", - }; + const wchar_t* const cases[] = + { kWeak, kLtr, kLtrRtl, kLtrRtlLtr, kRtl, kRtlLtr, kRtlLtrRtl }; // Ensure that SelectAll respects the |reversed| argument regardless of // application locale and text content directionality. @@ -749,6 +768,11 @@ TEST_F(RenderTextTest, SelectAll) { for (size_t i = 0; i < 2; ++i) { SetRTL(!base::i18n::IsRTL()); + // Test that an empty string produces an empty selection model. + render_text->SetText(string16()); + EXPECT_EQ(render_text->selection_model(), SelectionModel()); + + // Test the weak, LTR, RTL, and Bidi string cases. for (size_t j = 0; j < ARRAYSIZE_UNSAFE(cases); j++) { render_text->SetText(WideToUTF16(cases[j])); render_text->SelectAll(false); diff --git a/ui/gfx/render_text_win.cc b/ui/gfx/render_text_win.cc index 4322aff..1f8c369 100644 --- a/ui/gfx/render_text_win.cc +++ b/ui/gfx/render_text_win.cc @@ -305,12 +305,6 @@ RenderTextWin::RenderTextWin() RenderTextWin::~RenderTextWin() { } -base::i18n::TextDirection RenderTextWin::GetTextDirection() { - EnsureLayout(); - return (script_state_.uBidiLevel == 0) ? - base::i18n::LEFT_TO_RIGHT : base::i18n::RIGHT_TO_LEFT; -} - Size RenderTextWin::GetStringSize() { EnsureLayout(); return string_size_; @@ -600,11 +594,9 @@ void RenderTextWin::ItemizeLogicalText() { string_size_ = Size(0, GetFont().GetHeight()); common_baseline_ = 0; - // Use the first strong character direction as the base text direction. - // TODO(msw): Use the application text direction instead of LTR by default? + // Set Uniscribe's base text direction. script_state_.uBidiLevel = - (base::i18n::GetFirstStrongCharacterDirection(text()) == - base::i18n::RIGHT_TO_LEFT) ? 1 : 0; + (GetTextDirection() == base::i18n::RIGHT_TO_LEFT) ? 1 : 0; if (text().empty()) return; diff --git a/ui/gfx/render_text_win.h b/ui/gfx/render_text_win.h index 71dd82e..267025f 100644 --- a/ui/gfx/render_text_win.h +++ b/ui/gfx/render_text_win.h @@ -66,7 +66,6 @@ class RenderTextWin : public RenderText { virtual ~RenderTextWin(); // Overridden from RenderText: - virtual base::i18n::TextDirection GetTextDirection() OVERRIDE; virtual Size GetStringSize() OVERRIDE; virtual int GetBaseline() OVERRIDE; virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE; diff --git a/ui/gfx/text_constants.h b/ui/gfx/text_constants.h new file mode 100644 index 0000000..3c644ab --- /dev/null +++ b/ui/gfx/text_constants.h @@ -0,0 +1,45 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_GFX_TEXT_CONSTANTS_H_ +#define UI_GFX_TEXT_CONSTANTS_H_ + +namespace gfx { + +// TODO(msw): Distinguish between logical character stops and glyph stops? +// TODO(msw): Merge with base::i18n::BreakIterator::BreakType. +enum BreakType { + // Stop cursor movement on neighboring characters. + CHARACTER_BREAK = 0, + // Stop cursor movement on nearest word boundaries. + WORD_BREAK, + // Stop cursor movement on line ends as shown on screen. + LINE_BREAK, +}; + +// Horizontal text alignment modes. +enum HorizontalAlignment { + // Align the text's left edge with that of its display area. + ALIGN_LEFT = 0, + // Align the text's center with that of its display area. + ALIGN_CENTER, + // Align the text's right edge with that of its display area. + ALIGN_RIGHT, +}; + +// The directionality modes used to determine the base text direction. +enum DirectionalityMode { + // Use the first strong character's direction. + DIRECTIONALITY_FROM_TEXT = 0, + // Use the UI locale's text reading direction. + DIRECTIONALITY_FROM_UI, + // Use LTR regardless of content or UI locale. + DIRECTIONALITY_FORCE_LTR, + // Use RTL regardless of content or UI locale. + DIRECTIONALITY_FORCE_RTL, +}; + +} // namespace gfx + +#endif // UI_GFX_TEXT_CONSTANTS_H_ @@ -453,6 +453,7 @@ 'gfx/skia_utils_gtk.h', 'gfx/sys_color_change_listener.cc', 'gfx/sys_color_change_listener.h', + 'gfx/text_constants.h', 'gfx/transform.cc', 'gfx/transform.h', 'gfx/transform_util.cc', diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc index c5b27a4..d2d508f 100644 --- a/ui/views/controls/textfield/native_textfield_views.cc +++ b/ui/views/controls/textfield/native_textfield_views.cc @@ -24,6 +24,7 @@ #include "ui/gfx/canvas.h" #include "ui/gfx/insets.h" #include "ui/gfx/render_text.h" +#include "ui/gfx/text_constants.h" #include "ui/views/background.h" #include "ui/views/border.h" #include "ui/views/controls/focusable_border.h" diff --git a/ui/views/controls/textfield/textfield_views_model.cc b/ui/views/controls/textfield/textfield_views_model.cc index 372fcf1..d51e417 100644 --- a/ui/views/controls/textfield/textfield_views_model.cc +++ b/ui/views/controls/textfield/textfield_views_model.cc @@ -18,6 +18,7 @@ #include "ui/gfx/canvas.h" #include "ui/gfx/font.h" #include "ui/gfx/render_text.h" +#include "ui/gfx/text_constants.h" #include "ui/views/controls/textfield/textfield.h" #include "ui/views/views_delegate.h" diff --git a/ui/views/controls/textfield/textfield_views_model.h b/ui/views/controls/textfield/textfield_views_model.h index 8268595..c6308e0 100644 --- a/ui/views/controls/textfield/textfield_views_model.h +++ b/ui/views/controls/textfield/textfield_views_model.h @@ -15,6 +15,7 @@ #include "ui/base/ime/composition_text.h" #include "ui/gfx/rect.h" #include "ui/gfx/render_text.h" +#include "ui/gfx/text_constants.h" #include "ui/views/views_export.h" namespace gfx { |