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..427b91bd0f6ec0a3bdc6db9efa38846de2a78d6f 100644 |
--- a/third_party/WebKit/Source/web/WebFrameSerializer.cpp |
+++ b/third_party/WebKit/Source/web/WebFrameSerializer.cpp |
@@ -81,6 +81,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 +95,11 @@ MHTMLFrameSerializerDelegate::MHTMLFrameSerializerDelegate( |
WebFrameSerializer::MHTMLPartsGenerationDelegate& webDelegate) |
: m_webDelegate(webDelegate) {} |
+bool MHTMLFrameSerializerDelegate::shouldIgnoreElement(const Element& element) { |
+ // Do not include elements that are hidden and affect no layout. |
+ return !element.layoutObject(); |
tkent
2016/12/01 14:56:43
Though I suggested this, it drops <head>, <meta>,
jianli
2016/12/07 02:21:02
We don't want to drop <head>, <meta>, <style>, <li
|
+} |
+ |
bool MHTMLFrameSerializerDelegate::shouldIgnoreAttribute( |
const Element& element, |
const Attribute& attribute) { |