diff options
author | Iain Merrick <husky@google.com> | 2010-09-13 16:35:48 +0100 |
---|---|---|
committer | Iain Merrick <husky@google.com> | 2010-09-16 12:10:42 +0100 |
commit | 5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306 (patch) | |
tree | ddce1aa5e3b6967a69691892e500897558ff8ab6 /WebKitTools/MiniBrowser | |
parent | 12bec63ec71e46baba27f0bd9bd9d8067683690a (diff) | |
download | external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.zip external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.tar.gz external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.tar.bz2 |
Merge WebKit at r67178 : Initial merge by git.
Change-Id: I57e01163b6866cb029cdadf405a0394a3918bc18
Diffstat (limited to 'WebKitTools/MiniBrowser')
-rw-r--r-- | WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m | 2 | ||||
-rw-r--r-- | WebKitTools/MiniBrowser/qt/BrowserView.cpp | 75 | ||||
-rw-r--r-- | WebKitTools/MiniBrowser/qt/BrowserView.h | 54 | ||||
-rw-r--r-- | WebKitTools/MiniBrowser/qt/BrowserWindow.cpp | 56 | ||||
-rw-r--r-- | WebKitTools/MiniBrowser/qt/BrowserWindow.h | 30 | ||||
-rw-r--r-- | WebKitTools/MiniBrowser/qt/MiniBrowser.pro | 2 | ||||
-rw-r--r-- | WebKitTools/MiniBrowser/qt/main.cpp | 12 | ||||
-rw-r--r-- | WebKitTools/MiniBrowser/win/BrowserWindow.cpp | 4 |
8 files changed, 153 insertions, 82 deletions
diff --git a/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m b/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m index 17958c7..1fffce6 100644 --- a/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m +++ b/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m @@ -37,7 +37,7 @@ static WKBundleRef globalBundle; // WKBundlePageClient functions -void didClearWindowObjectForFrame(WKBundlePageRef page, WKBundleFrameRef frame, JSGlobalContextRef context, JSObjectRef window, const void *clientInfo) +void didClearWindowObjectForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleScriptWorldRef world, const void *clientInfo) { WKURLRef wkURL = WKBundleFrameCopyURL(WKBundlePageGetMainFrame(page)); CFURLRef cfURL = WKURLCopyCFURL(0, wkURL); diff --git a/WebKitTools/MiniBrowser/qt/BrowserView.cpp b/WebKitTools/MiniBrowser/qt/BrowserView.cpp new file mode 100644 index 0000000..a5e06ec --- /dev/null +++ b/WebKitTools/MiniBrowser/qt/BrowserView.cpp @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2010 University of Szeged + * + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 COMPUTER, INC. OR + * 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 "BrowserView.h" + +#include <QGraphicsScene> +#include "WKContext.h" + +static QWKPage* createNewPage(QWKPage* page) +{ + return page; +} + +BrowserView::BrowserView(QWidget* parent) + : QGraphicsView(parent) + , m_item(0) +{ + m_context.adopt(WKContextGetSharedProcessContext()); + + WKRetainPtr<WKPageNamespaceRef> pageNamespace(AdoptWK, WKPageNamespaceCreate(m_context.get())); + + m_item = new QGraphicsWKView(pageNamespace.get(), QGraphicsWKView::Simple, 0); + setScene(new QGraphicsScene(this)); + scene()->addItem(m_item); + + setFrameShape(QFrame::NoFrame); + setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + + connect(m_item, SIGNAL(titleChanged(QString)), this, SLOT(setWindowTitle(QString))); + m_item->page()->setCreateNewPageFunction(createNewPage); +} + +void BrowserView::resizeEvent(QResizeEvent* event) +{ + QGraphicsView::resizeEvent(event); + QRectF rect(QPoint(0, 0), event->size()); + m_item->setGeometry(rect); + scene()->setSceneRect(rect); +} + +void BrowserView::load(const QString& url) +{ + return m_item->load(QUrl::fromUserInput(url)); +} + +QGraphicsWKView* BrowserView::view() const +{ + return m_item; +} diff --git a/WebKitTools/MiniBrowser/qt/BrowserView.h b/WebKitTools/MiniBrowser/qt/BrowserView.h new file mode 100644 index 0000000..42b7658 --- /dev/null +++ b/WebKitTools/MiniBrowser/qt/BrowserView.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2010 University of Szeged + * + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 COMPUTER, INC. OR + * 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 BrowserView_h +#define BrowserView_h + +#include <QGraphicsView> +#include "qgraphicswkview.h" +#include "WKRetainPtr.h" + +class BrowserView : public QGraphicsView { + Q_OBJECT + +public: + BrowserView(QWidget* parent = 0); + virtual ~BrowserView() { delete m_item; } + + void load(const QString&); + QGraphicsWKView* view() const; + +protected: + virtual void resizeEvent(QResizeEvent*); + +private: + QGraphicsWKView* m_item; + WKRetainPtr<WKContextRef> m_context; +}; + +#endif diff --git a/WebKitTools/MiniBrowser/qt/BrowserWindow.cpp b/WebKitTools/MiniBrowser/qt/BrowserWindow.cpp index 2e0dccd..a703788 100644 --- a/WebKitTools/MiniBrowser/qt/BrowserWindow.cpp +++ b/WebKitTools/MiniBrowser/qt/BrowserWindow.cpp @@ -27,55 +27,8 @@ */ #include "BrowserWindow.h" -#include "WKPageNamespace.h" -#include "qwkpage.h" - -static QWKPage* createNewPage(QWKPage* page) -{ - return page; -} - -BrowserView::BrowserView(QWidget* parent) - : QGraphicsView(parent) - , m_item(0) -{ - m_context.adopt(WKContextGetSharedProcessContext()); - - WKRetainPtr<WKPageNamespaceRef> pageNamespace(AdoptWK, WKPageNamespaceCreate(m_context.get())); - - m_item = new QGraphicsWKView(pageNamespace.get(), QGraphicsWKView::Simple, 0); - setScene(new QGraphicsScene(this)); - scene()->addItem(m_item); - - setFrameShape(QFrame::NoFrame); - setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - - connect(m_item, SIGNAL(titleChanged(QString)), this, SLOT(setWindowTitle(QString))); - m_item->page()->setCreateNewPageFunction(createNewPage); -} -void BrowserView::resizeEvent(QResizeEvent* event) -{ - QGraphicsView::resizeEvent(event); - QRectF rect(QPoint(0, 0), event->size()); - m_item->setGeometry(rect); - scene()->setSceneRect(rect); -} - -void BrowserView::load(const QUrl& url) -{ -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - return m_item->load(QUrl::fromUserInput(url.toString())); -#else - return m_item->load(url); -#endif -} - -QGraphicsWKView* BrowserView::view() const -{ - return m_item; -} +#include "WKPageNamespace.h" BrowserWindow::BrowserWindow() { @@ -106,19 +59,20 @@ BrowserWindow::BrowserWindow() this->setCentralWidget(m_browser); m_browser->setFocus(Qt::OtherFocusReason); + + resize(960, 640); + show(); } void BrowserWindow::load(const QString& url) { m_addressBar->setText(url); - m_browser->load(QUrl(url)); + m_browser->load(url); } BrowserWindow* BrowserWindow::newWindow(const QString& url) { BrowserWindow* window = new BrowserWindow(); - window->resize(960, 640); - window->show(); window->load(url); return window; } diff --git a/WebKitTools/MiniBrowser/qt/BrowserWindow.h b/WebKitTools/MiniBrowser/qt/BrowserWindow.h index 99d3e82..47e55b5 100644 --- a/WebKitTools/MiniBrowser/qt/BrowserWindow.h +++ b/WebKitTools/MiniBrowser/qt/BrowserWindow.h @@ -26,33 +26,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifndef BrowserWindow_h +#define BrowserWindow_h + #define PLATFORM(x) 0 -#include "WKContext.h" -#include "WKRetainPtr.h" -#include "qgraphicswkview.h" +#include "BrowserView.h" #include <QtGui> -#include <QGraphicsScene> -#include <QGraphicsView> -#include <stdint.h> - -class BrowserView : public QGraphicsView { - Q_OBJECT - -public: - BrowserView(QWidget* parent = 0); - virtual ~BrowserView() { delete m_item; } - - void load(const QUrl&); - QGraphicsWKView* view() const; - -protected: - virtual void resizeEvent(QResizeEvent*); - -private: - QGraphicsWKView* m_item; - WKRetainPtr<WKContextRef> m_context; -}; class BrowserWindow : public QMainWindow { Q_OBJECT @@ -76,3 +56,5 @@ private: QMenuBar* m_menu; QLineEdit* m_addressBar; }; + +#endif diff --git a/WebKitTools/MiniBrowser/qt/MiniBrowser.pro b/WebKitTools/MiniBrowser/qt/MiniBrowser.pro index 274b9e5..e42c49a 100644 --- a/WebKitTools/MiniBrowser/qt/MiniBrowser.pro +++ b/WebKitTools/MiniBrowser/qt/MiniBrowser.pro @@ -3,9 +3,11 @@ TARGET = MiniBrowser SOURCES += \ main.cpp \ + BrowserView.cpp \ BrowserWindow.cpp \ HEADERS += \ + BrowserView.h \ BrowserWindow.h \ CONFIG += uitools diff --git a/WebKitTools/MiniBrowser/qt/main.cpp b/WebKitTools/MiniBrowser/qt/main.cpp index 2bc346b..8ff3de8 100644 --- a/WebKitTools/MiniBrowser/qt/main.cpp +++ b/WebKitTools/MiniBrowser/qt/main.cpp @@ -26,8 +26,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <QtGui> #include "BrowserWindow.h" +#include <QtGui> int main(int argc, char** argv) { QApplication app(argc, argv); @@ -44,11 +44,11 @@ int main(int argc, char** argv) { urls.append("http://www.google.com"); } - BrowserWindow* window = 0; - foreach (QString url, urls) { - window = new BrowserWindow(); - window->newWindow(url); - } + BrowserWindow* window = new BrowserWindow(); + window->load(urls[0]); + + for (int i = 1; i < urls.size(); ++i) + window->newWindow(urls[i]); app.exec(); diff --git a/WebKitTools/MiniBrowser/win/BrowserWindow.cpp b/WebKitTools/MiniBrowser/win/BrowserWindow.cpp index e519b00..dc43a68 100644 --- a/WebKitTools/MiniBrowser/win/BrowserWindow.cpp +++ b/WebKitTools/MiniBrowser/win/BrowserWindow.cpp @@ -70,6 +70,10 @@ LRESULT BrowserWindow::wndProc(HWND window, UINT message, WPARAM wParam, LPARAM bool handled = true; switch (message) { + case WM_ERASEBKGND: + lResult = 1; + break; + case WM_COMMAND: lResult = onCommand(LOWORD(wParam), handled); break; |