| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/render_text_linux.h" | 5 #include "ui/gfx/render_text_linux.h" |
| 6 | 6 |
| 7 #include <pango/pangocairo.h> | 7 #include <pango/pangocairo.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 | 9 |
| 10 #include "base/i18n/break_iterator.h" | 10 #include "base/i18n/break_iterator.h" |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 227 |
| 228 void RenderTextLinux::EnsureLayout() { | 228 void RenderTextLinux::EnsureLayout() { |
| 229 if (layout_ == NULL) { | 229 if (layout_ == NULL) { |
| 230 CanvasSkia canvas(display_rect().width(), display_rect().height(), false); | 230 CanvasSkia canvas(display_rect().width(), display_rect().height(), false); |
| 231 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas()); | 231 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas()); |
| 232 cairo_t* cr = scoped_platform_paint.GetPlatformSurface(); | 232 cairo_t* cr = scoped_platform_paint.GetPlatformSurface(); |
| 233 | 233 |
| 234 layout_ = pango_cairo_create_layout(cr); | 234 layout_ = pango_cairo_create_layout(cr); |
| 235 SetupPangoLayout( | 235 SetupPangoLayout( |
| 236 layout_, | 236 layout_, |
| 237 text(), | 237 GetCensoredText(), |
| 238 default_style().font, | 238 default_style().font, |
| 239 display_rect().width(), | 239 display_rect().width(), |
| 240 base::i18n::GetFirstStrongCharacterDirection(text()), | 240 base::i18n::GetFirstStrongCharacterDirection(text()), |
| 241 CanvasSkia::DefaultCanvasTextAlignment()); | 241 CanvasSkia::DefaultCanvasTextAlignment()); |
| 242 | 242 |
| 243 // No width set so that the x-axis position is relative to the start of the | 243 // No width set so that the x-axis position is relative to the start of the |
| 244 // text. ToViewPoint and ToTextPoint take care of the position conversion | 244 // text. ToViewPoint and ToTextPoint take care of the position conversion |
| 245 // between text space and view spaces. | 245 // between text space and view spaces. |
| 246 pango_layout_set_width(layout_, -1); | 246 pango_layout_set_width(layout_, -1); |
| 247 // TODO(xji): If RenderText will be used for displaying purpose, such as | 247 // TODO(xji): If RenderText will be used for displaying purpose, such as |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 } | 683 } |
| 684 | 684 |
| 685 void RenderTextLinux::GetSelectionBounds(std::vector<Rect>* bounds) { | 685 void RenderTextLinux::GetSelectionBounds(std::vector<Rect>* bounds) { |
| 686 if (selection_visual_bounds_.empty()) | 686 if (selection_visual_bounds_.empty()) |
| 687 CalculateSubstringBounds(GetSelectionStart(), GetCursorPosition(), | 687 CalculateSubstringBounds(GetSelectionStart(), GetCursorPosition(), |
| 688 &selection_visual_bounds_); | 688 &selection_visual_bounds_); |
| 689 *bounds = selection_visual_bounds_; | 689 *bounds = selection_visual_bounds_; |
| 690 } | 690 } |
| 691 | 691 |
| 692 } // namespace gfx | 692 } // namespace gfx |
| OLD | NEW |