diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-14 23:47:32 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-14 23:47:32 +0000 |
commit | ae0230aeb2e047b4b05146b0e815f047fa0e9f5d (patch) | |
tree | 70dcde808467f0b1ae4c442defe35ca4181148ec /ui/gfx | |
parent | a6691067036a8dfb93fb5e9d3ef18921f88674a7 (diff) | |
download | chromium_src-ae0230aeb2e047b4b05146b0e815f047fa0e9f5d.zip chromium_src-ae0230aeb2e047b4b05146b0e815f047fa0e9f5d.tar.gz chromium_src-ae0230aeb2e047b4b05146b0e815f047fa0e9f5d.tar.bz2 |
Fix a couple of problems with bold text in the omnibox dropdown.
(1) RenderText::GetFont() will never return a bold font, so code that tried to
elide bold strings, or to decide whether to use a bold ellipsis, always got the
wrong result. To fix this I added an accessor for RenderText styles.
(2) DeriveFont() needs to take gfx::Font::BOLD, not gfx::BOLD. (Boo to having
both of these!)
BUG=none
TEST=Paste a long URL in the address bar and check that it's elided, not clipped, in the dropdown
R=msw@chromium.org
Review URL: https://codereview.chromium.org/17106006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206519 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx')
-rw-r--r-- | ui/gfx/render_text.cc | 5 | ||||
-rw-r--r-- | ui/gfx/render_text.h | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc index 26c32ec..cdc706e 100644 --- a/ui/gfx/render_text.cc +++ b/ui/gfx/render_text.cc @@ -581,6 +581,11 @@ void RenderText::ApplyStyle(TextStyle style, } } +bool RenderText::GetStyle(TextStyle style) const { + return (styles_[style].breaks().size() == 1) && + styles_[style].breaks().front().second; +} + void RenderText::SetDirectionalityMode(DirectionalityMode mode) { if (mode == directionality_mode_) return; diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h index d4c8c9d..c10b8ab 100644 --- a/ui/gfx/render_text.h +++ b/ui/gfx/render_text.h @@ -269,6 +269,10 @@ class UI_EXPORT RenderText { void SetStyle(TextStyle style, bool value); void ApplyStyle(TextStyle style, bool value, const ui::Range& range); + // Returns whether this style is enabled consistently across the entire + // RenderText. + bool GetStyle(TextStyle style) const; + // Set the text directionality mode and get the text direction yielded. void SetDirectionalityMode(DirectionalityMode mode); base::i18n::TextDirection GetTextDirection(); |