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

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

Issue 1180653005: Refactoring: Remove addDisplayInline parameter of createInlineStyle (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: tkent's review 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/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 73ff93215e842ecdb112f54bc4efcb75a43fb29e..504f1e95fe01b1f47623e00eea6c9a05dc836999 100644
--- a/Source/core/editing/StyledMarkupSerializer.cpp
+++ b/Source/core/editing/StyledMarkupSerializer.cpp
@@ -172,9 +172,7 @@ String StyledMarkupSerializer<Strategy>::createMarkup()
markupAccumulator.wrapWithStyleNode(fullySelectedRootStyle->style());
}
} else {
- RefPtrWillBeRawPtr<EditingStyle> style = nullptr;
- if (ancestor->isElementNode())
- style = markupAccumulator.createInlineStyle(toElement(*ancestor), convertBlocksToInlines() && isBlock(ancestor));
+ RefPtrWillBeRawPtr<EditingStyle> style = createInlineStyleIfNeeded(markupAccumulator, *ancestor);
// Since this node and all the other ancestors are not in the selection we want
// styles that affect the exterior of the node not to be not included.
// If the node is not fully selected by the range, then we don't want to keep styles that affect its relationship to the nodes around it
@@ -288,9 +286,7 @@ Node* StyledMarkupSerializer<Strategy>::traverseNodesForSerialization(Node* star
ASSERT(startNode);
ASSERT(Strategy::isDescendantOf(*startNode, *parent));
if (markupAccumulator) {
- RefPtrWillBeRawPtr<EditingStyle> style = nullptr;
- if (parent->isElementNode())
- style = markupAccumulator->createInlineStyle(toElement(*parent), convertBlocksToInlines() && isBlock(parent));
+ RefPtrWillBeRawPtr<EditingStyle> style = createInlineStyleIfNeeded(*markupAccumulator, *parent);
wrapWithNode(*markupAccumulator, *parent, style);
}
lastClosed = parent;
@@ -314,6 +310,17 @@ void StyledMarkupSerializer<Strategy>::wrapWithNode(StyledMarkupAccumulator& acc
accumulator.appendEndTag(toElement(node));
}
+template<typename Strategy>
+RefPtrWillBeRawPtr<EditingStyle> StyledMarkupSerializer<Strategy>::createInlineStyleIfNeeded(StyledMarkupAccumulator& accumulator, Node& node)
+{
+ if (!node.isElementNode())
+ return nullptr;
+ RefPtrWillBeRawPtr<EditingStyle> inlineStyle = accumulator.createInlineStyle(toElement(node));
+ if (convertBlocksToInlines() && isBlock(&node))
+ inlineStyle->forceInline();
+ return inlineStyle;
+}
+
template class StyledMarkupSerializer<EditingStrategy>;
} // namespace blink
« 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