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

Unified Diff: third_party/WebKit/Source/core/editing/serializers/MarkupAccumulator.cpp

Issue 2707973002: Remove blacklist on .innerHTML and .outerHTML (Closed)
Patch Set: Typo fix Created 3 years, 10 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: third_party/WebKit/Source/core/editing/serializers/MarkupAccumulator.cpp
diff --git a/third_party/WebKit/Source/core/editing/serializers/MarkupAccumulator.cpp b/third_party/WebKit/Source/core/editing/serializers/MarkupAccumulator.cpp
index 1ea9422463f41e1809ef593f360467c697c67f07..bb9b4a5b791d1ac82a53363ce9d1ac4d5b3e6e7e 100644
--- a/third_party/WebKit/Source/core/editing/serializers/MarkupAccumulator.cpp
+++ b/third_party/WebKit/Source/core/editing/serializers/MarkupAccumulator.cpp
@@ -27,7 +27,6 @@
#include "core/editing/serializers/MarkupAccumulator.h"
-#include "core/HTMLNames.h"
#include "core/XLinkNames.h"
#include "core/XMLNSNames.h"
#include "core/XMLNames.h"
@@ -46,8 +45,6 @@
namespace blink {
-using namespace HTMLNames;
-
MarkupAccumulator::MarkupAccumulator(EAbsoluteURLs resolveUrlsMethod,
SerializationType serializationType)
: m_formatter(resolveUrlsMethod, serializationType) {}
@@ -91,11 +88,7 @@ static bool elementCannotHaveEndTag(const Node& node) {
if (!node.isHTMLElement())
return false;
- // FIXME: ieForbidsInsertHTML may not be the right function to call here
- // ieForbidsInsertHTML is used to disallow setting innerHTML/outerHTML
- // or createContextualFragment. It does not necessarily align with
- // which elements should be serialized w/o end tags.
- return toHTMLElement(node).ieForbidsInsertHTML();
+ return !toHTMLElement(node).shouldSerializeEndTag();
}
void MarkupAccumulator::appendEndMarkup(StringBuilder& result,
@@ -192,7 +185,9 @@ static void serializeNodesWithNamespaces(MarkupAccumulator& accumulator,
&namespaceHash);
}
- if (!childrenOnly && targetNode.isElementNode())
+ if ((!childrenOnly && targetNode.isElementNode()) &&
+ !(accumulator.serializeAsHTMLDocument(targetNode) &&
+ elementCannotHaveEndTag(targetNode)))
accumulator.appendEndTag(toElement(targetNode));
}

Powered by Google App Engine
This is Rietveld 408576698