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

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

Issue 1031533002: Supports the invisible underline for native input fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revised per comments. Created 5 years, 8 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.h ('k') | ui/views/controls/textfield/textfield.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.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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 676
677 for (; selection_max < text().length(); ++selection_max) 677 for (; selection_max < text().length(); ++selection_max)
678 if (iter.IsEndOfWord(selection_max) || iter.IsStartOfWord(selection_max)) 678 if (iter.IsEndOfWord(selection_max) || iter.IsStartOfWord(selection_max))
679 break; 679 break;
680 680
681 const bool reversed = selection().is_reversed(); 681 const bool reversed = selection().is_reversed();
682 MoveCursorTo(reversed ? selection_max : selection_min, false); 682 MoveCursorTo(reversed ? selection_max : selection_min, false);
683 MoveCursorTo(reversed ? selection_min : selection_max, true); 683 MoveCursorTo(reversed ? selection_min : selection_max, true);
684 } 684 }
685 685
686 const Range& RenderText::GetCompositionRange() const {
687 return composition_range_;
688 }
689
690 void RenderText::SetCompositionRange(const Range& composition_range) { 686 void RenderText::SetCompositionRange(const Range& composition_range) {
691 CHECK(!composition_range.IsValid() || 687 CHECK(!composition_range.IsValid() ||
692 Range(0, text_.length()).Contains(composition_range)); 688 Range(0, text_.length()).Contains(composition_range));
693 composition_range_.set_end(composition_range.end()); 689 composition_range_.set_end(composition_range.end());
694 composition_range_.set_start(composition_range.start()); 690 composition_range_.set_start(composition_range.start());
695 // TODO(oshima|msw): Altering composition underlines shouldn't 691 // TODO(oshima|msw): Altering composition underlines shouldn't
696 // require layout changes. It's currently necessary because 692 // require layout changes. It's currently necessary because
697 // RenderTextHarfBuzz paints text decorations by run, and 693 // RenderTextHarfBuzz paints text decorations by run, and
698 // RenderTextMac applies all styles during layout. 694 // RenderTextMac applies all styles during layout.
699 OnLayoutTextAttributeChanged(false); 695 OnLayoutTextAttributeChanged(false);
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 1503
1508 SetDisplayOffset(display_offset_.x() + delta_x); 1504 SetDisplayOffset(display_offset_.x() + delta_x);
1509 } 1505 }
1510 1506
1511 void RenderText::DrawSelection(Canvas* canvas) { 1507 void RenderText::DrawSelection(Canvas* canvas) {
1512 for (const Rect& s : GetSubstringBounds(selection())) 1508 for (const Rect& s : GetSubstringBounds(selection()))
1513 canvas->FillRect(s, selection_background_focused_color_); 1509 canvas->FillRect(s, selection_background_focused_color_);
1514 } 1510 }
1515 1511
1516 } // namespace gfx 1512 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/render_text.h ('k') | ui/views/controls/textfield/textfield.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698