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

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

Issue 1177323005: Move StyledMarkupAccumulator::shouldApplyWrappingStyle to its serializer (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
Index: Source/core/editing/StyledMarkupSerializer.cpp
diff --git a/Source/core/editing/StyledMarkupSerializer.cpp b/Source/core/editing/StyledMarkupSerializer.cpp
index 4b10abcb39f8d0ee3cb0fed86f596222c00ed9ad..6b1b0536494bde1b1695c8ffe4cfba0755e08a37 100644
--- a/Source/core/editing/StyledMarkupSerializer.cpp
+++ b/Source/core/editing/StyledMarkupSerializer.cpp
@@ -241,7 +241,7 @@ Node* StyledMarkupSerializer<Strategy>::traverseNodesForSerialization(Node* star
} else {
// Add the node to the markup if we're not skipping the descendants
if (markupAccumulator)
- markupAccumulator->appendStartTag(*n);
+ appendStartMarkup(*markupAccumulator, *n);
// If node has no children, close the tag now.
if (Strategy::hasChildren(*n)) {
@@ -337,6 +337,26 @@ RefPtrWillBeRawPtr<EditingStyle> StyledMarkupSerializer<Strategy>::createInlineS
return inlineStyle;
}
+template<typename Strategy>
+void StyledMarkupSerializer<Strategy>::appendStartMarkup(StyledMarkupAccumulator& accumulator, Node& node)
+{
+ switch (node.nodeType()) {
+ case Node::TEXT_NODE: {
+ Text& text = toText(node);
+ ContainerNode* parent = Strategy::parent(text);
yosin_UTC9 2015/06/12 12:09:55 For checking text in TEXTAREA, we should take pare
hajimehoshi 2015/06/16 08:15:18 Done.
+ if (parent && parent->isElementNode() && toElement(parent)->tagQName() == textareaTag) {
+ accumulator.appendText(text);
+ return;
+ }
+ accumulator.appendTextWithWrappingStyle(text);
yosin_UTC9 2015/06/12 12:09:55 I think we may want to calculate inline style here
hajimehoshi 2015/06/16 08:15:18 Done.
+ break;
+ }
+ default:
+ accumulator.appendStartMarkup(node);
+ break;
+ }
+}
+
template class StyledMarkupSerializer<EditingStrategy>;
} // namespace blink
« Source/core/editing/StyledMarkupAccumulator.h ('K') | « Source/core/editing/StyledMarkupSerializer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698