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

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

Issue 16867016: Windows implementation of multiline RenderText (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: min height/baseline; update tests 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
« no previous file with comments | « ui/gfx/render_text_linux.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) 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // Undo the temporarily applied composition underlines and selection colors. 242 // Undo the temporarily applied composition underlines and selection colors.
243 UndoCompositionAndSelectionStyles(); 243 UndoCompositionAndSelectionStyles();
244 } 244 }
245 245
246 void RenderTextMac::ComputeRuns() { 246 void RenderTextMac::ComputeRuns() {
247 DCHECK(line_); 247 DCHECK(line_);
248 248
249 CFArrayRef ct_runs = CTLineGetGlyphRuns(line_); 249 CFArrayRef ct_runs = CTLineGetGlyphRuns(line_);
250 const CFIndex ct_runs_count = CFArrayGetCount(ct_runs); 250 const CFIndex ct_runs_count = CFArrayGetCount(ct_runs);
251 251
252 // TODO(asvitkine): Don't use GetTextOffset() until draw time, since it may be 252 // TODO(asvitkine): Don't use GetLineOffset() until draw time, since it may be
253 // updated based on alignment changes without resetting the layout. 253 // updated based on alignment changes without resetting the layout.
254 gfx::Vector2d text_offset = GetTextOffset(); 254 gfx::Vector2d text_offset = GetLineOffset(0);
255 // Skia will draw glyphs with respect to the baseline. 255 // Skia will draw glyphs with respect to the baseline.
256 text_offset += gfx::Vector2d(0, common_baseline_); 256 text_offset += gfx::Vector2d(0, common_baseline_);
257 257
258 const SkScalar x = SkIntToScalar(text_offset.x()); 258 const SkScalar x = SkIntToScalar(text_offset.x());
259 const SkScalar y = SkIntToScalar(text_offset.y()); 259 const SkScalar y = SkIntToScalar(text_offset.y());
260 SkPoint run_origin = SkPoint::Make(x, y); 260 SkPoint run_origin = SkPoint::Make(x, y);
261 261
262 const CFRange empty_cf_range = CFRangeMake(0, 0); 262 const CFRange empty_cf_range = CFRangeMake(0, 0);
263 for (CFIndex i = 0; i < ct_runs_count; ++i) { 263 for (CFIndex i = 0; i < ct_runs_count; ++i) {
264 CTRunRef ct_run = 264 CTRunRef ct_run =
(...skipping 69 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_linux.cc ('k') | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698