diff options
Diffstat (limited to 'WebKit/qt/WebCoreSupport')
| -rw-r--r-- | WebKit/qt/WebCoreSupport/ChromeClientQt.cpp | 5 | ||||
| -rw-r--r-- | WebKit/qt/WebCoreSupport/ChromeClientQt.h | 2 | ||||
| -rw-r--r-- | WebKit/qt/WebCoreSupport/EditorClientQt.cpp | 22 | ||||
| -rw-r--r-- | WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp | 114 | ||||
| -rw-r--r-- | WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h | 5 | ||||
| -rw-r--r-- | WebKit/qt/WebCoreSupport/InspectorClientQt.cpp | 76 | ||||
| -rw-r--r-- | WebKit/qt/WebCoreSupport/InspectorClientQt.h | 5 |
7 files changed, 118 insertions, 111 deletions
diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index 26cf6f6..eb7ac9a 100644 --- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -141,6 +141,11 @@ void ChromeClientQt::takeFocus(FocusDirection) } +void ChromeClientQt::focusedNodeChanged(WebCore::Node*) +{ +} + + Page* ChromeClientQt::createWindow(Frame*, const FrameLoadRequest& request, const WindowFeatures& features) { QWebPage *newPage = m_webPage->createWindow(features.dialog ? QWebPage::WebModalDialog : QWebPage::WebBrowserWindow); diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/WebKit/qt/WebCoreSupport/ChromeClientQt.h index 196c4fc..939fe04 100644 --- a/WebKit/qt/WebCoreSupport/ChromeClientQt.h +++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.h @@ -63,6 +63,8 @@ namespace WebCore { virtual bool canTakeFocus(FocusDirection); virtual void takeFocus(FocusDirection); + virtual void focusedNodeChanged(Node*); + virtual Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&); virtual void show(); diff --git a/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp index 34241f0..3091a43 100644 --- a/WebKit/qt/WebCoreSupport/EditorClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp @@ -407,28 +407,38 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event) case VK_LEFT: if (kevent->shiftKey()) frame->editor()->command("MoveLeftAndModifySelection").execute(); - else frame->editor()->command("MoveLeft").execute(); + else + frame->editor()->command("MoveLeft").execute(); break; case VK_RIGHT: if (kevent->shiftKey()) frame->editor()->command("MoveRightAndModifySelection").execute(); - else frame->editor()->command("MoveRight").execute(); + else + frame->editor()->command("MoveRight").execute(); break; case VK_UP: if (kevent->shiftKey()) frame->editor()->command("MoveUpAndModifySelection").execute(); - else frame->editor()->command("MoveUp").execute(); + else + frame->editor()->command("MoveUp").execute(); break; case VK_DOWN: if (kevent->shiftKey()) frame->editor()->command("MoveDownAndModifySelection").execute(); - else frame->editor()->command("MoveDown").execute(); + else + frame->editor()->command("MoveDown").execute(); break; case VK_PRIOR: // PageUp - frame->editor()->command("MovePageUp").execute(); + if (kevent->shiftKey()) + frame->editor()->command("MovePageUpAndModifySelection").execute(); + else + frame->editor()->command("MovePageUp").execute(); break; case VK_NEXT: // PageDown - frame->editor()->command("MovePageDown").execute(); + if (kevent->shiftKey()) + frame->editor()->command("MovePageDownAndModifySelection").execute(); + else + frame->editor()->command("MovePageDown").execute(); break; case VK_TAB: return; diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 8749ada..3c30ab5 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -1,9 +1,10 @@ /* * Copyright (C) 2006 Zack Rusin <zack@kde.org> * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) * Copyright (C) 2008 Collabora Ltd. All rights reserved. * Coypright (C) 2008 Holger Hans Peter Freyther + * Coypright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in> * * All rights reserved. * @@ -53,8 +54,9 @@ #include "QNetworkReplyHandler.h" #include "ResourceHandleInternal.h" #include "ResourceHandle.h" -#include "Settings.h" +#include "ScriptController.h" #include "ScriptString.h" +#include "Settings.h" #include "QWebPageClient.h" #include "qwebpage.h" @@ -68,14 +70,10 @@ #include <QCoreApplication> #include <QDebug> -#if QT_VERSION >= 0x040400 #include <QGraphicsScene> #include <QGraphicsWidget> #include <QNetworkRequest> #include <QNetworkReply> -#else -#include "qwebnetworkinterface_p.h" -#endif #include "qwebhistory_p.h" static bool dumpFrameLoaderCallbacks = false; @@ -145,9 +143,9 @@ namespace WebCore FrameLoaderClientQt::FrameLoaderClientQt() : m_frame(0) , m_webFrame(0) + , m_firstData(false) , m_pluginView(0) , m_hasSentResponseToPlugin(false) - , m_firstData(false) , m_loadError (ResourceError()) { } @@ -176,8 +174,8 @@ void FrameLoaderClientQt::setFrame(QWebFrame* webFrame, Frame* frame) m_webFrame->page(), SIGNAL(loadFinished(bool))); connect(this, SIGNAL(loadFinished(bool)), m_webFrame, SIGNAL(loadFinished(bool))); - connect(this, SIGNAL(titleChanged(const QString&)), - m_webFrame, SIGNAL(titleChanged(const QString&))); + connect(this, SIGNAL(titleChanged(QString)), + m_webFrame, SIGNAL(titleChanged(QString))); } QWebFrame* FrameLoaderClientQt::webFrame() const @@ -307,6 +305,29 @@ void FrameLoaderClientQt::dispatchDidChangeLocationWithinPage() m_webFrame->page()->d->updateNavigationActions(); } +void FrameLoaderClientQt::dispatchDidPushStateWithinPage() +{ + if (dumpFrameLoaderCallbacks) + printf("%s - dispatchDidPushStateWithinPage\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame))); + + notImplemented(); +} + +void FrameLoaderClientQt::dispatchDidReplaceStateWithinPage() +{ + if (dumpFrameLoaderCallbacks) + printf("%s - dispatchDidReplaceStateWithinPage\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame))); + + notImplemented(); +} + +void FrameLoaderClientQt::dispatchDidPopStateWithinPage() +{ + if (dumpFrameLoaderCallbacks) + printf("%s - dispatchDidPopStateWithinPage\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame))); + + notImplemented(); +} void FrameLoaderClientQt::dispatchWillClose() { @@ -600,8 +621,11 @@ bool FrameLoaderClientQt::canHandleRequest(const WebCore::ResourceRequest&) cons return true; } -void FrameLoaderClientQt::windowObjectCleared() +void FrameLoaderClientQt::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world) { + if (world != mainThreadNormalWorld()) + return; + if (dumpFrameLoaderCallbacks) printf("%s - didClearWindowObjectForFrame\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame))); @@ -789,7 +813,6 @@ WTF::PassRefPtr<WebCore::DocumentLoader> FrameLoaderClientQt::createDocumentLoad void FrameLoaderClientQt::download(WebCore::ResourceHandle* handle, const WebCore::ResourceRequest&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&) { -#if QT_VERSION >= 0x040400 if (!m_webFrame) return; @@ -802,7 +825,6 @@ void FrameLoaderClientQt::download(WebCore::ResourceHandle* handle, const WebCor else reply->abort(); } -#endif } void FrameLoaderClientQt::assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest& request) @@ -955,11 +977,7 @@ void FrameLoaderClientQt::dispatchDecidePolicyForMIMEType(FramePolicyFunction fu void FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState>, const WebCore::String&) { Q_ASSERT(m_webFrame); -#if QT_VERSION < 0x040400 - QWebNetworkRequest r(request); -#else - QNetworkRequest r(request.toNetworkRequest()); -#endif + QNetworkRequest r(request.toNetworkRequest(m_webFrame)); QWebPage* page = m_webFrame->page(); if (!page->d->acceptNavigationRequest(0, r, QWebPage::NavigationType(action.type()))) { @@ -980,11 +998,7 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction(FramePolicyFunc void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState>) { Q_ASSERT(m_webFrame); -#if QT_VERSION < 0x040400 - QWebNetworkRequest r(request); -#else - QNetworkRequest r(request.toNetworkRequest()); -#endif + QNetworkRequest r(request.toNetworkRequest(m_webFrame)); QWebPage*page = m_webFrame->page(); if (!page->d->acceptNavigationRequest(m_webFrame, r, QWebPage::NavigationType(action.type()))) { @@ -1009,12 +1023,10 @@ void FrameLoaderClientQt::dispatchUnableToImplementPolicy(const WebCore::Resourc void FrameLoaderClientQt::startDownload(const WebCore::ResourceRequest& request) { -#if QT_VERSION >= 0x040400 if (!m_webFrame) return; - emit m_webFrame->page()->downloadRequested(request.toNetworkRequest()); -#endif + emit m_webFrame->page()->downloadRequested(request.toNetworkRequest(m_webFrame)); } PassRefPtr<Frame> FrameLoaderClientQt::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, @@ -1131,9 +1143,25 @@ public: QRegion clipRegion = QRegion(clipRect); platformWidget()->setMask(clipRegion); + handleVisibility(); + } + + virtual void show() + { + Widget::show(); + handleVisibility(); + } + +private: + void handleVisibility() + { + if (!isVisible()) + return; + // if setMask is set with an empty QRegion, no clipping will // be performed, so in that case we hide the platformWidget - platformWidget()->setVisible(!clipRegion.isEmpty()); + QRegion mask = platformWidget()->mask(); + platformWidget()->setVisible(!mask.isEmpty()); } }; @@ -1234,23 +1262,21 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, #endif // QT_NO_STYLE_STYLESHEET } -#if QT_VERSION >= 0x040400 if (!object) { QWebPluginFactory* factory = m_webFrame->page()->pluginFactory(); if (factory) object = factory->create(mimeType, qurl, params, values); } -#endif if (object) { QWidget* widget = qobject_cast<QWidget*>(object); if (widget) { - QWidget* parentWidget; + QWidget* parentWidget = 0; if (m_webFrame->page()->d->client) parentWidget = qobject_cast<QWidget*>(m_webFrame->page()->d->client->pluginParent()); - else - parentWidget = 0; // The plug-in won't be fully functional because the QWebView doesn't exist. - widget->setParent(parentWidget); + if (parentWidget) // don't reparent to nothing (i.e. keep whatever parent QWebPage::createPlugin() chose. + widget->setParent(parentWidget); + widget->hide(); RefPtr<QtPluginWidget> w = adoptRef(new QtPluginWidget()); w->setPlatformWidget(widget); // Make sure it's invisible until properly placed into the layout @@ -1260,13 +1286,12 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, #if QT_VERSION >= 0x040600 QGraphicsWidget* graphicsWidget = qobject_cast<QGraphicsWidget*>(object); if (graphicsWidget) { - QGraphicsObject* parentWidget; + QGraphicsObject* parentWidget = 0; if (m_webFrame->page()->d->client) parentWidget = qobject_cast<QGraphicsObject*>(m_webFrame->page()->d->client->pluginParent()); - else - parentWidget = 0; // The plug-in won't be fully functional because the QWebView doesn't exist. graphicsWidget->hide(); - graphicsWidget->setParentItem(parentWidget); + if (parentWidget) // don't reparent to nothing (i.e. keep whatever parent QWebPage::createPlugin() chose. + graphicsWidget->setParentItem(parentWidget); RefPtr<QtPluginGraphicsWidget> w = QtPluginGraphicsWidget::create(graphicsWidget); // Make sure it's invisible until properly placed into the layout w->setFrameRect(IntRect(0, 0, 0, 0)); @@ -1276,8 +1301,23 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, // FIXME: make things work for widgetless plugins as well delete object; } else { // NPAPI Plugins + Vector<String> params = paramNames; + Vector<String> values = paramValues; + if (mimeType == "application/x-shockwave-flash") { + QWebPageClient* client = m_webFrame->page()->d->client; + if (!client || !qobject_cast<QWidget*>(client->pluginParent())) { + // inject wmode=opaque when there is no client or the client is not a QWebView + size_t wmodeIndex = params.find("wmode"); + if (wmodeIndex == -1) { + params.append("wmode"); + values.append("opaque"); + } else + values[wmodeIndex] = "opaque"; + } + } + RefPtr<PluginView> pluginView = PluginView::create(m_frame, pluginSize, element, url, - paramNames, paramValues, mimeType, loadManually); + params, values, mimeType, loadManually); return pluginView; } diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index fe7590d..32b9caa 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -103,6 +103,9 @@ namespace WebCore { virtual void dispatchDidCancelClientRedirect(); virtual void dispatchWillPerformClientRedirect(const KURL&, double interval, double fireDate); virtual void dispatchDidChangeLocationWithinPage(); + virtual void dispatchDidPushStateWithinPage(); + virtual void dispatchDidReplaceStateWithinPage(); + virtual void dispatchDidPopStateWithinPage(); virtual void dispatchWillClose(); virtual void dispatchDidReceiveIcon(); virtual void dispatchDidStartProvisionalLoad(); @@ -199,7 +202,7 @@ namespace WebCore { virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType); virtual String overrideMediaType() const; - virtual void windowObjectCleared(); + virtual void dispatchDidClearWindowObjectInWorld(DOMWrapperWorld*); virtual void documentElementAvailable(); virtual void didPerformFirstNavigation() const; diff --git a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index 12f405c..d5683c4 100644 --- a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -50,8 +50,8 @@ namespace WebCore { static const QLatin1String settingStoragePrefix("Qt/QtWebKit/QWebInspector/"); static const QLatin1String settingStorageTypeSuffix(".type"); -static InspectorController::Setting variantToSetting(const QVariant& qvariant); -static QVariant settingToVariant(const InspectorController::Setting& icSetting); +static String variantToSetting(const QVariant& qvariant); +static QVariant settingToVariant(const String& value); class InspectorClientWebPage : public QWebPage { Q_OBJECT @@ -113,16 +113,11 @@ void InspectorClientQt::showWindow() updateWindowTitle(); m_inspectedWebPage->d->inspectorController()->setWindowVisible(true, true); - // We don't allow the inspector to ask for widget visibility itself because showWindow is - // not always called when we want. - // Inspecting an element or calling QWebInspector::show() should already have made the - // widget visible. } void InspectorClientQt::closeWindow() { - if (m_inspectedWebPage->d->inspector) - m_inspectedWebPage->d->inspector->close(); + m_inspectedWebPage->d->inspectorController()->setWindowVisible(false); } void InspectorClientQt::attachWindow() @@ -166,11 +161,10 @@ void InspectorClientQt::updateWindowTitle() if (m_inspectedWebPage->d->inspector) { QString caption = QCoreApplication::translate("QWebPage", "Web Inspector - %2").arg(m_inspectedURL); m_inspectedWebPage->d->inspector->setWindowTitle(caption); - emit m_inspectedWebPage->d->inspector->windowTitleChanged(caption); } } -void InspectorClientQt::populateSetting(const String& key, InspectorController::Setting& setting) +void InspectorClientQt::populateSetting(const String& key, String* setting) { QSettings qsettings; if (qsettings.status() == QSettings::AccessError) { @@ -184,10 +178,10 @@ void InspectorClientQt::populateSetting(const String& key, InspectorController:: QString storedValueType = qsettings.value(settingKey + settingStorageTypeSuffix).toString(); QVariant storedValue = qsettings.value(settingKey); storedValue.convert(QVariant::nameToType(storedValueType.toAscii().data())); - setting = variantToSetting(storedValue); + *setting = variantToSetting(storedValue); } -void InspectorClientQt::storeSetting(const String& key, const InspectorController::Setting& setting) +void InspectorClientQt::storeSetting(const String& key, const String& setting) { QSettings qsettings; if (qsettings.status() == QSettings::AccessError) { @@ -202,70 +196,24 @@ void InspectorClientQt::storeSetting(const String& key, const InspectorControlle qsettings.setValue(settingKey + settingStorageTypeSuffix, QVariant::typeToName(valueToStore.type())); } -void InspectorClientQt::removeSetting(const String&) +static String variantToSetting(const QVariant& qvariant) { - notImplemented(); -} - -static InspectorController::Setting variantToSetting(const QVariant& qvariant) -{ - InspectorController::Setting retVal; + String retVal; switch (qvariant.type()) { case QVariant::Bool: - retVal.set(qvariant.toBool()); - break; - case QVariant::Double: - retVal.set(qvariant.toDouble()); - break; - case QVariant::Int: - retVal.set((long)qvariant.toInt()); - break; + retVal = qvariant.toBool() ? "true" : "false"; case QVariant::String: - retVal.set(qvariant.toString()); - break; - case QVariant::StringList: { - QStringList qsList = qvariant.toStringList(); - int listCount = qsList.count(); - Vector<String> vector(listCount); - for (int i = 0; i < listCount; ++i) - vector[i] = qsList[i]; - retVal.set(vector); - break; - } + retVal = qvariant.toString(); } return retVal; } -static QVariant settingToVariant(const InspectorController::Setting& icSetting) +static QVariant settingToVariant(const String& setting) { QVariant retVal; - - switch (icSetting.type()) { - case InspectorController::Setting::StringType: - retVal.setValue(static_cast<QString>(icSetting.string())); - break; - case InspectorController::Setting::StringVectorType: { - const Vector<String>& vector = icSetting.stringVector(); - Vector<String>::const_iterator iter; - QStringList qsList; - for (iter = vector.begin(); iter != vector.end(); ++iter) - qsList << *iter; - retVal.setValue(qsList); - break; - } - case InspectorController::Setting::DoubleType: - retVal.setValue(icSetting.doubleValue()); - break; - case InspectorController::Setting::IntegerType: - retVal.setValue((int)icSetting.integerValue()); - break; - case InspectorController::Setting::BooleanType: - retVal.setValue(icSetting.booleanValue()); - break; - } - + retVal.setValue(static_cast<QString>(setting)); return retVal; } diff --git a/WebKit/qt/WebCoreSupport/InspectorClientQt.h b/WebKit/qt/WebCoreSupport/InspectorClientQt.h index ccf8b69..923bab4 100644 --- a/WebKit/qt/WebCoreSupport/InspectorClientQt.h +++ b/WebKit/qt/WebCoreSupport/InspectorClientQt.h @@ -66,9 +66,8 @@ namespace WebCore { virtual void hideHighlight(); virtual void inspectedURLChanged(const String& newURL); - virtual void populateSetting(const String& key, InspectorController::Setting&); - virtual void storeSetting(const String& key, const InspectorController::Setting&); - virtual void removeSetting(const String& key); + virtual void populateSetting(const String& key, String* value); + virtual void storeSetting(const String& key, const String& value); virtual void inspectorWindowObjectCleared(); |
