diff options
| author | Ben Murdoch <benm@google.com> | 2010-10-22 13:02:20 +0100 |
|---|---|---|
| committer | Ben Murdoch <benm@google.com> | 2010-10-26 15:21:41 +0100 |
| commit | a94275402997c11dd2e778633dacf4b7e630a35d (patch) | |
| tree | e66f56c67e3b01f22c9c23cd932271ee9ac558ed /WebKitTools/DumpRenderTree/qt | |
| parent | 09e26c78506587b3f5d930d7bc72a23287ffbec0 (diff) | |
| download | external_webkit-a94275402997c11dd2e778633dacf4b7e630a35d.zip external_webkit-a94275402997c11dd2e778633dacf4b7e630a35d.tar.gz external_webkit-a94275402997c11dd2e778633dacf4b7e630a35d.tar.bz2 | |
Merge WebKit at r70209: Initial merge by Git
Change-Id: Id23a68efa36e9d1126bcce0b137872db00892c8e
Diffstat (limited to 'WebKitTools/DumpRenderTree/qt')
11 files changed, 133 insertions, 5 deletions
diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro b/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro index 801251d..54d5af7 100644 --- a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro +++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro @@ -27,12 +27,14 @@ HEADERS = $$BASEDIR/WorkQueue.h \ WorkQueueItemQt.h \ LayoutTestControllerQt.h \ GCControllerQt.h \ + PlainTextControllerQt.h \ testplugin.h SOURCES = ../../../JavaScriptCore/wtf/Assertions.cpp \ $$BASEDIR/WorkQueue.cpp \ DumpRenderTreeQt.cpp \ EventSenderQt.cpp \ TextInputControllerQt.cpp \ + PlainTextControllerQt.cpp \ WorkQueueItemQt.cpp \ LayoutTestControllerQt.cpp \ GCControllerQt.cpp \ diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp index 80fa441..50ae605 100644 --- a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp @@ -37,6 +37,7 @@ #include "GCControllerQt.h" #include "LayoutTestControllerQt.h" #include "TextInputControllerQt.h" +#include "PlainTextControllerQt.h" #include "testplugin.h" #include "WorkQueue.h" @@ -450,6 +451,9 @@ DumpRenderTree::DumpRenderTree() view->setPage(m_page); m_mainView = view; } + // Use a frame group name for all pages created by DumpRenderTree to allow + // testing of cross-page frame lookup. + DumpRenderTreeSupportQt::webPageSetGroupName(m_page, "org.webkit.qt.DumpRenderTree"); m_mainView->setContextMenuPolicy(Qt::NoContextMenu); m_mainView->resize(QSize(LayoutTestController::maxViewWidth, LayoutTestController::maxViewHeight)); @@ -470,6 +474,7 @@ DumpRenderTree::DumpRenderTree() connect(m_controller, SIGNAL(done()), this, SLOT(dump())); m_eventSender = new EventSender(m_page); m_textInputController = new TextInputController(m_page); + m_plainTextController = new PlainTextController(m_page); m_gcController = new GCController(m_page); // now connect our different signals @@ -752,6 +757,7 @@ void DumpRenderTree::initJSObjects() frame->addToJavaScriptWindowObject(QLatin1String("eventSender"), m_eventSender); frame->addToJavaScriptWindowObject(QLatin1String("textInputController"), m_textInputController); frame->addToJavaScriptWindowObject(QLatin1String("GCController"), m_gcController); + frame->addToJavaScriptWindowObject(QLatin1String("plainText"), m_plainTextController); } void DumpRenderTree::showPage() @@ -827,7 +833,7 @@ static QString dumpHistoryItem(const QWebHistoryItem& item, int indent, bool cur for (int i = start; i < indent; i++) result.append(' '); - QString url = item.url().toString(); + QString url = item.url().toEncoded(); if (url.contains("file://")) { static QString layoutTestsString("/LayoutTests/"); static QString fileTestString("(file test):"); @@ -1059,6 +1065,11 @@ QWebPage *DumpRenderTree::createWindow() connectFrame(page->mainFrame()); connect(page, SIGNAL(loadFinished(bool)), m_controller, SLOT(maybeDump(bool))); connect(page, SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested())); + + // Use a frame group name for all pages created by DumpRenderTree to allow + // testing of cross-page frame lookup. + DumpRenderTreeSupportQt::webPageSetGroupName(page, "org.webkit.qt.DumpRenderTree"); + return page; } @@ -1067,6 +1078,9 @@ void DumpRenderTree::windowCloseRequested() QWebPage* page = qobject_cast<QWebPage*>(sender()); QObject* container = page->parent(); windows.removeAll(container); + // Our use of container->deleteLater() means we need to remove closed pages + // from the org.webkit.qt.DumpRenderTree group explicitly. + DumpRenderTreeSupportQt::webPageSetGroupName(page, ""); container->deleteLater(); } diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h index 3d34443..b3e4e32 100644 --- a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h +++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.h @@ -60,6 +60,7 @@ class DumpRenderTreeSupportQt; class EventSender; class TextInputController; class GCController; +class PlainTextController; namespace WebCore { @@ -148,6 +149,7 @@ private: EventSender *m_eventSender; TextInputController *m_textInputController; GCController* m_gcController; + PlainTextController* m_plainTextController; NetworkAccessManager* m_networkAccessManager; QFile *m_stdin; diff --git a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp index fd7c925..6fb75a5 100644 --- a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp @@ -254,9 +254,18 @@ void EventSender::keyDown(const QString& string, const QStringList& modifiers, u modifs = Qt::ControlModifier; s = QString(); } else if (code == 'o' && modifs == Qt::ControlModifier) { + // Mimic the emacs ctrl-o binding on Mac by inserting a paragraph + // separator and then putting the cursor back to its original + // position. Allows us to pass emacs-ctrl-o.html s = QLatin1String("\n"); code = '\n'; modifs = 0; + QKeyEvent event(QEvent::KeyPress, code, modifs, s); + sendEvent(m_page, &event); + QKeyEvent event2(QEvent::KeyRelease, code, modifs, s); + sendEvent(m_page, &event2); + s = QString(); + code = Qt::Key_Left; } else if (code == 'y' && modifs == Qt::ControlModifier) { s = QLatin1String("c"); code = 'c'; diff --git a/WebKitTools/DumpRenderTree/qt/GCControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/GCControllerQt.cpp index ba7e2c3..3aa507f 100644 --- a/WebKitTools/DumpRenderTree/qt/GCControllerQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/GCControllerQt.cpp @@ -48,7 +48,7 @@ void GCController::collectOnAlternateThread(bool waitUntilDone) const DumpRenderTreeSupportQt::garbageCollectorCollectOnAlternateThread(waitUntilDone); } -size_t GCController::getJSObjectCount() const +unsigned int GCController::getJSObjectCount() const { return DumpRenderTreeSupportQt::javaScriptObjectsCount(); } diff --git a/WebKitTools/DumpRenderTree/qt/GCControllerQt.h b/WebKitTools/DumpRenderTree/qt/GCControllerQt.h index ed2a858..d3c83b9 100644 --- a/WebKitTools/DumpRenderTree/qt/GCControllerQt.h +++ b/WebKitTools/DumpRenderTree/qt/GCControllerQt.h @@ -43,7 +43,7 @@ public: public slots: void collect() const; void collectOnAlternateThread(bool waitUntilDone) const; - size_t getJSObjectCount() const; + unsigned int getJSObjectCount() const; }; diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp index 90a04c4..d36a074 100644 --- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp @@ -284,13 +284,15 @@ void LayoutTestController::setDeferMainResourceDataLoad(bool defer) void LayoutTestController::queueBackNavigation(int howFarBackward) { //qDebug() << ">>>queueBackNavigation" << howFarBackward; - WorkQueue::shared()->queue(new BackItem(howFarBackward, m_drt->webPage())); + for (int i = 0; i != howFarBackward; ++i) + WorkQueue::shared()->queue(new BackItem(1, m_drt->webPage())); } void LayoutTestController::queueForwardNavigation(int howFarForward) { //qDebug() << ">>>queueForwardNavigation" << howFarForward; - WorkQueue::shared()->queue(new ForwardItem(howFarForward, m_drt->webPage())); + for (int i = 0; i != howFarForward; ++i) + WorkQueue::shared()->queue(new ForwardItem(1, m_drt->webPage())); } void LayoutTestController::queueLoad(const QString& url, const QString& target) @@ -796,5 +798,11 @@ void LayoutTestController::removeAllVisitedLinks() DumpRenderTreeSupportQt::dumpVisitedLinksCallbacks(true); } +bool LayoutTestController::hasSpellingMarker(int, int) +{ + // FIXME: Implement. + return false; +} + const unsigned LayoutTestController::maxViewWidth = 800; const unsigned LayoutTestController::maxViewHeight = 600; diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h index ec89acb..3684946 100644 --- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h +++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h @@ -219,6 +219,7 @@ public slots: // Empty stub method to keep parity with object model exposed by global LayoutTestController. void abortModal() {} + bool hasSpellingMarker(int from, int length); /* Policy values: 'on', 'auto' or 'off'. diff --git a/WebKitTools/DumpRenderTree/qt/PlainTextControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/PlainTextControllerQt.cpp new file mode 100644 index 0000000..441a37c --- /dev/null +++ b/WebKitTools/DumpRenderTree/qt/PlainTextControllerQt.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Robert Hogan <robert@roberthogan.net> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * 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. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "config.h" +#include "PlainTextControllerQt.h" + +#include "../../../WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h" +#include <QApplication> +#include <QInputMethodEvent> +#include <QKeyEvent> + +PlainTextController::PlainTextController(QWebPage* parent) + : QObject(parent) +{ +} + +QString PlainTextController::plainText(const QVariant& range) +{ + return DumpRenderTreeSupportQt::plainText(range); +} diff --git a/WebKitTools/DumpRenderTree/qt/PlainTextControllerQt.h b/WebKitTools/DumpRenderTree/qt/PlainTextControllerQt.h new file mode 100644 index 0000000..e78e110 --- /dev/null +++ b/WebKitTools/DumpRenderTree/qt/PlainTextControllerQt.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Robert Hogan <robert@roberthogan.net> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * 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. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef PlainTextControllerQt_h +#define PlainTextControllerQt_h + +#include <QList> +#include <QObject> +#include <QString> +#include <QVariant> + +#include "qwebpage.h" + +class PlainTextController : public QObject { + Q_OBJECT +public: + PlainTextController(QWebPage* parent); + +public slots: + QString plainText(const QVariant& range); +}; + +#endif // PlainTextControllerQt_h diff --git a/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro b/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro index e48b035..740ebb8 100644 --- a/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro +++ b/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro @@ -31,6 +31,7 @@ SOURCES = PluginObject.cpp \ Tests/DocumentOpenInDestroyStream.cpp \ Tests/NPRuntimeObjectFromDestroyedPlugin.cpp \ Tests/NPRuntimeRemoveProperty.cpp \ + Tests/PassDifferentNPPStruct.cpp \ Tests/PluginScriptableNPObjectInvokeDefault.cpp mac { |
