| Index: ui/gfx/render_text.cc
|
| diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc
|
| index c4f841dfcf7898f4b590f31839f865e8afbdac74..e395a6e006de38097ea3fe041de046c4c75ed810 100644
|
| --- a/ui/gfx/render_text.cc
|
| +++ b/ui/gfx/render_text.cc
|
| @@ -402,6 +402,7 @@ void ApplyRenderParams(const FontRenderParams& params,
|
| RenderText::~RenderText() {
|
| }
|
|
|
| +// static
|
| RenderText* RenderText::CreateInstance() {
|
| #if defined(OS_MACOSX)
|
| static const bool use_native =
|
| @@ -413,6 +414,7 @@ RenderText* RenderText::CreateInstance() {
|
| return new RenderTextHarfBuzz;
|
| }
|
|
|
| +// static
|
| RenderText* RenderText::CreateInstanceForEditing() {
|
| return new RenderTextHarfBuzz;
|
| }
|
| @@ -503,6 +505,14 @@ void RenderText::SetMultiline(bool multiline) {
|
| }
|
| }
|
|
|
| +void RenderText::SetReplaceNewlineCharsWithSymbols(bool replace) {
|
| + if (replace_newline_chars_with_symbols_ == replace)
|
| + return;
|
| + replace_newline_chars_with_symbols_ = replace;
|
| + cached_bounds_and_offset_valid_ = false;
|
| + OnTextAttributeChanged();
|
| +}
|
| +
|
| void RenderText::SetMinLineHeight(int line_height) {
|
| if (min_line_height_ == line_height)
|
| return;
|
| @@ -919,6 +929,7 @@ RenderText::RenderText()
|
| text_elided_(false),
|
| min_line_height_(0),
|
| multiline_(false),
|
| + replace_newline_chars_with_symbols_(true),
|
| subpixel_rendering_suppressed_(false),
|
| clip_to_display_rect_(true),
|
| baseline_(kInvalidBaseline),
|
| @@ -1093,7 +1104,7 @@ HorizontalAlignment RenderText::GetCurrentHorizontalAlignment() {
|
|
|
| Vector2d RenderText::GetAlignmentOffset(size_t line_number) {
|
| // TODO(ckocagil): Enable |lines_| usage on RenderTextMac.
|
| - if (multiline_)
|
| + if (MultilineSupported() && multiline_)
|
| DCHECK_LT(line_number, lines_.size());
|
| Vector2d offset;
|
| HorizontalAlignment horizontal_alignment = GetCurrentHorizontalAlignment();
|
| @@ -1257,7 +1268,7 @@ void RenderText::OnTextAttributeChanged() {
|
| }
|
| static const base::char16 kNewline[] = { '\n', 0 };
|
| static const base::char16 kNewlineSymbol[] = { 0x2424, 0 };
|
| - if (!multiline_)
|
| + if (!multiline_ && replace_newline_chars_with_symbols_)
|
| base::ReplaceChars(layout_text_, kNewline, kNewlineSymbol, &layout_text_);
|
|
|
| OnLayoutTextAttributeChanged(true);
|
|
|