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

Unified Diff: third_party/WebKit/Source/web/WebFrameSerializerImpl.cpp

Issue 2707973002: Remove blacklist on .innerHTML and .outerHTML (Closed)
Patch Set: Add HTMLElement::shouldSerializeEndTag 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/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());

Powered by Google App Engine
This is Rietveld 408576698