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

Unified Diff: ui/gfx/render_text_harfbuzz.h

Issue 882643005: Add multiline support to RenderTextHarfBuzz. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed review comments Created 5 years, 10 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/gfx/render_text_harfbuzz.h
diff --git a/ui/gfx/render_text_harfbuzz.h b/ui/gfx/render_text_harfbuzz.h
index 7f3a1dcef7396fb5b5f84af79d7d12a7a63a3c15..d0e167ecbed1cc421ec7b9eef17fb1aa0d8e50f1 100644
--- a/ui/gfx/render_text_harfbuzz.h
+++ b/ui/gfx/render_text_harfbuzz.h
@@ -113,6 +113,7 @@ class GFX_EXPORT RenderTextHarfBuzz : public RenderText {
private:
friend class RenderTextTest;
+ FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_NormalWidth);
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_RunDirection);
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_BreakRunsByUnicodeBlocks);
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_BreakRunsByEmoji);
@@ -121,6 +122,13 @@ class GFX_EXPORT RenderTextHarfBuzz : public RenderText {
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_NonExistentFont);
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_UniscribeFallback);
+ // Specify the width of a glyph for test. The width of glyphs is very
+ // platform-dependent and environment-dependent. Otherwise multiline test
+ // will become really flaky.
+ void set_glyph_width_for_test(uint8 test_width) {
+ glyph_width_for_test_ = test_width;
+ }
+
// Return the run index that contains the argument; or the length of the
// |runs_| vector if argument exceeds the text length or width.
size_t GetRunContainingCaret(const SelectionModel& caret) const;
@@ -168,6 +176,12 @@ class GFX_EXPORT RenderTextHarfBuzz : public RenderText {
// be NULL in case of an error.
scoped_ptr<base::i18n::BreakIterator> grapheme_iterator_;
+ // The total size of the layouted text.
+ SizeF total_size_;
+
+ // Fixed width of glyphs. This should only be set in test environments.
+ uint8 glyph_width_for_test_;
oshima 2015/02/05 21:29:40 instead of adding this to every instance, can you
msw 2015/02/05 21:50:58 That goes against my recommendation at: https://co
Jun Mukai 2015/02/05 22:21:48 One thing actually I was a bit worried about is th
oshima 2015/02/05 22:42:44 How about defining virtual function that gets the
Jun Mukai 2015/02/05 23:28:00 Rather than that, I would think that exposing the
oshima 2015/02/05 23:48:25 I'm fine as long as we can eliminate test only mem
+
DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzz);
};

Powered by Google App Engine
This is Rietveld 408576698