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

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

Issue 8681001: Revert 111288 - Possibly broke media_unittests on Mac (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_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Deleted: svn:mergeinfo
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 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 Point offset(ToViewPoint(Point())); 82 Point offset(ToViewPoint(Point()));
83 // Vertically centered. 83 // Vertically centered.
84 int text_y = offset.y() + ((bounds.height() - text_height) / 2); 84 int text_y = offset.y() + ((bounds.height() - text_height) / 2);
85 // TODO(xji): need to use SkCanvas->drawPosText() for gpu acceleration. 85 // TODO(xji): need to use SkCanvas->drawPosText() for gpu acceleration.
86 cairo_move_to(cr, offset.x(), text_y); 86 cairo_move_to(cr, offset.x(), text_y);
87 pango_cairo_show_layout(cr, layout); 87 pango_cairo_show_layout(cr, layout);
88 88
89 cairo_restore(cr); 89 cairo_restore(cr);
90 90
91 // Paint cursor. 91 // Paint cursor.
92 bounds = GetUpdatedCursorBounds();
92 if (cursor_visible() && focused()) 93 if (cursor_visible() && focused())
93 canvas->DrawRect(GetUpdatedCursorBounds(), kCursorColor); 94 canvas->DrawRectInt(kCursorColor,
95 bounds.x(),
96 bounds.y(),
97 bounds.width(),
98 bounds.height());
94 } 99 }
95 100
96 SelectionModel RenderTextLinux::FindCursorPosition(const Point& point) { 101 SelectionModel RenderTextLinux::FindCursorPosition(const Point& point) {
97 PangoLayout* layout = EnsureLayout(); 102 PangoLayout* layout = EnsureLayout();
98 103
99 if (text().empty()) 104 if (text().empty())
100 return SelectionModel(0, 0, SelectionModel::LEADING); 105 return SelectionModel(0, 0, SelectionModel::LEADING);
101 106
102 Point p(ToTextPoint(point)); 107 Point p(ToTextPoint(point));
103 108
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 size_t RenderTextLinux::Utf8IndexToUtf16Index(size_t index) const { 651 size_t RenderTextLinux::Utf8IndexToUtf16Index(size_t index) const {
647 int32_t utf16_index = 0; 652 int32_t utf16_index = 0;
648 UErrorCode ec = U_ZERO_ERROR; 653 UErrorCode ec = U_ZERO_ERROR;
649 u_strFromUTF8(NULL, 0, &utf16_index, layout_text_, index, &ec); 654 u_strFromUTF8(NULL, 0, &utf16_index, layout_text_, index, &ec);
650 DCHECK(ec == U_BUFFER_OVERFLOW_ERROR || 655 DCHECK(ec == U_BUFFER_OVERFLOW_ERROR ||
651 ec == U_STRING_NOT_TERMINATED_WARNING); 656 ec == U_STRING_NOT_TERMINATED_WARNING);
652 return utf16_index; 657 return utf16_index;
653 } 658 }
654 659
655 } // namespace gfx 660 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/gfx/render_text_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698