OLD | NEW |
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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 } // namespace internal | 419 } // namespace internal |
420 | 420 |
421 RenderText::~RenderText() { | 421 RenderText::~RenderText() { |
422 } | 422 } |
423 | 423 |
424 RenderText* RenderText::CreateInstance() { | 424 RenderText* RenderText::CreateInstance() { |
425 #if defined(OS_MACOSX) && defined(TOOLKIT_VIEWS) | 425 #if defined(OS_MACOSX) && defined(TOOLKIT_VIEWS) |
426 // Use the more complete HarfBuzz implementation for Views controls on Mac. | 426 // Use the more complete HarfBuzz implementation for Views controls on Mac. |
427 return new RenderTextHarfBuzz; | 427 return new RenderTextHarfBuzz; |
428 #else | 428 #else |
429 if (CommandLine::ForCurrentProcess()->HasSwitch( | 429 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
430 switches::kEnableHarfBuzzRenderText)) { | 430 switches::kDisableHarfBuzzRenderText)) { |
431 return new RenderTextHarfBuzz; | 431 return new RenderTextHarfBuzz; |
432 } | 432 } |
433 return CreateNativeInstance(); | 433 return CreateNativeInstance(); |
434 #endif | 434 #endif |
435 } | 435 } |
436 | 436 |
437 void RenderText::SetText(const base::string16& text) { | 437 void RenderText::SetText(const base::string16& text) { |
438 DCHECK(!composition_range_.IsValid()); | 438 DCHECK(!composition_range_.IsValid()); |
439 if (text_ == text) | 439 if (text_ == text) |
440 return; | 440 return; |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1425 SetDisplayOffset(display_offset_.x() + delta_x); | 1425 SetDisplayOffset(display_offset_.x() + delta_x); |
1426 } | 1426 } |
1427 | 1427 |
1428 void RenderText::DrawSelection(Canvas* canvas) { | 1428 void RenderText::DrawSelection(Canvas* canvas) { |
1429 const std::vector<Rect> sel = GetSubstringBounds(selection()); | 1429 const std::vector<Rect> sel = GetSubstringBounds(selection()); |
1430 for (std::vector<Rect>::const_iterator i = sel.begin(); i < sel.end(); ++i) | 1430 for (std::vector<Rect>::const_iterator i = sel.begin(); i < sel.end(); ++i) |
1431 canvas->FillRect(*i, selection_background_focused_color_); | 1431 canvas->FillRect(*i, selection_background_focused_color_); |
1432 } | 1432 } |
1433 | 1433 |
1434 } // namespace gfx | 1434 } // namespace gfx |
OLD | NEW |