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/gfx/font_list.h" | 10 #include "ui/gfx/font_list.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 ClipRect(clip_rect); | 233 ClipRect(clip_rect); |
234 | 234 |
235 Rect rect(text_bounds); | 235 Rect rect(text_bounds); |
236 base::string16 adjusted_text = text; | 236 base::string16 adjusted_text = text; |
237 | 237 |
238 #if defined(OS_WIN) | 238 #if defined(OS_WIN) |
239 AdjustStringDirection(flags, &adjusted_text); | 239 AdjustStringDirection(flags, &adjusted_text); |
240 #endif | 240 #endif |
241 | 241 |
242 scoped_ptr<RenderText> render_text(RenderText::CreateInstance()); | 242 scoped_ptr<RenderText> render_text(RenderText::CreateInstance()); |
243 render_text->SetTextShadows(shadows); | 243 render_text->set_shadows(shadows); |
244 | 244 |
245 if (flags & MULTI_LINE) { | 245 if (flags & MULTI_LINE) { |
246 WordWrapBehavior wrap_behavior = IGNORE_LONG_WORDS; | 246 WordWrapBehavior wrap_behavior = IGNORE_LONG_WORDS; |
247 if (flags & CHARACTER_BREAK) | 247 if (flags & CHARACTER_BREAK) |
248 wrap_behavior = WRAP_LONG_WORDS; | 248 wrap_behavior = WRAP_LONG_WORDS; |
249 else if (!(flags & NO_ELLIPSIS)) | 249 else if (!(flags & NO_ELLIPSIS)) |
250 wrap_behavior = ELIDE_LONG_WORDS; | 250 wrap_behavior = ELIDE_LONG_WORDS; |
251 | 251 |
252 std::vector<base::string16> strings; | 252 std::vector<base::string16> strings; |
253 ElideRectangleText(adjusted_text, font_list, text_bounds.width(), | 253 ElideRectangleText(adjusted_text, font_list, text_bounds.width(), |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 rect.set_height(line_height); | 394 rect.set_height(line_height); |
395 render_text->SetDisplayRect(rect); | 395 render_text->SetDisplayRect(rect); |
396 | 396 |
397 canvas_->save(); | 397 canvas_->save(); |
398 ClipRect(display_rect); | 398 ClipRect(display_rect); |
399 render_text->Draw(this); | 399 render_text->Draw(this); |
400 canvas_->restore(); | 400 canvas_->restore(); |
401 } | 401 } |
402 | 402 |
403 } // namespace gfx | 403 } // namespace gfx |
OLD | NEW |