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

Unified Diff: third_party/WebKit/Source/core/frame/FrameSerializer.cpp

Issue 2538953002: Remove hidden elements from MHTML (Closed)
Patch Set: Fix trybots Created 4 years 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/core/frame/FrameSerializer.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameSerializer.cpp b/third_party/WebKit/Source/core/frame/FrameSerializer.cpp
index 5eab834745b2b2889cd32e42e3d89dadf551d2e1..e474669c70fe3935b7921d00b1bede6bf3404eaa 100644
--- a/third_party/WebKit/Source/core/frame/FrameSerializer.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameSerializer.cpp
@@ -79,15 +79,6 @@ const int32_t maxSerializationTimeUmaMicroseconds = 10 * secondsToMicroseconds;
namespace blink {
-static bool shouldIgnoreElement(const Element& element) {
- if (isHTMLScriptElement(element))
- return true;
- if (isHTMLNoScriptElement(element))
- return true;
- return isHTMLMetaElement(element) &&
- toHTMLMetaElement(element).computeEncoding().isValid();
-}
-
class SerializerMarkupAccumulator : public MarkupAccumulator {
STACK_ALLOCATED();
@@ -112,6 +103,7 @@ class SerializerMarkupAccumulator : public MarkupAccumulator {
void appendEndTag(const Element&) override;
private:
+ bool shouldIgnoreElement(const Element&) const;
void appendAttributeValue(StringBuilder& out, const String& attributeValue);
void appendRewrittenAttribute(StringBuilder& out,
const Element&,
@@ -231,6 +223,19 @@ void SerializerMarkupAccumulator::appendEndTag(const Element& element) {
MarkupAccumulator::appendEndTag(element);
}
+bool SerializerMarkupAccumulator::shouldIgnoreElement(
+ const Element& element) const {
+ if (isHTMLScriptElement(element))
+ return true;
+ if (isHTMLNoScriptElement(element))
+ return true;
+ if (isHTMLMetaElement(element) &&
+ toHTMLMetaElement(element).computeEncoding().isValid()) {
+ return true;
+ }
+ return m_delegate.shouldIgnoreElement(element);
+}
+
void SerializerMarkupAccumulator::appendAttributeValue(
StringBuilder& out,
const String& attributeValue) {
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameSerializer.h ('k') | third_party/WebKit/Source/web/WebFrameSerializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698