Chromium Code Reviews| Index: Source/core/editing/StyledMarkupAccumulator.cpp |
| diff --git a/Source/core/editing/StyledMarkupAccumulator.cpp b/Source/core/editing/StyledMarkupAccumulator.cpp |
| index 66a58e71a528c78a881424db553b44f07b2f7889..51c8d2db1bca98629db0e7b34499def150b7c3e8 100644 |
| --- a/Source/core/editing/StyledMarkupAccumulator.cpp |
| +++ b/Source/core/editing/StyledMarkupAccumulator.cpp |
| @@ -96,11 +96,33 @@ void StyledMarkupAccumulator::appendEndMarkup(StringBuilder& result, const Eleme |
| void StyledMarkupAccumulator::appendText(Text& text) |
| { |
| - appendText(m_result, text); |
| + if (text.parentElement() && text.parentElement()->tagQName() == textareaTag) { |
|
yosin_UTC9
2015/06/12 12:05:17
Just FYI, for checking text in TEXTAREA, we should
|
| + appendText(m_result, text); |
| + return; |
| + } |
| + appendTextWithWrappingStyle(m_result, text); |
| } |
| void StyledMarkupAccumulator::appendText(StringBuilder& out, Text& text) |
| { |
| + const String& str = text.data(); |
| + unsigned length = str.length(); |
| + unsigned start = 0; |
| + if (m_end.isNotNull()) { |
| + if (text == m_end.text()) |
| + length = m_end.offset(); |
| + } |
| + if (m_start.isNotNull()) { |
| + if (text == m_start.text()) { |
| + start = m_start.offset(); |
| + length -= start; |
| + } |
| + } |
| + MarkupFormatter::appendCharactersReplacingEntities(out, str, start, length, m_formatter.entityMaskForText(text)); |
| +} |
| + |
| +void StyledMarkupAccumulator::appendTextWithWrappingStyle(StringBuilder& out, Text& text) |
| +{ |
| const bool parentIsTextarea = text.parentElement() && text.parentElement()->tagQName() == textareaTag; |
|
yosin_UTC9
2015/06/12 11:49:30
it seems that when |appendTextWithWrappingStyle()|
hajimehoshi
2015/06/16 06:32:06
Done.
|
| const bool wrappingSpan = shouldApplyWrappingStyle(text) && !parentIsTextarea; |
| if (wrappingSpan) { |
| @@ -121,20 +143,7 @@ void StyledMarkupAccumulator::appendText(StringBuilder& out, Text& text) |
| } |
| if (!shouldAnnotate() || parentIsTextarea) { |
| - const String& str = text.data(); |
| - unsigned length = str.length(); |
| - unsigned start = 0; |
| - if (m_end.isNotNull()) { |
| - if (text == m_end.text()) |
| - length = m_end.offset(); |
| - } |
| - if (m_start.isNotNull()) { |
| - if (text == m_start.text()) { |
| - start = m_start.offset(); |
| - length -= start; |
| - } |
| - } |
| - MarkupFormatter::appendCharactersReplacingEntities(out, str, start, length, m_formatter.entityMaskForText(text)); |
| + appendText(text); |
| } else { |
| const bool useRenderedText = !enclosingElementWithTag(firstPositionInNode(&text), selectTag); |
| String content = useRenderedText ? renderedText(text) : stringValueForRange(text); |