diff options
author | Cary Clark <> | 2009-03-24 21:14:25 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-24 21:14:25 -0700 |
commit | 5ec837f49e9c57d4394ce64b853fd86269c8b340 (patch) | |
tree | de89879b3a2cb0d713abc3c1fac766cb17706245 /WebKitTools/DumpRenderTree/qt | |
parent | 02ba42cb469e2f0e26216fe434dbb912cf48d248 (diff) | |
download | external_webkit-5ec837f49e9c57d4394ce64b853fd86269c8b340.zip external_webkit-5ec837f49e9c57d4394ce64b853fd86269c8b340.tar.gz external_webkit-5ec837f49e9c57d4394ce64b853fd86269c8b340.tar.bz2 |
Automated import from //branches/master/...@141953,141953
Diffstat (limited to 'WebKitTools/DumpRenderTree/qt')
-rw-r--r-- | WebKitTools/DumpRenderTree/qt/DumpRenderTree.cpp | 332 | ||||
-rw-r--r-- | WebKitTools/DumpRenderTree/qt/DumpRenderTree.h | 101 | ||||
-rw-r--r-- | WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro | 22 | ||||
-rw-r--r-- | WebKitTools/DumpRenderTree/qt/fonts.conf | 258 | ||||
-rw-r--r-- | WebKitTools/DumpRenderTree/qt/fonts/AHEM____.TTF | bin | 12480 -> 0 bytes | |||
-rw-r--r-- | WebKitTools/DumpRenderTree/qt/jsobjects.cpp | 363 | ||||
-rw-r--r-- | WebKitTools/DumpRenderTree/qt/jsobjects.h | 140 | ||||
-rw-r--r-- | WebKitTools/DumpRenderTree/qt/main.cpp | 174 | ||||
-rw-r--r-- | WebKitTools/DumpRenderTree/qt/testplugin.cpp | 67 | ||||
-rw-r--r-- | WebKitTools/DumpRenderTree/qt/testplugin.h | 45 |
10 files changed, 0 insertions, 1502 deletions
diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/qt/DumpRenderTree.cpp deleted file mode 100644 index 07075ba..0000000 --- a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.cpp +++ /dev/null @@ -1,332 +0,0 @@ -/* - * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) - * - * 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 "DumpRenderTree.h" -#include "jsobjects.h" -#include "testplugin.h" - -#include <QDir> -#include <QFile> -#include <QTimer> -#include <QBoxLayout> -#include <QScrollArea> -#include <QApplication> -#include <QUrl> -#include <QFocusEvent> - -#include <qwebpage.h> -#include <qwebframe.h> -#include <qwebview.h> -#include <qwebsettings.h> - -#include <unistd.h> -#include <qdebug.h> - -extern void qt_drt_run(bool b); -extern void qt_dump_set_accepts_editing(bool b); -extern void qt_dump_frame_loader(bool b); - - -namespace WebCore { - -// Choose some default values. -const unsigned int maxViewWidth = 800; -const unsigned int maxViewHeight = 600; - -class WebPage : public QWebPage { - Q_OBJECT -public: - WebPage(QWidget *parent, DumpRenderTree *drt); - - QWebPage *createWindow(QWebPage::WebWindowType); - - void javaScriptAlert(QWebFrame *frame, const QString& message); - void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID); - bool javaScriptConfirm(QWebFrame *frame, const QString& msg); - bool javaScriptPrompt(QWebFrame *frame, const QString& msg, const QString& defaultValue, QString* result); - -private slots: - void setViewGeometry(const QRect &r) - { - QWidget *v = view(); - if (v) - v->setGeometry(r); - } -private: - DumpRenderTree *m_drt; -}; - -WebPage::WebPage(QWidget *parent, DumpRenderTree *drt) - : QWebPage(parent), m_drt(drt) -{ - settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true); - settings()->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true); - settings()->setAttribute(QWebSettings::LinksIncludedInFocusChain, false); - connect(this, SIGNAL(geometryChangeRequested(const QRect &)), - this, SLOT(setViewGeometry(const QRect & ))); - - setPluginFactory(new TestPlugin(this)); -} - -QWebPage *WebPage::createWindow(QWebPage::WebWindowType) -{ - return m_drt->createWindow(); -} - -void WebPage::javaScriptAlert(QWebFrame *frame, const QString& message) -{ - fprintf(stdout, "ALERT: %s\n", message.toUtf8().constData()); -} - -void WebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, const QString&) -{ - fprintf (stdout, "CONSOLE MESSAGE: line %d: %s\n", lineNumber, message.toUtf8().constData()); -} - -bool WebPage::javaScriptConfirm(QWebFrame *frame, const QString& msg) -{ - fprintf(stdout, "CONFIRM: %s\n", msg.toUtf8().constData()); - return true; -} - -bool WebPage::javaScriptPrompt(QWebFrame *frame, const QString& msg, const QString& defaultValue, QString* result) -{ - fprintf(stdout, "PROMPT: %s, default text: %s\n", msg.toUtf8().constData(), defaultValue.toUtf8().constData()); - *result = defaultValue; - return true; -} - -DumpRenderTree::DumpRenderTree() - : m_stdin(0) - , m_notifier(0) -{ - m_controller = new LayoutTestController(this); - connect(m_controller, SIGNAL(done()), this, SLOT(dump()), Qt::QueuedConnection); - - QWebView *view = new QWebView(0); - view->resize(QSize(maxViewWidth, maxViewHeight)); - m_page = new WebPage(view, this); - view->setPage(m_page); - connect(m_page, SIGNAL(frameCreated(QWebFrame *)), this, SLOT(connectFrame(QWebFrame *))); - connectFrame(m_page->mainFrame()); - - connect(m_page, SIGNAL(loadFinished(bool)), m_controller, SLOT(maybeDump(bool))); - - m_page->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff); - m_page->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff); - connect(m_page->mainFrame(), SIGNAL(titleChanged(const QString&)), - SLOT(titleChanged(const QString&))); - - m_eventSender = new EventSender(m_page); - m_textInputController = new TextInputController(m_page); - - QObject::connect(this, SIGNAL(quit()), qApp, SLOT(quit()), Qt::QueuedConnection); - qt_drt_run(true); - QFocusEvent event(QEvent::FocusIn, Qt::ActiveWindowFocusReason); - QApplication::sendEvent(view, &event); -} - -DumpRenderTree::~DumpRenderTree() -{ - delete m_page; - - delete m_stdin; - delete m_notifier; -} - -void DumpRenderTree::open() -{ - if (!m_stdin) { - m_stdin = new QFile; - m_stdin->open(stdin, QFile::ReadOnly); - } - - if (!m_notifier) { - m_notifier = new QSocketNotifier(STDIN_FILENO, QSocketNotifier::Read); - connect(m_notifier, SIGNAL(activated(int)), this, SLOT(readStdin(int))); - } -} - -void DumpRenderTree::open(const QUrl& url) -{ - // W3C SVG tests expect to be 480x360 - bool isW3CTest = url.toString().contains("svg/W3C-SVG-1.1"); - int width = isW3CTest ? 480 : maxViewWidth; - int height = isW3CTest ? 360 : maxViewHeight; - m_page->view()->resize(QSize(width, height)); - m_page->setViewportSize(QSize(width, height)); - - resetJSObjects(); - - qt_dump_frame_loader(url.toString().contains("loading/")); - m_page->mainFrame()->load(url); -} - -void DumpRenderTree::readStdin(int /* socket */) -{ - // Read incoming data from stdin... - QByteArray line = m_stdin->readLine(); - if (line.endsWith('\n')) - line.truncate(line.size()-1); - //fprintf(stderr, "\n opening %s\n", line.constData()); - if (line.isEmpty()) - quit(); - - if (line.startsWith("http:") || line.startsWith("https:")) - open(QUrl(line)); - else { - QFileInfo fi(line); - open(QUrl::fromLocalFile(fi.absoluteFilePath())); - } - - fflush(stdout); -} - -void DumpRenderTree::resetJSObjects() -{ - m_controller->reset(); - foreach(QWidget *widget, windows) - delete widget; - windows.clear(); -} - -void DumpRenderTree::initJSObjects() -{ - QWebFrame *frame = qobject_cast<QWebFrame*>(sender()); - Q_ASSERT(frame); - frame->addToJavaScriptWindowObject(QLatin1String("layoutTestController"), m_controller); - frame->addToJavaScriptWindowObject(QLatin1String("eventSender"), m_eventSender); - frame->addToJavaScriptWindowObject(QLatin1String("textInputController"), m_textInputController); -} - - -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->frameName()); - result.append(QLatin1String("'\n--------\n")); - } - - result.append(frame->toPlainText()); - 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(); - - //fprintf(stderr, " Dumping\n"); - if (!m_notifier) { - // Dump markup in single file mode... - QString markup = frame->toHtml(); - fprintf(stdout, "Source:\n\n%s\n", markup.toUtf8().constData()); - } - - // Dump render text... - QString renderDump; - if (m_controller->shouldDumpAsText()) { - renderDump = dumpFramesAsText(frame); - } else { - renderDump = frame->renderTreeDump(); - } - if (renderDump.isEmpty()) { - printf("ERROR: nil result from %s", m_controller->shouldDumpAsText() ? "[documentElement innerText]" : "[frame renderTreeAsExternalRepresentation]"); - } else { - fprintf(stdout, "%s", renderDump.toUtf8().constData()); - } - - fprintf(stdout, "#EOF\n"); - - fflush(stdout); - - fprintf(stderr, "#EOF\n"); - - fflush(stderr); - - if (!m_notifier) { - // Exit now in single file mode... - quit(); - } -} - -void DumpRenderTree::titleChanged(const QString &s) -{ - if (m_controller->shouldDumpTitleChanges()) - printf("TITLE CHANGED: %s\n", s.toUtf8().data()); -} - -void DumpRenderTree::connectFrame(QWebFrame *frame) -{ - connect(frame, SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(initJSObjects())); - connect(frame, SIGNAL(provisionalLoad()), - layoutTestController(), SLOT(provisionalLoad())); -} - -QWebPage *DumpRenderTree::createWindow() -{ - if (!m_controller->canOpenWindows()) - return 0; - QWidget *container = new QWidget(0); - container->resize(0, 0); - container->move(-1, -1); - container->hide(); - QWebPage *page = new WebPage(container, this); - connect(m_page, SIGNAL(frameCreated(QWebFrame *)), this, SLOT(connectFrame(QWebFrame *))); - windows.append(container); - return page; -} - -int DumpRenderTree::windowCount() const -{ - int count = 0; - foreach(QWidget *w, windows) { - if (w->children().count()) - ++count; - } - return count + 1; -} - -} - -#include "DumpRenderTree.moc" diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.h b/WebKitTools/DumpRenderTree/qt/DumpRenderTree.h deleted file mode 100644 index a46cccb..0000000 --- a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> - * - * 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 DUMPRENDERTREE_H -#define DUMPRENDERTREE_H - -#include <QList> -#include <QObject> -#include <QTextStream> -#include <QSocketNotifier> - -QT_BEGIN_NAMESPACE -class QUrl; -class QFile; -QT_END_NAMESPACE -class QWebPage; -class QWebFrame; - -class LayoutTestController; -class EventSender; -class TextInputController; - -namespace WebCore { - -class DumpRenderTree : public QObject { -Q_OBJECT - -public: - DumpRenderTree(); - virtual ~DumpRenderTree(); - - // Initialize in multi-file mode, used by run-webkit-tests. - void open(); - - // Initialize in single-file mode. - void open(const QUrl& url); - - void resetJSObjects(); - - LayoutTestController *layoutTestController() const { return m_controller; } - EventSender *eventSender() const { return m_eventSender; } - TextInputController *textInputController() const { return m_textInputController; } - - QWebPage *createWindow(); - int windowCount() const; - - QWebPage *webPage() const { return m_page; } - -public Q_SLOTS: - void initJSObjects(); - void readStdin(int); - void dump(); - void titleChanged(const QString &s); - void connectFrame(QWebFrame *frame); - -Q_SIGNALS: - void quit(); - -private: - QString dumpFramesAsText(QWebFrame* frame); - LayoutTestController *m_controller; - - QWebPage *m_page; - - EventSender *m_eventSender; - TextInputController *m_textInputController; - - QFile *m_stdin; - QSocketNotifier* m_notifier; - - QList<QWidget *> windows; -}; - -} - -#endif diff --git a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro b/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro deleted file mode 100644 index 08f1ab7..0000000 --- a/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro +++ /dev/null @@ -1,22 +0,0 @@ -TARGET = DumpRenderTree -CONFIG -= app_bundle - -include(../../../WebKit.pri) -INCLUDEPATH += /usr/include/freetype2 -INCLUDEPATH += ../../../JavaScriptCore/kjs -DESTDIR = ../../../bin - - -QT = core gui -macx: QT += xml network - -HEADERS = DumpRenderTree.h jsobjects.h testplugin.h -SOURCES = DumpRenderTree.cpp main.cpp jsobjects.cpp testplugin.cpp - -unix:!mac { - QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -} - -qt-port:lessThan(QT_MINOR_VERSION, 4) { - DEFINES += QT_BEGIN_NAMESPACE="" QT_END_NAMESPACE="" -} diff --git a/WebKitTools/DumpRenderTree/qt/fonts.conf b/WebKitTools/DumpRenderTree/qt/fonts.conf deleted file mode 100644 index 3540c47..0000000 --- a/WebKitTools/DumpRenderTree/qt/fonts.conf +++ /dev/null @@ -1,258 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> -<fontconfig> - -<!-- - Accept deprecated 'mono' alias, replacing it with 'monospace' ---> - <match target="pattern"> - <test qual="any" name="family"> - <string>mono</string> - </test> - <edit name="family" mode="assign"> - <string>monospace</string> - </edit> - </match> - -<!-- - Accept alternate 'sans serif' spelling, replacing it with 'sans-serif' ---> - <match target="pattern"> - <test qual="any" name="family"> - <string>sans serif</string> - </test> - <edit name="family" mode="assign"> - <string>sans-serif</string> - </edit> - </match> - -<!-- - Accept deprecated 'sans' alias, replacing it with 'sans-serif' ---> - <match target="pattern"> - <test qual="any" name="family"> - <string>sans</string> - </test> - <edit name="family" mode="assign"> - <string>sans-serif</string> - </edit> - </match> - - - <config> -<!-- - These are the default Unicode chars that are expected to be blank - in fonts. All other blank chars are assumed to be broken and - won't appear in the resulting charsets - --> - <blank> - <int>0x0020</int> <!-- SPACE --> - <int>0x00A0</int> <!-- NO-BREAK SPACE --> - <int>0x00AD</int> <!-- SOFT HYPHEN --> - <int>0x034F</int> <!-- COMBINING GRAPHEME JOINER --> - <int>0x0600</int> <!-- ARABIC NUMBER SIGN --> - <int>0x0601</int> <!-- ARABIC SIGN SANAH --> - <int>0x0602</int> <!-- ARABIC FOOTNOTE MARKER --> - <int>0x0603</int> <!-- ARABIC SIGN SAFHA --> - <int>0x06DD</int> <!-- ARABIC END OF AYAH --> - <int>0x070F</int> <!-- SYRIAC ABBREVIATION MARK --> - <int>0x115F</int> <!-- HANGUL CHOSEONG FILLER --> - <int>0x1160</int> <!-- HANGUL JUNGSEONG FILLER --> - <int>0x1680</int> <!-- OGHAM SPACE MARK --> - <int>0x17B4</int> <!-- KHMER VOWEL INHERENT AQ --> - <int>0x17B5</int> <!-- KHMER VOWEL INHERENT AA --> - <int>0x180E</int> <!-- MONGOLIAN VOWEL SEPARATOR --> - <int>0x2000</int> <!-- EN QUAD --> - <int>0x2001</int> <!-- EM QUAD --> - <int>0x2002</int> <!-- EN SPACE --> - <int>0x2003</int> <!-- EM SPACE --> - <int>0x2004</int> <!-- THREE-PER-EM SPACE --> - <int>0x2005</int> <!-- FOUR-PER-EM SPACE --> - <int>0x2006</int> <!-- SIX-PER-EM SPACE --> - <int>0x2007</int> <!-- FIGURE SPACE --> - <int>0x2008</int> <!-- PUNCTUATION SPACE --> - <int>0x2009</int> <!-- THIN SPACE --> - <int>0x200A</int> <!-- HAIR SPACE --> - <int>0x200B</int> <!-- ZERO WIDTH SPACE --> - <int>0x200C</int> <!-- ZERO WIDTH NON-JOINER --> - <int>0x200D</int> <!-- ZERO WIDTH JOINER --> - <int>0x200E</int> <!-- LEFT-TO-RIGHT MARK --> - <int>0x200F</int> <!-- RIGHT-TO-LEFT MARK --> - <int>0x2028</int> <!-- LINE SEPARATOR --> - <int>0x2029</int> <!-- PARAGRAPH SEPARATOR --> - <int>0x202A</int> <!-- LEFT-TO-RIGHT EMBEDDING --> - <int>0x202B</int> <!-- RIGHT-TO-LEFT EMBEDDING --> - <int>0x202C</int> <!-- POP DIRECTIONAL FORMATTING --> - <int>0x202D</int> <!-- LEFT-TO-RIGHT OVERRIDE --> - <int>0x202E</int> <!-- RIGHT-TO-LEFT OVERRIDE --> - <int>0x202F</int> <!-- NARROW NO-BREAK SPACE --> - <int>0x205F</int> <!-- MEDIUM MATHEMATICAL SPACE --> - <int>0x2060</int> <!-- WORD JOINER --> - <int>0x2061</int> <!-- FUNCTION APPLICATION --> - <int>0x2062</int> <!-- INVISIBLE TIMES --> - <int>0x2063</int> <!-- INVISIBLE SEPARATOR --> - <int>0x206A</int> <!-- INHIBIT SYMMETRIC SWAPPING --> - <int>0x206B</int> <!-- ACTIVATE SYMMETRIC SWAPPING --> - <int>0x206C</int> <!-- INHIBIT ARABIC FORM SHAPING --> - <int>0x206D</int> <!-- ACTIVATE ARABIC FORM SHAPING --> - <int>0x206E</int> <!-- NATIONAL DIGIT SHAPES --> - <int>0x206F</int> <!-- NOMINAL DIGIT SHAPES --> - <int>0x3000</int> <!-- IDEOGRAPHIC SPACE --> - <int>0x3164</int> <!-- HANGUL FILLER --> - <int>0xFEFF</int> <!-- ZERO WIDTH NO-BREAK SPACE --> - <int>0xFFA0</int> <!-- HALFWIDTH HANGUL FILLER --> - <int>0xFFF9</int> <!-- INTERLINEAR ANNOTATION ANCHOR --> - <int>0xFFFA</int> <!-- INTERLINEAR ANNOTATION SEPARATOR --> - <int>0xFFFB</int> <!-- INTERLINEAR ANNOTATION TERMINATOR --> - </blank> -<!-- - Rescan configuration every 30 seconds when FcFontSetList is called - --> - <rescan> - <int>30</int> - </rescan> - </config> - -<!-- - URW provides metric and shape compatible fonts for these 10 Adobe families. - - However, these fonts are quite ugly and do not render well on-screen, - so we avoid matching them if the application said `anymetrics'; in that - case, a more generic font with different metrics but better appearance - will be used. - --> - <match target="pattern"> - <test name="family"> - <string>Avant Garde</string> - </test> - <test name="anymetrics" qual="all" compare="not_eq"> - <bool>true</bool> - </test> - <edit name="family" mode="append"> - <string>URW Gothic L</string> - </edit> - </match> - <match target="pattern"> - <test name="family"> - <string>Bookman</string> - </test> - <test name="anymetrics" qual="all" compare="not_eq"> - <bool>true</bool> - </test> - <edit name="family" mode="append"> - <string>URW Bookman L</string> - </edit> - </match> - <match target="pattern"> - <test name="family"> - <string>Courier</string> - </test> - <test name="anymetrics" qual="all" compare="not_eq"> - <bool>true</bool> - </test> - <edit name="family" mode="append"> - <string>Nimbus Mono L</string> - </edit> - </match> - <match target="pattern"> - <test name="family"> - <string>Helvetica</string> - </test> - <test name="anymetrics" qual="all" compare="not_eq"> - <bool>true</bool> - </test> - <edit name="family" mode="append"> - <string>Nimbus Sans L</string> - </edit> - </match> - <match target="pattern"> - <test name="family"> - <string>New Century Schoolbook</string> - </test> - <test name="anymetrics" qual="all" compare="not_eq"> - <bool>true</bool> - </test> - <edit name="family" mode="append"> - <string>Century Schoolbook L</string> - </edit> - </match> - <match target="pattern"> - <test name="family"> - <string>Palatino</string> - </test> - <test name="anymetrics" qual="all" compare="not_eq"> - <bool>true</bool> - </test> - <edit name="family" mode="append"> - <string>URW Palladio L</string> - </edit> - </match> - <match target="pattern"> - <test name="family"> - <string>Times</string> - </test> - <test name="anymetrics" qual="all" compare="not_eq"> - <bool>true</bool> - </test> - <edit name="family" mode="append"> - <string>Nimbus Roman No9 L</string> - </edit> - </match> - <match target="pattern"> - <test name="family"> - <string>Zapf Chancery</string> - </test> - <test name="anymetrics" qual="all" compare="not_eq"> - <bool>true</bool> - </test> - <edit name="family" mode="append"> - <string>URW Chancery L</string> - </edit> - </match> - <match target="pattern"> - <test name="family"> - <string>Zapf Dingbats</string> - </test> - <test name="anymetrics" qual="all" compare="not_eq"> - <bool>true</bool> - </test> - <edit name="family" mode="append"> - <string>Dingbats</string> - </edit> - </match> - <match target="pattern"> - <test name="family"> - <string>Symbol</string> - </test> - <test name="anymetrics" qual="all" compare="not_eq"> - <bool>true</bool> - </test> - <edit name="family" mode="append" binding="same"> - <string>Standard Symbols L</string> - </edit> - </match> - -<!-- - Serif faces - --> - <alias> - <family>Nimbus Roman No9 L</family> - <default><family>serif</family></default> - </alias> -<!-- - Sans-serif faces - --> - <alias> - <family>Nimbus Sans L</family> - <default><family>sans-serif</family></default> - </alias> -<!-- - Monospace faces - --> - <alias> - <family>Nimbus Mono L</family> - <default><family>monospace</family></default> - </alias> - - -</fontconfig> diff --git a/WebKitTools/DumpRenderTree/qt/fonts/AHEM____.TTF b/WebKitTools/DumpRenderTree/qt/fonts/AHEM____.TTF Binary files differdeleted file mode 100644 index ac81cb0..0000000 --- a/WebKitTools/DumpRenderTree/qt/fonts/AHEM____.TTF +++ /dev/null diff --git a/WebKitTools/DumpRenderTree/qt/jsobjects.cpp b/WebKitTools/DumpRenderTree/qt/jsobjects.cpp deleted file mode 100644 index 98603ad..0000000 --- a/WebKitTools/DumpRenderTree/qt/jsobjects.cpp +++ /dev/null @@ -1,363 +0,0 @@ -/* - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) - * - * 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 <jsobjects.h> -#include <qwebpage.h> -#include <qwebhistory.h> -#include <qwebframe.h> -#include <qevent.h> -#include <qapplication.h> -#include <qevent.h> - -#include "DumpRenderTree.h" -extern void qt_dump_editing_callbacks(bool b); -extern void qt_dump_resource_load_callbacks(bool b); - -LayoutTestController::LayoutTestController(WebCore::DumpRenderTree *drt) - : QObject() - , m_drt(drt) -{ - m_timeoutTimer = 0; - reset(); -} - -void LayoutTestController::reset() -{ - m_isLoading = true; - m_textDump = false; - m_dumpChildrenAsText = false; - m_canOpenWindows = false; - m_waitForDone = false; - m_dumpTitleChanges = false; - if (m_timeoutTimer) { - killTimer(m_timeoutTimer); - m_timeoutTimer = 0; - } - m_topLoadingFrame = 0; - qt_dump_editing_callbacks(false); - qt_dump_resource_load_callbacks(false); -} - -void LayoutTestController::maybeDump(bool ok) -{ - m_topLoadingFrame = 0; - - if (!shouldWaitUntilDone()) { - emit done(); - m_isLoading = false; - } -} - -void LayoutTestController::waitUntilDone() -{ - //qDebug() << ">>>>waitForDone"; - m_waitForDone = true; - m_timeoutTimer = startTimer(11000); -} - -void LayoutTestController::notifyDone() -{ - //qDebug() << ">>>>notifyDone"; - if (!m_timeoutTimer) - return; - killTimer(m_timeoutTimer); - m_timeoutTimer = 0; - emit done(); - m_isLoading = false; -} - -int LayoutTestController::windowCount() -{ - return m_drt->windowCount(); -} - -void LayoutTestController::clearBackForwardList() -{ - m_drt->webPage()->history()->clear(); -} - - -void LayoutTestController::dumpEditingCallbacks() -{ - qDebug() << ">>>dumpEditingCallbacks"; - qt_dump_editing_callbacks(true); -} - -void LayoutTestController::dumpResourceLoadCallbacks() -{ - qt_dump_resource_load_callbacks(true); -} - -void LayoutTestController::queueReload() -{ - //qDebug() << ">>>queueReload"; -} - -void LayoutTestController::provisionalLoad() -{ - QWebFrame *frame = qobject_cast<QWebFrame*>(sender()); - if (!m_topLoadingFrame && m_isLoading) - m_topLoadingFrame = frame; -} - -void LayoutTestController::timerEvent(QTimerEvent *) -{ - qDebug() << ">>>>>>>>>>>>> timeout"; - notifyDone(); -} - -QString LayoutTestController::encodeHostName(const QString &host) -{ - QString encoded = QString::fromLatin1(QUrl::toAce(host + QLatin1String(".no"))); - encoded.truncate(encoded.length() - 3); // strip .no - return encoded; -} - -QString LayoutTestController::decodeHostName(const QString &host) -{ - QString decoded = QUrl::fromAce(host.toLatin1() + QByteArray(".no")); - decoded.truncate(decoded.length() - 3); - return decoded; -} - - -EventSender::EventSender(QWebPage *parent) - : QObject(parent) -{ - m_page = parent; -} - -void EventSender::mouseDown() -{ -// qDebug() << "EventSender::mouseDown" << frame; - QMouseEvent event(QEvent::MouseButtonPress, m_mousePos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); - QApplication::sendEvent(m_page, &event); -} - -void EventSender::mouseUp() -{ -// qDebug() << "EventSender::mouseUp" << frame; - QMouseEvent event(QEvent::MouseButtonRelease, m_mousePos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); - QApplication::sendEvent(m_page, &event); -} - -void EventSender::mouseMoveTo(int x, int y) -{ -// qDebug() << "EventSender::mouseMoveTo" << x << y; - m_mousePos = QPoint(x, y); - QMouseEvent event(QEvent::MouseMove, m_mousePos, Qt::NoButton, Qt::NoButton, Qt::NoModifier); - QApplication::sendEvent(m_page, &event); -} - -void EventSender::leapForward(int ms) -{ - m_timeLeap += ms; - qDebug() << "EventSender::leapForward" << ms; -} - -void EventSender::keyDown(const QString &string, const QStringList &modifiers) -{ - QString s = string; - Qt::KeyboardModifiers modifs = 0; - for (int i = 0; i < modifiers.size(); ++i) { - const QString &m = modifiers.at(i); - if (m == "ctrlKey") - modifs |= Qt::ControlModifier; - else if (m == "shiftKey") - modifs |= Qt::ShiftModifier; - else if (m == "altKey") - modifs |= Qt::AltModifier; - else if (m == "metaKey") - modifs |= Qt::MetaModifier; - } - int code = 0; - if (string.length() == 1) { - code = string.unicode()->unicode(); - qDebug() << ">>>>>>>>> keyDown" << code << (char)code; - // map special keycodes used by the tests to something that works for Qt/X11 - if (code == '\t') { - code = Qt::Key_Tab; - if (modifs == Qt::ShiftModifier) - code = Qt::Key_Backtab; - s = QString(); - } else if (code == 127) { - code = Qt::Key_Backspace; - if (modifs == Qt::AltModifier) - modifs = Qt::ControlModifier; - s = QString(); - } else if (code == 'o' && modifs == Qt::ControlModifier) { - s = QLatin1String("\n"); - code = '\n'; - modifs = 0; - } else if (code == 'y' && modifs == Qt::ControlModifier) { - s = QLatin1String("c"); - code = 'c'; - } else if (code == 'k' && modifs == Qt::ControlModifier) { - s = QLatin1String("x"); - code = 'x'; - } else if (code == 'a' && modifs == Qt::ControlModifier) { - s = QString(); - code = Qt::Key_Home; - modifs = 0; - } else if (code == 0xf702) { - s = QString(); - code = Qt::Key_Left; - if (modifs & Qt::MetaModifier) { - code = Qt::Key_Home; - modifs &= ~Qt::MetaModifier; - } - } else if (code == 0xf703) { - s = QString(); - code = Qt::Key_Right; - if (modifs & Qt::MetaModifier) { - code = Qt::Key_End; - modifs &= ~Qt::MetaModifier; - } - } else if (code == 'a' && modifs == Qt::ControlModifier) { - s = QString(); - code = Qt::Key_Home; - modifs = 0; - } else { - code = string.unicode()->toUpper().unicode(); - } - } - QKeyEvent event(QEvent::KeyPress, code, modifs, s); - QApplication::sendEvent(m_page, &event); -} - -QWebFrame *EventSender::frameUnderMouse() const -{ - QWebFrame *frame = m_page->mainFrame(); - -redo: - QList<QWebFrame*> children = frame->childFrames(); - for (int i = 0; i < children.size(); ++i) { - if (children.at(i)->geometry().contains(m_mousePos)) { - frame = children.at(i); - goto redo; - } - } - if (frame->geometry().contains(m_mousePos)) - return frame; - return 0; -} - - -TextInputController::TextInputController(QWebPage *parent) - : QObject(parent) -{ -} - -void TextInputController::doCommand(const QString &command) -{ - Qt::KeyboardModifiers modifiers = Qt::NoModifier; - int keycode = 0; - if (command == "moveBackwardAndModifySelection:") { - modifiers |= Qt::ShiftModifier; - keycode = Qt::Key_Left; - } else if(command =="moveDown:") { - keycode = Qt::Key_Down; - } else if(command =="moveDownAndModifySelection:") { - modifiers |= Qt::ShiftModifier; - keycode = Qt::Key_Down; - } else if(command =="moveForward:") { - keycode = Qt::Key_Right; - } else if(command =="moveForwardAndModifySelection:") { - modifiers |= Qt::ShiftModifier; - keycode = Qt::Key_Right; - } else if(command =="moveLeft:") { - keycode = Qt::Key_Left; - } else if(command =="moveLeftAndModifySelection:") { - modifiers |= Qt::ShiftModifier; - keycode = Qt::Key_Left; - } else if(command =="moveRight:") { - keycode = Qt::Key_Right; - } else if(command =="moveRightAndModifySelection:") { - modifiers |= Qt::ShiftModifier; - keycode = Qt::Key_Right; - } else if(command =="moveToBeginningOfDocument:") { - modifiers |= Qt::ControlModifier; - keycode = Qt::Key_Home; - } else if(command =="moveToBeginningOfLine:") { - keycode = Qt::Key_Home; -// } else if(command =="moveToBeginningOfParagraph:") { - } else if(command =="moveToEndOfDocument:") { - modifiers |= Qt::ControlModifier; - keycode = Qt::Key_End; - } else if(command =="moveToEndOfLine:") { - keycode = Qt::Key_End; -// } else if(command =="moveToEndOfParagraph:") { - } else if(command =="moveUp:") { - keycode = Qt::Key_Up; - } else if(command =="moveUpAndModifySelection:") { - modifiers |= Qt::ShiftModifier; - keycode = Qt::Key_Up; - } else if(command =="moveWordBackward:") { - modifiers |= Qt::ControlModifier; - keycode = Qt::Key_Up; - } else if(command =="moveWordBackwardAndModifySelection:") { - modifiers |= Qt::ShiftModifier; - modifiers |= Qt::ControlModifier; - keycode = Qt::Key_Left; - } else if(command =="moveWordForward:") { - modifiers |= Qt::ControlModifier; - keycode = Qt::Key_Right; - } else if(command =="moveWordForwardAndModifySelection:") { - modifiers |= Qt::ControlModifier; - modifiers |= Qt::ShiftModifier; - keycode = Qt::Key_Right; - } else if(command =="moveWordLeft:") { - modifiers |= Qt::ControlModifier; - keycode = Qt::Key_Left; - } else if(command =="moveWordRight:") { - modifiers |= Qt::ControlModifier; - keycode = Qt::Key_Left; - } else if(command =="moveWordRightAndModifySelection:") { - modifiers |= Qt::ShiftModifier; - modifiers |= Qt::ControlModifier; - keycode = Qt::Key_Right; - } else if(command =="moveWordLeftAndModifySelection:") { - modifiers |= Qt::ShiftModifier; - modifiers |= Qt::ControlModifier; - keycode = Qt::Key_Left; - } else if(command =="pageDown:") { - keycode = Qt::Key_PageDown; - } else if(command =="pageUp:") { - keycode = Qt::Key_PageUp; - } else if(command == "deleteWordBackward:") { - modifiers |= Qt::ControlModifier; - keycode = Qt::Key_Backspace; - } else if(command == "deleteBackward:") { - keycode = Qt::Key_Backspace; - } else if(command == "deleteForward:") { - keycode = Qt::Key_Delete; - } - QKeyEvent event(QEvent::KeyPress, keycode, modifiers); - QApplication::sendEvent(parent(), &event); - QKeyEvent event2(QEvent::KeyRelease, keycode, modifiers); - QApplication::sendEvent(parent(), &event2); -} diff --git a/WebKitTools/DumpRenderTree/qt/jsobjects.h b/WebKitTools/DumpRenderTree/qt/jsobjects.h deleted file mode 100644 index 4ee6439..0000000 --- a/WebKitTools/DumpRenderTree/qt/jsobjects.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) - * - * 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 JSOBJECTS_H -#define JSOBJECTS_H - -#include <qobject.h> -#include <qdebug.h> -#include <qpoint.h> -#include <qstringlist.h> - -class QWebFrame; -namespace WebCore { - class DumpRenderTree; -} -class LayoutTestController : public QObject -{ - Q_OBJECT -public: - LayoutTestController(WebCore::DumpRenderTree *drt); - - bool isLoading() const { return m_isLoading; } - 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; } - bool canOpenWindows() const { return m_canOpenWindows; } - bool shouldDumpTitleChanges() const { return m_dumpTitleChanges; } - - void reset(); - -protected: - void timerEvent(QTimerEvent *); - -signals: - void done(); - -public slots: - void maybeDump(bool ok); - void dumpAsText() { m_textDump = true; } - void dumpChildFramesAsText() { m_dumpChildrenAsText = true; } - void setCanOpenWindows() { m_canOpenWindows = true; } - void waitUntilDone(); - void notifyDone(); - void dumpEditingCallbacks(); - void dumpResourceLoadCallbacks(); - void queueReload(); - void provisionalLoad(); - void setCloseRemainingWindowsWhenComplete(bool=false) {} - int windowCount(); - void display() {} - void clearBackForwardList(); - void dumpTitleChanges() { m_dumpTitleChanges = true; } - QString encodeHostName(const QString &host); - QString decodeHostName(const QString &host); - void dumpSelectionRect() const {} - -private: - bool m_isLoading; - bool m_textDump; - bool m_dumpChildrenAsText; - bool m_canOpenWindows; - bool m_waitForDone; - bool m_dumpTitleChanges; - int m_timeoutTimer; - QWebFrame *m_topLoadingFrame; - WebCore::DumpRenderTree *m_drt; -}; - -class QWebPage; -class QWebFrame; - -class EventSender : public QObject -{ - Q_OBJECT -public: - EventSender(QWebPage *parent); - -public slots: - void mouseDown(); - void mouseUp(); - void mouseMoveTo(int x, int y); - void leapForward(int ms); - void keyDown(const QString &string, const QStringList &modifiers=QStringList()); - void clearKillRing() {} - -private: - QPoint m_mousePos; - QWebPage *m_page; - int m_timeLeap; - QWebFrame *frameUnderMouse() const; -}; - -class TextInputController : public QObject -{ - Q_OBJECT -public: - TextInputController(QWebPage *parent); - -public slots: - void doCommand(const QString &command); -// void setMarkedText(const QString &str, int from, int length); -// bool hasMarkedText(); -// void unmarkText(); -// QList<int> markedRange(); -// QList<int> selectedRange(); -// void validAttributesForMarkedText(); -// void inserText(const QString &); -// void firstRectForCharacterRange(); -// void characterIndexForPoint(int, int); -// void substringFromRange(int, int); -// void conversationIdentifier(); -}; - -#endif diff --git a/WebKitTools/DumpRenderTree/qt/main.cpp b/WebKitTools/DumpRenderTree/qt/main.cpp deleted file mode 100644 index 8c4bc9c..0000000 --- a/WebKitTools/DumpRenderTree/qt/main.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) - * - * 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 "DumpRenderTree.h" - -#include <qstringlist.h> -#include <qapplication.h> -#include <qurl.h> -#include <qdir.h> -#include <qdebug.h> -#include <qfont.h> - -#ifdef Q_WS_X11 -#include <qx11info_x11.h> -#include <fontconfig/fontconfig.h> -#endif - -#include <limits.h> -#include <signal.h> - -#if defined(__GLIBC__) -#include <execinfo.h> -#endif - -void messageHandler(QtMsgType type, const char *message) -{ - if (type == QtCriticalMsg) { - fprintf(stderr, "%s\n", message); - return; - } - // do nothing -} - -QString get_backtrace() { - QString s; - -#if defined(__GLIBC__) - void* array[256]; - size_t size; /* number of stack frames */ - - size = backtrace(array, 256); - - if (!size) - return s; - - char** strings = backtrace_symbols(array, size); - for (int i = 0; i < size; ++i) { - s += QString::number(i) + - QLatin1String(": ") + - QLatin1String(strings[i]) + QLatin1String("\n"); - } - - if (strings) - free (strings); -#endif - - return s; -} - -static void crashHandler(int sig) -{ - fprintf(stderr, "%s\n", strsignal(sig)); - fprintf(stderr, "%s\n", get_backtrace().toLatin1().constData()); - exit(128 + sig); -} - -int main(int argc, char* argv[]) -{ -#ifdef Q_WS_X11 - FcInit(); - FcConfig *config = FcConfigCreate(); - QByteArray fontDir = getenv("WEBKIT_TESTFONTS"); - if (fontDir.isEmpty() || !QDir(fontDir).exists()) { - fprintf(stderr, - "\n\n" - "--------------------------------------------------------------------\n" - "WEBKIT_TESTFONTS environment variable is not set correctly.\n" - "This variable has to point to the directory containing the fonts\n" - "you can checkout from svn://labs.trolltech.com/svn/webkit/testfonts\n" - "--------------------------------------------------------------------\n" -); - exit(1); - } - char currentPath[PATH_MAX+1]; - getcwd(currentPath, PATH_MAX); - QByteArray configFile = currentPath; - configFile += "/WebKitTools/DumpRenderTree/qt/fonts.conf"; - if (!FcConfigParseAndLoad (config, (FcChar8*) configFile.data(), true)) - qFatal("Couldn't load font configuration file"); - if (!FcConfigAppFontAddDir (config, (FcChar8*) fontDir.data())) - qFatal("Couldn't add font dir!"); - FcConfigSetCurrent(config); -#endif - QApplication app(argc, argv); -#ifdef Q_WS_X11 - QX11Info::setAppDpiY(0, 96); - QX11Info::setAppDpiX(0, 96); -#endif - - QFont f("Sans Serif"); - f.setPointSize(9); - f.setWeight(QFont::Normal); - f.setStyle(QFont::StyleNormal); - app.setFont(f); - app.setStyle(QLatin1String("Plastique")); - - - signal(SIGILL, crashHandler); /* 4: illegal instruction (not reset when caught) */ - signal(SIGTRAP, crashHandler); /* 5: trace trap (not reset when caught) */ - signal(SIGFPE, crashHandler); /* 8: floating point exception */ - signal(SIGBUS, crashHandler); /* 10: bus error */ - signal(SIGSEGV, crashHandler); /* 11: segmentation violation */ - signal(SIGSYS, crashHandler); /* 12: bad argument to system call */ - signal(SIGPIPE, crashHandler); /* 13: write on a pipe with no reader */ - signal(SIGXCPU, crashHandler); /* 24: exceeded CPU time limit */ - signal(SIGXFSZ, crashHandler); /* 25: exceeded file size limit */ - - QStringList args = app.arguments(); - if (args.count() < 2) { - qDebug() << "Usage: DumpRenderTree [-v] filename"; - exit(0); - } - - // supress debug output from Qt if not started with -v - if (!args.contains(QLatin1String("-v"))) - qInstallMsgHandler(messageHandler); - - WebCore::DumpRenderTree dumper; - - if (args.last() == QLatin1String("-")) { - dumper.open(); - } else { - if (!args.last().startsWith("/") - && !args.last().startsWith("file:") - && !args.last().startsWith("http:") - && !args.last().startsWith("https:")) { - QString path = QDir::currentPath(); - if (!path.endsWith('/')) - path.append('/'); - args.last().prepend(path); - } - dumper.open(QUrl(args.last())); - } - return app.exec(); -#ifdef Q_WS_X11 - FcConfigSetCurrent(0); -#endif -} diff --git a/WebKitTools/DumpRenderTree/qt/testplugin.cpp b/WebKitTools/DumpRenderTree/qt/testplugin.cpp deleted file mode 100644 index 54431e9..0000000 --- a/WebKitTools/DumpRenderTree/qt/testplugin.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) - * - * 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 "testplugin.h" - -TestPlugin::TestPlugin(QObject *parent) - : QWebPluginFactory(parent) -{ -} - -TestPlugin::~TestPlugin() -{ -} - -QList<QWebPluginFactory::Plugin> TestPlugin::plugins() const -{ - QWebPluginFactory::Plugin plugin; - - plugin.name = "testplugin"; - plugin.description = "testdescription"; - MimeType mimeType; - mimeType.name = "testtype"; - mimeType.fileExtensions.append("testsuffixes"); - plugin.mimeTypes.append(mimeType); - - plugin.name = "testplugin2"; - plugin.description = "testdescription2"; - mimeType.name = "testtype2"; - mimeType.fileExtensions.append("testsuffixes2"); - mimeType.fileExtensions.append("testsuffixes3"); - plugin.mimeTypes.append(mimeType); - - return QList<QWebPluginFactory::Plugin>() << plugin; -} - -QObject *TestPlugin::create(const QString &mimeType, - const QUrl &url, - const QStringList &argumentNames, - const QStringList &argumentValues) const -{ - return 0; -} - diff --git a/WebKitTools/DumpRenderTree/qt/testplugin.h b/WebKitTools/DumpRenderTree/qt/testplugin.h deleted file mode 100644 index 3d8a28c..0000000 --- a/WebKitTools/DumpRenderTree/qt/testplugin.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) - * - * 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 <qwebpluginfactory.h> - - -class TestPlugin : public QWebPluginFactory -{ -public: - explicit TestPlugin(QObject *parent = 0); - virtual ~TestPlugin(); - - virtual QList<Plugin> plugins() const; - - virtual QObject *create(const QString &mimeType, - const QUrl &url, - const QStringList &argumentNames, - const QStringList &argumentValues) const; - -}; - |