Chromium Code Reviews| Index: third_party/WebKit/Source/web/WebFrameSerializerImpl.cpp |
| diff --git a/third_party/WebKit/Source/web/WebFrameSerializerImpl.cpp b/third_party/WebKit/Source/web/WebFrameSerializerImpl.cpp |
| index adace6ffb25b63fa544ef6fc694a47ed6675a691..00ee8774502ad2d1d01c4c8392a377b79b080402 100644 |
| --- a/third_party/WebKit/Source/web/WebFrameSerializerImpl.cpp |
| +++ b/third_party/WebKit/Source/web/WebFrameSerializerImpl.cpp |
| @@ -99,6 +99,8 @@ |
| namespace blink { |
| +using namespace HTMLNames; |
|
tkent
2017/02/22 00:31:55
This is unnecessary.
|
| + |
| // Maximum length of data buffer which is used to temporary save generated |
| // html content data. This is a soft limit which might be passed if a very large |
| // contegious string is found in the html document. |
| @@ -365,6 +367,14 @@ void WebFrameSerializerImpl::openTagToString(Element* element, |
| saveHTMLContentToBuffer(result.toString(), param); |
| } |
| +static inline bool canHaveEndTag(Element* element) { |
|
tkent
2017/02/22 00:31:55
I don't think we need to introduce new function.
|
| + if (!element->isHTMLElement()) { |
| + return true; |
| + } |
| + |
| + return toHTMLElement(element)->shouldSerializeEndTag(); |
| +} |
| + |
| // Serialize end tag of an specified element. |
| void WebFrameSerializerImpl::endTagToString(Element* element, |
| SerializeDomParam* param) { |
| @@ -384,8 +394,7 @@ void WebFrameSerializerImpl::endTagToString(Element* element, |
| if (param->isHTMLDocument) { |
| result.append('>'); |
| // FIXME: This code is horribly wrong. WebFrameSerializerImpl must die. |
| - if (!element->isHTMLElement() || |
| - !toHTMLElement(element)->ieForbidsInsertHTML()) { |
| + if (canHaveEndTag(element)) { |
| // We need to write end tag when it is required. |
| result.append("</"); |
| result.append(element->nodeName().lower()); |