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

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

Issue 630583002: Enable HarfBuzz by default everywhere except CrOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enable win Created 6 years, 2 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 | « no previous file | no next file » | 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.h" 5 #include "ui/gfx/render_text.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <climits> 8 #include <climits>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 paint->setAutohinted(params.autohinter); 386 paint->setAutohinted(params.autohinter);
387 paint->setHinting(FontRenderParamsHintingToSkPaintHinting(params.hinting)); 387 paint->setHinting(FontRenderParamsHintingToSkPaintHinting(params.hinting));
388 } 388 }
389 389
390 } // namespace internal 390 } // namespace internal
391 391
392 RenderText::~RenderText() { 392 RenderText::~RenderText() {
393 } 393 }
394 394
395 RenderText* RenderText::CreateInstance() { 395 RenderText* RenderText::CreateInstance() {
396 #if defined(OS_MACOSX) && defined(TOOLKIT_VIEWS) 396 // Disable on Chrome OS. Blocked on http://crbug.com/423791
397 // Use the more complete HarfBuzz implementation for Views controls on Mac. 397 #if defined(OS_CHROMEOS)
398 return new RenderTextHarfBuzz; 398 const bool default_is_harfbuzz = false;
msw 2014/10/15 20:09:57 nit: these could just be return statements below t
ckocagil 2014/10/15 20:17:30 Done.
399 #else 399 #else
400 const bool default_is_harfbuzz = true;
401 #endif
402
400 if (CommandLine::ForCurrentProcess()->HasSwitch( 403 if (CommandLine::ForCurrentProcess()->HasSwitch(
401 switches::kEnableHarfBuzzRenderText)) { 404 switches::kEnableHarfBuzzRenderText)) {
402 return new RenderTextHarfBuzz; 405 return new RenderTextHarfBuzz;
403 } 406 }
404 return CreateNativeInstance(); 407 if (CommandLine::ForCurrentProcess()->HasSwitch(
405 #endif 408 switches::kDisableHarfBuzzRenderText)) {
409 return CreateNativeInstance();
410 }
411 return default_is_harfbuzz ? new RenderTextHarfBuzz : CreateNativeInstance();
406 } 412 }
407 413
408 void RenderText::SetText(const base::string16& text) { 414 void RenderText::SetText(const base::string16& text) {
409 DCHECK(!composition_range_.IsValid()); 415 DCHECK(!composition_range_.IsValid());
410 if (text_ == text) 416 if (text_ == text)
411 return; 417 return;
412 text_ = text; 418 text_ = text;
413 419
414 // Adjust ranged styles and colors to accommodate a new text length. 420 // Adjust ranged styles and colors to accommodate a new text length.
415 // Clear style ranges as they might break new text graphemes and apply 421 // Clear style ranges as they might break new text graphemes and apply
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
1381 SetDisplayOffset(display_offset_.x() + delta_x); 1387 SetDisplayOffset(display_offset_.x() + delta_x);
1382 } 1388 }
1383 1389
1384 void RenderText::DrawSelection(Canvas* canvas) { 1390 void RenderText::DrawSelection(Canvas* canvas) {
1385 const std::vector<Rect> sel = GetSubstringBounds(selection()); 1391 const std::vector<Rect> sel = GetSubstringBounds(selection());
1386 for (std::vector<Rect>::const_iterator i = sel.begin(); i < sel.end(); ++i) 1392 for (std::vector<Rect>::const_iterator i = sel.begin(); i < sel.end(); ++i)
1387 canvas->FillRect(*i, selection_background_focused_color_); 1393 canvas->FillRect(*i, selection_background_focused_color_);
1388 } 1394 }
1389 1395
1390 } // namespace gfx 1396 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698