diff options
author | skanuj@chromium.org <skanuj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-24 02:17:49 +0000 |
---|---|---|
committer | skanuj@chromium.org <skanuj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-24 02:17:49 +0000 |
commit | 61f9908f6732c769e0dfa5f9c53c740bf98a17ce (patch) | |
tree | 779cab30feaac574fc1790e0de9751c97063eec5 /ui/gfx/render_text_unittest.cc | |
parent | 0624275c81af9616d4c93d2d09bb655fa5c8e676 (diff) | |
download | chromium_src-61f9908f6732c769e0dfa5f9c53c740bf98a17ce.zip chromium_src-61f9908f6732c769e0dfa5f9c53c740bf98a17ce.tar.gz chromium_src-61f9908f6732c769e0dfa5f9c53c740bf98a17ce.tar.bz2 |
Infinite Suggest - views implementation
(See comment 36 on crbug.com/327833 for screenshots)
RenderText:
Allow layout_text_ to be empty if there is no room to render a single character.
----------------
OmniboxResultView:
Revises the OmniboxResultView to rely on RenderText for eliding and rendering.
The match contents and description can not be rendered together as one string.
See crbug.com/331153 for a possible error case. The relevant TODO is removed.
-----------------------------------------------------------
Infinite Suggestion:
These suggestions show a leading ellipsis to suggest tail completion. Ideally
they should appear at an offset equivalent to that of omitted text. This is
accomplished by computing the required width as if the full text is present and
the actual width required to show the suggestion with leading ellipsis.
If the window is not wide enough to show the suggestion at the offset of the
omitted text, the suggestions are shifted towards the start edge such that the
longest infinite suggestion is visible. The suggestions are never shifted beyond
the start edge.
The suggestions are shown aligned to the start edge when directionality of suggestion differs from directionality of UI.
When the directionality of suggestion differs from directionality of UI, we try
to show the suggestions such that the leading ellipsis is still vertically
aligned for all suggestions.
BUG=327833, 336543, 328699
TBR=msw@chromium.org
Review URL: https://codereview.chromium.org/171153004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252873 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/render_text_unittest.cc')
-rw-r--r-- | ui/gfx/render_text_unittest.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc index 7565921..977cea4 100644 --- a/ui/gfx/render_text_unittest.cc +++ b/ui/gfx/render_text_unittest.cc @@ -419,6 +419,8 @@ TEST_F(RenderTextTest, ElidedText) { } cases[] = { // Strings shorter than the elision width should be laid out in full. { L"", L"" , false }, + { L"M", L"" , false }, + { L" . ", L" . " , false }, { kWeak, kWeak , false }, { kLtr, kLtr , false }, { kLtrRtl, kLtrRtl , false }, @@ -443,7 +445,7 @@ TEST_F(RenderTextTest, ElidedText) { { L"0\x05e9\x05bc\x05c1\x05b8", L"0\x05e9\x05bc\x05c1\x05b8", false }, { L"0\x05e9\x05bc\x05c1\x05b8", L"0\x05e9\x05bc\x2026" , true }, { L"01\x05e9\x05bc\x05c1\x05b8", L"01\x05e9\x2026" , true }, - { L"012\x05e9\x05bc\x05c1\x05b8", L"012\x2026" , true }, + { L"012\x05e9\x05bc\x05c1\x05b8", L"012\x2026\x200E" , true }, { L"012\xF0\x9D\x84\x9E", L"012\xF0\x2026" , true }, }; @@ -468,7 +470,8 @@ TEST_F(RenderTextTest, ElidedText) { render_text->SetText(input); render_text->SetDisplayRect(gfx::Rect(0, 0, expected_width, 100)); - EXPECT_EQ(input, render_text->text()); + EXPECT_EQ(input, render_text->text()) + << "->For case " << i << ": " << cases[i].text << "\n"; EXPECT_EQ(WideToUTF16(cases[i].layout_text), render_text->GetLayoutText()) << "->For case " << i << ": " << cases[i].text << "\n"; expected_render_text->SetText(base::string16()); |