Index: third_party/WebKit/Source/web/WebPageSerializerImpl.cpp |
diff --git a/third_party/WebKit/Source/web/WebPageSerializerImpl.cpp b/third_party/WebKit/Source/web/WebPageSerializerImpl.cpp |
index 6d2dfa1cd19f1675e53b340d63fa62f7772b8916..007111d392dcbd8004ebe4c25d9a45cb4b5ec46a 100644 |
--- a/third_party/WebKit/Source/web/WebPageSerializerImpl.cpp |
+++ b/third_party/WebKit/Source/web/WebPageSerializerImpl.cpp |
@@ -425,14 +425,11 @@ void WebPageSerializerImpl::buildContentForNode(Node* node, |
} |
WebPageSerializerImpl::WebPageSerializerImpl(WebFrame* frame, |
- bool recursiveSerialization, |
WebPageSerializerClient* client, |
const WebVector<WebURL>& links, |
const WebVector<WebString>& localPaths, |
const WebString& localDirectoryName) |
: m_client(client) |
- , m_recursiveSerialization(recursiveSerialization) |
- , m_framesCollected(false) |
, m_localDirectoryName(localDirectoryName) |
, m_htmlEntities(false) |
, m_xmlEntities(true) |
@@ -453,51 +450,16 @@ WebPageSerializerImpl::WebPageSerializerImpl(WebFrame* frame, |
ASSERT(m_dataBuffer.isEmpty()); |
} |
-void WebPageSerializerImpl::collectTargetFrames() |
-{ |
- ASSERT(!m_framesCollected); |
- m_framesCollected = true; |
- |
- // First, process main frame. |
- m_frames.append(m_specifiedWebLocalFrameImpl); |
- // Return now if user only needs to serialize specified frame, not including |
- // all sub-frames. |
- if (!m_recursiveSerialization) |
- return; |
- // Collect all frames inside the specified frame. |
- for (WebLocalFrameImpl* frame : m_frames) { |
- // Get current using document. |
- Document* currentDoc = frame->frame()->document(); |
- // Go through sub-frames. |
- RefPtrWillBeRawPtr<HTMLAllCollection> all = currentDoc->all(); |
- |
- for (unsigned i = 0; Element* element = all->item(i); ++i) { |
- if (!element->isHTMLElement()) |
- continue; |
- WebLocalFrameImpl* webFrame = |
- WebLocalFrameImpl::fromFrameOwnerElement(element); |
- if (webFrame) |
- m_frames.append(webFrame); |
- } |
- } |
-} |
- |
bool WebPageSerializerImpl::serialize() |
{ |
- if (!m_framesCollected) |
- collectTargetFrames(); |
- |
bool didSerialization = false; |
KURL mainURL = m_specifiedWebLocalFrameImpl->frame()->document()->url(); |
- for (unsigned i = 0; i < m_frames.size(); ++i) { |
- WebLocalFrameImpl* webFrame = m_frames[i]; |
- Document* document = webFrame->frame()->document(); |
- const KURL& url = document->url(); |
- |
- if (!url.isValid() || !m_localLinks.contains(url.string())) |
- continue; |
+ WebLocalFrameImpl* webFrame = m_specifiedWebLocalFrameImpl; |
+ Document* document = webFrame->frame()->document(); |
+ const KURL& url = document->url(); |
+ if (url.isValid() || m_localLinks.contains(url.string())) { |
dcheng
2015/09/25 19:53:52
Should this be &&?
Łukasz Anforowicz
2015/09/25 20:35:57
Right. My bad.
|
didSerialization = true; |
const WTF::TextEncoding& textEncoding = document->encoding().isValid() ? document->encoding() : UTF8Encoding(); |