summaryrefslogtreecommitdiffstats
path: root/ui/gfx
diff options
context:
space:
mode:
Diffstat (limited to 'ui/gfx')
-rw-r--r--ui/gfx/render_text.cc1
-rw-r--r--ui/gfx/render_text.h8
-rw-r--r--ui/gfx/render_text_linux.cc1
-rw-r--r--ui/gfx/render_text_win.cc3
4 files changed, 12 insertions, 1 deletions
diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc
index 80550c3..a7923b2 100644
--- a/ui/gfx/render_text.cc
+++ b/ui/gfx/render_text.cc
@@ -621,6 +621,7 @@ RenderText::RenderText()
composition_range_(ui::Range::InvalidRange()),
fade_head_(false),
fade_tail_(false),
+ background_is_transparent_(false),
cached_bounds_and_offset_valid_(false) {
}
diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h
index 2498bcb..84e5b79 100644
--- a/ui/gfx/render_text.h
+++ b/ui/gfx/render_text.h
@@ -161,6 +161,11 @@ class UI_EXPORT RenderText {
void set_fade_tail(bool fade_tail) { fade_tail_ = fade_tail; }
bool fade_tail() const { return fade_tail_; }
+ bool background_is_transparent() const { return background_is_transparent_; }
+ void set_background_is_transparent(bool transparent) {
+ background_is_transparent_ = transparent;
+ }
+
// This cursor position corresponds to SelectionModel::selection_end. In
// addition to representing the selection end, it's also where logical text
// edits take place, and doesn't necessarily correspond to
@@ -415,6 +420,9 @@ class UI_EXPORT RenderText {
bool fade_head_;
bool fade_tail_;
+ // Is the background transparent (either partially or fully)?
+ bool background_is_transparent_;
+
// The local display area for rendering the text.
Rect display_rect_;
diff --git a/ui/gfx/render_text_linux.cc b/ui/gfx/render_text_linux.cc
index 133bd4e..9ceeb9e 100644
--- a/ui/gfx/render_text_linux.cc
+++ b/ui/gfx/render_text_linux.cc
@@ -382,6 +382,7 @@ void RenderTextLinux::DrawVisualText(Canvas* canvas) {
internal::SkiaTextRenderer renderer(canvas);
ApplyFadeEffects(&renderer);
+ renderer.SetFontSmoothingSettings(true, !background_is_transparent());
for (GSList* it = current_line_->runs; it; it = it->next) {
PangoLayoutRun* run = reinterpret_cast<PangoLayoutRun*>(it->data);
diff --git a/ui/gfx/render_text_win.cc b/ui/gfx/render_text_win.cc
index ae31475..05ed0ab 100644
--- a/ui/gfx/render_text_win.cc
+++ b/ui/gfx/render_text_win.cc
@@ -482,7 +482,8 @@ void RenderTextWin::DrawVisualText(Canvas* canvas) {
bool cleartype_enabled;
GetCachedFontSmoothingSettings(&smoothing_enabled, &cleartype_enabled);
// Note that |cleartype_enabled| corresponds to Skia's |enable_lcd_text|.
- renderer.SetFontSmoothingSettings(smoothing_enabled, cleartype_enabled);
+ renderer.SetFontSmoothingSettings(
+ smoothing_enabled, cleartype_enabled && !background_is_transparent());
for (size_t i = 0; i < runs_.size(); ++i) {
// Get the run specified by the visual-to-logical map.