diff options
author | Ben Murdoch <benm@google.com> | 2010-06-15 19:36:43 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-06-16 14:52:28 +0100 |
commit | 545e470e52f0ac6a3a072bf559c796b42c6066b6 (patch) | |
tree | c0c14763654d84d37577dde512c3d3b4699a9e86 /WebKit/qt/Api | |
parent | 719298a66237d38ea5c05f1547123ad8aacbc237 (diff) | |
download | external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.zip external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.gz external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.bz2 |
Merge webkit.org at r61121: Initial merge by git.
Change-Id: Icd6db395c62285be384d137164d95d7466c98760
Diffstat (limited to 'WebKit/qt/Api')
-rw-r--r-- | WebKit/qt/Api/qwebframe.cpp | 8 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebhistory.cpp | 5 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebhistory.h | 1 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebhistory_p.h | 2 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebkitplatformplugin.h | 31 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebpage.cpp | 55 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebpage.h | 1 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebpage_p.h | 5 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebpluginfactory.cpp | 4 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebsettings.cpp | 18 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebsettings.h | 6 |
11 files changed, 107 insertions, 29 deletions
diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp index 7a28f83..3eba058 100644 --- a/WebKit/qt/Api/qwebframe.cpp +++ b/WebKit/qt/Api/qwebframe.cpp @@ -48,6 +48,7 @@ #include "PlatformWheelEvent.h" #include "PrintContext.h" #include "PutPropertySlot.h" +#include "RenderLayer.h" #include "RenderTreeAsText.h" #include "RenderView.h" #include "ResourceRequest.h" @@ -475,7 +476,12 @@ void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object JSC::JSLock lock(JSC::SilenceAssertionsOnly); JSDOMWindow* window = toJSDOMWindow(d->frame, mainThreadNormalWorld()); - JSC::Bindings::RootObject* root = d->frame->script()->bindingRootObject(); + JSC::Bindings::RootObject* root; + if (ownership == QScriptEngine::QtOwnership) + root = d->frame->script()->cacheableBindingRootObject(); + else + root = d->frame->script()->bindingRootObject(); + if (!window) { qDebug() << "Warning: couldn't get window object"; return; diff --git a/WebKit/qt/Api/qwebhistory.cpp b/WebKit/qt/Api/qwebhistory.cpp index 06e6cfa..0147f92 100644 --- a/WebKit/qt/Api/qwebhistory.cpp +++ b/WebKit/qt/Api/qwebhistory.cpp @@ -555,3 +555,8 @@ QWebPagePrivate* QWebHistoryPrivate::page() { return QWebFramePrivate::kit(lst->page()->mainFrame())->page()->handle(); } + +WebCore::HistoryItem* QWebHistoryItemPrivate::core(QWebHistoryItem* q) +{ + return q->d->item; +} diff --git a/WebKit/qt/Api/qwebhistory.h b/WebKit/qt/Api/qwebhistory.h index cce4553..3456784 100644 --- a/WebKit/qt/Api/qwebhistory.h +++ b/WebKit/qt/Api/qwebhistory.h @@ -61,6 +61,7 @@ private: friend class QWebPage; friend class WebCore::FrameLoaderClientQt; friend class QWebHistoryItemPrivate; + friend class DumpRenderTreeSupportQt; //friend QDataStream & operator<<(QDataStream& out,const QWebHistoryItem& hist); //friend QDataStream & operator>>(QDataStream& in,QWebHistoryItem& hist); QExplicitlySharedDataPointer<QWebHistoryItemPrivate> d; diff --git a/WebKit/qt/Api/qwebhistory_p.h b/WebKit/qt/Api/qwebhistory_p.h index a6682cd..c9ff91b 100644 --- a/WebKit/qt/Api/qwebhistory_p.h +++ b/WebKit/qt/Api/qwebhistory_p.h @@ -45,6 +45,8 @@ public: item->deref(); } + static WebCore::HistoryItem* core(QWebHistoryItem* q); + WebCore::HistoryItem* item; }; diff --git a/WebKit/qt/Api/qwebkitplatformplugin.h b/WebKit/qt/Api/qwebkitplatformplugin.h index 7d024ae..bac618c 100644 --- a/WebKit/qt/Api/qwebkitplatformplugin.h +++ b/WebKit/qt/Api/qwebkitplatformplugin.h @@ -58,20 +58,43 @@ Q_SIGNALS: void didHide(); }; +class QWebNotificationData +{ +public: + virtual const QString title() const = 0; + virtual const QString message() const = 0; + virtual const QByteArray iconData() const = 0; +}; + +class QWebNotificationPresenter : public QObject +{ + Q_OBJECT +public: + QWebNotificationPresenter() {} + virtual ~QWebNotificationPresenter() {} + + virtual void showNotification(const QWebNotificationData*) = 0; + +Q_SIGNALS: + void notificationClosed(); +}; + class QWebKitPlatformPlugin { public: - inline ~QWebKitPlatformPlugin() {} + virtual ~QWebKitPlatformPlugin() {} enum Extension { - MultipleSelections + MultipleSelections, + Notifications }; - virtual QWebSelectMethod* createSelectInputMethod() const = 0; virtual bool supportsExtension(Extension extension) const = 0; + virtual QWebSelectMethod* createSelectInputMethod() const = 0; + virtual QWebNotificationPresenter* createNotificationPresenter() const = 0; }; -Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.0"); +Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.2"); #endif // QWEBKITPLATFORMPLUGIN_H diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp index 0e9d92f..d49ac14 100644 --- a/WebKit/qt/Api/qwebpage.cpp +++ b/WebKit/qt/Api/qwebpage.cpp @@ -267,6 +267,9 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) JSC::initializeThreading(); WTF::initializeMainThread(); WebCore::SecurityOrigin::setLocalLoadPolicy(WebCore::SecurityOrigin::AllowLocalLoadsForLocalAndSubstituteData); +#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0) + WebCore::Font::setCodePath(WebCore::Font::Complex); +#endif chromeClient = new ChromeClientQt(q); contextMenuClient = new ContextMenuClientQt(); @@ -299,7 +302,7 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) PageGroup::setShouldTrackVisitedLinks(true); #if ENABLE(NOTIFICATIONS) - notificationPresenterClient = new NotificationPresenterClientQt(q); + NotificationPresenterClientQt::notificationPresenter()->addClient(); #endif } @@ -315,7 +318,7 @@ QWebPagePrivate::~QWebPagePrivate() delete page; #if ENABLE(NOTIFICATIONS) - delete notificationPresenterClient; + NotificationPresenterClientQt::notificationPresenter()->removeClient(); #endif } @@ -1008,7 +1011,7 @@ void QWebPagePrivate::dragEnterEvent(QGraphicsSceneDragDropEvent* ev) Qt::DropAction action = dragOpToDropAction(page->dragController()->dragEntered(&dragData)); ev->setDropAction(action); if (action != Qt::IgnoreAction) - ev->accept(); + ev->acceptProposedAction(); #endif } @@ -1021,7 +1024,7 @@ void QWebPagePrivate::dragEnterEvent(QDragEnterEvent* ev) ev->setDropAction(action); // We must accept this event in order to receive the drag move events that are sent // while the drag and drop action is in progress. - ev->accept(); + ev->acceptProposedAction(); #endif } @@ -1051,7 +1054,7 @@ void QWebPagePrivate::dragMoveEvent(QGraphicsSceneDragDropEvent* ev) Qt::DropAction action = dragOpToDropAction(page->dragController()->dragUpdated(&dragData)); ev->setDropAction(action); if (action != Qt::IgnoreAction) - ev->accept(); + ev->acceptProposedAction(); #endif } @@ -1065,7 +1068,7 @@ void QWebPagePrivate::dragMoveEvent(QDragMoveEvent* ev) ev->setDropAction(action); // We must accept this event in order to receive the drag move events that are sent // while the drag and drop action is in progress. - ev->accept(); + ev->acceptProposedAction(); #endif } @@ -1075,7 +1078,7 @@ void QWebPagePrivate::dropEvent(QGraphicsSceneDragDropEvent* ev) DragData dragData(ev->mimeData(), ev->pos().toPoint(), QCursor::pos(), dropActionToDragOp(ev->possibleActions())); if (page->dragController()->performDrag(&dragData)) - ev->accept(); + ev->acceptProposedAction(); #endif } @@ -1087,7 +1090,7 @@ void QWebPagePrivate::dropEvent(QDropEvent* ev) DragData dragData(ev->mimeData(), ev->pos(), QCursor::pos(), dropActionToDragOp(Qt::DropAction(ev->dropAction()))); if (page->dragController()->performDrag(&dragData)) - ev->accept(); + ev->acceptProposedAction(); #endif } @@ -1203,6 +1206,7 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) ev->accept(); } +#ifndef QT_NO_PROPERTIES void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* event) { if (event->propertyName() == "_q_viewMode") { @@ -1257,6 +1261,7 @@ void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* ev } #endif } +#endif void QWebPagePrivate::shortcutOverrideEvent(QKeyEvent* event) { @@ -1931,6 +1936,30 @@ bool QWebPage::shouldInterruptJavaScript() } /*! + \fn bool QWebPage::allowGeolocationRequest() + \since 4.7 + + This function is called whenever a JavaScript program running inside \a frame tries to access user location through navigator.geolocation. + + If the user wants to allow access to location then it should return true; otherwise false. + + The default implementation executes the query using QMessageBox::information with QMessageBox::Yes and QMessageBox::No buttons. + + \warning Because of binary compatibility constraints, this function is not virtual. If you want to + provide your own implementation in a QWebPage subclass, reimplement the allowGeolocationRequest() + slot in your subclass instead. QtWebKit will dynamically detect the slot and call it. +*/ +bool QWebPage::allowGeolocationRequest(QWebFrame *frame) +{ +#ifdef QT_NO_MESSAGEBOX + return false; +#else + QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; + return QMessageBox::Yes == QMessageBox::information(parent, tr("Location Request by- %1").arg(frame->url().host()), tr("The page wants to access your location information. Do you want to allow the request?"), QMessageBox::Yes, QMessageBox::No); +#endif +} + +/*! This function is called whenever WebKit wants to create a new window of the given \a type, for example when a JavaScript program requests to open a document in a new window. @@ -2641,9 +2670,11 @@ bool QWebPage::event(QEvent *ev) d->touchEvent(static_cast<QTouchEvent*>(ev)); break; #endif +#ifndef QT_NO_PROPERTIES case QEvent::DynamicPropertyChange: d->dynamicPropertyChangeEvent(static_cast<QDynamicPropertyChangeEvent*>(ev)); break; +#endif default: return QObject::event(ev); } @@ -3095,6 +3126,14 @@ bool QWebPage::findText(const QString &subString, FindFlags options) } else return d->page->markAllMatchesForText(subString, caseSensitivity, true, 0); } else { + if (subString.isEmpty()) { + d->page->mainFrame()->selection()->clear(); + Frame* frame = d->page->mainFrame()->tree()->firstChild(); + while (frame) { + frame->selection()->clear(); + frame = frame->tree()->traverseNextWithWrap(false); + } + } ::FindDirection direction = ::FindDirectionForward; if (options & FindBackward) direction = ::FindDirectionBackward; diff --git a/WebKit/qt/Api/qwebpage.h b/WebKit/qt/Api/qwebpage.h index a4b555a..721f4a8 100644 --- a/WebKit/qt/Api/qwebpage.h +++ b/WebKit/qt/Api/qwebpage.h @@ -307,6 +307,7 @@ public: public Q_SLOTS: bool shouldInterruptJavaScript(); + bool allowGeolocationRequest(QWebFrame *frame); Q_SIGNALS: void loadStarted(); diff --git a/WebKit/qt/Api/qwebpage_p.h b/WebKit/qt/Api/qwebpage_p.h index 7414716..272f96b 100644 --- a/WebKit/qt/Api/qwebpage_p.h +++ b/WebKit/qt/Api/qwebpage_p.h @@ -44,7 +44,6 @@ namespace WebCore { class EditorClientQt; class Element; class InspectorController; - class NotificationPresenterClientQt; class Node; class Page; class Frame; @@ -113,7 +112,9 @@ public: void inputMethodEvent(QInputMethodEvent*); +#ifndef QT_NO_PROPERTIES void dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent*); +#endif void shortcutOverrideEvent(QKeyEvent*); void leaveEvent(QEvent*); @@ -191,8 +192,6 @@ public: bool inspectorIsInternalOnly; // True if created through the Inspect context menu action Qt::DropAction m_lastDropAction; - WebCore::NotificationPresenterClientQt* notificationPresenterClient; - QString viewMode; static bool drtRun; diff --git a/WebKit/qt/Api/qwebpluginfactory.cpp b/WebKit/qt/Api/qwebpluginfactory.cpp index f715430..b9180be 100644 --- a/WebKit/qt/Api/qwebpluginfactory.cpp +++ b/WebKit/qt/Api/qwebpluginfactory.cpp @@ -63,7 +63,7 @@ /*! \class QWebPluginFactory::Plugin \since 4.4 - \brief the QWebPluginFactory::Plugin structure describes the properties of a plugin a QWebPluginFactory can create. + \brief The QWebPluginFactory::Plugin structure describes the properties of a plugin a QWebPluginFactory can create. \inmodule QtWebKit */ @@ -147,7 +147,7 @@ QWebPluginFactory::~QWebPluginFactory() supported plugins the factory can create. \note Currently, this function is only called when JavaScript programs - access the global \c plugins or \c mimetypes objects. + access the global \c plugins or \c mimetypes objects. */ /*! diff --git a/WebKit/qt/Api/qwebsettings.cpp b/WebKit/qt/Api/qwebsettings.cpp index a649658..4881bac 100644 --- a/WebKit/qt/Api/qwebsettings.cpp +++ b/WebKit/qt/Api/qwebsettings.cpp @@ -184,9 +184,10 @@ void QWebSettingsPrivate::apply() global->attributes.value(QWebSettings::SpatialNavigationEnabled)); settings->setSpatialNavigationEnabled(value); - value = attributes.value(QWebSettings::DOMPasteAllowed, - global->attributes.value(QWebSettings::DOMPasteAllowed)); + value = attributes.value(QWebSettings::JavascriptCanAccessClipboard, + global->attributes.value(QWebSettings::JavascriptCanAccessClipboard)); settings->setDOMPasteAllowed(value); + settings->setJavaScriptCanAccessClipboard(value); value = attributes.value(QWebSettings::DeveloperExtrasEnabled, global->attributes.value(QWebSettings::DeveloperExtrasEnabled)); @@ -235,10 +236,6 @@ void QWebSettingsPrivate::apply() global->attributes.value(QWebSettings::LocalContentCanAccessFileUrls)); settings->setAllowFileAccessFromFileURLs(value); - value = attributes.value(QWebSettings::JavaScriptCanAccessClipboard, - global->attributes.value(QWebSettings::JavaScriptCanAccessClipboard)); - settings->setJavaScriptCanAccessClipboard(value); - value = attributes.value(QWebSettings::XSSAuditingEnabled, global->attributes.value(QWebSettings::XSSAuditingEnabled)); settings->setXSSAuditorEnabled(value); @@ -249,6 +246,10 @@ void QWebSettingsPrivate::apply() settings->setTiledBackingStoreEnabled(value); #endif + value = attributes.value(QWebSettings::SiteSpecificQuirksEnabled, + global->attributes.value(QWebSettings::SiteSpecificQuirksEnabled)); + settings->setNeedsSiteSpecificQuirks(value); + settings->setUsesPageCache(WebCore::pageCache()->capacity()); } else { QList<QWebSettingsPrivate*> settings = *::allSettings(); @@ -376,8 +377,6 @@ QWebSettings* QWebSettings::globalSettings() recording visited pages in the history and storing web page icons. This is disabled by default. \value JavascriptCanOpenWindows Specifies whether JavaScript programs can open new windows. This is disabled by default. - \value DOMPasteAllowed Specifies whether JavaScript programs can - read clipboard contents. \value JavascriptCanAccessClipboard Specifies whether JavaScript programs can read or write to the clipboard. This is disabled by default. \value DeveloperExtrasEnabled Enables extra tools for Web developers. @@ -433,6 +432,8 @@ QWebSettings* QWebSettings::globalSettings() and at other times scrolling the page itself. For this reason iframes and framesets are barely usable on touch devices. This will flatten all the frames to become one scrollable page. This is disabled by default. + \value SiteSpecificQuirksEnabled This setting enables WebKit's workaround for broken sites. It is + enabled by default. */ /*! @@ -469,6 +470,7 @@ QWebSettings::QWebSettings() d->attributes.insert(QWebSettings::WebGLEnabled, false); d->attributes.insert(QWebSettings::TiledBackingStoreEnabled, false); d->attributes.insert(QWebSettings::FrameFlatteningEnabled, false); + d->attributes.insert(QWebSettings::SiteSpecificQuirksEnabled, true); d->offlineStorageDefaultQuota = 5 * 1024 * 1024; d->defaultTextEncoding = QLatin1String("iso-8859-1"); } diff --git a/WebKit/qt/Api/qwebsettings.h b/WebKit/qt/Api/qwebsettings.h index 040f9b4..c063bcd 100644 --- a/WebKit/qt/Api/qwebsettings.h +++ b/WebKit/qt/Api/qwebsettings.h @@ -55,7 +55,7 @@ public: PluginsEnabled, PrivateBrowsingEnabled, JavascriptCanOpenWindows, - DOMPasteAllowed, + JavascriptCanAccessClipboard, DeveloperExtrasEnabled, LinksIncludedInFocusChain, ZoomTextOnly, @@ -68,14 +68,14 @@ public: #endif LocalContentCanAccessRemoteUrls, DnsPrefetchEnabled, - JavaScriptCanAccessClipboard, XSSAuditingEnabled, AcceleratedCompositingEnabled, SpatialNavigationEnabled, LocalContentCanAccessFileUrls, TiledBackingStoreEnabled, FrameFlatteningEnabled, - WebGLEnabled + WebGLEnabled, + SiteSpecificQuirksEnabled }; enum WebGraphic { MissingImageGraphic, |