Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(522)

Side by Side Diff: ui/gfx/render_text_linux.cc

Issue 8819001: Revert 113075 (requested by asvitkine) (requested by asvitkine) (requested by asvitkine) (request... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // Vertically centered. 277 // Vertically centered.
278 int text_y = offset.y() + ((bounds.height() - text_height) / 2); 278 int text_y = offset.y() + ((bounds.height() - text_height) / 2);
279 // TODO(xji): need to use SkCanvas->drawPosText() for gpu acceleration. 279 // TODO(xji): need to use SkCanvas->drawPosText() for gpu acceleration.
280 cairo_move_to(cr, offset.x(), text_y); 280 cairo_move_to(cr, offset.x(), text_y);
281 pango_cairo_show_layout(cr, layout_); 281 pango_cairo_show_layout(cr, layout_);
282 282
283 cairo_restore(cr); 283 cairo_restore(cr);
284 } 284 }
285 285
286 size_t RenderTextLinux::IndexOfAdjacentGrapheme(size_t index, bool next) { 286 size_t RenderTextLinux::IndexOfAdjacentGrapheme(size_t index, bool next) {
287 if (index > text().length())
288 return text().length();
289 EnsureLayout(); 287 EnsureLayout();
290 return Utf16IndexOfAdjacentGrapheme(Utf16IndexToUtf8Index(index), next); 288 return Utf16IndexOfAdjacentGrapheme(Utf16IndexToUtf8Index(index), next);
291 } 289 }
292 290
293 GSList* RenderTextLinux::GetRunContainingPosition(size_t position) const { 291 GSList* RenderTextLinux::GetRunContainingPosition(size_t position) const {
294 GSList* run = current_line_->runs; 292 GSList* run = current_line_->runs;
295 while (run) { 293 while (run) {
296 PangoItem* item = reinterpret_cast<PangoLayoutRun*>(run->data)->item; 294 PangoItem* item = reinterpret_cast<PangoLayoutRun*>(run->data)->item;
297 size_t run_start = Utf8IndexToUtf16Index(item->offset); 295 size_t run_start = Utf8IndexToUtf16Index(item->offset);
298 size_t run_end = Utf8IndexToUtf16Index(item->offset + item->length); 296 size_t run_end = Utf8IndexToUtf16Index(item->offset + item->length);
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 } 683 }
686 684
687 void RenderTextLinux::GetSelectionBounds(std::vector<Rect>* bounds) { 685 void RenderTextLinux::GetSelectionBounds(std::vector<Rect>* bounds) {
688 if (selection_visual_bounds_.empty()) 686 if (selection_visual_bounds_.empty())
689 CalculateSubstringBounds(GetSelectionStart(), GetCursorPosition(), 687 CalculateSubstringBounds(GetSelectionStart(), GetCursorPosition(),
690 &selection_visual_bounds_); 688 &selection_visual_bounds_);
691 *bounds = selection_visual_bounds_; 689 *bounds = selection_visual_bounds_;
692 } 690 }
693 691
694 } // namespace gfx 692 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698