+2008-01-03 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Lars.
+
+ Added the first revision of QWebView and started moving functionality from QWebPave over to QWebView and QWebFrame.
+
+ * WebCore.pro:
+
2008-01-03 Alp Toker <alp@atoker.com>
Suggested by Mark Rowe.
$$PWD/platform/qt/SharedTimerQt.h \
$$PWD/../WebKit/qt/Api/qwebframe.h \
$$PWD/../WebKit/qt/Api/qwebpage.h \
+ $$PWD/../WebKit/qt/Api/qwebview.h \
$$PWD/../WebKit/qt/Api/qwebnetworkinterface.h \
$$PWD/../WebKit/qt/Api/qwebnetworkinterface_p.h \
$$PWD/../WebKit/qt/Api/qwebobjectplugin.h \
../WebKit/qt/Api/qwebnetworkinterface.cpp \
../WebKit/qt/Api/qcookiejar.cpp \
../WebKit/qt/Api/qwebpage.cpp \
+ ../WebKit/qt/Api/qwebview.cpp \
../WebKit/qt/Api/qwebpagehistory.cpp \
../WebKit/qt/Api/qwebsettings.cpp \
../WebKit/qt/Api/qwebobjectplugin.cpp \
$$PWD/qwebobjectplugin.h \
$$PWD/qwebobjectpluginconnector.h \
$$PWD/qwebpage.h \
+ $$PWD/qwebview.h \
$$PWD/qwebpagehistory.h \
$$PWD/qwebsettings.h \
$$PWD/qwebhistoryinterface.h
void titleChanged(const QString &title);
void hoveringOverLink(const QString &link, const QString &title, const QString &textContent);
+ void loadStarted();
+ void loadFinished();
+
+ /**
+ * Signal is emitted when an icon ("favicon") is loaded from the site.
+ */
+ void iconLoaded();
+
private:
friend class QWebPage;
friend class QWebPagePrivate;
#include "qwebsettings.h"
#include "Frame.h"
+#include "FrameLoaderClientQt.h"
#include "ChromeClientQt.h"
#include "ContextMenu.h"
#include "ContextMenuClientQt.h"
frameData.marginWidth = 0;
frameData.marginHeight = 0;
mainFrame = new QWebFrame(q, &frameData);
- QObject::connect(mainFrame, SIGNAL(titleChanged(const QString&)),
- q, SIGNAL(titleChanged(const QString&)));
mainFrame->d->frameView->setFrameGeometry(q->geometry());
emit q->frameCreated(mainFrame);
return d->mainFrame;
}
-QSize QWebPage::sizeHint() const
+QWebFrame *QWebPage::currentFrame() const
{
- return QSize(800, 600);
-}
-
-void QWebPage::stop()
-{
- triggerAction(Stop);
+ return static_cast<WebCore::FrameLoaderClientQt *>(d->page->focusController()->focusedOrMainFrame()->loader()->client())->webFrame();
}
QWebPageHistory *QWebPage::history() const
DownloadImageToDisk,
CopyImageToClipboard,
- GoBack,
+ GoBack, // ###GoBackward instead?
GoForward,
Stop,
Reload,
explicit QWebPage(QWidget *parent = 0);
~QWebPage();
+ // ### move to frame
void open(const QUrl &url);
void open(const QWebNetworkRequest &request);
QWebFrame *mainFrame() const;
+ QWebFrame *currentFrame() const;
QWebPageHistory *history() const;
QWebSettings *settings();
- QSize sizeHint() const;
-
+ // ### move to frame
QString title() const;
QUrl url() const;
QPixmap icon() const;
QAction *action(WebAction action) const;
virtual void triggerAction(WebAction action, bool checked = false);
-public Q_SLOTS:
- /**
- * Stops loading of the page, if loading.
- */
- void stop();
-
Q_SIGNALS:
- /**
- * Signal is emitted when load is started on one of the child
- * frames of the page. The frame on which the load started
- * is passed.
- */
- void loadStarted(QWebFrame *frame);
/**
* Signal is emitted when the global progress status changes.
* It accumulates changes from all the child frames.
*/
void loadProgressChanged(int progress);
- /**
- * Signal is emitted when load has been finished on one of
- * the child frames of the page. The frame on which the
- * load finished is passed as an argument.
- */
- void loadFinished(QWebFrame *frame);
- /**
- * Signal is emitted when the title of this page has changed.
- * Applies only to the main frame. Sub-frame titles do not trigger this.
- */
- void titleChanged(const QString& title);
/**
* Signal is emitted when the mouse is hovering over a link.
* The first parameter is the link url, the second is the link title
* Signal is emitted when the statusbar text is changed by the page.
*/
void statusBarTextChanged(const QString& text);
- /**
- * Signal is emitted when an icon ("favicon") is loaded from the site.
- */
- void iconLoaded();
void selectionChanged();
/**
* Signal is emitted when the mainframe()'s initial layout is completed.
*/
+ // ### move to frame
void initialLayoutComplete();
// ### call addedToHistory instead, something more signal'ish
void geometryChangeRequest(const QRect& geom);
+ //void addEmbeddableWidget(QWidget *widget);
+ //void addEmbeddableWidget(const QString &classid, QWidget *widget);
+ //void removeEmbeddableWidget(QWidget *widget);
+ //QHash<QString, QWidget *> embeddableWidgets() const;
+ //void clearEmbeddableWidgets();
+
protected:
virtual QWebPage *createWindow();
virtual QWebPage *createModalDialog();
};
class QWebPageHistoryPrivate;
+// ### rename to QWebHistory
class QWEBKIT_EXPORT QWebPageHistory
{
public:
--- /dev/null
+/*
+ Copyright (C) 2007 Trolltech ASA
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "qwebview.h"
+#include "qwebframe.h"
+#include "qevent.h"
+
+class QWebViewPrivate
+{
+public:
+ QWebPage *page;
+};
+
+QWebView::QWebView(QWidget *parent)
+ : QWidget(parent)
+{
+ d = new QWebViewPrivate;
+ d->page = 0;
+}
+
+QWebView::~QWebView()
+{
+ if (d->page && d->page->parent() == this)
+ delete d->page;
+ delete d;
+}
+
+QWebPage *QWebView::page() const
+{
+ if (!d->page) {
+ QWebView *that = const_cast<QWebView *>(this);
+ that->setPage(new QWebPage(that));
+ }
+ return d->page;
+}
+
+void QWebView::setPage(QWebPage *page)
+{
+ if (d->page == page)
+ return;
+ if (d->page) {
+ if (d->page->parent() == this) {
+ delete d->page;
+ } else {
+ d->page->disconnect(this);
+ }
+ }
+ d->page = page;
+ if (d->page) {
+ // #### connect signals
+ QWebFrame *mainFrame = d->page->mainFrame();
+ connect(mainFrame, SIGNAL(loadStarted()),
+ this, SIGNAL(loadStarted()));
+ connect(mainFrame, SIGNAL(loadFinished()),
+ this, SIGNAL(loadFinished()));
+ connect(mainFrame, SIGNAL(titleChanged(const QString&)),
+ this, SIGNAL(titleChanged(const QString&)));
+ connect(mainFrame, SIGNAL(iconLoaded()),
+ this, SIGNAL(iconLoaded()));
+
+ connect(d->page, SIGNAL(loadProgressChanged(int)),
+ this, SIGNAL(loadProgressChanged(int)));
+ connect(d->page, SIGNAL(statusBarTextChanged(const QString &)),
+ this, SIGNAL(statusBarTextChanged(const QString &)));
+ }
+ update();
+}
+
+void QWebView::load(const QUrl &url)
+{
+ page()->open(url);
+}
+
+void QWebView::load(const QWebNetworkRequest &request)
+{
+ page()->open(request);
+}
+
+void QWebView::setHtml(const QString &html, const QUrl &baseUrl)
+{
+ // #### FIXME
+}
+
+void QWebView::setHtml(const QByteArray &html, const QUrl &baseUrl)
+{
+ // #### FIXME
+}
+
+QWebPageHistory *QWebView::history() const
+{
+ return page()->history();
+}
+
+QWebSettings *QWebView::settings() const
+{
+ return page()->settings();
+}
+
+QString QWebView::title() const
+{
+ if (d->page)
+ return d->page->title();
+ return QString();
+}
+
+QUrl QWebView::url() const
+{
+ if (d->page)
+ return d->page->url();
+ return QUrl();
+}
+
+QPixmap QWebView::icon() const
+{
+ if (d->page)
+ return d->page->icon();
+ return QPixmap();
+}
+
+QString QWebView::selectedText() const
+{
+ if (d->page)
+ return d->page->selectedText();
+ return QString();
+}
+
+QAction *QWebView::action(QWebPage::WebAction action) const
+{
+ return page()->action(action);
+}
+
+void QWebView::triggerAction(QWebPage::WebAction action, bool checked)
+{
+ page()->triggerAction(action, checked);
+}
+
+bool QWebView::isModified()
+{
+ if (d->page)
+ return d->page->isModified();
+ return false;
+}
+
+Qt::TextInteractionFlags QWebView::textInteractionFlags() const
+{
+ // ### FIXME (add to page)
+ return Qt::TextInteractionFlags();
+}
+
+void QWebView::setTextInteractionFlags(Qt::TextInteractionFlags flags)
+{
+ Q_UNUSED(flags)
+ // ### FIXME (add to page)
+}
+
+QSize QWebView::sizeHint() const
+{
+ return QSize(800, 600); // ####...
+}
+
+void QWebView::stop()
+{
+ if (d->page)
+ d->page->triggerAction(QWebPage::Stop);
+}
+
+void QWebView::backward()
+{
+ if (d->page)
+ d->page->triggerAction(QWebPage::GoBack);
+}
+
+void QWebView::forward()
+{
+ if (d->page)
+ d->page->triggerAction(QWebPage::GoForward);
+}
+
+void QWebView::reload()
+{
+ if (d->page)
+ d->page->triggerAction(QWebPage::Reload);
+}
+
+void QWebView::resizeEvent(QResizeEvent *e)
+{
+ if (d->page)
+ d->page->resize(e->size());
+}
+
--- /dev/null
+/*
+ Copyright (C) 2007 Trolltech ASA
+ Copyright (C) 2007 Staikos Computing Services Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+#ifndef QWEBVIEW_H
+#define QWEBVIEW_H
+
+#include "qwebkitglobal.h"
+#include "qwebpage.h"
+#include <QtGui/qwidget.h>
+
+class QWebPage;
+class QWebViewPrivate;
+
+class QWEBKIT_EXPORT QWebView : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit QWebView(QWidget *parent = 0);
+ virtual ~QWebView();
+
+ QWebPage *page() const;
+ void setPage(QWebPage *page);
+
+ // ### also offer in QWebFrame
+ void load(const QUrl &url);
+ void load(const QWebNetworkRequest &request);
+ void setHtml(const QString &html, const QUrl &baseUrl = QUrl());
+ void setHtml(const QByteArray &html, const QUrl &baseUrl = QUrl());
+
+ QWebPageHistory *history() const;
+ QWebSettings *settings() const;
+
+ QString title() const;
+ QUrl url() const;
+ QPixmap icon() const;
+
+ QString selectedText() const;
+
+ QAction *action(QWebPage::WebAction action) const;
+ void triggerAction(QWebPage::WebAction action, bool checked = false);
+
+ bool isModified();
+
+ Qt::TextInteractionFlags textInteractionFlags() const;
+ void setTextInteractionFlags(Qt::TextInteractionFlags flags);
+
+ /* #### QTextBrowser compatibility?
+ bool openLinks() const;
+ void setOpenLinks(bool open);
+
+ bool openExternalLinks() const;
+ void setOpenExternalLinks(bool open);
+ */
+
+ QSize sizeHint() const;
+public Q_SLOTS:
+ void stop();
+ void backward();
+ void forward();
+ void reload();
+
+Q_SIGNALS:
+ void loadStarted();
+ void loadProgressChanged(int progress);
+ void loadFinished();
+ void titleChanged(const QString& title);
+ void statusBarTextChanged(const QString& text);
+ void linkClicked(const QUrl &url);
+ void selectionChanged();
+ void iconLoaded();
+
+protected:
+ virtual void resizeEvent(QResizeEvent *e);
+
+private:
+ QWebViewPrivate *d;
+};
+
+#endif // QWEBVIEW_H
+2008-01-03 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Lars.
+
+ Added the first revision of QWebView and started moving functionality from QWebPave over to QWebView and QWebFrame.
+
+
+ * Api/headers.pri:
+ * Api/qwebframe.h:
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::createMainFrame):
+ * Api/qwebpage.h:
+ * Api/qwebpagehistory.h:
+ * Api/qwebview.cpp: Added.
+ (QWebView::QWebView):
+ (QWebView::~QWebView):
+ (QWebView::page):
+ (QWebView::setPage):
+ (QWebView::load):
+ (QWebView::setHtml):
+ (QWebView::history):
+ (QWebView::settings):
+ (QWebView::title):
+ (QWebView::url):
+ (QWebView::icon):
+ (QWebView::selectedText):
+ (QWebView::action):
+ (QWebView::triggerAction):
+ (QWebView::isModified):
+ (QWebView::textInteractionFlags):
+ (QWebView::setTextInteractionFlags):
+ (QWebView::sizeHint):
+ (QWebView::stop):
+ (QWebView::backward):
+ (QWebView::forward):
+ (QWebView::reload):
+ * Api/qwebview.h: Added.
+ * QtLauncher/main.cpp:
+ (MainWindow::MainWindow):
+ (MainWindow::webPage):
+ (MainWindow::changeLocation):
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::setFrame):
+ * WebCoreSupport/FrameLoaderClientQt.h:
+
2007-12-14 Darin Adler <darin@apple.com>
Reviewed by Alexey.
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <qwebpage.h>
+#include <qwebview.h>
#include <qwebframe.h>
#include <qwebsettings.h>
public:
MainWindow(const QUrl &url = QUrl())
{
- page = new WebPage(this);
- InfoWidget *info = new InfoWidget(page);
+ view = new QWebView(this);
+ view->setPage(new WebPage(view));
+ InfoWidget *info = new InfoWidget(view);
info->setGeometry(20, 20, info->sizeHint().width(),
info->sizeHint().height());
- connect(page, SIGNAL(loadStarted(QWebFrame*)),
+ connect(view, SIGNAL(loadStarted()),
info, SLOT(startLoad()));
- connect(page, SIGNAL(loadProgressChanged(int)),
+ connect(view, SIGNAL(loadProgressChanged(int)),
info, SLOT(changeLoad(int)));
- connect(page, SIGNAL(loadFinished(QWebFrame*)),
+ connect(view, SIGNAL(loadFinished()),
info, SLOT(endLoad()));
- connect(page, SIGNAL(loadFinished(QWebFrame*)),
+ connect(view, SIGNAL(loadFinished()),
this, SLOT(loadFinished()));
- connect(page, SIGNAL(titleChanged(const QString&)),
+ connect(view, SIGNAL(titleChanged(const QString&)),
this, SLOT(setWindowTitle(const QString&)));
- connect(page, SIGNAL(hoveringOverLink(const QString&, const QString&)),
+ connect(view->page(), SIGNAL(hoveringOverLink(const QString&, const QString&)),
this, SLOT(showLinkHover(const QString&, const QString&)));
- setCentralWidget(page);
+ setCentralWidget(view);
QToolBar *bar = addToolBar("Navigation");
urlEdit = new SearchEdit(url.toString());
urlEdit->setSizePolicy(QSizePolicy::Expanding, urlEdit->sizePolicy().verticalPolicy());
connect(urlEdit, SIGNAL(returnPressed()),
SLOT(changeLocation()));
- bar->addAction(page->action(QWebPage::GoBack));
- bar->addAction(page->action(QWebPage::Stop));
- bar->addAction(page->action(QWebPage::GoForward));
+ bar->addAction(view->action(QWebPage::GoBack));
+ bar->addAction(view->action(QWebPage::Stop));
+ bar->addAction(view->action(QWebPage::GoForward));
bar->addSeparator();
- bar->addAction(page->action(QWebPage::Cut));
- bar->addAction(page->action(QWebPage::Copy));
- bar->addAction(page->action(QWebPage::Paste));
+ bar->addAction(view->action(QWebPage::Cut));
+ bar->addAction(view->action(QWebPage::Copy));
+ bar->addAction(view->action(QWebPage::Paste));
bar->addSeparator();
- bar->addAction(page->action(QWebPage::Undo));
- bar->addAction(page->action(QWebPage::Redo));
+ bar->addAction(view->action(QWebPage::Undo));
+ bar->addAction(view->action(QWebPage::Redo));
addToolBarBreak();
bar = addToolBar("Location");
hoverLabel->hide();
if (url.isValid())
- page->open(url);
+ view->load(url);
info->raise();
}
- inline QWebPage *webPage() const { return page; }
+ inline QWebPage *webPage() const { return view->page(); }
protected slots:
void changeLocation()
{
QUrl url(urlEdit->text());
- page->open(url);
+ view->load(url);
}
void loadFinished()
{
- urlEdit->setText(page->url().toString());
+ urlEdit->setText(view->url().toString());
}
void showLinkHover(const QString &link, const QString &toolTip)
{
300, hoverSize.height());
}
private:
- QWebPage *page;
+ QWebView *view;
QLineEdit *urlEdit;
HoverLabel *hoverLabel;
};
return;
}
- connect(this, SIGNAL(loadStarted(QWebFrame*)),
- m_webFrame->page(), SIGNAL(loadStarted(QWebFrame *)));
+ connect(this, SIGNAL(loadStarted()),
+ m_webFrame, SIGNAL(loadStarted()));
connect(this, SIGNAL(loadProgressChanged(int)),
m_webFrame->page(), SIGNAL(loadProgressChanged(int)));
- connect(this, SIGNAL(loadFinished(QWebFrame*)),
- m_webFrame->page(), SIGNAL(loadFinished(QWebFrame *)));
+ connect(this, SIGNAL(loadFinished()),
+ m_webFrame, SIGNAL(loadFinished()));
connect(this, SIGNAL(titleChanged(const QString&)),
m_webFrame, SIGNAL(titleChanged(const QString&)));
}
void FrameLoaderClientQt::postProgressStartedNotification()
{
if (m_webFrame && m_frame->page())
- emit loadStarted(m_webFrame);
+ emit loadStarted();
if (m_frame->tree()->parent())
return;
m_webFrame->page()->d->updateNavigationActions();
void FrameLoaderClientQt::postProgressFinishedNotification()
{
if (m_webFrame && m_frame->page())
- emit loadFinished(m_webFrame);
+ emit loadFinished();
}
void FrameLoaderClientQt::setMainFrameDocumentReady(bool b)
void FrameLoaderClientQt::dispatchDidReceiveIcon()
{
if (m_webFrame) {
- emit m_webFrame->page()->iconLoaded();
+ emit m_webFrame->iconLoaded();
}
}
void slotCallPolicyFunction(int);
signals:
void sigCallPolicyFunction(int);
- void loadStarted(QWebFrame *frame);
+ void loadStarted();
void loadProgressChanged(int d);
- void loadFinished(QWebFrame *frame);
+ void loadFinished();
void titleChanged(const QString& title);
public:
+2008-01-03 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Lars.
+
+ Added the first revision of QWebView and started moving functionality from QWebPave over to QWebView and QWebFrame.
+
+
+ * DumpRenderTree/qt/DumpRenderTree.cpp:
+ (WebCore::DumpRenderTree::DumpRenderTree):
+
2008-01-02 Sam Weinig <sam@webkit.org>
* Scripts/do-webcore-rename: Yet more renaming ideas.
m_page->resize(maxViewWidth, maxViewHeight);
m_page->mainFrame()->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_page->mainFrame()->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- connect(m_page, SIGNAL(titleChanged(const QString&)),
+ connect(m_page->mainFrame(), SIGNAL(titleChanged(const QString&)),
SLOT(titleChanged(const QString&)));
m_eventSender = new EventSender(m_page);