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

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

Issue 1015533016: Move allow_character_break property to RenderText. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 525
526 void RenderText::SetMultiline(bool multiline) { 526 void RenderText::SetMultiline(bool multiline) {
527 if (multiline != multiline_) { 527 if (multiline != multiline_) {
528 multiline_ = multiline; 528 multiline_ = multiline;
529 cached_bounds_and_offset_valid_ = false; 529 cached_bounds_and_offset_valid_ = false;
530 lines_.clear(); 530 lines_.clear();
531 OnTextAttributeChanged(); 531 OnTextAttributeChanged();
532 } 532 }
533 } 533 }
534 534
535 void RenderText::SetAllowCharacterBreak(bool allow_character_break) {
536 if (allow_character_break_ == allow_character_break)
537 return;
538 allow_character_break_ = allow_character_break;
539 cached_bounds_and_offset_valid_ = false;
msw 2015/03/25 20:54:15 Should we only run these 3 lines if multi-line is
Jun Mukai 2015/03/26 01:35:08 Done.
540 lines_.clear();
541 OnTextAttributeChanged();
542 }
543
535 void RenderText::SetReplaceNewlineCharsWithSymbols(bool replace) { 544 void RenderText::SetReplaceNewlineCharsWithSymbols(bool replace) {
536 if (replace_newline_chars_with_symbols_ == replace) 545 if (replace_newline_chars_with_symbols_ == replace)
537 return; 546 return;
538 replace_newline_chars_with_symbols_ = replace; 547 replace_newline_chars_with_symbols_ = replace;
539 cached_bounds_and_offset_valid_ = false; 548 cached_bounds_and_offset_valid_ = false;
540 OnTextAttributeChanged(); 549 OnTextAttributeChanged();
541 } 550 }
542 551
543 void RenderText::SetMinLineHeight(int line_height) { 552 void RenderText::SetMinLineHeight(int line_height) {
544 if (min_line_height_ == line_height) 553 if (min_line_height_ == line_height)
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 baselines_(NORMAL_BASELINE), 978 baselines_(NORMAL_BASELINE),
970 styles_(NUM_TEXT_STYLES), 979 styles_(NUM_TEXT_STYLES),
971 composition_and_selection_styles_applied_(false), 980 composition_and_selection_styles_applied_(false),
972 obscured_(false), 981 obscured_(false),
973 obscured_reveal_index_(-1), 982 obscured_reveal_index_(-1),
974 truncate_length_(0), 983 truncate_length_(0),
975 elide_behavior_(NO_ELIDE), 984 elide_behavior_(NO_ELIDE),
976 text_elided_(false), 985 text_elided_(false),
977 min_line_height_(0), 986 min_line_height_(0),
978 multiline_(false), 987 multiline_(false),
988 allow_character_break_(false),
979 replace_newline_chars_with_symbols_(true), 989 replace_newline_chars_with_symbols_(true),
980 subpixel_rendering_suppressed_(false), 990 subpixel_rendering_suppressed_(false),
981 clip_to_display_rect_(true), 991 clip_to_display_rect_(true),
982 baseline_(kInvalidBaseline), 992 baseline_(kInvalidBaseline),
983 cached_bounds_and_offset_valid_(false) { 993 cached_bounds_and_offset_valid_(false) {
984 } 994 }
985 995
986 SelectionModel RenderText::GetAdjacentSelectionModel( 996 SelectionModel RenderText::GetAdjacentSelectionModel(
987 const SelectionModel& current, 997 const SelectionModel& current,
988 BreakType break_type, 998 BreakType break_type,
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 1517
1508 SetDisplayOffset(display_offset_.x() + delta_x); 1518 SetDisplayOffset(display_offset_.x() + delta_x);
1509 } 1519 }
1510 1520
1511 void RenderText::DrawSelection(Canvas* canvas) { 1521 void RenderText::DrawSelection(Canvas* canvas) {
1512 for (const Rect& s : GetSubstringBounds(selection())) 1522 for (const Rect& s : GetSubstringBounds(selection()))
1513 canvas->FillRect(s, selection_background_focused_color_); 1523 canvas->FillRect(s, selection_background_focused_color_);
1514 } 1524 }
1515 1525
1516 } // namespace gfx 1526 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698