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

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

Issue 1133243008: Refactoring: Remove StyledMarkupAccumulator::shouldAnnotate* methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: yosin's review Created 5 years, 7 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/StyledMarkupSerializer.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/StyledMarkupSerializer.cpp
diff --git a/Source/core/editing/StyledMarkupSerializer.cpp b/Source/core/editing/StyledMarkupSerializer.cpp
index 41b5ea7175b50407afe9fb18b8ae9554a4885f46..8d7009f504c3bc85eb17266a7902f72b53bc6c79 100644
--- a/Source/core/editing/StyledMarkupSerializer.cpp
+++ b/Source/core/editing/StyledMarkupSerializer.cpp
@@ -80,6 +80,7 @@ StyledMarkupSerializer<Strategy>::StyledMarkupSerializer(EAbsoluteURLs shouldRes
: m_markupAccumulator(shouldResolveURLs, toTextOffset(start.parentAnchoredEquivalent()), toTextOffset(end.parentAnchoredEquivalent()), start.document(), shouldAnnotate, highestNodeToBeSerialized)
, m_start(start)
, m_end(end)
+ , m_shouldAnnotate(shouldAnnotate)
{
}
@@ -128,7 +129,7 @@ String StyledMarkupSerializer<Strategy>::createMarkup(bool convertBlocksToInline
Node* firstNode = m_start.nodeAsRangeFirstNode();
VisiblePosition visibleStart(toPositionInDOMTree(m_start), VP_DEFAULT_AFFINITY);
VisiblePosition visibleEnd(toPositionInDOMTree(m_end), VP_DEFAULT_AFFINITY);
- if (m_markupAccumulator.shouldAnnotateForInterchange() && needInterchangeNewlineAfter(visibleStart)) {
+ if (m_shouldAnnotate == AnnotateForInterchange && needInterchangeNewlineAfter(visibleStart)) {
if (visibleStart == visibleEnd.previous())
return interchangeNewlineString;
@@ -187,7 +188,7 @@ String StyledMarkupSerializer<Strategy>::createMarkup(bool convertBlocksToInline
}
// FIXME: The interchange newline should be placed in the block that it's in, not after all of the content, unconditionally.
- if (m_markupAccumulator.shouldAnnotateForInterchange() && needInterchangeNewlineAt(visibleEnd))
+ if (m_shouldAnnotate == AnnotateForInterchange && needInterchangeNewlineAt(visibleEnd))
m_markupAccumulator.appendString(interchangeNewlineString);
return takeResults();
@@ -240,8 +241,9 @@ Node* StyledMarkupSerializer<Strategy>::serializeNodes(Node* startNode, Node* pa
Node* highestNodeToBeSerialized = m_markupAccumulator.highestNodeToBeSerialized();
if (highestNodeToBeSerialized && Strategy::parent(*highestNodeToBeSerialized)) {
- RefPtrWillBeRawPtr<EditingStyle> wrappingStyle = EditingStyle::wrappingStyleForSerialization(Strategy::parent(*highestNodeToBeSerialized), m_markupAccumulator.shouldAnnotate());
- if (m_markupAccumulator.shouldAnnotateForNavigationTransition()) {
+ bool shouldAnnotate = m_shouldAnnotate == AnnotateForInterchange || m_shouldAnnotate == AnnotateForNavigationTransition;
+ RefPtrWillBeRawPtr<EditingStyle> wrappingStyle = EditingStyle::wrappingStyleForSerialization(Strategy::parent(*highestNodeToBeSerialized), shouldAnnotate);
+ if (m_shouldAnnotate == AnnotateForNavigationTransition) {
wrappingStyle->style()->removeProperty(CSSPropertyBackgroundColor);
wrappingStyle->style()->removeProperty(CSSPropertyBackgroundImage);
}
@@ -274,7 +276,7 @@ Node* StyledMarkupSerializer<Strategy>::traverseNodesForSerialization(Node* star
continue;
}
- if (!n->layoutObject() && !enclosingElementWithTag(firstPositionInOrBeforeNode(n), selectTag) && !m_markupAccumulator.shouldAnnotateForNavigationTransition()) {
+ if (!n->layoutObject() && !enclosingElementWithTag(firstPositionInOrBeforeNode(n), selectTag) && m_shouldAnnotate != AnnotateForNavigationTransition) {
next = Strategy::nextSkippingChildren(*n);
// Don't skip over pastEnd.
if (pastEnd && Strategy::isDescendantOf(*pastEnd, *n))
« no previous file with comments | « Source/core/editing/StyledMarkupSerializer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698