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

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

Issue 1174873002: Refactoring: Remove StyledMarkupAccumulator::appendString and add appendNewLine (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase 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.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/StyledMarkupSerializer.cpp
diff --git a/Source/core/editing/StyledMarkupSerializer.cpp b/Source/core/editing/StyledMarkupSerializer.cpp
index 633b65d297d2513c70da807ada173f244ddb4b18..0a4d7e1620987fac506794771280d8534e1e222d 100644
--- a/Source/core/editing/StyledMarkupSerializer.cpp
+++ b/Source/core/editing/StyledMarkupSerializer.cpp
@@ -117,8 +117,6 @@ static PassRefPtrWillBeRawPtr<EditingStyle> styleFromMatchedRulesAndInlineDecl(c
template<typename Strategy>
String StyledMarkupSerializer<Strategy>::createMarkup()
{
- DEFINE_STATIC_LOCAL(const String, interchangeNewlineString, ("<br class=\"" AppleInterchangeNewline "\">"));
-
StyledMarkupAccumulator markupAccumulator(m_shouldResolveURLs, toTextOffset(m_start.parentAnchoredEquivalent()), toTextOffset(m_end.parentAnchoredEquivalent()), m_start.document(), m_shouldAnnotate, m_highestNodeToBeSerialized.get());
Node* pastEnd = m_end.nodeAsRangePastLastNode();
@@ -127,15 +125,15 @@ String StyledMarkupSerializer<Strategy>::createMarkup()
VisiblePosition visibleStart(toPositionInDOMTree(m_start), VP_DEFAULT_AFFINITY);
VisiblePosition visibleEnd(toPositionInDOMTree(m_end), VP_DEFAULT_AFFINITY);
if (m_shouldAnnotate == AnnotateForInterchange && needInterchangeNewlineAfter(visibleStart)) {
+ markupAccumulator.appendInterchangeNewline();
if (visibleStart == visibleEnd.previous())
- return interchangeNewlineString;
+ return markupAccumulator.takeResults();
- markupAccumulator.appendString(interchangeNewlineString);
firstNode = visibleStart.next().deepEquivalent().deprecatedNode();
if (pastEnd && Strategy::PositionType::beforeNode(firstNode).compareTo(Strategy::PositionType::beforeNode(pastEnd)) >= 0) {
// This condition hits in editing/pasteboard/copy-display-none.html.
- return interchangeNewlineString;
+ return markupAccumulator.takeResults();
}
}
@@ -186,7 +184,7 @@ String StyledMarkupSerializer<Strategy>::createMarkup()
// FIXME: The interchange newline should be placed in the block that it's in, not after all of the content, unconditionally.
if (m_shouldAnnotate == AnnotateForInterchange && needInterchangeNewlineAt(visibleEnd))
- markupAccumulator.appendString(interchangeNewlineString);
+ markupAccumulator.appendInterchangeNewline();
return markupAccumulator.takeResults();
}
« no previous file with comments | « Source/core/editing/StyledMarkupAccumulator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698