else return QString();
}
+QString QWebFrame::name() const
+{
+ return d->frame->tree()->name();
+}
+
QWebPage * QWebFrame::page() const
{
return d->page;
QString renderTreeDump() const;
QString selectedText() const;
QString title() const;
+ QString name() const;
QList<QWebFrame*> childFrames() const;
+2007-10-02 Lars Knoll <lars@trolltech.com>
+
+ Reviewed by bdash.
+
+ Add API to retrieve the frame name from QWebFrame.
+ Implement support for DRT::dumpChildrenAsText.
+
+ * Api/qwebframe.cpp:
+ (QWebFrame::name):
+ * Api/qwebframe.h:
+
2007-10-02 Lars Knoll <lars@trolltech.com>
Reviewed by bdash.
+2007-10-02 Lars Knoll <lars@trolltech.com>
+
+ Reviewed by bdash.
+
+ Add API to retrieve the frame name from QWebFrame.
+ Implement support for DRT::dumpChildrenAsText.
+
+ * DumpRenderTree/DumpRenderTree.qtproj/DumpRenderTree.cpp:
+ (WebCore::DumpRenderTree::dumpFramesAsText):
+ (WebCore::DumpRenderTree::dump):
+ * DumpRenderTree/DumpRenderTree.qtproj/DumpRenderTree.h:
+ * DumpRenderTree/DumpRenderTree.qtproj/jsobjects.cpp:
+ (LayoutTestController::LayoutTestController):
+ (LayoutTestController::reset):
+ * DumpRenderTree/DumpRenderTree.qtproj/jsobjects.h:
+
2007-10-02 Lars Knoll <lars@trolltech.com>
Reviewed by bdash.
frame->addToJSWindowObject("eventSender", m_eventSender);
}
+
+QString DumpRenderTree::dumpFramesAsText(QWebFrame* frame)
+{
+ if (!frame)
+ return QString();
+
+ QString result;
+ QWebFrame *parent = qobject_cast<QWebFrame *>(frame->parent());
+ if (parent) {
+ result.append(QLatin1String("\n--------\nFrame: '"));
+ result.append(frame->name());
+ result.append(QLatin1String("'\n--------\n"));
+ }
+
+ result.append(frame->innerText());
+ result.append(QLatin1String("\n"));
+
+ if (m_controller->shouldDumpChildrenAsText()) {
+ QList<QWebFrame *> children = frame->childFrames();
+ for (int i = 0; i < children.size(); ++i)
+ result += dumpFramesAsText(children.at(i));
+ }
+
+ return result;
+}
+
void DumpRenderTree::dump()
{
QWebFrame *frame = m_page->mainFrame();
// Dump render text...
QString renderDump;
if (m_controller->shouldDumpAsText()) {
- renderDump = frame->innerText();
- renderDump.append("\n");
+ renderDump = dumpFramesAsText(frame);
} else {
renderDump = frame->renderTreeDump();
}
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
+ * documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
void quit();
private:
+ QString dumpFramesAsText(QWebFrame* frame);
LayoutTestController *m_controller;
QWebPage *m_page;
{
m_isLoading = true;
m_textDump = false;
+ m_dumpChildrenAsText = false;
m_waitForDone = false;
m_timeoutTimer = 0;
m_topLoadingFrame = 0;
{
m_isLoading = true;
m_textDump = false;
+ m_dumpChildrenAsText = false;
m_waitForDone = false;
if (m_timeoutTimer) {
killTimer(m_timeoutTimer);
void setLoading(bool loading) { m_isLoading = loading; }
bool shouldDumpAsText() const { return m_textDump; }
+ bool shouldDumpChildrenAsText() const { return m_dumpChildrenAsText; }
bool shouldWaitUntilDone() const { return m_waitForDone; }
void reset();
public slots:
void maybeDump(bool ok);
void dumpAsText() { m_textDump = true; }
+ void dumpChildFramesAsText() { m_dumpChildrenAsText = true; }
void waitUntilDone();
void notifyDone();
void dumpEditingCallbacks();
private:
bool m_isLoading;
bool m_textDump;
+ bool m_dumpChildrenAsText;
bool m_waitForDone;
int m_timeoutTimer;
QWebFrame *m_topLoadingFrame;