Chromium Code Reviews| Index: third_party/WebKit/Source/web/WebFrameSerializer.cpp |
| diff --git a/third_party/WebKit/Source/web/WebFrameSerializer.cpp b/third_party/WebKit/Source/web/WebFrameSerializer.cpp |
| index eaa7ce181b5c6717af265c81928a8a5f1c8fe951..0dc02a698720b19ca760ad8cbb3dfe386936ac9f 100644 |
| --- a/third_party/WebKit/Source/web/WebFrameSerializer.cpp |
| +++ b/third_party/WebKit/Source/web/WebFrameSerializer.cpp |
| @@ -31,6 +31,7 @@ |
| #include "public/web/WebFrameSerializer.h" |
| #include "core/HTMLNames.h" |
| +#include "core/InputTypeNames.h" |
| #include "core/dom/Document.h" |
| #include "core/dom/Element.h" |
| #include "core/frame/Frame.h" |
| @@ -81,6 +82,7 @@ class MHTMLFrameSerializerDelegate final : public FrameSerializer::Delegate { |
| public: |
| explicit MHTMLFrameSerializerDelegate( |
| WebFrameSerializer::MHTMLPartsGenerationDelegate&); |
| + bool shouldIgnoreElement(const Element&) override; |
| bool shouldIgnoreAttribute(const Element&, const Attribute&) override; |
| bool rewriteLink(const Element&, String& rewrittenLink) override; |
| bool shouldSkipResourceWithURL(const KURL&) override; |
| @@ -94,6 +96,15 @@ MHTMLFrameSerializerDelegate::MHTMLFrameSerializerDelegate( |
| WebFrameSerializer::MHTMLPartsGenerationDelegate& webDelegate) |
| : m_webDelegate(webDelegate) {} |
| +bool MHTMLFrameSerializerDelegate::shouldIgnoreElement(const Element& element) { |
| + // Do not include any hidden elements since they will not be made visible |
| + // due to the fact that the script execution is disabled for MHTML loading. |
| + if (element.hasAttribute(HTMLNames::hiddenAttr)) |
| + return true; |
| + return isHTMLInputElement(element) && |
| + toHTMLInputElement(&element)->type() == InputTypeNames::hidden; |
| +} |
|
tkent
2016/11/30 08:22:34
Can you check existence of layoutObject(), or chec
jianli
2016/12/01 02:13:08
Done.
|
| + |
| bool MHTMLFrameSerializerDelegate::shouldIgnoreAttribute( |
| const Element& element, |
| const Attribute& attribute) { |