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

Unified Diff: Source/core/editing/StyledMarkupAccumulator.cpp

Issue 1181953004: Refactoring: Separate StyledMarkupAccumulator::appendText into this and appendTextWithInlineStyle (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/editing/StyledMarkupAccumulator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « Source/core/editing/StyledMarkupAccumulator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698