OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/gfx/canvas.h" | 5 #include "ui/gfx/canvas.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "ui/base/range/range.h" | 10 #include "ui/base/range/range.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 if (range.IsValid() && !style.underline) { | 172 if (range.IsValid() && !style.underline) { |
173 style.range = range; | 173 style.range = range; |
174 style.underline = true; | 174 style.underline = true; |
175 render_text->ApplyStyleRange(style); | 175 render_text->ApplyStyleRange(style); |
176 } | 176 } |
177 } | 177 } |
178 | 178 |
179 // Returns updated |flags| to match platform-specific expected behavior. | 179 // Returns updated |flags| to match platform-specific expected behavior. |
180 int AdjustPlatformSpecificFlags(const string16& text, int flags) { | 180 int AdjustPlatformSpecificFlags(const string16& text, int flags) { |
181 #if defined(OS_LINUX) | 181 #if defined(OS_LINUX) |
182 // TODO(asvitkine): On Linux, NO_ELLIPSIS really means MULTI_LINE. | |
183 // http://crbug.com/107357 | |
184 if (flags & gfx::Canvas::NO_ELLIPSIS) | |
185 flags |= gfx::Canvas::MULTI_LINE; | |
186 | |
187 // TODO(asvitkine): ash/tooltips/tooltip_controller.cc adds \n's to the string | 182 // TODO(asvitkine): ash/tooltips/tooltip_controller.cc adds \n's to the string |
188 // without passing MULTI_LINE. | 183 // without passing MULTI_LINE. |
189 if (text.find('\n') != string16::npos) | 184 if (text.find('\n') != string16::npos) |
190 flags |= gfx::Canvas::MULTI_LINE; | 185 flags |= gfx::Canvas::MULTI_LINE; |
191 #endif | 186 #endif |
192 | 187 |
193 return flags; | 188 return flags; |
194 } | 189 } |
195 | 190 |
196 } // anonymous namespace | 191 } // anonymous namespace |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 rect.set_height(line_height); | 470 rect.set_height(line_height); |
476 render_text->SetDisplayRect(rect); | 471 render_text->SetDisplayRect(rect); |
477 | 472 |
478 canvas_->save(SkCanvas::kClip_SaveFlag); | 473 canvas_->save(SkCanvas::kClip_SaveFlag); |
479 ClipRect(display_rect); | 474 ClipRect(display_rect); |
480 render_text->Draw(this); | 475 render_text->Draw(this); |
481 canvas_->restore(); | 476 canvas_->restore(); |
482 } | 477 } |
483 | 478 |
484 } // namespace gfx | 479 } // namespace gfx |
OLD | NEW |