diff options
Diffstat (limited to 'WebKit/qt/WebCoreSupport')
21 files changed, 573 insertions, 85 deletions
diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index 9fbc5e5..3bcc8f8 100644 --- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -566,7 +566,7 @@ void ChromeClientQt::setCursor(const Cursor& cursor) return; pageClient->setCursor(*cursor.platformCursor()); #else - UNUSED_PARAM(cursor) + UNUSED_PARAM(cursor); #endif } @@ -642,7 +642,7 @@ QWebSelectMethod* ChromeClientQt::createSelectPopup() const #endif } -void ChromeClientQt::didReceiveViewportArguments(Frame* frame, const ViewportArguments& arguments) const +void ChromeClientQt::dispatchViewportDataDidChange(const ViewportArguments&) const { emit m_webPage->viewportChangeRequested(); } diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/WebKit/qt/WebCoreSupport/ChromeClientQt.h index 56801aa..0a449f6 100644 --- a/WebKit/qt/WebCoreSupport/ChromeClientQt.h +++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.h @@ -177,7 +177,7 @@ namespace WebCore { QWebSelectMethod* createSelectPopup() const; - virtual void didReceiveViewportArguments(Frame*, const ViewportArguments&) const; + virtual void dispatchViewportDataDidChange(const ViewportArguments&) const; QWebPage* m_webPage; WebCore::KURL lastHoverURL; diff --git a/WebKit/qt/WebCoreSupport/DeviceMotionClientQt.cpp b/WebKit/qt/WebCoreSupport/DeviceMotionClientQt.cpp new file mode 100644 index 0000000..4761514 --- /dev/null +++ b/WebKit/qt/WebCoreSupport/DeviceMotionClientQt.cpp @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 "DeviceMotionClientQt.h" + +#include "DeviceMotionController.h" +#include "DeviceMotionProviderQt.h" + +#include "qwebpage.h" + +namespace WebCore { + +DeviceMotionClientQt::DeviceMotionClientQt(QWebPage* page) + : m_page(page) + , m_controller(0) + , m_provider(new DeviceMotionProviderQt()) +{ + + connect(m_provider, SIGNAL(deviceMotionChanged()), SLOT(changeDeviceMotion())); +} + +DeviceMotionClientQt::~DeviceMotionClientQt() +{ + disconnect(); + delete m_provider; +} + +void DeviceMotionClientQt::setController(DeviceMotionController* controller) +{ + m_controller = controller; +} + +void DeviceMotionClientQt::startUpdating() +{ + m_provider->start(); +} + +void DeviceMotionClientQt::stopUpdating() +{ + m_provider->stop(); +} + +DeviceMotionData* DeviceMotionClientQt::currentDeviceMotion() const +{ + return m_provider->currentDeviceMotion(); +} + +void DeviceMotionClientQt::deviceMotionControllerDestroyed() +{ + delete this; +} + +void DeviceMotionClientQt::changeDeviceMotion() +{ + if (!m_controller) + return; + + m_controller->didChangeDeviceMotion(currentDeviceMotion()); +} + +} // namespace WebCore + +#include "moc_DeviceMotionClientQt.cpp" diff --git a/WebKit/qt/WebCoreSupport/DeviceMotionClientQt.h b/WebKit/qt/WebCoreSupport/DeviceMotionClientQt.h new file mode 100644 index 0000000..ea843e2 --- /dev/null +++ b/WebKit/qt/WebCoreSupport/DeviceMotionClientQt.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 DeviceMotionClientQt_h +#define DeviceMotionClientQt_h + +#include "DeviceMotionClient.h" +#include "DeviceMotionData.h" + +#include <QObject> + +class QWebPage; + +namespace WebCore { + +class DeviceMotionProviderQt; + +class DeviceMotionClientQt : public QObject, public DeviceMotionClient { + Q_OBJECT +public: + DeviceMotionClientQt(QWebPage*); + virtual ~DeviceMotionClientQt(); + + virtual void setController(DeviceMotionController*); + virtual void startUpdating(); + virtual void stopUpdating(); + virtual DeviceMotionData* currentDeviceMotion() const; + virtual void deviceMotionControllerDestroyed(); + +public Q_SLOTS: + void changeDeviceMotion(); + +private: + QWebPage* m_page; + DeviceMotionController* m_controller; + DeviceMotionProviderQt* m_provider; +}; + +} // namespece WebCore + +#endif // DeviceMotionClientQt_h diff --git a/WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.cpp b/WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.cpp new file mode 100644 index 0000000..ccf7697 --- /dev/null +++ b/WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.cpp @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 "DeviceMotionProviderQt.h" + +#include "DeviceOrientationProviderQt.h" + +namespace WebCore { + +DeviceMotionProviderQt::DeviceMotionProviderQt() +{ + m_acceleration.addFilter(this); + m_motion = DeviceMotionData::create(); + m_deviceOrientation = new DeviceOrientationProviderQt(); +} + +DeviceMotionProviderQt::~DeviceMotionProviderQt() +{ + delete m_deviceOrientation; +} + +void DeviceMotionProviderQt::start() +{ + m_acceleration.start(); + m_deviceOrientation->start(); +} + +void DeviceMotionProviderQt::stop() +{ + m_acceleration.stop(); + m_deviceOrientation->stop(); +} + +bool DeviceMotionProviderQt::filter(QAccelerometerReading* reading) +{ + RefPtr<DeviceMotionData::Acceleration> accel = DeviceMotionData::Acceleration::create( + /* x available */ true, reading->x(), + /* y available */ true, reading->y(), + /* z available */ true, reading->z()); + + RefPtr<DeviceMotionData::RotationRate> rotation = DeviceMotionData::RotationRate::create( + m_deviceOrientation->hasAlpha(), m_deviceOrientation->orientation()->alpha(), + /* beta available */ true, m_deviceOrientation->orientation()->beta(), + /* gamma available */ true, m_deviceOrientation->orientation()->gamma()); + + m_motion = DeviceMotionData::create(accel, + accel, /* FIXME: Needs to provide acceleration include gravity. */ + rotation, + false, 0 /* The interval is treated internally by Qt mobility */); + + emit deviceMotionChanged(); + + return false; +} + +} // namespace WebCore + +#include "moc_DeviceMotionProviderQt.cpp" diff --git a/WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.h b/WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.h new file mode 100644 index 0000000..f3200d5 --- /dev/null +++ b/WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 DeviceMotionProviderQt_h +#define DeviceMotionProviderQt_h + +#include "DeviceMotionData.h" +#include "RefPtr.h" + +#include <QAccelerometerFilter> +#include <QObject> + +QTM_USE_NAMESPACE + +namespace WebCore { + +class DeviceOrientationProviderQt; + +class DeviceMotionProviderQt : public QObject, public QAccelerometerFilter { + Q_OBJECT +public: + DeviceMotionProviderQt(); + ~DeviceMotionProviderQt(); + + bool filter(QAccelerometerReading*); + void start(); + void stop(); + DeviceMotionData* currentDeviceMotion() const { return m_motion.get(); } + +Q_SIGNALS: + void deviceMotionChanged(); + +private: + RefPtr<DeviceMotionData> m_motion; + QAccelerometer m_acceleration; + DeviceOrientationProviderQt* m_deviceOrientation; +}; + +} // namespace WebCore + +#endif // DeviceMotionProviderQt_h diff --git a/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.cpp b/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.cpp new file mode 100644 index 0000000..1d0c6d1 --- /dev/null +++ b/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.cpp @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 "DeviceOrientationClientQt.h" + +#include "DeviceOrientationController.h" +#include "DeviceOrientationProviderQt.h" +#include "qwebpage.h" + +namespace WebCore { + +DeviceOrientationClientQt::DeviceOrientationClientQt(QWebPage* page) + : m_page(page) + , m_controller(0) + , m_provider(new DeviceOrientationProviderQt()) +{ + connect(m_provider, SIGNAL(deviceOrientationChanged(DeviceOrientation*)), SLOT(changeDeviceOrientation(DeviceOrientation*))); +} + +DeviceOrientationClientQt::~DeviceOrientationClientQt() +{ + disconnect(); + delete m_provider; +} + +void DeviceOrientationClientQt::setController(DeviceOrientationController* controller) +{ + m_controller = controller; +} + +void DeviceOrientationClientQt::startUpdating() +{ + m_provider->start(); +} + +void DeviceOrientationClientQt::stopUpdating() +{ + m_provider->stop(); +} + +DeviceOrientation* DeviceOrientationClientQt::lastOrientation() const +{ + return m_provider->orientation(); +} + +void DeviceOrientationClientQt::deviceOrientationControllerDestroyed() +{ + delete this; +} + +void DeviceOrientationClientQt::changeDeviceOrientation(DeviceOrientation* orientation) +{ + if (!m_controller) + return; + + m_controller->didChangeDeviceOrientation(orientation); +} + +} // namespace WebCore + +#include "moc_DeviceOrientationClientQt.cpp" diff --git a/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h b/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h new file mode 100644 index 0000000..61968c4 --- /dev/null +++ b/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 DeviceOrientationClientQt_h +#define DeviceOrientationClientQt_h + +#include "DeviceOrientation.h" +#include "DeviceOrientationClient.h" + +#include <QObject> + +class QWebPage; + +namespace WebCore { + +class DeviceOrientationProviderQt; + +class DeviceOrientationClientQt : public QObject, public DeviceOrientationClient { + Q_OBJECT +public: + DeviceOrientationClientQt(QWebPage*); + virtual ~DeviceOrientationClientQt(); + + virtual void setController(DeviceOrientationController*); + virtual void startUpdating(); + virtual void stopUpdating(); + virtual DeviceOrientation* lastOrientation() const; + virtual void deviceOrientationControllerDestroyed(); + +public Q_SLOTS: + void changeDeviceOrientation(DeviceOrientation*); + +private: + QWebPage* m_page; + DeviceOrientationController* m_controller; + DeviceOrientationProviderQt* m_provider; +}; + +} // namespace WebCore + +#endif // DeviceOrientationClientQt_h diff --git a/WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.cpp b/WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.cpp new file mode 100644 index 0000000..051eba0 --- /dev/null +++ b/WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.cpp @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 "DeviceOrientationProviderQt.h" + +namespace WebCore { + +DeviceOrientationProviderQt::DeviceOrientationProviderQt() +{ + m_rotation.addFilter(this); + m_orientation = DeviceOrientation::create(); +} + +DeviceOrientationProviderQt::~DeviceOrientationProviderQt() +{ +} + +void DeviceOrientationProviderQt::start() +{ + m_rotation.start(); +} + +void DeviceOrientationProviderQt::stop() +{ + m_rotation.stop(); +} + +bool DeviceOrientationProviderQt::filter(QRotationReading* reading) +{ + // Provide device orientation data according W3C spec: + // http://dev.w3.org/geo/api/spec-source-orientation.html + // Qt mobility provide these data via QRotationSensor using the + // QRotationReading class: + // - the rotation around z axis (alpha) is given as z in QRotationReading; + // - the rotation around x axis (beta) is given as x in QRotationReading; + // - the rotation around y axis (gamma) is given as y in QRotationReading; + // See: http://doc.qt.nokia.com/qtmobility-1.0/qrotationreading.html + // The Z (alpha) rotation angle is checked via hasAlpha() private method, + // depending if the device is able do detect the alpha rotation. X (beta) and + // Y (gamma) axis are availble in this context. + m_orientation = DeviceOrientation::create(hasAlpha(), reading->z(), + /* x available */ true, reading->x(), + /* y available */ true, reading->y()); + emit deviceOrientationChanged(m_orientation.get()); + + return false; +} + +} + +#include "moc_DeviceOrientationProviderQt.cpp" diff --git a/WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.h b/WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.h new file mode 100644 index 0000000..86c224e --- /dev/null +++ b/WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * 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 DeviceOrientationProviderQt_h +#define DeviceOrientationProviderQt_h + +#include "DeviceOrientation.h" +#include "RefPtr.h" + +#include <QObject> +#include <QRotationFilter> + +QTM_USE_NAMESPACE + +namespace WebCore { + +class DeviceOrientationClientQt; + +class DeviceOrientationProviderQt : public QObject, public QRotationFilter { + Q_OBJECT +public: + DeviceOrientationProviderQt(); + ~DeviceOrientationProviderQt(); + + bool filter(QRotationReading*); + void start(); + void stop(); + bool isActive() const { return m_rotation.isActive(); } + DeviceOrientation* orientation() const { return m_orientation.get(); } + bool hasAlpha() const { return m_rotation.property("hasZ").toBool(); } + +Q_SIGNALS: + void deviceOrientationChanged(DeviceOrientation*); + +private: + RefPtr<DeviceOrientation> m_orientation; + QRotationSensor m_rotation; +}; + +} + +#endif // DeviceOrientationProviderQt_h diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index 836df49..28f6810 100644 --- a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -631,8 +631,8 @@ void DumpRenderTreeSupportQt::dumpNotification(bool b) QString DumpRenderTreeSupportQt::viewportAsText(QWebPage* page, const QSize& availableSize) { - WebCore::ViewportArguments args = page->mainFrame()->d->viewportArguments(); - WebCore::ViewportConfiguration conf = WebCore::findConfigurationForViewportData(args, + WebCore::ViewportArguments args = page->d->viewportArguments(); + WebCore::ViewportAttributes conf = WebCore::computeViewportAttributes(args, /* desktop-width */ 980, /* device-width */ 320, /* device-height */ 480, @@ -641,8 +641,8 @@ QString DumpRenderTreeSupportQt::viewportAsText(QWebPage* page, const QSize& ava QString res; res = res.sprintf("viewport size %dx%d scale %f with limits [%f, %f]\n", - conf.layoutViewport.width(), - conf.layoutViewport.height(), + conf.layoutSize.width(), + conf.layoutSize.height(), conf.initialScale, conf.minimumScale, conf.maximumScale); @@ -764,6 +764,15 @@ void DumpRenderTreeSupportQt::simulateDesktopNotificationClick(const QString& ti #endif } +QString DumpRenderTreeSupportQt::plainText(const QVariant& range) +{ + QMap<QString, QVariant> map = range.toMap(); + QVariant startContainer = map.value("startContainer"); + map = startContainer.toMap(); + + return map.value("innerText").toString(); +} + // 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 5a59475..0e76f04 100644 --- a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h +++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h @@ -98,6 +98,7 @@ public: static QString markerTextForListItem(const QWebElement& listItem); static QVariantMap computedStyleIncludingVisitedInfo(const QWebElement& element); + static QString plainText(const QVariant& rng); static void dumpFrameLoader(bool b); static void dumpResourceLoadCallbacks(bool b); diff --git a/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp index 9db4333..2dd3b37 100644 --- a/WebKit/qt/WebCoreSupport/EditorClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp @@ -457,39 +457,7 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event) m_page->triggerAction(QWebPage::Copy); else #endif // QT_NO_SHORTCUT - switch (kevent->windowsVirtualKeyCode()) { - case VK_UP: - frame->editor()->command("MoveUp").execute(); - break; - case VK_DOWN: - frame->editor()->command("MoveDown").execute(); - break; - case VK_PRIOR: // PageUp - frame->editor()->command("MovePageUp").execute(); - break; - case VK_NEXT: // PageDown - frame->editor()->command("MovePageDown").execute(); - break; - case VK_HOME: - if (kevent->ctrlKey()) - frame->editor()->command("MoveToBeginningOfDocument").execute(); - break; - case VK_END: - if (kevent->ctrlKey()) - frame->editor()->command("MoveToEndOfDocument").execute(); - break; - default: - if (kevent->ctrlKey()) { - switch (kevent->windowsVirtualKeyCode()) { - case VK_A: - frame->editor()->command("SelectAll").execute(); - break; - default: - return; - } - } else - return; - } + return; } event->setDefaultHandled(); } diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 41bcb3c..4ebc7e1 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -64,7 +64,6 @@ #include "ResourceHandleInternal.h" #include "ResourceHandle.h" #include "ScriptController.h" -#include "ScriptString.h" #include "Settings.h" #include "QWebPageClient.h" #include "ViewportArguments.h" @@ -1505,6 +1504,7 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, else { // NPAPI Plugins Vector<String> params = paramNames; Vector<String> values = paramValues; +#if !OS(SYMBIAN) if (mimeType == "application/x-shockwave-flash") { QWebPageClient* client = m_webFrame->page()->d->client; const bool isQWebView = client && qobject_cast<QWidget*>(client->pluginParent()); @@ -1530,6 +1530,7 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, } #endif } +#endif RefPtr<PluginView> pluginView = PluginView::create(m_frame, pluginSize, element, url, params, values, mimeType, loadManually); diff --git a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index b6673e6..e596870 100644 --- a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -39,7 +39,6 @@ #include "NotImplemented.h" #include "Page.h" #include "PlatformString.h" -#include "ScriptController.h" #include "ScriptDebugServer.h" #include "qwebinspector.h" #include "qwebinspector_p.h" @@ -266,22 +265,7 @@ bool InspectorClientQt::sendMessageToFrontend(const String& message) return false; Page* frontendPage = QWebPagePrivate::core(m_frontendWebPage); - if (!frontendPage) - return false; - - Frame* frame = frontendPage->mainFrame(); - if (!frame) - return false; - - ScriptController* scriptController = frame->script(); - if (!scriptController) - return false; - - String dispatchToFrontend("WebInspector.dispatchMessageFromBackend("); - dispatchToFrontend += message; - dispatchToFrontend += ");"; - scriptController->executeScript(dispatchToFrontend); - return true; + return doDispatchMessageOnFrontendPage(frontendPage, message); } static String variantToSetting(const QVariant& qvariant) diff --git a/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp b/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp index fad7247..a6dda58 100644 --- a/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp +++ b/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp @@ -37,6 +37,7 @@ #include <QUrl> #include <QWidget> #include <qendian.h> +#include <wtf/text/CString.h> namespace WebCore { diff --git a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp index 7b33d9e..0324c0d 100644 --- a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp @@ -40,6 +40,7 @@ #include "QtPlatformPlugin.h" #include "ScriptExecutionContext.h" #include "SecurityOrigin.h" +#include "UserGestureIndicator.h" #include "qwebframe_p.h" #include "qwebkitglobal.h" @@ -262,8 +263,11 @@ void NotificationPresenterClientQt::cancel(NotificationWrapper* wrapper) void NotificationPresenterClientQt::notificationClicked(NotificationWrapper* wrapper) { Notification* notification = notificationForWrapper(wrapper); - if (notification) + if (notification) { + // Make sure clicks on notifications are treated as user gestures. + UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); sendEvent(notification, eventNames().clickEvent); + } } void NotificationPresenterClientQt::notificationClicked(const QString& title) diff --git a/WebKit/qt/WebCoreSupport/PageClientQt.cpp b/WebKit/qt/WebCoreSupport/PageClientQt.cpp index ea209d9..9aa01a2 100644 --- a/WebKit/qt/WebCoreSupport/PageClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/PageClientQt.cpp @@ -105,6 +105,7 @@ QRectF PageClientQWidget::windowRect() const PageClientQGraphicsWidget::~PageClientQGraphicsWidget() { + delete overlay; #if USE(ACCELERATED_COMPOSITING) if (!rootGraphicsLayer) return; @@ -117,10 +118,6 @@ PageClientQGraphicsWidget::~PageClientQGraphicsWidget() void PageClientQGraphicsWidget::scroll(int dx, int dy, const QRect& rectToScroll) { view->scroll(qreal(dx), qreal(dy), rectToScroll); - -#if USE(ACCELERATED_COMPOSITING) - updateCompositingScrollPosition(); -#endif } void PageClientQGraphicsWidget::update(const QRect& dirtyRect) @@ -132,8 +129,6 @@ void PageClientQGraphicsWidget::update(const QRect& dirtyRect) overlay->update(QRectF(dirtyRect)); #if USE(ACCELERATED_COMPOSITING) syncLayers(); - // This might be a slow-scroll. We ensure that the compositing layers are in the right position. - updateCompositingScrollPosition(); #endif } @@ -150,11 +145,15 @@ void PageClientQGraphicsWidget::createOrDeleteOverlay() } if (useOverlay == !!overlay) return; + if (useOverlay) { - overlay = QSharedPointer<QGraphicsItemOverlay>(new QGraphicsItemOverlay(view, page)); + overlay = new QGraphicsItemOverlay(view, page); overlay->setZValue(OverlayZValue); - } else - overlay.clear(); + } else { + // Changing the overlay might be done inside paint events. + overlay->deleteLater(); + overlay = 0; + } } #if USE(ACCELERATED_COMPOSITING) @@ -180,7 +179,6 @@ void PageClientQGraphicsWidget::setRootGraphicsLayer(QGraphicsItem* layer) layer->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); layer->setParentItem(view); layer->setZValue(RootGraphicsLayerZValue); - updateCompositingScrollPosition(); } createOrDeleteOverlay(); } @@ -192,13 +190,6 @@ void PageClientQGraphicsWidget::markForSync(bool scheduleSync) syncMetaMethod.invoke(view, Qt::QueuedConnection); } -void PageClientQGraphicsWidget::updateCompositingScrollPosition() -{ - if (rootGraphicsLayer && page && page->mainFrame()) { - const QPoint scrollPosition = page->mainFrame()->scrollPosition(); - rootGraphicsLayer.data()->setPos(-scrollPosition); - } -} #endif #if ENABLE(TILED_BACKING_STORE) diff --git a/WebKit/qt/WebCoreSupport/PageClientQt.h b/WebKit/qt/WebCoreSupport/PageClientQt.h index eea7f40..7014fd2 100644 --- a/WebKit/qt/WebCoreSupport/PageClientQt.h +++ b/WebKit/qt/WebCoreSupport/PageClientQt.h @@ -32,7 +32,6 @@ #include "qwebpage.h" #include "qwebpage_p.h" #include <QtCore/qmetaobject.h> -#include <QtCore/qsharedpointer.h> #include <QtGui/qgraphicsscene.h> #include <QtGui/qgraphicsview.h> #include <QtGui/qgraphicswidget.h> @@ -83,10 +82,10 @@ public: // the overlay is here for one reason only: to have the scroll-bars and other // extra UI elements appear on top of any QGraphicsItems created by CSS compositing layers -class QGraphicsItemOverlay : public QGraphicsItem { +class QGraphicsItemOverlay : public QGraphicsObject { public: QGraphicsItemOverlay(QGraphicsWidget* view, QWebPage* p) - :QGraphicsItem(view) + :QGraphicsObject(view) , q(view) , page(p) { @@ -124,6 +123,7 @@ public: #if USE(ACCELERATED_COMPOSITING) , shouldSync(false) #endif + , overlay(0) { Q_ASSERT(view); #if USE(ACCELERATED_COMPOSITING) @@ -170,7 +170,6 @@ public: #if USE(ACCELERATED_COMPOSITING) virtual void setRootGraphicsLayer(QGraphicsItem* layer); virtual void markForSync(bool scheduleSync); - void updateCompositingScrollPosition(); void syncLayers(); // QGraphicsWebView can render composited layers @@ -194,7 +193,7 @@ public: bool shouldSync; #endif // the overlay gets instantiated when the root layer is attached, and get deleted when it's detached - QSharedPointer<QGraphicsItemOverlay> overlay; + QGraphicsItemOverlay* overlay; // we need to put the root graphics layer behind the overlay (which contains the scrollbar) enum { RootGraphicsLayerZValue, OverlayZValue }; diff --git a/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp b/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp index 56a0fac..9b34955 100644 --- a/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp +++ b/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp @@ -127,7 +127,7 @@ void PopupMenuQt::didHide() void PopupMenuQt::hide() { - if (!m_popup) + if (m_popup) m_popup->hide(); } diff --git a/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp b/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp index 1f91d8c..9786967 100644 --- a/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp +++ b/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp @@ -91,20 +91,20 @@ QWebKitPlatformPlugin* QtPlatformPlugin::plugin() QWebSelectMethod* QtPlatformPlugin::createSelectInputMethod() { QWebKitPlatformPlugin* p = plugin(); - return p ? qobject_cast<QWebSelectMethod*>(p->createExtension(QWebKitPlatformPlugin::MultipleSelections)) : 0; + return p ? static_cast<QWebSelectMethod*>(p->createExtension(QWebKitPlatformPlugin::MultipleSelections)) : 0; } QWebNotificationPresenter* QtPlatformPlugin::createNotificationPresenter() { QWebKitPlatformPlugin* p = plugin(); - return p ? qobject_cast<QWebNotificationPresenter*>(p->createExtension(QWebKitPlatformPlugin::Notifications)) : 0; + return p ? static_cast<QWebNotificationPresenter*>(p->createExtension(QWebKitPlatformPlugin::Notifications)) : 0; } QWebHapticFeedbackPlayer* QtPlatformPlugin::createHapticFeedbackPlayer() { QWebKitPlatformPlugin* p = plugin(); - return p ? qobject_cast<QWebHapticFeedbackPlayer*>(p->createExtension(QWebKitPlatformPlugin::Haptics)) : 0; + return p ? static_cast<QWebHapticFeedbackPlayer*>(p->createExtension(QWebKitPlatformPlugin::Haptics)) : 0; } } |