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

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

Issue 24012002: Move Range code to gfx. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: d Created 7 years, 3 months 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_mac.h ('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) 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/render_text_mac.h" 5 #include "ui/gfx/render_text_mac.h"
6 6
7 #include <ApplicationServices/ApplicationServices.h> 7 #include <ApplicationServices/ApplicationServices.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 29 matching lines...) Expand all
40 40
41 std::vector<RenderText::FontSpan> RenderTextMac::GetFontSpansForTesting() { 41 std::vector<RenderText::FontSpan> RenderTextMac::GetFontSpansForTesting() {
42 EnsureLayout(); 42 EnsureLayout();
43 if (!runs_valid_) 43 if (!runs_valid_)
44 ComputeRuns(); 44 ComputeRuns();
45 45
46 std::vector<RenderText::FontSpan> spans; 46 std::vector<RenderText::FontSpan> spans;
47 for (size_t i = 0; i < runs_.size(); ++i) { 47 for (size_t i = 0; i < runs_.size(); ++i) {
48 gfx::Font font(runs_[i].font_name, runs_[i].text_size); 48 gfx::Font font(runs_[i].font_name, runs_[i].text_size);
49 const CFRange cf_range = CTRunGetStringRange(runs_[i].ct_run); 49 const CFRange cf_range = CTRunGetStringRange(runs_[i].ct_run);
50 const ui::Range range(cf_range.location, 50 const gfx::Range range(cf_range.location,
51 cf_range.location + cf_range.length); 51 cf_range.location + cf_range.length);
52 spans.push_back(RenderText::FontSpan(font, range)); 52 spans.push_back(RenderText::FontSpan(font, range));
53 } 53 }
54 54
55 return spans; 55 return spans;
56 } 56 }
57 57
58 SelectionModel RenderTextMac::AdjacentCharSelectionModel( 58 SelectionModel RenderTextMac::AdjacentCharSelectionModel(
59 const SelectionModel& selection, 59 const SelectionModel& selection,
60 VisualCursorDirection direction) { 60 VisualCursorDirection direction) {
61 // TODO(asvitkine): Implement this. http://crbug.com/131618 61 // TODO(asvitkine): Implement this. http://crbug.com/131618
62 return SelectionModel(); 62 return SelectionModel();
63 } 63 }
64 64
65 SelectionModel RenderTextMac::AdjacentWordSelectionModel( 65 SelectionModel RenderTextMac::AdjacentWordSelectionModel(
66 const SelectionModel& selection, 66 const SelectionModel& selection,
67 VisualCursorDirection direction) { 67 VisualCursorDirection direction) {
68 // TODO(asvitkine): Implement this. http://crbug.com/131618 68 // TODO(asvitkine): Implement this. http://crbug.com/131618
69 return SelectionModel(); 69 return SelectionModel();
70 } 70 }
71 71
72 ui::Range RenderTextMac::GetGlyphBounds(size_t index) { 72 gfx::Range RenderTextMac::GetGlyphBounds(size_t index) {
73 // TODO(asvitkine): Implement this. http://crbug.com/131618 73 // TODO(asvitkine): Implement this. http://crbug.com/131618
74 return ui::Range(); 74 return gfx::Range();
75 } 75 }
76 76
77 std::vector<Rect> RenderTextMac::GetSubstringBounds(const ui::Range& range) { 77 std::vector<Rect> RenderTextMac::GetSubstringBounds(const gfx::Range& range) {
78 // TODO(asvitkine): Implement this. http://crbug.com/131618 78 // TODO(asvitkine): Implement this. http://crbug.com/131618
79 return std::vector<Rect>(); 79 return std::vector<Rect>();
80 } 80 }
81 81
82 size_t RenderTextMac::TextIndexToLayoutIndex(size_t index) const { 82 size_t RenderTextMac::TextIndexToLayoutIndex(size_t index) const {
83 // TODO(asvitkine): Implement this. http://crbug.com/131618 83 // TODO(asvitkine): Implement this. http://crbug.com/131618
84 return index; 84 return index;
85 } 85 }
86 86
87 size_t RenderTextMac::LayoutIndexToTextIndex(size_t index) const { 87 size_t RenderTextMac::LayoutIndexToTextIndex(size_t index) const {
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 run_origin.offset(run_width, 0); 334 run_origin.offset(run_width, 0);
335 } 335 }
336 runs_valid_ = true; 336 runs_valid_ = true;
337 } 337 }
338 338
339 RenderText* RenderText::CreateInstance() { 339 RenderText* RenderText::CreateInstance() {
340 return new RenderTextMac; 340 return new RenderTextMac;
341 } 341 }
342 342
343 } // namespace gfx 343 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/render_text_mac.h ('k') | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698