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

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

Issue 1164253002: Refactoring: Remove boolean paramters from StyledMarkupAccumulator (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') | Source/core/editing/StyledMarkupSerializer.cpp » ('j') | 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 8c60ccd5ab364da60616857101911d0eaab1038b..ebeefb28cc2ffc1ba74d91eb0db2ae03597df16e 100644
--- a/Source/core/editing/StyledMarkupAccumulator.cpp
+++ b/Source/core/editing/StyledMarkupAccumulator.cpp
@@ -39,13 +39,6 @@ namespace blink {
namespace {
tkent 2015/06/08 07:49:56 Remove this namespace block.
hajimehoshi 2015/06/08 07:56:55 Done.
-const String& styleNodeCloseTag(bool isBlock)
-{
- DEFINE_STATIC_LOCAL(const String, divClose, ("</div>"));
- DEFINE_STATIC_LOCAL(const String, styleSpanClose, ("</span>"));
- return isBlock ? divClose : styleSpanClose;
-}
-
} // namespace
using namespace HTMLNames;
@@ -108,7 +101,9 @@ void StyledMarkupAccumulator::appendText(StringBuilder& out, Text& text)
// FIXME: Should this be included in forceInline?
wrappingStyle->style()->setProperty(CSSPropertyFloat, CSSValueNone);
- appendStyleNodeOpenTag(out, wrappingStyle->style());
+ out.appendLiteral("<span style=\"");
+ MarkupFormatter::appendAttributeValue(out, wrappingStyle->style()->asText(), m_document->isHTMLDocument());
+ out.appendLiteral("\">");
}
if (!shouldAnnotate() || parentIsTextarea) {
@@ -135,7 +130,7 @@ void StyledMarkupAccumulator::appendText(StringBuilder& out, Text& text)
}
if (wrappingSpan)
- out.append(styleNodeCloseTag(false));
+ out.append("</span>");
}
void StyledMarkupAccumulator::appendElement(StringBuilder& out, Element& element)
@@ -196,19 +191,6 @@ void StyledMarkupAccumulator::appendElement(StringBuilder& out, Element& element
m_formatter.appendCloseTag(out, element);
}
-void StyledMarkupAccumulator::appendStyleNodeOpenTag(StringBuilder& out, StylePropertySet* style, bool isBlock)
-{
- // wrappingStyleForSerialization should have removed -webkit-text-decorations-in-effect
- ASSERT(propertyMissingOrEqualToNone(style, CSSPropertyWebkitTextDecorationsInEffect));
tkent 2015/06/08 07:49:56 The assertion is removed. Is it intentional?
hajimehoshi 2015/06/08 07:56:55 Oh, I forgot that. Copied.
- if (isBlock)
- out.appendLiteral("<div style=\"");
- else
- out.appendLiteral("<span style=\"");
- ASSERT(m_document);
tkent 2015/06/08 07:49:56 Ditto.
hajimehoshi 2015/06/08 07:56:55 Done.
- MarkupFormatter::appendAttributeValue(out, style->asText(), m_document->isHTMLDocument());
- out.appendLiteral("\">");
-}
-
void StyledMarkupAccumulator::wrapWithNode(ContainerNode& node, RangeFullySelectsNode rangeFullySelectsNode)
{
StringBuilder markup;
@@ -221,12 +203,15 @@ void StyledMarkupAccumulator::wrapWithNode(ContainerNode& node, RangeFullySelect
appendEndTag(toElement(node));
}
-void StyledMarkupAccumulator::wrapWithStyleNode(StylePropertySet* style, bool isBlock)
+void StyledMarkupAccumulator::wrapWithStyleNode(StylePropertySet* style)
{
StringBuilder openTag;
- appendStyleNodeOpenTag(openTag, style, isBlock);
+ openTag.appendLiteral("<div style=\"");
+ MarkupFormatter::appendAttributeValue(openTag, style->asText(), m_document->isHTMLDocument());
+ openTag.appendLiteral("\">");
m_reversedPrecedingMarkup.append(openTag.toString());
- appendString(styleNodeCloseTag(isBlock));
+
+ appendString("</div>");
}
String StyledMarkupAccumulator::takeResults()
« no previous file with comments | « Source/core/editing/StyledMarkupAccumulator.h ('k') | Source/core/editing/StyledMarkupSerializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698