diff options
Diffstat (limited to 'WebKit/qt')
-rw-r--r-- | WebKit/qt/Api/headers.pri | 3 | ||||
-rw-r--r-- | WebKit/qt/Api/qgraphicswebview.cpp | 2 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebframe.cpp | 16 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebframe.h | 1 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebscriptworld.cpp | 11 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebscriptworld.h | 2 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebsettings.cpp | 1 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebsettings.h | 3 | ||||
-rw-r--r-- | WebKit/qt/ChangeLog | 225 | ||||
-rw-r--r-- | WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp | 60 | ||||
-rw-r--r-- | WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h | 10 | ||||
-rw-r--r-- | WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp | 78 | ||||
-rw-r--r-- | WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h | 3 | ||||
-rw-r--r-- | WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp | 59 | ||||
-rw-r--r-- | WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h | 4 | ||||
-rw-r--r-- | WebKit/qt/declarative/qdeclarativewebview.cpp | 2 | ||||
-rw-r--r-- | WebKit/qt/symbian/eabi/QtWebKitu.def | 19 | ||||
-rw-r--r-- | WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp | 8 | ||||
-rw-r--r-- | WebKit/qt/tests/tests.pri | 3 |
19 files changed, 461 insertions, 49 deletions
diff --git a/WebKit/qt/Api/headers.pri b/WebKit/qt/Api/headers.pri index e9fe28d..29bb125 100644 --- a/WebKit/qt/Api/headers.pri +++ b/WebKit/qt/Api/headers.pri @@ -12,5 +12,4 @@ WEBKIT_API_HEADERS = $$PWD/qwebframe.h \ $$PWD/qwebpluginfactory.h \ $$PWD/qwebhistory.h \ $$PWD/qwebinspector.h \ - $$PWD/qwebkitversion.h \ - $$PWD/qwebscriptworld.h + $$PWD/qwebkitversion.h diff --git a/WebKit/qt/Api/qgraphicswebview.cpp b/WebKit/qt/Api/qgraphicswebview.cpp index 8361970..6d6acc5 100644 --- a/WebKit/qt/Api/qgraphicswebview.cpp +++ b/WebKit/qt/Api/qgraphicswebview.cpp @@ -151,6 +151,8 @@ void QGraphicsWebViewPrivate::_q_contentsSizeChanged(const QSize& size) void QGraphicsWebViewPrivate::_q_scaleChanged() { #if ENABLE(TILED_BACKING_STORE) + if (!page) + return; static_cast<PageClientQGraphicsWidget*>(page->d->client)->updateTiledBackingStoreScale(); #endif } diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp index c42cfa3..c4cb597 100644 --- a/WebKit/qt/Api/qwebframe.cpp +++ b/WebKit/qt/Api/qwebframe.cpp @@ -1378,22 +1378,6 @@ 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 5f3dbd4..e78fb07 100644 --- a/WebKit/qt/Api/qwebframe.h +++ b/WebKit/qt/Api/qwebframe.h @@ -200,7 +200,6 @@ 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/qwebscriptworld.cpp b/WebKit/qt/Api/qwebscriptworld.cpp index 5d912cc..84b678d 100644 --- a/WebKit/qt/Api/qwebscriptworld.cpp +++ b/WebKit/qt/Api/qwebscriptworld.cpp @@ -35,6 +35,17 @@ QWebScriptWorld::QWebScriptWorld() d = new QWebScriptWorldPrivate(ScriptController::createWorld()); } +QWebScriptWorld::QWebScriptWorld(const QWebScriptWorld& other) + : d(other.d) +{ +} + +QWebScriptWorld &QWebScriptWorld::operator=(const QWebScriptWorld& other) +{ + d = other.d; + return *this; +} + DOMWrapperWorld* QWebScriptWorld::world() const { return d->world.get(); diff --git a/WebKit/qt/Api/qwebscriptworld.h b/WebKit/qt/Api/qwebscriptworld.h index 6e728ab..6a9d6e0 100644 --- a/WebKit/qt/Api/qwebscriptworld.h +++ b/WebKit/qt/Api/qwebscriptworld.h @@ -35,6 +35,8 @@ class QWebFrame; class QWEBKIT_EXPORT QWebScriptWorld { public: QWebScriptWorld(); + QWebScriptWorld(const QWebScriptWorld&); + QWebScriptWorld &operator=(const QWebScriptWorld&); ~QWebScriptWorld(); WebCore::DOMWrapperWorld* world() const; diff --git a/WebKit/qt/Api/qwebsettings.cpp b/WebKit/qt/Api/qwebsettings.cpp index b2766a7..ff7c101 100644 --- a/WebKit/qt/Api/qwebsettings.cpp +++ b/WebKit/qt/Api/qwebsettings.cpp @@ -90,6 +90,7 @@ static WebGraphicHash* graphics() hash->insert(QWebSettings::DefaultFrameIconGraphic, QPixmap(QLatin1String(":webkit/resources/urlIcon.png"))); hash->insert(QWebSettings::TextAreaSizeGripCornerGraphic, QPixmap(QLatin1String(":webkit/resources/textAreaResizeCorner.png"))); hash->insert(QWebSettings::DeleteButtonGraphic, QPixmap(QLatin1String(":webkit/resources/deleteButton.png"))); + hash->insert(QWebSettings::InputSpeechButtonGraphic, QPixmap(QLatin1String(":webkit/resources/inputSpeech.png"))); } return hash; diff --git a/WebKit/qt/Api/qwebsettings.h b/WebKit/qt/Api/qwebsettings.h index 38a2b3f..8967e7c 100644 --- a/WebKit/qt/Api/qwebsettings.h +++ b/WebKit/qt/Api/qwebsettings.h @@ -82,7 +82,8 @@ public: MissingPluginGraphic, DefaultFrameIconGraphic, TextAreaSizeGripCornerGraphic, - DeleteButtonGraphic + DeleteButtonGraphic, + InputSpeechButtonGraphic }; enum FontSize { MinimumFontSize, diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog index 2e565ae..2a649f6 100644 --- a/WebKit/qt/ChangeLog +++ b/WebKit/qt/ChangeLog @@ -1,3 +1,228 @@ +2010-07-03 Robert Hogan <robert@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Return usable property names from DRT's computedStyleIncludingVisitedInfo() + + Object property names such as 'background-color' need to be returned in camel + case, i.e. backgroundColor so that JS can reference them. Add support for this + to DumpRenderTreeSupportQt. + + https://bugs.webkit.org/show_bug.cgi?id=40445 + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (convertToPropertyName): + (DumpRenderTreeSupportQt::computedStyleIncludingVisitedInfo): + +2010-07-01 Robert Hogan <robert@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] dump frames in ascending alphabetical order of title + + https://bugs.webkit.org/show_bug.cgi?id=41261 + + Unskip: + http/tests/navigation/metaredirect-frames.html + http/tests/navigation/redirect302-frames.html + http/tests/navigation/redirect302-subframeload.html + http/tests/navigation/timerredirect-frames.html + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::getChildHistoryItems): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + +2010-07-01 Bea Lam <bea.lam@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Doc improvements for QDeclarativeWebView + + * declarative/qdeclarativewebview.cpp: + +2010-07-01 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Create QComboBoxes when clicked and destroy on hide. + https://bugs.webkit.org/show_bug.cgi?id=41451 + + Currently a QComboBox is created for each RenderMenuList and + it gets destroyed either when the RenderMenuList or the + QWebView (its Qt parent) is destroyed. This cause a crash + when the QWebView is destroyed before the render tree (which + is kept in cache). + + This patch aim to destroy the QComboBox as soon as its popup + gets hidden, and likewise, create it only when the popup is + requested to be shown. + It also removes the unneeded reference to the QGraphicsProxyWidget, + destroying the QComboBox automatically destroys its bound + proxywidget. + + * WebCoreSupport/QtFallbackWebPopup.cpp: + (WebCore::QtFallbackWebPopupCombo::hidePopup): + (WebCore::QtFallbackWebPopup::QtFallbackWebPopup): + (WebCore::QtFallbackWebPopup::~QtFallbackWebPopup): + (WebCore::QtFallbackWebPopup::show): + (WebCore::QtFallbackWebPopup::hide): + (WebCore::QtFallbackWebPopup::destroyPopup): + (WebCore::QtFallbackWebPopup::populate): + * WebCoreSupport/QtFallbackWebPopup.h: + +2010-07-01 Satish Sampath <satish@chromium.org> + + Reviewed by Kent Tamura. + + Rendering the speech button in input elements. + https://bugs.webkit.org/show_bug.cgi?id=40984 + + * Api/qwebsettings.cpp: + (graphics): + * Api/qwebsettings.h: + +2010-06-30 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Make sure we catch closed QComboBox popups. + https://bugs.webkit.org/show_bug.cgi?id=39019 + + The way it works currently is using the QComboBox::show/hidePopup + virtual method to catch popup requests in the middle. There is + some cases however that the popup widget gets closed without + going through the hidePopup method. + + This patch adds an event filter to the popup's view to know when + it gets closed and calls hidePopup to call our handling code. + This may get hidePopup called twice but this shouldn't have any + effect. + + * WebCoreSupport/QtFallbackWebPopup.cpp: + (WebCore::QtFallbackWebPopupCombo::QtFallbackWebPopupCombo): + (WebCore::QtFallbackWebPopupCombo::eventFilter): + * WebCoreSupport/QtFallbackWebPopup.h: + +2010-06-30 Simon Hausmann <simon.hausmann@nokia.com> + + Unreviewed Symbian build fix. + + [Qt] Update the def files to link DumpRenderTree. + + * symbian/eabi/QtWebKitu.def: + +2010-06-30 Samuel Nevala <samuel.nevala@digia.com> + + Reviewed by Simon Hausmann. + + [Qt] Auto test wont compile from \3rdparty\webkit\WebKit\qt\tests + https://bugs.webkit.org/show_bug.cgi?id=38720 + + Load qttest_p4.prf under QTDIR_build. + + * tests/tests.pri: + +2010-06-29 Robert Hogan <robert@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] support dumpResourceResponseMIMETypes + https://bugs.webkit.org/show_bug.cgi?id=41260 + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::dumpResourceResponseMIMETypes): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::dispatchDidReceiveResponse): + * WebCoreSupport/FrameLoaderClientQt.h: + +2010-06-28 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Unreviewed Symbian build fix. + + [Qt] Update the def file after r61879. + + * symbian/eabi/QtWebKitu.def: + +2010-06-28 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] QGraphicsWebView crash when calling setScale() before setUrl() + https://bugs.webkit.org/show_bug.cgi?id=40000 + + Check 'page' before dereference in _q_scaleChanged() + Autotest included. + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::_q_scaleChanged): + * tests/qgraphicswebview/tst_qgraphicswebview.cpp: + (tst_QGraphicsWebView::crashOnSetScaleBeforeSetUrl): + +2010-06-26 Simon Hausmann <hausmann@webkit.org> + + [Qt] Prospective build fix for MSVC + + In order for the forward declaration of QWebScriptWorldPrivate + to work with QExplicitlySharedDataPointer, then copy constructor + and assignment operators must not be compiler generated, to + avoid them ending up in places where the private class is not + declared. + + * Api/qwebscriptworld.cpp: + (QWebScriptWorld::QWebScriptWorld): + (QWebScriptWorld::operator=): + * Api/qwebscriptworld.h: + +2010-06-26 Robert Hogan <robert@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] DRT Support for setCustomPolicyDelegate + + https://bugs.webkit.org/show_bug.cgi?id=39564 + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::setCustomPolicyDelegate): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (drtDescriptionSuitableForTestResult): + (WebCore::navigationTypeToString): + (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction): + * WebCoreSupport/FrameLoaderClientQt.h: + +2010-06-25 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] QtWebKit crashes if <select>'s render changes in its onchange event + https://bugs.webkit.org/show_bug.cgi?id=41164 + + QtWebKit crashes if <select>'s renderer changes in its onchange event. + + * WebCoreSupport/QtFallbackWebPopup.cpp: + (WebCore::QtFallbackWebPopup::~QtFallbackWebPopup): + +2010-06-25 Robert Hogan <robert@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] Support evaluateScriptInIsolatedWorld() + + https://bugs.webkit.org/show_bug.cgi?id=40079 + + Remove evaluateScriptInIsolatedWorld() from QtWebKit API. + Remove QWebScriptWorld from exported headers. + Confine support to DumpRenderTreeSupportQt so that the tests can pass. + + * Api/headers.pri: + * Api/qwebframe.cpp: + * Api/qwebframe.h: + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::clearScriptWorlds): + (DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + 2010-06-24 Simon Hausmann <simon.hausmann@nokia.com> Unreviewed Symbian build fix. diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index 0ae55d7..09dec71 100644 --- a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -49,6 +49,7 @@ #include "PrintContext.h" #include "RenderListItem.h" #include "RenderTreeAsText.h" +#include "ScriptController.h" #include "SecurityOrigin.h" #include "Settings.h" #if ENABLE(SVG) @@ -65,11 +66,13 @@ #include "qwebhistory_p.h" #include "qwebpage.h" #include "qwebpage_p.h" +#include "qwebscriptworld.h" using namespace WebCore; CheckPermissionFunctionType* checkPermissionFunction = 0; RequestPermissionFunctionType* requestPermissionFunction = 0; +QMap<int, QWebScriptWorld*> m_worldMap; DumpRenderTreeSupportQt::DumpRenderTreeSupportQt() { @@ -392,6 +395,20 @@ QString DumpRenderTreeSupportQt::markerTextForListItem(const QWebElement& listIt return WebCore::markerTextForListItem(listItem.m_element); } +static QString convertToPropertyName(const QString& name) +{ + QStringList parts = name.split('-'); + QString camelCaseName; + for (int j = 0; j < parts.count(); ++j) { + QString part = parts.at(j); + if (j) + camelCaseName.append(part.replace(0, 1, part.left(1).toUpper())); + else + camelCaseName.append(part); + } + return camelCaseName; +} + QVariantMap DumpRenderTreeSupportQt::computedStyleIncludingVisitedInfo(const QWebElement& element) { QVariantMap res; @@ -404,7 +421,7 @@ QVariantMap DumpRenderTreeSupportQt::computedStyleIncludingVisitedInfo(const QWe for (int i = 0; i < style->length(); i++) { QString name = style->item(i); QString value = (static_cast<WebCore::CSSStyleDeclaration*>(style.get()))->getPropertyValue(name); - res[name] = QVariant(value); + res[convertToPropertyName(name)] = QVariant(value); } return res; } @@ -510,6 +527,11 @@ void DumpRenderTreeSupportQt::dumpResourceLoadCallbacksPath(const QString& path) FrameLoaderClientQt::dumpResourceLoadCallbacksPath = path; } +void DumpRenderTreeSupportQt::dumpResourceResponseMIMETypes(bool b) +{ + FrameLoaderClientQt::dumpResourceResponseMIMETypes = b; +} + void DumpRenderTreeSupportQt::setWillSendRequestReturnsNullOnRedirect(bool b) { FrameLoaderClientQt::sendRequestReturnsNullOnRedirect = b; @@ -525,6 +547,12 @@ void DumpRenderTreeSupportQt::setWillSendRequestClearHeaders(const QStringList& FrameLoaderClientQt::sendRequestClearHeaders = headers; } +void DumpRenderTreeSupportQt::setCustomPolicyDelegate(bool enabled, bool permissive) +{ + FrameLoaderClientQt::policyDelegateEnabled = enabled; + FrameLoaderClientQt::policyDelegatePermissive = permissive; +} + void DumpRenderTreeSupportQt::dumpEditingCallbacks(bool b) { EditorClientQt::dumpEditingCallbacks = b; @@ -596,17 +624,17 @@ QString DumpRenderTreeSupportQt::historyItemTarget(const QWebHistoryItem& histor return (QWebHistoryItemPrivate::core(&it)->target()); } -QList<QWebHistoryItem> DumpRenderTreeSupportQt::getChildHistoryItems(const QWebHistoryItem& historyItem) +QMap<QString, QWebHistoryItem> DumpRenderTreeSupportQt::getChildHistoryItems(const QWebHistoryItem& historyItem) { QWebHistoryItem it = historyItem; HistoryItem* item = QWebHistoryItemPrivate::core(&it); const WebCore::HistoryItemVector& children = item->children(); unsigned size = children.size(); - QList<QWebHistoryItem> kids; + QMap<QString, QWebHistoryItem> kids; for (unsigned i = 0; i < size; ++i) { QWebHistoryItem kid(new QWebHistoryItemPrivate(children[i].get())); - kids.prepend(kid); + kids.insert(DumpRenderTreeSupportQt::historyItemTarget(kid), kid); } return kids; } @@ -617,6 +645,30 @@ bool DumpRenderTreeSupportQt::shouldClose(QWebFrame* frame) return coreFrame->loader()->shouldClose(); } +void DumpRenderTreeSupportQt::clearScriptWorlds() +{ + m_worldMap.clear(); +} + +void DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(QWebFrame* frame, int worldID, const QString& script) +{ + QWebScriptWorld* scriptWorld; + if (!worldID) { + scriptWorld = new QWebScriptWorld(); + } else if (!m_worldMap.contains(worldID)) { + scriptWorld = new QWebScriptWorld(); + m_worldMap.insert(worldID, scriptWorld); + } else + scriptWorld = m_worldMap.value(worldID); + + WebCore::Frame* coreFrame = QWebFramePrivate::core(frame); + + ScriptController* proxy = coreFrame->script(); + + if (proxy) + proxy->executeScriptInWorld(scriptWorld->world(), script, true); +} + // Provide a backward compatibility with previously exported private symbols as of QtWebKit 4.6 release void QWEBKIT_EXPORT qt_resumeActiveDOMObjects(QWebFrame* frame) diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h index 0b94a03..304e65b 100644 --- a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h +++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h @@ -30,6 +30,7 @@ class QWebElement; class QWebFrame; class QWebPage; class QWebHistoryItem; +class QWebScriptWorld; enum NotificationPermission { NotificationAllowed, @@ -42,6 +43,7 @@ typedef void (RequestPermissionFunctionType) (QObject* receiver, const QString&) extern CheckPermissionFunctionType* checkPermissionFunction; extern RequestPermissionFunctionType* requestPermissionFunction; +extern QMap<int, QWebScriptWorld*> m_worldMap; class QWEBKIT_EXPORT DumpRenderTreeSupportQt { @@ -74,6 +76,8 @@ public: static void garbageCollectorCollectOnAlternateThread(bool waitUntilDone); static void setJavaScriptProfilingEnabled(QWebFrame*, bool enabled); static int javaScriptObjectsCount(); + static void clearScriptWorlds(); + static void evaluateScriptInIsolatedWorld(QWebFrame* frame, int worldID, const QString& script); static void setTimelineProfilingEnabled(QWebPage*, bool enabled); static void webInspectorExecuteScript(QWebPage* page, long callId, const QString& script); @@ -106,6 +110,7 @@ public: static void dumpFrameLoader(bool b); static void dumpResourceLoadCallbacks(bool b); + static void dumpResourceResponseMIMETypes(bool b); static void dumpResourceLoadCallbacksPath(const QString& path); static void setWillSendRequestReturnsNullOnRedirect(bool b); static void setWillSendRequestReturnsNull(bool b); @@ -115,6 +120,7 @@ public: static void dumpSetAcceptsEditing(bool b); static void dumpNotification(bool b); + // These functions should eventually turn into public API // and the "receiver" concept would go away static void setNotificationsReceiver(QObject* receiver); @@ -122,11 +128,13 @@ public: static void setCheckPermissionFunction(CheckPermissionFunctionType*); static void setRequestPermissionFunction(RequestPermissionFunctionType*); - static QList<QWebHistoryItem> getChildHistoryItems(const QWebHistoryItem& historyItem); + static QMap<QString, QWebHistoryItem> getChildHistoryItems(const QWebHistoryItem& historyItem); static bool isTargetItem(const QWebHistoryItem& historyItem); static QString historyItemTarget(const QWebHistoryItem& historyItem); static bool shouldClose(QWebFrame* frame); + + static void setCustomPolicyDelegate(bool enabled, bool permissive); }; #endif diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 42b0c49..db731d8 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -38,7 +38,9 @@ #include "FrameTree.h" #include "FrameView.h" #include "DocumentLoader.h" +#include "HitTestResult.h" #include "MIMETypeRegistry.h" +#include "MouseEvent.h" #include "ResourceResponse.h" #include "Page.h" #include "PluginData.h" @@ -127,6 +129,25 @@ static QString drtDescriptionSuitableForTestResult(const WebCore::ResourceRespon return QString::fromLatin1("<NSURLResponse %1, http status code %2>").arg(url).arg(httpStatusCode); } +static QString drtDescriptionSuitableForTestResult(const RefPtr<WebCore::Node> node, int exception) +{ + QString result; + if (exception) { + result.append("ERROR"); + return result; + } + if (!node) { + result.append("NULL"); + return result; + } + result.append(node->nodeName()); + RefPtr<WebCore::Node> parent = node->parentNode(); + if (parent) { + result.append(" > "); + result.append(drtDescriptionSuitableForTestResult(parent, 0)); + } + return result; +} namespace WebCore { @@ -135,8 +156,32 @@ bool FrameLoaderClientQt::dumpFrameLoaderCallbacks = false; bool FrameLoaderClientQt::dumpResourceLoadCallbacks = false; bool FrameLoaderClientQt::sendRequestReturnsNullOnRedirect = false; bool FrameLoaderClientQt::sendRequestReturnsNull = false; +bool FrameLoaderClientQt::dumpResourceResponseMIMETypes = false; + QStringList FrameLoaderClientQt::sendRequestClearHeaders; QString FrameLoaderClientQt::dumpResourceLoadCallbacksPath; +bool FrameLoaderClientQt::policyDelegateEnabled = false; +bool FrameLoaderClientQt::policyDelegatePermissive = false; + +// Taken from DumpRenderTree/chromium/WebViewHost.cpp +static const char* navigationTypeToString(NavigationType type) +{ + switch (type) { + case NavigationTypeLinkClicked: + return "link clicked"; + case NavigationTypeFormSubmitted: + return "form submitted"; + case NavigationTypeBackForward: + return "back/forward"; + case NavigationTypeReload: + return "reload"; + case NavigationTypeFormResubmitted: + return "form resubmitted"; + case NavigationTypeOther: + return "other"; + } + return "illegal value"; +} FrameLoaderClientQt::FrameLoaderClientQt() : m_frame(0) @@ -910,7 +955,12 @@ void FrameLoaderClientQt::dispatchDidReceiveResponse(WebCore::DocumentLoader*, u printf("%s - didReceiveResponse %s\n", qPrintable(dumpAssignedUrls[identifier]), qPrintable(drtDescriptionSuitableForTestResult(response))); - //qDebug() << " got response from" << response.url().string(); + + if (dumpResourceResponseMIMETypes) { + printf("%s has MIME type %s\n", + qPrintable(QFileInfo(drtDescriptionSuitableForTestResult(response.url())).fileName()), + qPrintable(QString(response.mimeType()))); + } } void FrameLoaderClientQt::dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long, int) @@ -1046,6 +1096,32 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFun Q_ASSERT(m_webFrame); QNetworkRequest r(request.toNetworkRequest(m_webFrame)); QWebPage*page = m_webFrame->page(); + PolicyAction result; + + // Currently, this is only enabled by DRT + if (policyDelegateEnabled) { + RefPtr<Node> node; + for (const Event* event = action.event(); event; event = event->underlyingEvent()) { + if (event->isMouseEvent()) { + const MouseEvent* mouseEvent = static_cast<const MouseEvent*>(event); + node = QWebFramePrivate::core(m_webFrame)->eventHandler()->hitTestResultAtPoint( + mouseEvent->absoluteLocation(), false).innerNonSharedNode(); + break; + } + } + + printf("Policy delegate: attempt to load %s with navigation type '%s'%s\n", + qPrintable(drtDescriptionSuitableForTestResult(request.url())), navigationTypeToString(action.type()), + (node) ? qPrintable(" originating from " + drtDescriptionSuitableForTestResult(node, 0)) : ""); + + if (policyDelegatePermissive) + result = PolicyUse; + else + result = PolicyIgnore; + + callPolicyFunction(function, result); + return; + } if (!page->d->acceptNavigationRequest(m_webFrame, r, QWebPage::NavigationType(action.type()))) { if (action.type() == NavigationTypeFormSubmitted || action.type() == NavigationTypeFormResubmitted) diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index d858589..b4a3c7e 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -214,10 +214,13 @@ public: static bool dumpFrameLoaderCallbacks; static bool dumpResourceLoadCallbacks; + static bool dumpResourceResponseMIMETypes; static QString dumpResourceLoadCallbacksPath; static bool sendRequestReturnsNullOnRedirect; static bool sendRequestReturnsNull; static QStringList sendRequestClearHeaders; + static bool policyDelegateEnabled; + static bool policyDelegatePermissive; private: Frame *m_frame; diff --git a/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp b/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp index 26420e5..59ac87b 100644 --- a/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp +++ b/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp @@ -47,6 +47,10 @@ namespace WebCore { QtFallbackWebPopupCombo::QtFallbackWebPopupCombo(QtFallbackWebPopup& ownerPopup) : m_ownerPopup(ownerPopup) { + // Install an event filter on the view inside the combo box popup to make sure we know + // when the popup got closed. E.g. QComboBox::hidePopup() won't be called when the popup + // is closed by a mouse wheel event outside its window. + view()->installEventFilter(this); } void QtFallbackWebPopupCombo::showPopup() @@ -71,14 +75,24 @@ void QtFallbackWebPopupCombo::hidePopup() QComboBox::hidePopup(); - if (QGraphicsProxyWidget* proxy = graphicsProxyWidget()) - proxy->setVisible(false); - if (!m_ownerPopup.m_popupVisible) return; m_ownerPopup.m_popupVisible = false; m_ownerPopup.popupDidHide(); + m_ownerPopup.destroyPopup(); +} + +bool QtFallbackWebPopupCombo::eventFilter(QObject* watched, QEvent* event) +{ + Q_ASSERT(watched == view()); + + if (event->type() == QEvent::Show && !m_ownerPopup.m_popupVisible) + showPopup(); + else if (event->type() == QEvent::Hide && m_ownerPopup.m_popupVisible) + hidePopup(); + + return false; } // QtFallbackWebPopup @@ -86,19 +100,13 @@ void QtFallbackWebPopupCombo::hidePopup() QtFallbackWebPopup::QtFallbackWebPopup() : QtAbstractWebPopup() , m_popupVisible(false) - , m_combo(new QtFallbackWebPopupCombo(*this)) - , m_proxy(0) + , m_combo(0) { - connect(m_combo, SIGNAL(activated(int)), - SLOT(activeChanged(int)), Qt::QueuedConnection); } QtFallbackWebPopup::~QtFallbackWebPopup() { - // If we create a proxy, then the deletion of the proxy and the - // combo will be done by the proxy's parent (QGraphicsWebView) - if (!m_proxy) - delete m_combo; + destroyPopup(); } void QtFallbackWebPopup::show() @@ -109,17 +117,20 @@ void QtFallbackWebPopup::show() #if ENABLE(SYMBIAN_DIALOG_PROVIDERS) TRAP_IGNORE(showS60BrowserDialog()); #else + + destroyPopup(); + m_combo = new QtFallbackWebPopupCombo(*this); + connect(m_combo, SIGNAL(activated(int)), + SLOT(activeChanged(int)), Qt::QueuedConnection); + populate(); m_combo->setCurrentIndex(currentIndex()); QRect rect = geometry(); if (QGraphicsWebView *webView = qobject_cast<QGraphicsWebView*>(pageClient()->pluginParent())) { - if (!m_proxy) { - m_proxy = new QGraphicsProxyWidget(webView); - m_proxy->setWidget(m_combo); - } else - m_proxy->setVisible(true); - m_proxy->setGeometry(rect); + QGraphicsProxyWidget* proxy = new QGraphicsProxyWidget(webView); + proxy->setWidget(m_combo); + proxy->setGeometry(rect); } else { m_combo->setParent(pageClient()->ownerWidget()); m_combo->setGeometry(QRect(rect.left(), rect.top(), @@ -188,13 +199,21 @@ void QtFallbackWebPopup::showS60BrowserDialog() void QtFallbackWebPopup::hide() { - m_combo->hidePopup(); + // Destroying the QComboBox here cause problems if the popup is in the + // middle of its show animation. Instead we rely on the fact that the + // Qt::Popup window will hide itself on mouse events outside its window. } -void QtFallbackWebPopup::populate() +void QtFallbackWebPopup::destroyPopup() { - m_combo->clear(); + if (m_combo) { + m_combo->deleteLater(); + m_combo = 0; + } +} +void QtFallbackWebPopup::populate() +{ QStandardItemModel* model = qobject_cast<QStandardItemModel*>(m_combo->model()); Q_ASSERT(model); diff --git a/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h b/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h index 6d2e1ff..e6c371f 100644 --- a/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h +++ b/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h @@ -42,6 +42,8 @@ public: virtual void show(); virtual void hide(); + void destroyPopup(); + private slots: void activeChanged(int); @@ -49,7 +51,6 @@ private: friend class QtFallbackWebPopupCombo; bool m_popupVisible; QtFallbackWebPopupCombo* m_combo; - QGraphicsProxyWidget* m_proxy; void populate(); #if ENABLE(SYMBIAN_DIALOG_PROVIDERS) @@ -62,6 +63,7 @@ public: QtFallbackWebPopupCombo(QtFallbackWebPopup& ownerPopup); virtual void showPopup(); virtual void hidePopup(); + virtual bool eventFilter(QObject* watched, QEvent* event); private: QtFallbackWebPopup& m_ownerPopup; diff --git a/WebKit/qt/declarative/qdeclarativewebview.cpp b/WebKit/qt/declarative/qdeclarativewebview.cpp index a349bec..0342c9f 100644 --- a/WebKit/qt/declarative/qdeclarativewebview.cpp +++ b/WebKit/qt/declarative/qdeclarativewebview.cpp @@ -180,6 +180,8 @@ void GraphicsWebView::mouseMoveEvent(QGraphicsSceneMouseEvent* event) When this item has keyboard focus, all keyboard input will be sent directly to the web page within. + + \sa {declarative/modelviews/webview}{WebView example}, {demos/declarative/webbrowser}{Web Browser demo} */ /*! diff --git a/WebKit/qt/symbian/eabi/QtWebKitu.def b/WebKit/qt/symbian/eabi/QtWebKitu.def index 3fefb4d..548add1 100644 --- a/WebKit/qt/symbian/eabi/QtWebKitu.def +++ b/WebKit/qt/symbian/eabi/QtWebKitu.def @@ -760,7 +760,7 @@ EXPORTS _ZN23DumpRenderTreeSupportQt27setTimelineProfilingEnabledEP8QWebPageb @759 NONAME _ZN23DumpRenderTreeSupportQt28setDumpRenderTreeModeEnabledEb @760 NONAME _ZN23DumpRenderTreeSupportQt29dumpResourceLoadCallbacksPathERK7QString @761 NONAME - _ZN23DumpRenderTreeSupportQt29evaluateScriptInIsolatedWorldEP9QWebFrameiRK7QString @762 NONAME ABSENT + _ZN23DumpRenderTreeSupportQt29evaluateScriptInIsolatedWorldEP9QWebFrameiRK7QString @762 NONAME _ZN23DumpRenderTreeSupportQt29setJavaScriptProfilingEnabledEP9QWebFrameb @763 NONAME _ZN23DumpRenderTreeSupportQt29setWillSendRequestReturnsNullEb @764 NONAME _ZN23DumpRenderTreeSupportQt30setWillSendRequestClearHeadersERK11QStringList @765 NONAME @@ -782,3 +782,20 @@ EXPORTS _ZN23DumpRenderTreeSupportQt20getChildHistoryItemsERK15QWebHistoryItem @ 781 NONAME _ZN23DumpRenderTreeSupportQt23setMockGeolocationErrorEiRK7QString @ 782 NONAME _ZN23DumpRenderTreeSupportQt26setMockGeolocationPositionEddd @ 783 NONAME + _ZN23DumpRenderTreeSupportQt17clearScriptWorldsEv @ 784 NONAME + _ZN23DumpRenderTreeSupportQt23setCustomPolicyDelegateEbb @ 785 NONAME + _ZN15QWebScriptWorldC1ERKS_ @ 786 NONAME + _ZN15QWebScriptWorldC1Ev @ 787 NONAME + _ZN15QWebScriptWorldC2ERKS_ @ 788 NONAME + _ZN15QWebScriptWorldC2Ev @ 789 NONAME + _ZN15QWebScriptWorldD1Ev @ 790 NONAME + _ZN15QWebScriptWorldD2Ev @ 791 NONAME + _ZN15QWebScriptWorldaSERKS_ @ 792 NONAME + _ZN23DumpRenderTreeSupportQt29dumpResourceResponseMIMETypesEb @ 793 NONAME + _ZN23DumpRenderTreeSupportQtC1Ev @ 794 NONAME + _ZN23DumpRenderTreeSupportQtC2Ev @ 795 NONAME + _ZN23DumpRenderTreeSupportQtD1Ev @ 796 NONAME + _ZN23DumpRenderTreeSupportQtD2Ev @ 797 NONAME + _ZN8QWebPage23allowGeolocationRequestEP9QWebFrame @ 798 NONAME + _ZN8QWebPage23viewportChangeRequestedERKNS_13ViewportHintsE @ 799 NONAME + _ZNK15QWebScriptWorld5worldEv @ 800 NONAME diff --git a/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp b/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp index e06524d..a04ff17 100644 --- a/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp +++ b/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp @@ -34,6 +34,7 @@ private slots: void crashOnViewlessWebPages(); void microFocusCoordinates(); void focusInputTypes(); + void crashOnSetScaleBeforeSetUrl(); }; void tst_QGraphicsWebView::qgraphicswebview() @@ -132,6 +133,13 @@ void tst_QGraphicsWebView::crashOnViewlessWebPages() delete page; } +void tst_QGraphicsWebView::crashOnSetScaleBeforeSetUrl() +{ + QGraphicsWebView* webView = new QGraphicsWebView; + webView->setScale(2.0); + delete webView; +} + void tst_QGraphicsWebView::microFocusCoordinates() { QWebPage* page = new QWebPage; diff --git a/WebKit/qt/tests/tests.pri b/WebKit/qt/tests/tests.pri index 525e662..a795ff8 100644 --- a/WebKit/qt/tests/tests.pri +++ b/WebKit/qt/tests/tests.pri @@ -3,7 +3,8 @@ CONFIG -= app_bundle VPATH += $$_PRO_FILE_PWD_ # Add the tst_ prefix, In QTDIR_build it's done by qttest_p4.prf -!CONFIG(QTDIR_build):TARGET = tst_$$TARGET +CONFIG(QTDIR_build) { load(qttest_p4) } +ELSE { TARGET = tst_$$TARGET } SOURCES += $${TARGET}.cpp INCLUDEPATH += \ $$PWD \ |