| Index: ui/gfx/render_text.cc | 
| diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc | 
| index c9fe334e585135a77199c41d03c0b6bb3efcb1f7..589a9c7b631bb4a23811307895990d3b01dc3157 100644 | 
| --- a/ui/gfx/render_text.cc | 
| +++ b/ui/gfx/render_text.cc | 
| @@ -445,21 +445,17 @@ void RenderText::SetText(const base::string16& text) { | 
| DCHECK(!composition_range_.IsValid()); | 
| if (text_ == text) | 
| return; | 
| -  text_ = text; | 
| +  text_.clear(); | 
| +  AppendText(text); | 
|  | 
| -  // Adjust ranged styles, baselines, and colors to accommodate a new text | 
| -  // length. Clear style ranges as they might break new text graphemes and apply | 
| +  // Clear style ranges as they might break new text graphemes and apply | 
| // the first style to the whole text instead. | 
| -  const size_t text_length = text_.length(); | 
| -  colors_.SetMax(text_length); | 
| +  colors_.SetValue(colors_.breaks().begin()->second); | 
| baselines_.SetValue(baselines_.breaks().begin()->second); | 
| -  baselines_.SetMax(text_length); | 
| for (size_t style = 0; style < NUM_TEXT_STYLES; ++style) { | 
| BreakList<bool>& break_list = styles_[style]; | 
| break_list.SetValue(break_list.breaks().begin()->second); | 
| -    break_list.SetMax(text_length); | 
| } | 
| -  cached_bounds_and_offset_valid_ = false; | 
|  | 
| // Reset selection model. SetText should always followed by SetSelectionModel | 
| // or SetCursorPosition in upper layer. | 
| @@ -468,7 +464,19 @@ void RenderText::SetText(const base::string16& text) { | 
| // Invalidate the cached text direction if it depends on the text contents. | 
| if (directionality_mode_ == DIRECTIONALITY_FROM_TEXT) | 
| text_direction_ = base::i18n::UNKNOWN_DIRECTION; | 
| +} | 
|  | 
| +void RenderText::AppendText(const base::string16& text) { | 
| +  text_ += text; | 
| +  // Adjust ranged styles and colors to accommodate a new text length. | 
| +  const size_t text_length = text_.length(); | 
| +  colors_.SetMax(text_length); | 
| +  baselines_.SetMax(text_length); | 
| +  for (size_t style = 0; style < NUM_TEXT_STYLES; ++style) { | 
| +    BreakList<bool>& break_list = styles_[style]; | 
| +    break_list.SetMax(text_length); | 
| +  } | 
| +  cached_bounds_and_offset_valid_ = false; | 
| obscured_reveal_index_ = -1; | 
| OnTextAttributeChanged(); | 
| } | 
|  |