Chromium Code Reviews| 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..3b262e03ef951447e81c2a5b9d34ad9c2607c88b 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) {} |
| @@ -87,15 +84,11 @@ void MarkupAccumulator::appendStartMarkup(StringBuilder& result, |
| } |
| } |
| -static bool elementCannotHaveEndTag(const Node& node) { |
| +static inline bool elementCannotHaveEndTag(const Node& node) { |
|
tkent
2017/02/22 00:31:55
Please add |inline| only if it improves user-visib
|
| 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)); |
| } |