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

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: 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..a7c6ffd0d36109194c4d0c279731c0e79b946074 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);
+ // FIXME: Refactor MarkupAccumulator so it is easier to append an element like this, without special cases for XHTML
hajimehoshi 2015/06/11 01:40:32 nit: Use TODO(yourname) instead.
hajimehoshi 2015/06/11 02:30:16 Now MarkupFormatter has two modes represented by e
Tiger (Sony Mobile) 2015/06/11 08:15:16 Done.
Tiger (Sony Mobile) 2015/06/11 08:15:16 It would be nice to have that delegated yes. Is an
hajimehoshi 2015/06/11 08:37:12 Yes, XHTML is slightly different from XML in that
Tiger (Sony Mobile) 2015/06/11 10:22:10 This is only recommended for compatibility but not
yosin_UTC9 2015/06/12 07:07:31 How about using |Document* document = element->do
philipj_slow 2015/06/12 07:58:49 Actually XHTML does not need a space before the sl
if (isHTMLHeadElement(element)) {
- out.appendLiteral("<meta charset=\"");
- out.append(m_document->charset());
- out.appendLiteral("\">");
+ result.appendLiteral("<meta http-equiv=\"Content-Type\" content=\"");
+ result.append(m_document->suggestedMIMEType());
hajimehoshi 2015/06/11 01:40:32 Use MarkupFormatter::appendAttributeValue for esca
Tiger (Sony Mobile) 2015/06/11 08:15:16 Done.
+ result.appendLiteral("; charset=");
hajimehoshi 2015/06/11 01:41:40 last '"' is missing?
Tiger (Sony Mobile) 2015/06/11 08:15:16 The last " is on line 166/168. The complete tag wi
+ result.append(m_document->charset());
hajimehoshi 2015/06/11 01:41:41 MarkupFormatter::appendAttributeValue
Tiger (Sony Mobile) 2015/06/11 08:15:17 Done.
+ if (m_document->isXHTMLDocument())
+ 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