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

Unified Diff: Source/core/page/PageSerializer.cpp

Issue 1174923003: Merge page serializers [10/12] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix issues 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/PageSerializer.cpp
diff --git a/Source/core/page/PageSerializer.cpp b/Source/core/page/PageSerializer.cpp
index 6f26b42564efa38e3be47e401e68365d564c4383..cd6de2b77a05b6f67e0456bce3e4500f51f00611 100644
--- a/Source/core/page/PageSerializer.cpp
+++ b/Source/core/page/PageSerializer.cpp
@@ -135,11 +135,11 @@ SerializerMarkupAccumulator::~SerializerMarkupAccumulator()
{
}
-void SerializerMarkupAccumulator::appendText(StringBuilder& out, Text& text)
+void SerializerMarkupAccumulator::appendText(StringBuilder& result, Text& text)
{
Element* parent = text.parentElement();
if (parent && !shouldIgnoreElement(*parent))
- MarkupAccumulator::appendText(out, text);
+ MarkupAccumulator::appendText(result, text);
}
bool SerializerMarkupAccumulator::shouldIgnoreAttribute(const Attribute& attribute)
@@ -151,21 +151,27 @@ bool SerializerMarkupAccumulator::shouldIgnoreAttribute(const Attribute& attribu
return MarkupAccumulator::shouldIgnoreAttribute(attribute);
}
-void SerializerMarkupAccumulator::appendElement(StringBuilder& out, Element& element, Namespaces* namespaces)
+void SerializerMarkupAccumulator::appendElement(StringBuilder& result, Element& element, Namespaces* namespaces)
{
if (!shouldIgnoreElement(element))
- MarkupAccumulator::appendElement(out, element, namespaces);
+ MarkupAccumulator::appendElement(result, element, namespaces);
+ // TODO(tiger): Refactor MarkupAccumulator so it is easier to append an element like this, without special cases for XHTML
if (isHTMLHeadElement(element)) {
- out.appendLiteral("<meta charset=\"");
- out.append(m_document->charset());
- out.appendLiteral("\">");
+ result.appendLiteral("<meta http-equiv=\"Content-Type\" content=\"");
+ MarkupFormatter::appendAttributeValue(result, m_document->suggestedMIMEType(), m_document->isHTMLDocument());
+ result.appendLiteral("; charset=");
+ MarkupFormatter::appendAttributeValue(result, m_document->charset(), m_document->isHTMLDocument());
+ if (m_document->isXHTMLDocument())
hajimehoshi 2015/06/12 09:57:02 Please remove fixing XHTML compatibility in this C
Tiger (Sony Mobile) 2015/06/12 11:31:55 This is not only for XHTML compatibility but XML c
+ result.appendLiteral("\" />");
+ else
+ result.appendLiteral("\">");
}
// FIXME: For object (plugins) tags and video tag we could replace them by an image of their current contents.
}
-void SerializerMarkupAccumulator::appendCustomAttributes(StringBuilder& out, const Element& element, Namespaces* namespaces)
+void SerializerMarkupAccumulator::appendCustomAttributes(StringBuilder& result, const Element& element, Namespaces* namespaces)
{
if (!element.isFrameOwnerElement())
return;
@@ -182,7 +188,7 @@ void SerializerMarkupAccumulator::appendCustomAttributes(StringBuilder& out, con
// We need to give a fake location to blank frames so they can be referenced by the serialized frame.
url = m_serializer->urlForBlankFrame(toLocalFrame(frame));
- appendAttribute(out, element, Attribute(frameOwnerURLAttributeName(frameOwner), AtomicString(url.string())), namespaces);
+ appendAttribute(result, element, Attribute(frameOwnerURLAttributeName(frameOwner), AtomicString(url.string())), namespaces);
}
void SerializerMarkupAccumulator::appendStartTag(Node& node, Namespaces* namespaces)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698