diff options
Diffstat (limited to 'WebKit/qt/Api')
| -rw-r--r-- | WebKit/qt/Api/DerivedSources.pro | 2 | ||||
| -rw-r--r-- | WebKit/qt/Api/headers.pri | 3 | ||||
| -rw-r--r-- | WebKit/qt/Api/qgraphicswebview.cpp | 6 | ||||
| -rw-r--r-- | WebKit/qt/Api/qwebframe.cpp | 22 | ||||
| -rw-r--r-- | WebKit/qt/Api/qwebframe.h | 2 | ||||
| -rw-r--r-- | WebKit/qt/Api/qwebframe_p.h | 2 | ||||
| -rw-r--r-- | WebKit/qt/Api/qwebhistory.cpp | 9 | ||||
| -rw-r--r-- | WebKit/qt/Api/qwebkitplatformplugin.h | 6 | ||||
| -rw-r--r-- | WebKit/qt/Api/qwebpage.cpp | 226 | ||||
| -rw-r--r-- | WebKit/qt/Api/qwebpage.h | 38 | ||||
| -rw-r--r-- | WebKit/qt/Api/qwebpage_p.h | 9 | ||||
| -rw-r--r-- | WebKit/qt/Api/qwebscriptworld.cpp | 49 | ||||
| -rw-r--r-- | WebKit/qt/Api/qwebscriptworld.h | 48 | ||||
| -rw-r--r-- | WebKit/qt/Api/qwebscriptworld_p.h | 44 | ||||
| -rw-r--r-- | WebKit/qt/Api/qwebsettings.cpp | 4 | ||||
| -rw-r--r-- | WebKit/qt/Api/qwebsettings.h | 4 |
16 files changed, 431 insertions, 43 deletions
diff --git a/WebKit/qt/Api/DerivedSources.pro b/WebKit/qt/Api/DerivedSources.pro index 22d4c8d..62546f6 100644 --- a/WebKit/qt/Api/DerivedSources.pro +++ b/WebKit/qt/Api/DerivedSources.pro @@ -12,7 +12,7 @@ DOUBLE_ESCAPED_QUOTE = "" ESCAPE = "" win32-msvc*|symbian { ESCAPE = "^" -} else:win32-g++:isEmpty(QMAKE_SH) { +} else:win32-g++*:isEmpty(QMAKE_SH) { # MinGW's make will run makefile commands using sh, even if make # was run from the Windows shell, if it finds sh in the path. ESCAPE = "^" diff --git a/WebKit/qt/Api/headers.pri b/WebKit/qt/Api/headers.pri index 29bb125..e9fe28d 100644 --- a/WebKit/qt/Api/headers.pri +++ b/WebKit/qt/Api/headers.pri @@ -12,4 +12,5 @@ WEBKIT_API_HEADERS = $$PWD/qwebframe.h \ $$PWD/qwebpluginfactory.h \ $$PWD/qwebhistory.h \ $$PWD/qwebinspector.h \ - $$PWD/qwebkitversion.h + $$PWD/qwebkitversion.h \ + $$PWD/qwebscriptworld.h diff --git a/WebKit/qt/Api/qgraphicswebview.cpp b/WebKit/qt/Api/qgraphicswebview.cpp index 178f5c2..8361970 100644 --- a/WebKit/qt/Api/qgraphicswebview.cpp +++ b/WebKit/qt/Api/qgraphicswebview.cpp @@ -122,7 +122,7 @@ void QGraphicsWebViewPrivate::_q_pageDestroyed() void QGraphicsWebViewPrivate::updateResizesToContentsForPage() { ASSERT(page); - + static_cast<PageClientQGraphicsWidget*>(page->d->client)->viewResizesToContents = resizesToContents; if (resizesToContents) { // resizes to contents mode requires preferred contents size to be set if (!page->preferredContentsSize().isValid()) @@ -821,10 +821,8 @@ void QGraphicsWebView::setResizesToContents(bool enabled) if (d->resizesToContents == enabled) return; d->resizesToContents = enabled; - if (d->page) { - static_cast<PageClientQGraphicsWidget*>(d->page->d->client)->viewResizesToContents = enabled; + if (d->page) d->updateResizesToContentsForPage(); - } } bool QGraphicsWebView::resizesToContents() const diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp index 3eba058..c42cfa3 100644 --- a/WebKit/qt/Api/qwebframe.cpp +++ b/WebKit/qt/Api/qwebframe.cpp @@ -71,6 +71,8 @@ #include "qwebpage_p.h" #include "qwebsecurityorigin.h" #include "qwebsecurityorigin_p.h" +#include "qwebscriptworld.h" +#include "qwebscriptworld_p.h" #include "runtime_object.h" #include "runtime_root.h" #include "wtf/HashMap.h" @@ -1272,8 +1274,8 @@ void QWebFrame::print(QPrinter *printer) const if (!painter.begin(printer)) return; - const qreal zoomFactorX = printer->logicalDpiX() / qt_defaultDpi(); - const qreal zoomFactorY = printer->logicalDpiY() / qt_defaultDpi(); + const qreal zoomFactorX = (qreal)printer->logicalDpiX() / qt_defaultDpi(); + const qreal zoomFactorY = (qreal)printer->logicalDpiY() / qt_defaultDpi(); PrintContext printContext(d->frame); float pageHeight = 0; @@ -1376,6 +1378,22 @@ QVariant QWebFrame::evaluateJavaScript(const QString& scriptSource) return rc; } +QVariant QWebFrame::evaluateScriptInIsolatedWorld(QWebScriptWorld* scriptWorld, const QString& scriptSource) +{ + ScriptController *proxy = d->frame->script(); + QVariant rc; + + if (proxy) { + JSC::JSValue v = proxy->executeScriptInWorld(scriptWorld->world(), scriptSource, true).jsValue(); + if (!d->frame) // In case the script removed our frame from the page. + return QString(); + int distance = 0; + rc = JSC::Bindings::convertValueToQVariant(proxy->globalObject(mainThreadNormalWorld())->globalExec(), v, QMetaType::Void, &distance); + } + return rc; +} + + /*! \since 4.5 diff --git a/WebKit/qt/Api/qwebframe.h b/WebKit/qt/Api/qwebframe.h index ecd31de..5f3dbd4 100644 --- a/WebKit/qt/Api/qwebframe.h +++ b/WebKit/qt/Api/qwebframe.h @@ -49,6 +49,7 @@ class QWebHistoryItem; class QWebSecurityOrigin; class QWebElement; class QWebElementCollection; +class QWebScriptWorld; class DumpRenderTreeSupportQt; namespace WebCore { @@ -199,6 +200,7 @@ public: public Q_SLOTS: QVariant evaluateJavaScript(const QString& scriptSource); + QVariant evaluateScriptInIsolatedWorld(QWebScriptWorld* scriptWorld, const QString& scriptSource); #ifndef QT_NO_PRINTER void print(QPrinter *printer) const; #endif diff --git a/WebKit/qt/Api/qwebframe_p.h b/WebKit/qt/Api/qwebframe_p.h index fcc37e7..62bd59e 100644 --- a/WebKit/qt/Api/qwebframe_p.h +++ b/WebKit/qt/Api/qwebframe_p.h @@ -71,6 +71,7 @@ public: , allowsScrolling(true) , marginWidth(-1) , marginHeight(-1) + , initialLayoutComplete(false) {} void init(QWebFrame* qframe, QWebFrameData* frameData); void setPage(QWebPage*); @@ -98,6 +99,7 @@ public: bool allowsScrolling; int marginWidth; int marginHeight; + bool initialLayoutComplete; }; class QWebHitTestResultPrivate { diff --git a/WebKit/qt/Api/qwebhistory.cpp b/WebKit/qt/Api/qwebhistory.cpp index 0147f92..a6f3d0c 100644 --- a/WebKit/qt/Api/qwebhistory.cpp +++ b/WebKit/qt/Api/qwebhistory.cpp @@ -363,9 +363,8 @@ bool QWebHistory::canGoForward() const void QWebHistory::back() { if (canGoBack()) { - d->lst->goBack(); WebCore::Page* page = d->lst->page(); - page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward); + page->goToItem(d->lst->backItem(), WebCore::FrameLoadTypeIndexedBackForward); } } @@ -378,9 +377,8 @@ void QWebHistory::back() void QWebHistory::forward() { if (canGoForward()) { - d->lst->goForward(); WebCore::Page* page = d->lst->page(); - page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward); + page->goToItem(d->lst->forwardItem(), WebCore::FrameLoadTypeIndexedBackForward); } } @@ -391,9 +389,8 @@ void QWebHistory::forward() */ void QWebHistory::goToItem(const QWebHistoryItem &item) { - d->lst->goToItem(item.d->item); WebCore::Page* page = d->lst->page(); - page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward); + page->goToItem(item.d->item, WebCore::FrameLoadTypeIndexedBackForward); } /*! diff --git a/WebKit/qt/Api/qwebkitplatformplugin.h b/WebKit/qt/Api/qwebkitplatformplugin.h index bac618c..32d22d4 100644 --- a/WebKit/qt/Api/qwebkitplatformplugin.h +++ b/WebKit/qt/Api/qwebkitplatformplugin.h @@ -31,7 +31,7 @@ class QWebSelectData { public: - inline ~QWebSelectData() {} + virtual ~QWebSelectData() {} enum ItemType { Option, Group, Separator }; @@ -48,7 +48,7 @@ class QWebSelectMethod : public QObject { Q_OBJECT public: - inline ~QWebSelectMethod() {} + virtual ~QWebSelectMethod() {} virtual void show(const QWebSelectData&) = 0; virtual void hide() = 0; @@ -61,6 +61,8 @@ Q_SIGNALS: class QWebNotificationData { public: + virtual ~QWebNotificationData() {} + virtual const QString title() const = 0; virtual const QString message() const = 0; virtual const QByteArray iconData() const = 0; diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp index d49ac14..eab909c 100644 --- a/WebKit/qt/Api/qwebpage.cpp +++ b/WebKit/qt/Api/qwebpage.cpp @@ -593,7 +593,7 @@ void QWebPagePrivate::timerEvent(QTimerEvent *ev) if (timerId == tripleClickTimer.timerId()) tripleClickTimer.stop(); else - q->QObject::timerEvent(ev); + q->timerEvent(ev); } void QWebPagePrivate::mouseMoveEvent(QGraphicsSceneMouseEvent* ev) @@ -1207,6 +1207,14 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) } #ifndef QT_NO_PROPERTIES +typedef struct { + const char* name; + double deferredRepaintDelay; + double initialDeferredRepaintDelayDuringLoading; + double maxDeferredRepaintDelayDuringLoading; + double deferredRepaintDelayIncrementDuringLoading; +} QRepaintThrottlingPreset; + void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* event) { if (event->propertyName() == "_q_viewMode") { @@ -1224,7 +1232,42 @@ void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* ev } else if (event->propertyName() == "_q_HTMLTokenizerTimeDelay") { double timeDelay = q->property("_q_HTMLTokenizerTimeDelay").toDouble(); q->handle()->page->setCustomHTMLTokenizerTimeDelay(timeDelay); - } + } else if (event->propertyName() == "_q_RepaintThrottlingDeferredRepaintDelay") { + double p = q->property("_q_RepaintThrottlingDeferredRepaintDelay").toDouble(); + FrameView::setRepaintThrottlingDeferredRepaintDelay(p); + } else if (event->propertyName() == "_q_RepaintThrottlingnInitialDeferredRepaintDelayDuringLoading") { + double p = q->property("_q_RepaintThrottlingnInitialDeferredRepaintDelayDuringLoading").toDouble(); + FrameView::setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(p); + } else if (event->propertyName() == "_q_RepaintThrottlingMaxDeferredRepaintDelayDuringLoading") { + double p = q->property("_q_RepaintThrottlingMaxDeferredRepaintDelayDuringLoading").toDouble(); + FrameView::setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading(p); + } else if (event->propertyName() == "_q_RepaintThrottlingDeferredRepaintDelayIncrementDuringLoading") { + double p = q->property("_q_RepaintThrottlingDeferredRepaintDelayIncrementDuringLoading").toDouble(); + FrameView::setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading(p); + } else if (event->propertyName() == "_q_RepaintThrottlingPreset") { + static const QRepaintThrottlingPreset presets[] = { + { "NoThrottling", 0, 0, 0, 0 }, + { "Legacy", 0.025, 0, 2.5, 0.5 }, + { "Minimal", 0.01, 0, 1, 0.2 }, + { "Medium", 0.025, 1, 5, 0.5 }, + { "Heavy", 0.1, 2, 10, 1 } + }; + + QString p = q->property("_q_RepaintThrottlingPreset").toString(); + for(int i = 0; i < sizeof(presets) / sizeof(presets[0]); i++) { + if(p == presets[i].name) { + FrameView::setRepaintThrottlingDeferredRepaintDelay( + presets[i].deferredRepaintDelay); + FrameView::setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading( + presets[i].initialDeferredRepaintDelayDuringLoading); + FrameView::setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading( + presets[i].maxDeferredRepaintDelayDuringLoading); + FrameView::setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading( + presets[i].deferredRepaintDelayIncrementDuringLoading); + break; + } + } + } #if ENABLE(TILED_BACKING_STORE) else if (event->propertyName() == "_q_TiledBackingStoreTileSize") { WebCore::Frame* frame = QWebFramePrivate::core(q->mainFrame()); @@ -1655,6 +1698,109 @@ InspectorController* QWebPagePrivate::inspectorController() \value WebModalDialog The window acts as modal dialog. */ + +/*! + \class QWebPage::ViewportHints + \since 4.7 + \brief The QWebPage::ViewportHints class describes hints that can be applied to a viewport. + + QWebPage::ViewportHints provides a description of a viewport, such as viewport geometry, + initial scale factor with limits, plus information about whether a user should be able + to scale the contents in the viewport or not, ie. by zooming. + + ViewportHints can be set by a web author using the viewport meta tag extension, documented + at \l{http://developer.apple.com/safari/library/documentation/appleapplications/reference/safariwebcontent/usingtheviewport/usingtheviewport.html}{Safari Reference Library: Using the Viewport Meta Tag}. + + All values might not be set, as such when dealing with the hints, the developer needs to + check whether the values are valid. Negative values denote an invalid qreal value. + + \inmodule QtWebKit +*/ + +/*! + Constructs an empty QWebPage::ViewportHints. +*/ +QWebPage::ViewportHints::ViewportHints() + : d(0) + , m_initialScaleFactor(-1.0) + , m_minimumScaleFactor(-1.0) + , m_maximumScaleFactor(-1.0) + , m_isUserScalable(true) + , m_isValid(false) +{ + +} + +/*! + Constructs a QWebPage::ViewportHints which is a copy from \a other . +*/ +QWebPage::ViewportHints::ViewportHints(const QWebPage::ViewportHints& other) + : d(other.d) + , m_initialScaleFactor(other.m_initialScaleFactor) + , m_minimumScaleFactor(other.m_minimumScaleFactor) + , m_maximumScaleFactor(other.m_maximumScaleFactor) + , m_isUserScalable(other.m_isUserScalable) + , m_isValid(other.m_isValid) + , m_size(other.m_size) +{ + +} + +/*! + Destroys the QWebPage::ViewportHints. +*/ +QWebPage::ViewportHints::~ViewportHints() +{ + +} + +/*! + Assigns the given QWebPage::ViewportHints to this viewport hints and returns a + reference to this. +*/ +QWebPage::ViewportHints& QWebPage::ViewportHints::operator=(const QWebPage::ViewportHints& other) +{ + if (this != &other) { + d = other.d; + m_initialScaleFactor = other.m_initialScaleFactor; + m_minimumScaleFactor = other.m_minimumScaleFactor; + m_maximumScaleFactor = other.m_maximumScaleFactor; + m_isUserScalable = other.m_isUserScalable; + m_isValid = other.m_isValid; + m_size = other.m_size; + } + + return *this; +} + +/*! \fn inline bool QWebPage::ViewportHints::isValid() const + Returns whether this is a valid ViewportHints or not. + + An invalid ViewportHints will have an empty QSize, negative values for scale factors and + true for the boolean isUserScalable. +*/ + +/*! \fn inline QSize QWebPage::ViewportHints::size() const + Returns the size of the viewport. +*/ + +/*! \fn inline qreal QWebPage::ViewportHints::initialScaleFactor() const + Returns the initial scale of the viewport as a multiplier. +*/ + +/*! \fn inline qreal QWebPage::ViewportHints::minimumScaleFactor() const + Returns the minimum scale value of the viewport as a multiplier. +*/ + +/*! \fn inline qreal QWebPage::ViewportHints::maximumScaleFactor() const + Returns the maximum scale value of the viewport as a multiplier. +*/ + +/*! \fn inline bool QWebPage::ViewportHints::isUserScalable() const + Determines whether or not the scale can be modified by the user. +*/ + + /*! \class QWebPage \since 4.4 @@ -1852,9 +1998,14 @@ QWidget *QWebPage::view() const */ void QWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID) { - Q_UNUSED(message) - Q_UNUSED(lineNumber) Q_UNUSED(sourceID) + + // Catch plugin logDestroy message for LayoutTests/plugins/open-and-close-window-with-plugin.html + // At this point DRT's WebPage has already been destroyed + if (QWebPagePrivate::drtRun) { + if (message == "PLUGIN: NPP_Destroy") + fprintf (stdout, "CONSOLE MESSAGE: line %d: %s\n", lineNumber, message.toUtf8().constData()); + } } /*! @@ -2184,30 +2335,42 @@ QSize QWebPage::preferredContentsSize() const /*! \property QWebPage::preferredContentsSize \since 4.6 - \brief the preferred size of the contents + \brief a custom size used for laying out the page contents. + + By default all pages are laid out using the viewport of the page as the base. + + As pages mostly are designed for desktop usage, they often do not layout properly + on small devices as the contents require a certain view width. For this reason + it is common to use a different layout size and then scale the contents to fit + within the actual view. - If this property is set to a valid size, it is used to lay out the page. - If it is not set (the default), the viewport size is used instead. + If this property is set to a valid size, this size is used for all layout needs + instead of the size of the viewport. + + Setting an invalid size, makes the page fall back to using the viewport size for layout. \sa viewportSize */ -void QWebPage::setPreferredContentsSize(const QSize &size) const +void QWebPage::setPreferredContentsSize(const QSize& size) const { + // FIXME: Rename this method to setCustomLayoutSize + d->fixedLayoutSize = size; - QWebFrame *frame = mainFrame(); - if (frame->d->frame && frame->d->frame->view()) { - WebCore::FrameView* view = frame->d->frame->view(); + QWebFrame* frame = mainFrame(); + if (!frame->d->frame || !frame->d->frame->view()) + return; - if (size.isValid()) { - view->setUseFixedLayout(true); - view->setFixedLayoutSize(size); - view->layout(); - } else if (view->useFixedLayout()) { - view->setUseFixedLayout(false); - view->layout(); - } - } + WebCore::FrameView* view = frame->d->frame->view(); + + if (size.isValid()) { + view->setUseFixedLayout(true); + view->setFixedLayoutSize(size); + } else if (view->useFixedLayout()) + view->setUseFixedLayout(false); + + if (frame->d->initialLayoutComplete) + view->layout(); } /*! @@ -3538,6 +3701,29 @@ quint64 QWebPage::bytesReceived() const } /*! + \since 4.7 + \fn void QWebPage::viewportChangeRequested(const QWebPage::ViewportHints& hints) + + This signal is emitted before any layout of the contents, giving you the viewport \a arguments + the web page would like you to use when laying out its contents, including elements fixed to the + viewport. This viewport might be larger that your actual viewport, meaning that a initialScaleFactor + should be applied. When no scale is given, it is assumed that the contents should be scaled + such that the width of the scaled contents fits within the actual viewport. + + The minimum and maximum allowed scale represents the min and max values that the page + allows for scaling, and thus, affects the ability to zoom in on the page. + + Invalid values are supplied for the values not explicitly set by the web author; thus an + invalid viewport size, and negative values for scale factor and limits. The boolean + ViewportHints::isUserScalable is set to true. + + Page authors can provide the supplied values by using the viewport meta tag. More information + about this can be found at \l{http://developer.apple.com/safari/library/documentation/appleapplications/reference/safariwebcontent/usingtheviewport/usingtheviewport.html}{Safari Reference Library: Using the Viewport Meta Tag}. + + \sa QWebPage::ViewportHints, setPreferredContentsSize(), QGraphicsWebView::setScale() +*/ + +/*! \fn void QWebPage::loadStarted() This signal is emitted when a new load of the page is started. diff --git a/WebKit/qt/Api/qwebpage.h b/WebKit/qt/Api/qwebpage.h index 721f4a8..fcaa302 100644 --- a/WebKit/qt/Api/qwebpage.h +++ b/WebKit/qt/Api/qwebpage.h @@ -42,12 +42,13 @@ class QWebFrame; class QWebNetworkRequest; class QWebHistory; -class QWebPagePrivate; class QWebFrameData; +class QWebHistoryItem; +class QWebHitTestResult; class QWebNetworkInterface; +class QWebPagePrivate; class QWebPluginFactory; -class QWebHitTestResult; -class QWebHistoryItem; +class QtViewportHintsPrivate; namespace WebCore { class ChromeClientQt; @@ -194,6 +195,35 @@ public: WebModalDialog }; + class ViewportHints { + public: + ViewportHints(); + ViewportHints(const QWebPage::ViewportHints& other); + + ~ViewportHints(); + + QWebPage::ViewportHints& operator=(const QWebPage::ViewportHints& other); + + inline qreal initialScaleFactor() const { return m_initialScaleFactor; }; + inline qreal minimumScaleFactor() const { return m_minimumScaleFactor; }; + inline qreal maximumScaleFactor() const { return m_maximumScaleFactor; }; + inline bool isUserScalable() const { return m_isUserScalable; }; + inline bool isValid() const { return m_isValid; }; + inline QSize size() const { return m_size; }; + + private: + QSharedDataPointer<QtViewportHintsPrivate> d; + qreal m_initialScaleFactor; + qreal m_minimumScaleFactor; + qreal m_maximumScaleFactor; + bool m_isUserScalable; + bool m_isValid; + QSize m_size; + + friend class WebCore::ChromeClientQt; + }; + + explicit QWebPage(QObject *parent = 0); ~QWebPage(); @@ -339,6 +369,8 @@ Q_SIGNALS: void saveFrameStateRequested(QWebFrame* frame, QWebHistoryItem* item); void restoreFrameStateRequested(QWebFrame* frame); + void viewportChangeRequested(const QWebPage::ViewportHints& hints); + protected: virtual QWebPage *createWindow(WebWindowType type); virtual QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); diff --git a/WebKit/qt/Api/qwebpage_p.h b/WebKit/qt/Api/qwebpage_p.h index 272f96b..54a1523 100644 --- a/WebKit/qt/Api/qwebpage_p.h +++ b/WebKit/qt/Api/qwebpage_p.h @@ -58,6 +58,15 @@ QT_END_NAMESPACE class QWebInspector; class QWebPageClient; +class QtViewportHintsPrivate : public QSharedData { +public: + QtViewportHintsPrivate(QWebPage::ViewportHints* qq) + : q(qq) + { } + + QWebPage::ViewportHints* q; +}; + class QWebPagePrivate { public: QWebPagePrivate(QWebPage*); diff --git a/WebKit/qt/Api/qwebscriptworld.cpp b/WebKit/qt/Api/qwebscriptworld.cpp new file mode 100644 index 0000000..5d912cc --- /dev/null +++ b/WebKit/qt/Api/qwebscriptworld.cpp @@ -0,0 +1,49 @@ +/* + Copyright (C) 2010 Robert Hogan <robert@roberthogan.net> + + 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 "qwebscriptworld.h" +#include "qwebscriptworld_p.h" + +#include "KURL.h" +#include "ScriptController.h" +#include <QStringList> + +using namespace WebCore; + +/*! + Constructs a security origin from \a other. +*/ +QWebScriptWorld::QWebScriptWorld() +{ + d = new QWebScriptWorldPrivate(ScriptController::createWorld()); +} + +DOMWrapperWorld* QWebScriptWorld::world() const +{ + return d->world.get(); +} + +/*! + Destroys the security origin. +*/ +QWebScriptWorld::~QWebScriptWorld() +{ +} + diff --git a/WebKit/qt/Api/qwebscriptworld.h b/WebKit/qt/Api/qwebscriptworld.h new file mode 100644 index 0000000..6e728ab --- /dev/null +++ b/WebKit/qt/Api/qwebscriptworld.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2010 Robert Hogan <robert@roberthogan.net> + + 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 QWebScriptWorld_h_ +#define QWebScriptWorld_h_ + +#include <QtCore/qurl.h> +#include <QtCore/qshareddata.h> + +#include "qwebkitglobal.h" + +namespace WebCore { + class DOMWrapperWorld; +} + +class QWebScriptWorldPrivate; +class QWebFrame; + +class QWEBKIT_EXPORT QWebScriptWorld { +public: + QWebScriptWorld(); + ~QWebScriptWorld(); + + WebCore::DOMWrapperWorld* world() const; + +private: + QExplicitlySharedDataPointer<QWebScriptWorldPrivate> d; + + friend class QWebFrame; +}; + +#endif diff --git a/WebKit/qt/Api/qwebscriptworld_p.h b/WebKit/qt/Api/qwebscriptworld_p.h new file mode 100644 index 0000000..7115eb2 --- /dev/null +++ b/WebKit/qt/Api/qwebscriptworld_p.h @@ -0,0 +1,44 @@ +/* + Copyright (C) 2010 Robert Hogan <robert@roberthogan.net> + + 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 _QWEBSCRIPTWORLD_P_H_ +#define _QWEBSCRIPTWORLD_P_H_ + +#include "RefPtr.h" + +namespace WebCore { + class DOMWrapperWorld; +} + +class QWebScriptWorldPrivate : public QSharedData { +public: + QWebScriptWorldPrivate(WTF::PassRefPtr<WebCore::DOMWrapperWorld> o) + { + Q_ASSERT(o); + world = o; + } + + ~QWebScriptWorldPrivate() + { + } + + WTF::RefPtr<WebCore::DOMWrapperWorld> world; +}; + +#endif diff --git a/WebKit/qt/Api/qwebsettings.cpp b/WebKit/qt/Api/qwebsettings.cpp index 4881bac..b2766a7 100644 --- a/WebKit/qt/Api/qwebsettings.cpp +++ b/WebKit/qt/Api/qwebsettings.cpp @@ -24,9 +24,9 @@ #include "qwebpage_p.h" #include "qwebplugindatabase_p.h" +#include "AbstractDatabase.h" #include "Cache.h" #include "CrossOriginPreflightResultCache.h" -#include "Database.h" #include "FontCache.h" #include "Page.h" #include "PageCache.h" @@ -217,7 +217,7 @@ void QWebSettingsPrivate::apply() #if ENABLE(DATABASE) value = attributes.value(QWebSettings::OfflineStorageDatabaseEnabled, global->attributes.value(QWebSettings::OfflineStorageDatabaseEnabled)); - WebCore::Database::setIsAvailable(value); + WebCore::AbstractDatabase::setIsAvailable(value); #endif value = attributes.value(QWebSettings::OfflineWebApplicationCacheEnabled, diff --git a/WebKit/qt/Api/qwebsettings.h b/WebKit/qt/Api/qwebsettings.h index c063bcd..38a2b3f 100644 --- a/WebKit/qt/Api/qwebsettings.h +++ b/WebKit/qt/Api/qwebsettings.h @@ -74,8 +74,8 @@ public: LocalContentCanAccessFileUrls, TiledBackingStoreEnabled, FrameFlatteningEnabled, - WebGLEnabled, - SiteSpecificQuirksEnabled + SiteSpecificQuirksEnabled, + WebGLEnabled }; enum WebGraphic { MissingImageGraphic, |
