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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 return CommandLine::ForCurrentProcess()->HasSwitch( | 396 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
397 switches::kDisableHarfBuzzRenderText) ? CreateNativeInstance() : | 397 switches::kDisableHarfBuzzRenderText) ? CreateNativeInstance() : |
398 new RenderTextHarfBuzz; | 398 new RenderTextHarfBuzz; |
399 } | 399 } |
400 | 400 |
401 void RenderText::SetText(const base::string16& text) { | 401 void RenderText::SetText(const base::string16& text) { |
402 DCHECK(!composition_range_.IsValid()); | 402 DCHECK(!composition_range_.IsValid()); |
403 if (text_ == text) | 403 if (text_ == text) |
404 return; | 404 return; |
405 text_ = text; | 405 text_ = text; |
406 | 406 |
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 SetDisplayOffset(display_offset_.x() + delta_x); | 1392 SetDisplayOffset(display_offset_.x() + delta_x); |
1393 } | 1393 } |
1394 | 1394 |
1395 void RenderText::DrawSelection(Canvas* canvas) { | 1395 void RenderText::DrawSelection(Canvas* canvas) { |
1396 const std::vector<Rect> sel = GetSubstringBounds(selection()); | 1396 const std::vector<Rect> sel = GetSubstringBounds(selection()); |
1397 for (std::vector<Rect>::const_iterator i = sel.begin(); i < sel.end(); ++i) | 1397 for (std::vector<Rect>::const_iterator i = sel.begin(); i < sel.end(); ++i) |
1398 canvas->FillRect(*i, selection_background_focused_color_); | 1398 canvas->FillRect(*i, selection_background_focused_color_); |
1399 } | 1399 } |
1400 | 1400 |
1401 } // namespace gfx | 1401 } // namespace gfx |
OLD | NEW |