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

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: fix 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
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::SetWordWrapBehavior(WordWrapBehavior behavior) {
536 if (word_wrap_behavior_ == behavior)
537 return;
538 word_wrap_behavior_ = behavior;
539 if (multiline_) {
540 cached_bounds_and_offset_valid_ = false;
541 lines_.clear();
542 OnTextAttributeChanged();
543 }
544 }
545
535 void RenderText::SetReplaceNewlineCharsWithSymbols(bool replace) { 546 void RenderText::SetReplaceNewlineCharsWithSymbols(bool replace) {
536 if (replace_newline_chars_with_symbols_ == replace) 547 if (replace_newline_chars_with_symbols_ == replace)
537 return; 548 return;
538 replace_newline_chars_with_symbols_ = replace; 549 replace_newline_chars_with_symbols_ = replace;
539 cached_bounds_and_offset_valid_ = false; 550 cached_bounds_and_offset_valid_ = false;
540 OnTextAttributeChanged(); 551 OnTextAttributeChanged();
541 } 552 }
542 553
543 void RenderText::SetMinLineHeight(int line_height) { 554 void RenderText::SetMinLineHeight(int line_height) {
544 if (min_line_height_ == line_height) 555 if (min_line_height_ == line_height)
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 baselines_(NORMAL_BASELINE), 980 baselines_(NORMAL_BASELINE),
970 styles_(NUM_TEXT_STYLES), 981 styles_(NUM_TEXT_STYLES),
971 composition_and_selection_styles_applied_(false), 982 composition_and_selection_styles_applied_(false),
972 obscured_(false), 983 obscured_(false),
973 obscured_reveal_index_(-1), 984 obscured_reveal_index_(-1),
974 truncate_length_(0), 985 truncate_length_(0),
975 elide_behavior_(NO_ELIDE), 986 elide_behavior_(NO_ELIDE),
976 text_elided_(false), 987 text_elided_(false),
977 min_line_height_(0), 988 min_line_height_(0),
978 multiline_(false), 989 multiline_(false),
990 word_wrap_behavior_(IGNORE_LONG_WORDS),
979 replace_newline_chars_with_symbols_(true), 991 replace_newline_chars_with_symbols_(true),
980 subpixel_rendering_suppressed_(false), 992 subpixel_rendering_suppressed_(false),
981 clip_to_display_rect_(true), 993 clip_to_display_rect_(true),
982 baseline_(kInvalidBaseline), 994 baseline_(kInvalidBaseline),
983 cached_bounds_and_offset_valid_(false) { 995 cached_bounds_and_offset_valid_(false) {
984 } 996 }
985 997
986 SelectionModel RenderText::GetAdjacentSelectionModel( 998 SelectionModel RenderText::GetAdjacentSelectionModel(
987 const SelectionModel& current, 999 const SelectionModel& current,
988 BreakType break_type, 1000 BreakType break_type,
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 1519
1508 SetDisplayOffset(display_offset_.x() + delta_x); 1520 SetDisplayOffset(display_offset_.x() + delta_x);
1509 } 1521 }
1510 1522
1511 void RenderText::DrawSelection(Canvas* canvas) { 1523 void RenderText::DrawSelection(Canvas* canvas) {
1512 for (const Rect& s : GetSubstringBounds(selection())) 1524 for (const Rect& s : GetSubstringBounds(selection()))
1513 canvas->FillRect(s, selection_background_focused_color_); 1525 canvas->FillRect(s, selection_background_focused_color_);
1514 } 1526 }
1515 1527
1516 } // namespace gfx 1528 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698