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

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

Issue 1672073003: Shunt string-dumping functions from WebFrame to a side class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added/updated TODOs. Created 4 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/WebLocalFrameImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
index 0d231ae438dfd171ee2980a507af59918616f11f..16266890ca18d939de3e7b6b7b521d1b35274550 100644
--- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
+++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
@@ -137,7 +137,6 @@
#include "core/layout/LayoutBox.h"
#include "core/layout/LayoutObject.h"
#include "core/layout/LayoutPart.h"
-#include "core/layout/LayoutTreeAsText.h"
#include "core/layout/LayoutView.h"
#include "core/style/StyleInheritedData.h"
#include "core/loader/DocumentLoader.h"
@@ -245,64 +244,6 @@ namespace blink {
static int frameCount = 0;
-static void frameContentAsPlainText(size_t maxChars, LocalFrame* frame, StringBuilder& output)
-{
- Document* document = frame->document();
- if (!document)
- return;
-
- if (!frame->view())
- return;
-
- // Select the document body.
- if (document->body()) {
- const EphemeralRange range = EphemeralRange::rangeOfContents(*document->body());
-
- // The text iterator will walk nodes giving us text. This is similar to
- // the plainText() function in core/editing/TextIterator.h, but we implement the maximum
- // size and also copy the results directly into a wstring, avoiding the
- // string conversion.
- for (TextIterator it(range.startPosition(), range.endPosition()); !it.atEnd(); it.advance()) {
- it.text().appendTextToStringBuilder(output, 0, maxChars - output.length());
- if (output.length() >= maxChars)
- return; // Filled up the buffer.
- }
- }
-
- // The separator between frames when the frames are converted to plain text.
- const LChar frameSeparator[] = { '\n', '\n' };
- const size_t frameSeparatorLength = WTF_ARRAY_LENGTH(frameSeparator);
-
- // Recursively walk the children.
- const FrameTree& frameTree = frame->tree();
- for (Frame* curChild = frameTree.firstChild(); curChild; curChild = curChild->tree().nextSibling()) {
- if (!curChild->isLocalFrame())
- continue;
- LocalFrame* curLocalChild = toLocalFrame(curChild);
- // Ignore the text of non-visible frames.
- LayoutView* contentLayoutObject = curLocalChild->contentLayoutObject();
- LayoutPart* ownerLayoutObject = curLocalChild->ownerLayoutObject();
- if (!contentLayoutObject || !contentLayoutObject->size().width() || !contentLayoutObject->size().height()
- || (contentLayoutObject->location().x() + contentLayoutObject->size().width() <= 0) || (contentLayoutObject->location().y() + contentLayoutObject->size().height() <= 0)
- || (ownerLayoutObject && ownerLayoutObject->style() && ownerLayoutObject->style()->visibility() != VISIBLE)) {
- continue;
- }
-
- // Make sure the frame separator won't fill up the buffer, and give up if
- // it will. The danger is if the separator will make the buffer longer than
- // maxChars. This will cause the computation above:
- // maxChars - output->size()
- // to be a negative number which will crash when the subframe is added.
- if (output.length() >= maxChars - frameSeparatorLength)
- return;
-
- output.append(frameSeparator, frameSeparatorLength);
- frameContentAsPlainText(maxChars, curLocalChild, output);
- if (output.length() >= maxChars)
- return; // Filled up the buffer.
- }
-}
-
static WillBeHeapVector<ScriptSourceCode> createSourcesVector(const WebScriptSource* sourcesIn, unsigned numSources)
{
WillBeHeapVector<ScriptSourceCode> sources;
@@ -1453,38 +1394,6 @@ WebString WebLocalFrameImpl::pageProperty(const WebString& propertyName, int pag
return m_printContext->pageProperty(frame(), propertyName.utf8().data(), pageIndex);
}
-WebString WebLocalFrameImpl::contentAsText(size_t maxChars) const
-{
- if (!frame())
- return WebString();
- StringBuilder text;
- frameContentAsPlainText(maxChars, frame(), text);
- return text.toString();
-}
-
-WebString WebLocalFrameImpl::contentAsMarkup() const
-{
- if (!frame())
- return WebString();
- return createMarkup(frame()->document());
-}
-
-WebString WebLocalFrameImpl::layoutTreeAsText(LayoutAsTextControls toShow) const
-{
- LayoutAsTextBehavior behavior = LayoutAsTextShowAllLayers;
-
- if (toShow & LayoutAsTextWithLineTrees)
- behavior |= LayoutAsTextShowLineTrees;
-
- if (toShow & LayoutAsTextDebug)
- behavior |= LayoutAsTextShowCompositedLayers | LayoutAsTextShowAddresses | LayoutAsTextShowIDAndClass | LayoutAsTextShowLayerNesting;
-
- if (toShow & LayoutAsTextPrinting)
- behavior |= LayoutAsTextPrintingMode;
-
- return externalRepresentation(frame(), behavior);
-}
-
void WebLocalFrameImpl::registerTestInterface(const WebString& name, WebTestInterfaceFactory* factory)
{
m_testInterfaces.set(name, adoptPtr(factory));
@@ -1502,11 +1411,6 @@ v8::Local<v8::Value> WebLocalFrameImpl::createTestInterface(const AtomicString&
return v8::Local<v8::Value>();
}
-WebString WebLocalFrameImpl::markerTextForListItem(const WebElement& webElement) const
-{
- return blink::markerTextForListItem(const_cast<Element*>(webElement.constUnwrap<Element>()));
-}
-
void WebLocalFrameImpl::printPagesWithBoundaries(WebCanvas* canvas, const WebSize& pageSizeInPixels)
{
ASSERT(m_printContext);
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.h ('k') | third_party/WebKit/Source/web/WebRemoteFrameImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698