diff options
Diffstat (limited to 'WebKit/qt')
39 files changed, 1186 insertions, 251 deletions
diff --git a/WebKit/qt/Api/DerivedSources.pro b/WebKit/qt/Api/DerivedSources.pro index 6fb52f2..d8bd1db 100644 --- a/WebKit/qt/Api/DerivedSources.pro +++ b/WebKit/qt/Api/DerivedSources.pro @@ -10,7 +10,7 @@ DESTDIR = ../../../include/QtWebKit QUOTE = "" DOUBLE_ESCAPED_QUOTE = "" ESCAPE = "" -win32-msvc* | (contains(QMAKE_HOST.os, "Windows"):isEmpty(QMAKE_SH)) { +win32-msvc* | wince* | contains(QMAKE_HOST.os, "Windows"):isEmpty(QMAKE_SH) { # MinGW's make will run makefile commands using sh, even if make # was run from the Windows shell, if it finds sh in the path. ESCAPE = "^" diff --git a/WebKit/qt/Api/qgraphicswebview.cpp b/WebKit/qt/Api/qgraphicswebview.cpp index 7f66d98..36d4326 100644 --- a/WebKit/qt/Api/qgraphicswebview.cpp +++ b/WebKit/qt/Api/qgraphicswebview.cpp @@ -75,7 +75,6 @@ public: QGraphicsWebView* q; QWebPage* page; bool resizesToContents; - QSize deviceSize; // Just a convenience to avoid using page->client->overlay always QSharedPointer<QGraphicsItemOverlay> overlay; @@ -131,13 +130,8 @@ void QGraphicsWebViewPrivate::updateResizesToContentsForPage() if (!page->preferredContentsSize().isValid()) page->setPreferredContentsSize(QSize(960, 800)); -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) QObject::connect(page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), q, SLOT(_q_contentsSizeChanged(const QSize&)), Qt::UniqueConnection); -#else - QObject::connect(page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), - q, SLOT(_q_contentsSizeChanged(const QSize&))); -#endif } else { QObject::disconnect(page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), q, SLOT(_q_contentsSizeChanged(const QSize&))); @@ -243,14 +237,10 @@ QGraphicsWebView::QGraphicsWebView(QGraphicsItem* parent) : QGraphicsWidget(parent) , d(new QGraphicsWebViewPrivate(this)) { -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, true); -#endif setAcceptDrops(true); setAcceptHoverEvents(true); -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) setAcceptTouchEvents(true); -#endif setFocusPolicy(Qt::StrongFocus); setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); #if ENABLE(TILED_BACKING_STORE) @@ -316,7 +306,6 @@ bool QGraphicsWebView::sceneEvent(QEvent* event) { // Re-implemented in order to allows fixing event-related bugs in patch releases. -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) if (d->page && (event->type() == QEvent::TouchBegin || event->type() == QEvent::TouchEnd || event->type() == QEvent::TouchUpdate)) { @@ -325,7 +314,6 @@ bool QGraphicsWebView::sceneEvent(QEvent* event) // Always return true so that we'll receive also TouchUpdate and TouchEnd events return true; } -#endif return QGraphicsWidget::sceneEvent(event); } @@ -419,11 +407,7 @@ void QGraphicsWebViewPrivate::detachCurrentPage() if (!page) return; -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) page->d->view.clear(); -#else - page->d->view = 0; -#endif // The client has always to be deleted. delete page->d->client; @@ -555,24 +539,6 @@ QIcon QGraphicsWebView::icon() const } /*! - \property QGraphicsWebView::deviceSize - \brief the size of the device using the web view - - The device size is used by the DOM window object methods - otherHeight(), otherWidth() as well as a page for the viewport - meta tag attributes device-width and device-height. -*/ -void QGraphicsWebView::setDeviceSize(const QSize& size) -{ - d->deviceSize = size; -} - -QSize QGraphicsWebView::deviceSize() const -{ - return d->deviceSize; -} - -/*! \property QGraphicsWebView::zoomFactor \brief the zoom factor for the view */ diff --git a/WebKit/qt/Api/qgraphicswebview.h b/WebKit/qt/Api/qgraphicswebview.h index 77f0359..8620ac5 100644 --- a/WebKit/qt/Api/qgraphicswebview.h +++ b/WebKit/qt/Api/qgraphicswebview.h @@ -41,7 +41,6 @@ class QWEBKIT_EXPORT QGraphicsWebView : public QGraphicsWidget { Q_PROPERTY(QString title READ title NOTIFY titleChanged) Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged) Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor) - Q_PROPERTY(QSize deviceSize READ deviceSize WRITE setDeviceSize) Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) @@ -65,9 +64,6 @@ public: qreal zoomFactor() const; void setZoomFactor(qreal); - QSize deviceSize() const; - void setDeviceSize(const QSize&); - bool isModified() const; void load(const QUrl& url); diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp index 46580bb..1791096 100644 --- a/WebKit/qt/Api/qwebframe.cpp +++ b/WebKit/qt/Api/qwebframe.cpp @@ -230,6 +230,14 @@ void QWebFramePrivate::init(QWebFrame *qframe, QWebFrameData *frameData) frame->init(); } +WebCore::ViewportArguments QWebFramePrivate::viewportArguments() +{ + if (!frame || !frame->document()) + return WebCore::ViewportArguments(); + + return frame->document()->viewportArguments(); +} + void QWebFramePrivate::setPage(QWebPage* newPage) { if (page == newPage) @@ -781,11 +789,9 @@ void QWebFrame::load(const QNetworkRequest &req, case QNetworkAccessManager::PostOperation: request.setHTTPMethod("POST"); break; -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) case QNetworkAccessManager::DeleteOperation: request.setHTTPMethod("DELETE"); break; -#endif case QNetworkAccessManager::UnknownOperation: // eh? break; diff --git a/WebKit/qt/Api/qwebframe_p.h b/WebKit/qt/Api/qwebframe_p.h index 6d6eca1..5ba3f52 100644 --- a/WebKit/qt/Api/qwebframe_p.h +++ b/WebKit/qt/Api/qwebframe_p.h @@ -90,6 +90,8 @@ public: void renderFromTiledBackingStore(WebCore::GraphicsContext*, const QRegion& clip); #endif + WebCore::ViewportArguments viewportArguments(); + QWebFrame *q; Qt::ScrollBarPolicy horizontalScrollBarPolicy; Qt::ScrollBarPolicy verticalScrollBarPolicy; @@ -101,7 +103,6 @@ public: int marginWidth; int marginHeight; bool zoomTextOnly; - WebCore::ViewportArguments viewportArguments; }; class QWebHitTestResultPrivate { diff --git a/WebKit/qt/Api/qwebinspector.cpp b/WebKit/qt/Api/qwebinspector.cpp index 802ea98..27148f7 100644 --- a/WebKit/qt/Api/qwebinspector.cpp +++ b/WebKit/qt/Api/qwebinspector.cpp @@ -196,6 +196,31 @@ void QWebInspectorPrivate::setFrontend(QWidget* newFrontend) } } +/*! + * \internal + */ +void QWebInspectorPrivate::attachAndReplaceRemoteFrontend(QObject* newRemoteFrontend) +{ + if (remoteFrontend) + remoteFrontend->setParent(0); + + remoteFrontend = newRemoteFrontend; + + if (remoteFrontend) + remoteFrontend->setParent(q); +} + +/*! + * \internal + */ +void QWebInspectorPrivate::detachRemoteFrontend() +{ + if (remoteFrontend) { + remoteFrontend->deleteLater(); + remoteFrontend = 0; + } +} + void QWebInspectorPrivate::adjustFrontendSize(const QSize& size) { if (frontend) diff --git a/WebKit/qt/Api/qwebinspector_p.h b/WebKit/qt/Api/qwebinspector_p.h index 4d327cc..3099eb1 100644 --- a/WebKit/qt/Api/qwebinspector_p.h +++ b/WebKit/qt/Api/qwebinspector_p.h @@ -33,14 +33,18 @@ public: : q(qq) , page(0) , frontend(0) + , remoteFrontend(0) {} void setFrontend(QWidget* newFrontend); + void attachAndReplaceRemoteFrontend(QObject* newRemoteFrontend); + void detachRemoteFrontend(); void adjustFrontendSize(const QSize& size); QWebInspector* q; QWebPage* page; QWidget* frontend; + QObject* remoteFrontend; }; #endif diff --git a/WebKit/qt/Api/qwebkitplatformplugin.h b/WebKit/qt/Api/qwebkitplatformplugin.h index 76496c5..a851d56 100644 --- a/WebKit/qt/Api/qwebkitplatformplugin.h +++ b/WebKit/qt/Api/qwebkitplatformplugin.h @@ -84,9 +84,13 @@ Q_SIGNALS: void notificationClicked(); }; -class QWebHapticFeedbackPlayer +class QWebHapticFeedbackPlayer: public QObject { + Q_OBJECT public: + QWebHapticFeedbackPlayer() {} + virtual ~QWebHapticFeedbackPlayer() {} + enum HapticStrength { None, Weak, Medium, Strong }; @@ -110,12 +114,9 @@ public: }; virtual bool supportsExtension(Extension extension) const = 0; - virtual QWebSelectMethod* createSelectInputMethod() const = 0; - virtual QWebNotificationPresenter* createNotificationPresenter() const = 0; - virtual QWebHapticFeedbackPlayer* createHapticFeedbackPlayer() const = 0; - + virtual QObject* createExtension(Extension extension) const = 0; }; -Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.4"); +Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.5"); #endif // QWEBKITPLATFORMPLUGIN_H diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp index 181b3a6..932103d 100644 --- a/WebKit/qt/Api/qwebpage.cpp +++ b/WebKit/qt/Api/qwebpage.cpp @@ -21,6 +21,7 @@ #include "config.h" #include "qwebpage.h" + #include "qwebview.h" #include "qwebframe.h" #include "qwebpage_p.h" @@ -77,6 +78,7 @@ #include "HTMLInputElement.h" #include "HTMLNames.h" #include "HitTestResult.h" +#include "InspectorServerQt.h" #include "WindowFeatures.h" #include "WebPlatformStrategies.h" #include "LocalizedStrings.h" @@ -86,6 +88,7 @@ #include "GeolocationPermissionClientQt.h" #include "NotificationPresenterClientQt.h" #include "PageClientQt.h" +#include "PlatformTouchEvent.h" #include "WorkerThread.h" #include "wtf/Threading.h" @@ -93,6 +96,7 @@ #include <QBasicTimer> #include <QBitArray> #include <QDebug> +#include <QDesktopWidget> #include <QDragEnterEvent> #include <QDragLeaveEvent> #include <QDragMoveEvent> @@ -112,16 +116,13 @@ #include <QSysInfo> #include <QTextCharFormat> #include <QTextDocument> +#include <QTouchEvent> #include <QNetworkAccessManager> #include <QNetworkRequest> #if defined(Q_WS_X11) #include <QX11Info> #endif -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) -#include <QTouchEvent> -#include "PlatformTouchEvent.h" -#endif using namespace WebCore; @@ -254,12 +255,29 @@ static inline Qt::DropAction dragOpToDropAction(unsigned actions) QWebPagePrivate::QWebPagePrivate(QWebPage *qq) : q(qq) + , page(0) , client(0) -#if QT_VERSION < QT_VERSION_CHECK(4, 6, 0) - , view(0) + , mainFrame(0) +#ifndef QT_NO_UNDOSTACK + , undoStack(0) #endif + , insideOpenCall(false) + , m_totalBytes(0) + , m_bytesReceived() , clickCausedFocus(false) + , networkManager(0) + , forwardUnsupportedContent(false) + , smartInsertDeleteEnabled(true) + , selectTrailingWhitespaceEnabled(false) + , linkPolicy(QWebPage::DontDelegateLinks) , viewportSize(QSize(0, 0)) +#ifndef QT_NO_CONTEXTMENU + , currentContextMenu(0) +#endif + , settings(0) + , editable(false) + , useFixedLayout(false) + , pluginFactory(0) , inspectorFrontend(0) , inspector(0) , inspectorIsInternalOnly(false) @@ -272,7 +290,7 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) WebCore::Font::setCodePath(WebCore::Font::Complex); #endif - WebPlatformStrategies::initialize(qq); + WebPlatformStrategies::initialize(); Page::PageClients pageClients; pageClients.chromeClient = new ChromeClientQt(q); @@ -284,23 +302,6 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) settings = new QWebSettings(page->settings()); -#ifndef QT_NO_UNDOSTACK - undoStack = 0; -#endif - mainFrame = 0; - networkManager = 0; - pluginFactory = 0; - insideOpenCall = false; - forwardUnsupportedContent = false; - editable = false; - useFixedLayout = false; - linkPolicy = QWebPage::DontDelegateLinks; -#ifndef QT_NO_CONTEXTMENU - currentContextMenu = 0; -#endif - smartInsertDeleteEnabled = true; - selectTrailingWhitespaceEnabled = false; - history.d = new QWebHistoryPrivate(page->backForwardList()); memset(actions, 0, sizeof(actions)); @@ -793,7 +794,6 @@ void QWebPagePrivate::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev) void QWebPagePrivate::handleSoftwareInputPanel(Qt::MouseButton button) { -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) Frame* frame = page->focusController()->focusedFrame(); if (!frame) return; @@ -810,7 +810,6 @@ void QWebPagePrivate::handleSoftwareInputPanel(Qt::MouseButton button) } clickCausedFocus = false; -#endif } void QWebPagePrivate::mouseReleaseEvent(QMouseEvent *ev) @@ -1136,9 +1135,7 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) { WebCore::Frame *frame = page->focusController()->focusedOrMainFrame(); WebCore::Editor *editor = frame->editor(); -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) QInputMethodEvent::Attribute selection(QInputMethodEvent::Selection, 0, 0, QVariant()); -#endif if (!editor->canEdit()) { ev->ignore(); @@ -1177,13 +1174,11 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) } break; } -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) case QInputMethodEvent::Selection: { selection = a; hasSelection = true; break; } -#endif } } @@ -1195,7 +1190,6 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) // 3. populated preedit with a selection attribute, and start/end of 0 or non-0 updates selection of supplied preedit text // 4. otherwise event is updating supplied pre-edit text QString preedit = ev->preeditString(); -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) if (hasSelection) { QString text = (renderTextControl) ? QString(renderTextControl->text()) : QString(); if (preedit.isEmpty() && selection.start + selection.length > 0) @@ -1203,10 +1197,8 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) editor->setComposition(preedit, underlines, (selection.length < 0) ? selection.start + selection.length : selection.start, (selection.length < 0) ? selection.start : selection.start + selection.length); - } else -#endif - if (!preedit.isEmpty()) - editor->setComposition(preedit, underlines, preedit.length(), 0); + } else if (!preedit.isEmpty()) + editor->setComposition(preedit, underlines, preedit.length(), 0); } ev->accept(); @@ -1302,6 +1294,10 @@ void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* ev frame->tiledBackingStore()->setKeepAndCoverAreaMultipliers(keepMultiplier, coverMultiplier); } #endif + else if (event->propertyName() == "_q_webInspectorServerPort") { + InspectorServerQt* inspectorServer = InspectorServerQt::server(); + inspectorServer->listen(inspectorServerPort()); + } } #endif @@ -1391,7 +1387,6 @@ bool QWebPagePrivate::handleScrolling(QKeyEvent *ev, Frame *frame) return frame->eventHandler()->scrollRecursively(direction, granularity); } -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) bool QWebPagePrivate::touchEvent(QTouchEvent* event) { WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); @@ -1404,7 +1399,6 @@ bool QWebPagePrivate::touchEvent(QTouchEvent* event) // Return whether the default action was cancelled in the JS event handler return frame->eventHandler()->handleTouchEvent(PlatformTouchEvent(event)); } -#endif /*! This method is used by the input method to query a set of properties of the page @@ -1479,7 +1473,6 @@ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const return QVariant(); } -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) case Qt::ImAnchorPosition: { if (renderTextControl) { if (editor->hasComposition()) { @@ -1502,7 +1495,6 @@ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const } return QVariant(0); } -#endif default: return QVariant(); } @@ -1559,6 +1551,14 @@ InspectorController* QWebPagePrivate::inspectorController() #endif } +quint16 QWebPagePrivate::inspectorServerPort() +{ +#if ENABLE(INSPECTOR) && !defined(QT_NO_PROPERTIES) + if (q && q->property("_q_webInspectorServerPort").isValid()) + return q->property("_q_webInspectorServerPort").toInt(); +#endif + return 0; +} /*! \enum QWebPage::FindFlag @@ -1987,11 +1987,7 @@ void QWebPage::setView(QWidget* view) */ QWidget *QWebPage::view() const { -#if QT_VERSION < QT_VERSION_CHECK(4, 6, 0) - return d->view; -#else return d->view.data(); -#endif } /*! @@ -2325,19 +2321,67 @@ void QWebPage::setViewportSize(const QSize &size) const } } -QWebPage::ViewportConfiguration QWebPage::viewportConfigurationForSize(QSize availableSize) const +static int getintenv(const char* variable) +{ + bool ok; + int value = qgetenv(variable).toInt(&ok); + return (ok) ? value : -1; +} + +static QSize queryDeviceSizeForScreenContainingWidget(const QWidget* widget) +{ + QDesktopWidget* desktop = QApplication::desktop(); + if (!desktop) + return QSize(); + + QSize size; + + if (widget) { + // Returns the available geometry of the screen which contains widget. + // NOTE: this must be the the full screen size including any fixed status areas etc. + size = desktop->availableGeometry(widget).size(); + } else + size = desktop->availableGeometry().size(); + + // This must be in portrait mode, adjust if not. + if (size.width() > size.height()) { + int width = size.width(); + size.setWidth(size.height()); + size.setHeight(width); + } + + return size; +} + +/*! + Computes the optimal viewport configuration given the \a availableSize, when + user interface components are disregarded. + + The configuration is also dependent on the device screen size which is obtained + automatically. For testing purposes the size can be overridden by setting two + environment variables QTWEBKIT_DEVICE_WIDTH and QTWEBKIT_DEVICE_HEIGHT, which + both needs to be set. +*/ + +QWebPage::ViewportConfiguration QWebPage::viewportConfigurationForSize(const QSize& availableSize) const { static int desktopWidth = 980; static int deviceDPI = 160; - FloatRect rect = d->page->chrome()->windowRect(); + ViewportConfiguration result; - int deviceWidth = rect.width(); - int deviceHeight = rect.height(); + int deviceWidth = getintenv("QTWEBKIT_DEVICE_WIDTH"); + int deviceHeight = getintenv("QTWEBKIT_DEVICE_HEIGHT"); - WebCore::ViewportConfiguration conf = WebCore::findConfigurationForViewportData(mainFrame()->d->viewportArguments, desktopWidth, deviceWidth, deviceHeight, deviceDPI, availableSize); + // Both environment variables need to be set - or they will be ignored. + if (deviceWidth < 0 && deviceHeight < 0) { + QSize size = queryDeviceSizeForScreenContainingWidget((d->client) ? d->client->ownerWidget() : 0); + deviceWidth = size.width(); + deviceHeight = size.height(); + } - ViewportConfiguration result; + WebCore::ViewportConfiguration conf = WebCore::findConfigurationForViewportData(mainFrame()->d->viewportArguments(), + desktopWidth, deviceWidth, deviceHeight, deviceDPI, availableSize); result.m_isValid = true; result.m_size = conf.layoutViewport; @@ -2854,13 +2898,11 @@ bool QWebPage::event(QEvent *ev) case QEvent::Leave: d->leaveEvent(ev); break; -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: // Return whether the default action was cancelled in the JS event handler return d->touchEvent(static_cast<QTouchEvent*>(ev)); -#endif #ifndef QT_NO_PROPERTIES case QEvent::DynamicPropertyChange: d->dynamicPropertyChangeEvent(static_cast<QDynamicPropertyChangeEvent*>(ev)); diff --git a/WebKit/qt/Api/qwebpage.h b/WebKit/qt/Api/qwebpage.h index b1441ff..e71e3da 100644 --- a/WebKit/qt/Api/qwebpage.h +++ b/WebKit/qt/Api/qwebpage.h @@ -55,6 +55,7 @@ namespace WebCore { class EditorClientQt; class FrameLoaderClientQt; class InspectorClientQt; + class InspectorServerRequestHandlerQt; class InspectorFrontendClientQt; class NotificationPresenterClientQt; class GeolocationPermissionClientQt; @@ -216,13 +217,13 @@ public: QWebPage::ViewportConfiguration& operator=(const QWebPage::ViewportConfiguration& other); - inline qreal initialScaleFactor() const { return m_initialScaleFactor; }; - inline qreal minimumScaleFactor() const { return m_minimumScaleFactor; }; - inline qreal maximumScaleFactor() const { return m_maximumScaleFactor; }; - inline qreal devicePixelRatio() const { return m_devicePixelRatio; }; - inline bool isUserScalable() const { return m_isUserScalable; }; - inline bool isValid() const { return m_isValid; }; - inline QSize size() const { return m_size; }; + inline qreal initialScaleFactor() const { return m_initialScaleFactor; } + inline qreal minimumScaleFactor() const { return m_minimumScaleFactor; } + inline qreal maximumScaleFactor() const { return m_maximumScaleFactor; } + inline qreal devicePixelRatio() const { return m_devicePixelRatio; } + inline bool isUserScalable() const { return m_isUserScalable; } + inline bool isValid() const { return m_isValid; } + inline QSize size() const { return m_size; } private: QSharedDataPointer<QtViewportConfigurationPrivate> d; @@ -275,7 +276,7 @@ public: QSize viewportSize() const; void setViewportSize(const QSize &size) const; - ViewportConfiguration viewportConfigurationForSize(QSize availableSize) const; + ViewportConfiguration viewportConfigurationForSize(const QSize& availableSize) const; QSize preferredContentsSize() const; void setPreferredContentsSize(const QSize &size) const; @@ -425,6 +426,7 @@ private: friend class WebCore::EditorClientQt; friend class WebCore::FrameLoaderClientQt; friend class WebCore::InspectorClientQt; + friend class WebCore::InspectorServerRequestHandlerQt; friend class WebCore::InspectorFrontendClientQt; friend class WebCore::NotificationPresenterClientQt; friend class WebCore::GeolocationPermissionClientQt; diff --git a/WebKit/qt/Api/qwebpage_p.h b/WebKit/qt/Api/qwebpage_p.h index 82f5365..12716f9 100644 --- a/WebKit/qt/Api/qwebpage_p.h +++ b/WebKit/qt/Api/qwebpage_p.h @@ -131,38 +131,29 @@ public: void handleSoftwareInputPanel(Qt::MouseButton); bool handleScrolling(QKeyEvent*, WebCore::Frame*); -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) // Returns whether the default action was cancelled in the JS event handler bool touchEvent(QTouchEvent*); -#endif void setInspector(QWebInspector*); QWebInspector* getOrCreateInspector(); WebCore::InspectorController* inspectorController(); + quint16 inspectorServerPort(); #ifndef QT_NO_SHORTCUT static QWebPage::WebAction editorActionForKeyEvent(QKeyEvent* event); #endif static const char* editorCommandForWebActions(QWebPage::WebAction action); - WebCore::ChromeClientQt *chromeClient; - WebCore::ContextMenuClientQt *contextMenuClient; - WebCore::EditorClientQt *editorClient; + QWebPage *q; WebCore::Page *page; - + QWebPageClient* client; QPointer<QWebFrame> mainFrame; - QWebPage *q; - QWebPageClient* client; #ifndef QT_NO_UNDOSTACK QUndoStack *undoStack; #endif -#if QT_VERSION >= 0x040600 QWeakPointer<QWidget> view; -#else - QWidget* view; -#endif bool insideOpenCall; quint64 m_totalBytes; diff --git a/WebKit/qt/Api/qwebsettings.cpp b/WebKit/qt/Api/qwebsettings.cpp index b71de25..6b36522 100644 --- a/WebKit/qt/Api/qwebsettings.cpp +++ b/WebKit/qt/Api/qwebsettings.cpp @@ -174,6 +174,11 @@ void QWebSettingsPrivate::apply() settings->setWebGLEnabled(value); #endif + + value = attributes.value(QWebSettings::HyperlinkAuditingEnabled, + global->attributes.value(QWebSettings::HyperlinkAuditingEnabled)); + + settings->setHyperlinkAuditingEnabled(value); value = attributes.value(QWebSettings::JavascriptCanOpenWindows, global->attributes.value(QWebSettings::JavascriptCanOpenWindows)); @@ -495,6 +500,7 @@ QWebSettings::QWebSettings() d->attributes.insert(QWebSettings::LocalContentCanAccessFileUrls, true); d->attributes.insert(QWebSettings::AcceleratedCompositingEnabled, true); d->attributes.insert(QWebSettings::WebGLEnabled, false); + d->attributes.insert(QWebSettings::HyperlinkAuditingEnabled, false); d->attributes.insert(QWebSettings::TiledBackingStoreEnabled, false); d->attributes.insert(QWebSettings::FrameFlatteningEnabled, false); d->attributes.insert(QWebSettings::SiteSpecificQuirksEnabled, true); diff --git a/WebKit/qt/Api/qwebsettings.h b/WebKit/qt/Api/qwebsettings.h index 8967e7c..d5e0ef6 100644 --- a/WebKit/qt/Api/qwebsettings.h +++ b/WebKit/qt/Api/qwebsettings.h @@ -75,7 +75,8 @@ public: TiledBackingStoreEnabled, FrameFlatteningEnabled, SiteSpecificQuirksEnabled, - WebGLEnabled + WebGLEnabled, + HyperlinkAuditingEnabled }; enum WebGraphic { MissingImageGraphic, diff --git a/WebKit/qt/Api/qwebview.cpp b/WebKit/qt/Api/qwebview.cpp index 1f400cb..64b7a90 100644 --- a/WebKit/qt/Api/qwebview.cpp +++ b/WebKit/qt/Api/qwebview.cpp @@ -307,9 +307,7 @@ QWebView::QWebView(QWidget *parent) setAttribute(Qt::WA_InputMethodEnabled); #endif -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) setAttribute(Qt::WA_AcceptTouchEvents); -#endif #if defined(Q_WS_MAEMO_5) QAbstractKineticScroller* scroller = new QWebViewKineticScroller(); static_cast<QWebViewKineticScroller*>(scroller)->setWidget(this); @@ -348,13 +346,7 @@ void QWebViewPrivate::detachCurrentPage() if (!page) return; - if (page) { -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - page->d->view.clear(); -#else - page->d->view = 0; -#endif - } + page->d->view.clear(); // if the page client is the special client constructed for // delegating the responsibilities to a QWidget, we need @@ -828,7 +820,6 @@ bool QWebView::event(QEvent *e) if (cursor().shape() == Qt::ArrowCursor) d->page->d->client->resetCursor(); #endif -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) } else if (e->type() == QEvent::TouchBegin || e->type() == QEvent::TouchEnd || e->type() == QEvent::TouchUpdate) { @@ -836,7 +827,6 @@ bool QWebView::event(QEvent *e) // Always return true so that we'll receive also TouchUpdate and TouchEnd events return true; -#endif } else if (e->type() == QEvent::Leave) d->page->event(e); } diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog index 34edbd7..7a2c064 100644 --- a/WebKit/qt/ChangeLog +++ b/WebKit/qt/ChangeLog @@ -1,3 +1,354 @@ +2010-09-28 Jenn Braithwaite <jennb@chromium.org> + + Reviewed by Dmitry Titov. + + Added oldPage param to FrameLoaderClient::didTransferChildFrameToNewDocument. + https://bugs.webkit.org/show_bug.cgi?id=46663 + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::didTransferChildFrameToNewDocument): + * WebCoreSupport/FrameLoaderClientQt.h: + +2010-09-28 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Clean up QWebPage::ViewportConfiguration API + https://bugs.webkit.org/show_bug.cgi?id=46730 + + - Pass QSize parameter as const-reference + - Style fixes + + * Api/qwebpage.cpp: + (QWebPage::viewportConfigurationForSize): + * Api/qwebpage.h: + +2010-09-28 Andras Becsi <abecsi@webkit.org> + + Reviewed by Csaba Osztrogonác. + + Undefined reference errors when linking due to gperf and inlining. + webkit.org/b/29244 + + EFL CMake changes by Leandro Pereira <leandro@profusion.mobi> + + Refactor gperf code generation and usage to fix the debug build with gcc>4.4. + Hitherto gperf generated C code, these files were included in multiple C++ files across WebCore + to access the functionality provided. This resulted in debug build failure with newer gcc versions + because of a behaviour change of gcc, which disables C style inlining in debug mode. + The make-hash-tools.pl script lets gperf generate C++ code for all gperf files now, which are compiled + in their own compilation unit. + The functionality provided by the generated code is wrapped behind HashTools.h, so there is no need + for multiple inclusions of generated C files to access these functions. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::createPlugin): + +2010-09-28 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] Remove support for Qt 4.5 + https://bugs.webkit.org/show_bug.cgi?id=46718 + + Remove the code for versions of Qt prior to 4.6. + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::updateResizesToContentsForPage): + (QGraphicsWebView::QGraphicsWebView): + (QGraphicsWebView::sceneEvent): + (QGraphicsWebViewPrivate::detachCurrentPage): + * Api/qwebframe.cpp: + (QWebFrame::load): + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + (QWebPagePrivate::handleSoftwareInputPanel): + (QWebPagePrivate::inputMethodEvent): + (QWebPagePrivate::touchEvent): + (QWebPage::inputMethodQuery): + (QWebPage::view): + (QWebPage::event): + * Api/qwebpage_p.h: + * Api/qwebview.cpp: + (QWebView::QWebView): + (QWebViewPrivate::detachCurrentPage): + (QWebView::event): + * WebCoreSupport/EditorClientQt.cpp: + (WebCore::EditorClientQt::setInputMethodState): + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::createPlugin): + * WebCoreSupport/PageClientQt.cpp: + (WebCore::PageClientQWidget::setInputMethodHints): + (WebCore::PageClientQGraphicsWidget::setInputMethodEnabled): + (WebCore::PageClientQGraphicsWidget::inputMethodEnabled): + (WebCore::PageClientQGraphicsWidget::setInputMethodHints): + * WebCoreSupport/PageClientQt.h: + (WebCore::QGraphicsItemOverlay::page): + * tests/qwebframe/tst_qwebframe.cpp: + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::inputMethods_data): + (inputMethodHints): + (inputMethodEnabled): + (tst_QWebPage::inputMethods): + (tst_QWebPage::originatingObjectInNetworkRequests): + * tests/qwebview/tst_qwebview.cpp: + (tst_QWebView::reusePage): + +2010-09-28 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Simon Hausmann. + + Clean up QWebPage initialization + + * Api/qwebpage.cpp: + * Api/qwebpage_p.h: + +2010-09-28 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] tst_QWebPage::testStopScheduledPageRefresh() fails on MeeGo handset + https://bugs.webkit.org/show_bug.cgi?id=46706 + + The test require the network to succeed or fail in order to work. + On MeeGo, the network can simply timeout the because of the netword access + management. This patch makes the test use local URLs to avoid the + problem. + + * tests/qwebpage/tst_qwebpage.cpp: + (TestNetworkManager::TestNetworkManager): + +2010-09-27 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> + + Reviewed by Antonio Gomes. + + [Qt] Remove setDeviceSize methods + https://bugs.webkit.org/show_bug.cgi?id=46347 + + Remove our setDeviceHeight() API and obtain it automatically from the + system. Also for testing purposes, make it possible to override the + values via two newly introduced environment variables. + + * Api/qgraphicswebview.cpp: + * Api/qgraphicswebview.h: + * Api/qwebpage.cpp: + (getintenv): + (queryDeviceSizeForScreenContainingWidget): + (QWebPage::viewportConfigurationForSize): + * WebCoreSupport/PageClientQt.cpp: + (WebCore::PageClientQGraphicsWidget::windowRect): + * symbian/eabi/QtWebKitu.def: + +2010-09-27 Girish Ramakrishnan <girish@forwardbias.in> + + Reviewed by Antonio Gomes. + + Enable local rendering of NPAPI plugins on Maemo6. + + https://bugs.webkit.org/show_bug.cgi?id=46618 + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::createPlugin): + +2010-09-27 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] tst_QWebFrame::popupFocus() randomly fail on MeeGo handset because the focus is not set on the window + https://bugs.webkit.org/show_bug.cgi?id=46617 + + This patch avoid the race condition by waiting for the window + to be mapped on screen before attempting any actions. + + * tests/qwebframe/tst_qwebframe.cpp: + +2010-09-24 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + Keep viewport information in Document + https://bugs.webkit.org/show_bug.cgi?id=46385 + + The viewport meta data (layout viewport, scale) needs to be set again when bringing + back a page from the page cache. As the viewport metadata is only retrieved while parsing + the document, we need to store it in the Document class. + + * Api/qwebframe.cpp: + (QWebFramePrivate::viewportArguments): + * Api/qwebframe_p.h: + * Api/qwebpage.cpp: + (QWebPage::viewportConfigurationForSize): + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::didReceiveViewportArguments): + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::viewportAsText): + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::dispatchDidCommitLoad): + +2010-09-23 Ademar de Souza Reis Jr <ademar.reis@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + Fix QWebHapticFeedbackPlayer exposure via QWebKitPlatformPlugin + + [Qt] QWebHapticFeedbackPlayer needs correct exposure through QWebKitPlatformPlugin + https://bugs.webkit.org/show_bug.cgi?id=46402 + + QWebHapticFeedbackPlayer is exported through + QWebKitPlatformPlugin::createExtension(), but + createHapticFeedbackPlayer() and the correct + inheritage are missing. + + * Api/qwebkitplatformplugin.h: + * WebCoreSupport/QtPlatformPlugin.cpp: + (WebCore::QtPlatformPlugin::createHapticFeedbackPlayer): + * WebCoreSupport/QtPlatformPlugin.h: + +2010-09-23 Nate Chapin <japhet@chromium.org> + + Reviewed by Darin Fisher. + + Add hyperlink auditing settings (i.e., <a ping>). + https://bugs.webkit.org/show_bug.cgi?id=30458 + + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): + (QWebSettings::QWebSettings): + * Api/qwebsettings.h: + + +2010-09-23 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Refactor QtWebKitPlatformPlugin interface + + Make it easier to keep source-compability for the + QtWebKitPlatformPlugin interface, and run qmake + on the example (but not build) for convenience. + + https://bugs.webkit.org/show_bug.cgi?id=46345 + + * Api/qwebkitplatformplugin.h: + * WebCoreSupport/QtPlatformPlugin.cpp: + * examples/platformplugin/README: + * examples/platformplugin/WebPlugin.cpp: + * examples/platformplugin/WebPlugin.h: + * examples/platformplugin/qwebkitplatformplugin.h: + +2010-09-22 Andras Becsi <abecsi@webkit.org> + + Speculative build fix for the Qt Windows bots. + + * Api/DerivedSources.pro: + +2010-09-22 Jamey Hicks <jamey.hicks@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Web Inspector: Remote Web Inspector support for QtWebKit + https://bugs.webkit.org/show_bug.cgi?id=43988 + + Runs a web debug server on port specified by QtTestBrowser + argument -remote-inspector-port. Property + _q_webInspectorServerPort of the QWebPage instance will be set + according to the argument. All pages with that property set will + be remotely inspectable. + + URL for remote inspection of first QWebPage is + http://localhost:9222/webkit/inspector/inspector.html?page=1 + where 1 is the number of the QWebPage instance. + + The base URL yields an index page with links to the individual inspectors: + http://localhost:9222/ + + * Api/qwebinspector.cpp: + (QWebInspectorPrivate::attachAndReplaceRemoteFrontend): + (QWebInspectorPrivate::detachRemoteFrontend): + * Api/qwebinspector_p.h: + (QWebInspectorPrivate::QWebInspectorPrivate): + * Api/qwebpage.cpp: + (QWebPagePrivate::dynamicPropertyChangeEvent): + (QWebPagePrivate::inspectorServerPort): + * Api/qwebpage.h: + * Api/qwebpage_p.h: + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::InspectorClientQt): + (WebCore::InspectorClientQt::inspectorDestroyed): + (WebCore::InspectorClientQt::openInspectorFrontend): + (WebCore::InspectorClientQt::attachAndReplaceRemoteFrontend): + (WebCore::InspectorClientQt::detachRemoteFrontend): + (WebCore::InspectorClientQt::sendMessageToFrontend): + * WebCoreSupport/InspectorClientQt.h: + * WebCoreSupport/InspectorServerQt.cpp: Added. + (WebCore::generateWebSocketChallengeResponse): + (WebCore::parseWebSocketChallengeNumber): + (WebCore::InspectorServerQt::server): + (WebCore::InspectorServerQt::InspectorServerQt): + (WebCore::InspectorServerQt::~InspectorServerQt): + (WebCore::InspectorServerQt::listen): + (WebCore::InspectorServerQt::close): + (WebCore::InspectorServerQt::inspectorClientForPage): + (WebCore::InspectorServerQt::registerClient): + (WebCore::InspectorServerQt::unregisterClient): + (WebCore::InspectorServerQt::newConnection): + (WebCore::InspectorServerRequestHandlerQt::InspectorServerRequestHandlerQt): + (WebCore::InspectorServerRequestHandlerQt::~InspectorServerRequestHandlerQt): + (WebCore::InspectorServerRequestHandlerQt::tcpReadyRead): + (WebCore::InspectorServerRequestHandlerQt::tcpConnectionDisconnected): + (WebCore::InspectorServerRequestHandlerQt::webSocketSend): + (WebCore::InspectorServerRequestHandlerQt::webSocketReadyRead): + (WebCore::RemoteFrontendChannel::RemoteFrontendChannel): + (WebCore::RemoteFrontendChannel::sendMessageToFrontend): + * WebCoreSupport/InspectorServerQt.h: Added. + +2010-09-22 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] PluginStrategy implementation is broken + https://bugs.webkit.org/show_bug.cgi?id=46078 + + Remove the QWebPage* member from WebPlatformStrategies. + Get the originator QWebPage of the getPluginInfo call via + the Page* argument. + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + * WebCoreSupport/WebPlatformStrategies.cpp: + (WebPlatformStrategies::initialize): + (WebPlatformStrategies::WebPlatformStrategies): + (WebPlatformStrategies::getPluginInfo): + Use the ChromeClient for accessing the originator QWebPage. + * WebCoreSupport/WebPlatformStrategies.h: + +2010-09-22 İsmail Dönmez <ismail@namtrac.org> + + Reviewed by Andreas Kling. + + [Qt] Buildfix for WinCE + + * Api/DerivedSources.pro: + +2010-09-20 Philippe Normand <pnormand@igalia.com> + + Reviewed by Eric Carlson. + + [GTK] enhanced context menu for media elements + https://bugs.webkit.org/show_bug.cgi?id=45021 + + * WebCoreSupport/WebPlatformStrategies.cpp: + * WebCoreSupport/WebPlatformStrategies.h: + (WebPlatformStrategies::contextMenuItemTagOpenVideoInNewWindow): + (WebPlatformStrategies::contextMenuItemTagOpenAudioInNewWindow): + (WebPlatformStrategies::contextMenuItemTagCopyVideoLinkToClipboard): + (WebPlatformStrategies::contextMenuItemTagCopyAudioLinkToClipboard): + (WebPlatformStrategies::contextMenuItemTagToggleMediaControls) + (WebPlatformStrategies::contextMenuItemTagToggleMediaLoop) + (WebPlatformStrategies::contextMenuItemTagEnterVideoFullscreen) + (WebPlatformStrategies::contextMenuItemTagMediaPlay) + (WebPlatformStrategies::contextMenuItemTagMediaPause) + (WebPlatformStrategies::contextMenuItemTagMediaMute) + 2010-09-20 Jacob Dinu <dinu.jacob@nokia.com> Reviewed by Adam Barth. diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index a5dfdc7..9fbc5e5 100644 --- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -644,8 +644,6 @@ QWebSelectMethod* ChromeClientQt::createSelectPopup() const void ChromeClientQt::didReceiveViewportArguments(Frame* frame, const ViewportArguments& arguments) const { - m_webPage->mainFrame()->d->viewportArguments = arguments; - emit m_webPage->viewportChangeRequested(); } diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index ed7ac32..836df49 100644 --- a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -631,7 +631,7 @@ void DumpRenderTreeSupportQt::dumpNotification(bool b) QString DumpRenderTreeSupportQt::viewportAsText(QWebPage* page, const QSize& availableSize) { - WebCore::ViewportArguments args = page->mainFrame()->d->viewportArguments; + WebCore::ViewportArguments args = page->mainFrame()->d->viewportArguments(); WebCore::ViewportConfiguration conf = WebCore::findConfigurationForViewportData(args, /* desktop-width */ 980, /* device-width */ 320, diff --git a/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp index 080c459..9db4333 100644 --- a/WebKit/qt/WebCoreSupport/EditorClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp @@ -595,7 +595,6 @@ void EditorClientQt::setInputMethodState(bool active) { QWebPageClient* webPageClient = m_page->d->client; if (webPageClient) { -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) Qt::InputMethodHints hints; HTMLInputElement* inputElement = 0; @@ -628,8 +627,7 @@ void EditorClientQt::setInputMethodState(bool active) hints |= Qt::ImhNoAutoUppercase; hints |= Qt::ImhNoPredictiveText; #endif // Q_WS_MAEMO_5 || Q_WS_MAEMO_6 || Q_OS_SYMBIAN - webPageClient->setInputMethodHints(hints); -#endif // QT_VERSION check + webPageClient->setInputMethodHints(hints); webPageClient->setInputMethodEnabled(active); } emit m_page->microFocusChanged(); diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 4aadeb0..41bcb3c 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -442,9 +442,6 @@ void FrameLoaderClientQt::dispatchDidCommitLoad() if (m_frame->tree()->parent() || !m_webFrame) return; - // Clear the viewport arguments. - m_webFrame->d->viewportArguments = WebCore::ViewportArguments(); - emit m_webFrame->urlChanged(m_webFrame->url()); m_webFrame->page()->d->updateNavigationActions(); @@ -1248,7 +1245,7 @@ PassRefPtr<Frame> FrameLoaderClientQt::createFrame(const KURL& url, const String return frameData.frame.release(); } -void FrameLoaderClientQt::didTransferChildFrameToNewDocument() +void FrameLoaderClientQt::didTransferChildFrameToNewDocument(Page*) { ASSERT(m_frame->ownerElement()); @@ -1370,7 +1367,6 @@ private: } }; -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) class QtPluginGraphicsWidget: public Widget { public: @@ -1415,7 +1411,6 @@ private: QGraphicsWidget* graphicsWidget; }; -#endif PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually) @@ -1456,7 +1451,7 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, for (unsigned i = 0; i < numqStyleSheetProperties; ++i) { CSSPropertyID property = qstyleSheetProperties[i]; - styleSheet += QString::fromLatin1(::getPropertyName(property)); + styleSheet += QString::fromLatin1(getPropertyName(property)); styleSheet += QLatin1Char(':'); styleSheet += computedStyle(element)->getPropertyValue(property); styleSheet += QLatin1Char(';'); @@ -1488,7 +1483,7 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, w->setFrameRect(IntRect(0, 0, 0, 0)); return w; } -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + QGraphicsWidget* graphicsWidget = qobject_cast<QGraphicsWidget*>(object); if (graphicsWidget) { QGraphicsObject* parentWidget = 0; @@ -1502,7 +1497,7 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, w->setFrameRect(IntRect(0, 0, 0, 0)); return w; } -#endif + // FIXME: make things work for widgetless plugins as well delete object; } @@ -1513,7 +1508,7 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, if (mimeType == "application/x-shockwave-flash") { QWebPageClient* client = m_webFrame->page()->d->client; const bool isQWebView = client && qobject_cast<QWidget*>(client->pluginParent()); -#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO >= 5) size_t wmodeIndex = params.find("wmode"); if (wmodeIndex == -1) { // Disable XEmbed mode and force it to opaque mode diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index fffda58..ec6a3b6 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -198,7 +198,7 @@ public: virtual PassRefPtr<Frame> createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight); - virtual void didTransferChildFrameToNewDocument(); + virtual void didTransferChildFrameToNewDocument(WebCore::Page*); virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool); virtual void redirectDataToPlugin(Widget* pluginWidget); diff --git a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index e6e6fde..b6673e6 100644 --- a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -32,7 +32,10 @@ #include "InspectorClientQt.h" #include "Frame.h" +#include "InspectorBackendDispatcher.h" #include "InspectorController.h" +#include "InspectorFrontend.h" +#include "InspectorServerQt.h" #include "NotImplemented.h" #include "Page.h" #include "PlatformString.h" @@ -115,17 +118,26 @@ InspectorClientQt::InspectorClientQt(QWebPage* page) : m_inspectedWebPage(page) , m_frontendWebPage(0) , m_frontendClient(0) -{} +{ + InspectorServerQt* webInspectorServer = InspectorServerQt::server(); + if (webInspectorServer) + webInspectorServer->registerClient(this); +} void InspectorClientQt::inspectorDestroyed() { if (m_frontendClient) m_frontendClient->inspectorClientDestroyed(); + + InspectorServerQt* webInspectorServer = InspectorServerQt::server(); + if (webInspectorServer) + webInspectorServer->unregisterClient(this); + delete this; } -void InspectorClientQt::openInspectorFrontend(WebCore::InspectorController*) +void InspectorClientQt::openInspectorFrontend(WebCore::InspectorController* inspectorController) { #if USE(V8) ensureDebuggerScriptLoaded(); @@ -136,6 +148,10 @@ void InspectorClientQt::openInspectorFrontend(WebCore::InspectorController*) inspectorView->setPage(inspectorPage); QWebInspector* inspector = m_inspectedWebPage->d->getOrCreateInspector(); + // Remote frontend was attached. + if (m_inspectedWebPage->d->inspector->d->remoteFrontend) + return; + // This is a known hook that allows changing the default URL for the // Web inspector. This is used for SDK purposes. Please keep this hook // around and don't remove it. @@ -167,6 +183,23 @@ void InspectorClientQt::releaseFrontendPage() m_frontendClient = 0; } +void InspectorClientQt::attachAndReplaceRemoteFrontend(RemoteFrontendChannel* channel) +{ +#if ENABLE(INSPECTOR) + // Channel was allocated by InspectorServerQt. Here we transfer ownership to inspector. + m_inspectedWebPage->d->inspector->d->attachAndReplaceRemoteFrontend(channel); + m_inspectedWebPage->d->inspectorController()->connectFrontend(); +#endif +} + +void InspectorClientQt::detachRemoteFrontend() +{ +#if ENABLE(INSPECTOR) + m_inspectedWebPage->d->inspector->d->detachRemoteFrontend(); + m_inspectedWebPage->d->inspectorController()->disconnectFrontend(); +#endif +} + void InspectorClientQt::highlight(Node*) { notImplemented(); @@ -223,6 +256,12 @@ void InspectorClientQt::storeSetting(const String& key, const String& setting) bool InspectorClientQt::sendMessageToFrontend(const String& message) { + if (m_inspectedWebPage->d->inspector->d->remoteFrontend) { + RemoteFrontendChannel* session = qobject_cast<RemoteFrontendChannel*>(m_inspectedWebPage->d->inspector->d->remoteFrontend); + if (session) + session->sendMessageToFrontend(message); + return true; + } if (!m_frontendWebPage) return false; diff --git a/WebKit/qt/WebCoreSupport/InspectorClientQt.h b/WebKit/qt/WebCoreSupport/InspectorClientQt.h index 0074159..64a2d0c 100644 --- a/WebKit/qt/WebCoreSupport/InspectorClientQt.h +++ b/WebKit/qt/WebCoreSupport/InspectorClientQt.h @@ -42,8 +42,10 @@ class QWebView; namespace WebCore { class InspectorFrontendClientQt; +class InspectorServerRequestHandlerQt; class Node; class Page; +class RemoteFrontendChannel; class InspectorClientQt : public InspectorClient { public: @@ -63,10 +65,16 @@ public: void releaseFrontendPage(); + void attachAndReplaceRemoteFrontend(RemoteFrontendChannel *channel); + void detachRemoteFrontend(); + private: QWebPage* m_inspectedWebPage; QWebPage* m_frontendWebPage; InspectorFrontendClientQt* m_frontendClient; + bool m_remoteInspector; + + friend class InspectorServerRequestHandlerQt; }; class InspectorFrontendClientQt : public InspectorFrontendClientLocal { diff --git a/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp b/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp new file mode 100644 index 0000000..fad7247 --- /dev/null +++ b/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp @@ -0,0 +1,386 @@ +/* + 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 "InspectorServerQt.h" + +#include "InspectorBackendDispatcher.h" +#include "InspectorClientQt.h" +#include "MD5.h" +#include "Page.h" +#include "qwebpage.h" +#include "qwebpage_p.h" +#include <QFile> +#include <QHttpHeader> +#include <QHttpRequestHeader> +#include <QHttpResponseHeader> +#include <QString> +#include <QStringList> +#include <QTcpServer> +#include <QTcpSocket> +#include <QUrl> +#include <QWidget> +#include <qendian.h> + +namespace WebCore { + +/*! + Computes the WebSocket handshake response given the two challenge numbers and key3. + */ +static void generateWebSocketChallengeResponse(uint32_t number1, uint32_t number2, const unsigned char key3[8], unsigned char response[16]) +{ + uint8_t challenge[16]; + qToBigEndian<qint32>(number1, &challenge[0]); + qToBigEndian<qint32>(number2, &challenge[4]); + memcpy(&challenge[8], key3, 8); + MD5 md5; + md5.addBytes(challenge, sizeof(challenge)); + Vector<uint8_t, 16> digest; + md5.checksum(digest); + memcpy(response, digest.data(), 16); +} + +/*! + Parses and returns a WebSocket challenge number according to the + method specified in the WebSocket protocol. + + The field contains numeric digits interspersed with spaces and + non-numeric digits. The protocol ignores the characters that are + neither digits nor spaces. The digits are concatenated and + interpreted as a long int. The result is this number divided by + the number of spaces. + */ +static quint32 parseWebSocketChallengeNumber(QString field) +{ + QString nString; + int numSpaces = 0; + for (int i = 0; i < field.size(); i++) { + QChar c = field[i]; + if (c == (QChar)' ') { + numSpaces++; + } else if ((c >= (QChar)'0') && (c <= (QChar)'9')) { + nString.append((QChar)c); + } + } + quint32 num = nString.toLong(); + quint32 result = (numSpaces ? (num / numSpaces) : num); + return result; +} + +static InspectorServerQt* s_inspectorServer; + +InspectorServerQt* InspectorServerQt::server() +{ + // s_inspectorServer is deleted in unregisterClient() when the last client is unregistered. + if (!s_inspectorServer) + s_inspectorServer = new InspectorServerQt(); + + return s_inspectorServer; +} + +InspectorServerQt::InspectorServerQt() + : QObject() + , m_tcpServer(0) + , m_pageNumber(1) +{ +} + +InspectorServerQt::~InspectorServerQt() +{ + close(); +} + +void InspectorServerQt::listen(quint16 port) +{ + if (m_tcpServer) + return; + + m_tcpServer = new QTcpServer(); + m_tcpServer->listen(QHostAddress::Any, port); + connect(m_tcpServer, SIGNAL(newConnection()), SLOT(newConnection())); +} + +void InspectorServerQt::close() +{ + if (m_tcpServer) { + m_tcpServer->close(); + delete m_tcpServer; + } + m_tcpServer = 0; +} + +InspectorClientQt* InspectorServerQt::inspectorClientForPage(int pageNum) +{ + InspectorClientQt* client = m_inspectorClients.value(pageNum); + return client; +} + +void InspectorServerQt::registerClient(InspectorClientQt* client) +{ + if (!m_inspectorClients.key(client)) + m_inspectorClients.insert(m_pageNumber++, client); +} + +void InspectorServerQt::unregisterClient(InspectorClientQt* client) +{ + int pageNum = m_inspectorClients.key(client, -1); + if (pageNum >= 0) + m_inspectorClients.remove(pageNum); + if (!m_inspectorClients.size()) { + // s_inspectorServer points to this. + s_inspectorServer = 0; + close(); + deleteLater(); + } +} + +void InspectorServerQt::newConnection() +{ + QTcpSocket* tcpConnection = m_tcpServer->nextPendingConnection(); + InspectorServerRequestHandlerQt* handler = new InspectorServerRequestHandlerQt(tcpConnection, this); + handler->setParent(this); +} + +InspectorServerRequestHandlerQt::InspectorServerRequestHandlerQt(QTcpSocket* tcpConnection, InspectorServerQt* server) + : QObject(server) + , m_tcpConnection(tcpConnection) + , m_server(server) + , m_inspectorClient(0) +{ + m_endOfHeaders = false; + m_contentLength = 0; + + connect(m_tcpConnection, SIGNAL(readyRead()), SLOT(tcpReadyRead())); + connect(m_tcpConnection, SIGNAL(disconnected()), SLOT(tcpConnectionDisconnected())); +} + +InspectorServerRequestHandlerQt::~InspectorServerRequestHandlerQt() +{ +} + +void InspectorServerRequestHandlerQt::tcpReadyRead() +{ + QHttpRequestHeader header; + bool isWebSocket = false; + if (!m_tcpConnection) + return; + + if (!m_endOfHeaders) { + while (m_tcpConnection->bytesAvailable() && !m_endOfHeaders) { + QByteArray line = m_tcpConnection->readLine(); + m_data.append(line); + if (line == "\r\n") + m_endOfHeaders = true; + } + if (m_endOfHeaders) { + header = QHttpRequestHeader(QString::fromLatin1(m_data)); + if (header.isValid()) { + m_path = header.path(); + m_contentType = header.contentType().toLatin1(); + m_contentLength = header.contentLength(); + if (header.hasKey("Upgrade") && (header.value("Upgrade") == QLatin1String("WebSocket"))) + isWebSocket = true; + + m_data.clear(); + } + } + } + + if (m_endOfHeaders) { + QStringList pathAndQuery = m_path.split("?"); + m_path = pathAndQuery[0]; + QStringList words = m_path.split(QString::fromLatin1("/")); + + if (isWebSocket) { + // switch to websocket-style WebSocketService messaging + if (m_tcpConnection) { + m_tcpConnection->disconnect(SIGNAL(readyRead())); + connect(m_tcpConnection, SIGNAL(readyRead()), SLOT(webSocketReadyRead())); + + QByteArray key3 = m_tcpConnection->read(8); + + quint32 number1 = parseWebSocketChallengeNumber(header.value("Sec-WebSocket-Key1")); + quint32 number2 = parseWebSocketChallengeNumber(header.value("Sec-WebSocket-Key2")); + + char responseData[16]; + generateWebSocketChallengeResponse(number1, number2, (unsigned char*)key3.data(), (unsigned char*)responseData); + QByteArray response(responseData, sizeof(responseData)); + + QHttpResponseHeader responseHeader(101, "WebSocket Protocol Handshake", 1, 1); + responseHeader.setValue("Upgrade", header.value("Upgrade")); + responseHeader.setValue("Connection", header.value("Connection")); + responseHeader.setValue("Sec-WebSocket-Origin", header.value("Origin")); + responseHeader.setValue("Sec-WebSocket-Location", ("ws://" + header.value("Host") + m_path)); + responseHeader.setContentLength(response.size()); + m_tcpConnection->write(responseHeader.toString().toLatin1()); + m_tcpConnection->write(response); + m_tcpConnection->flush(); + + if ((words.size() == 4) + && (words[1] == QString::fromLatin1("devtools")) + && (words[2] == QString::fromLatin1("page"))) { + int pageNum = words[3].toInt(); + + m_inspectorClient = m_server->inspectorClientForPage(pageNum); + // Attach remoteFrontendChannel to inspector, also transferring ownership. + if (m_inspectorClient) + m_inspectorClient->attachAndReplaceRemoteFrontend(new RemoteFrontendChannel(this)); + } + + } + + return; + } + if (m_contentLength && (m_tcpConnection->bytesAvailable() < m_contentLength)) + return; + + QByteArray content = m_tcpConnection->read(m_contentLength); + m_endOfHeaders = false; + + QByteArray response; + int code = 200; + QString text = QString::fromLatin1("OK"); + + // If no path is specified, generate an index page. + if ((m_path == "") || (m_path == "/")) { + QString indexHtml = "<html><head><title>Remote Web Inspector</title></head><body><ul>\n"; + for (QMap<int, InspectorClientQt* >::const_iterator it = m_server->m_inspectorClients.begin(); + it != m_server->m_inspectorClients.end(); + ++it) { + indexHtml.append(QString("<li><a href=\"/webkit/inspector/inspector.html?page=%1\">%2</li>\n") + .arg(it.key()) + .arg(it.value()->m_inspectedWebPage->mainFrame()->url().toString())); + } + indexHtml.append("</ul></body></html>"); + response = indexHtml.toLatin1(); + } else { + QString path = QString(":%1").arg(m_path); + QFile file(path); + // It seems that there should be an enum or define for these status codes somewhere in Qt or WebKit, + // but grep fails to turn one up. + // QNetwork uses the numeric values directly. + if (file.exists()) { + file.open(QIODevice::ReadOnly); + response = file.readAll(); + } else { + code = 404; + text = QString::fromLatin1("Not OK"); + } + } + + QHttpResponseHeader responseHeader(code, text, 1, 0); + responseHeader.setContentLength(response.size()); + if (!m_contentType.isEmpty()) + responseHeader.setContentType(QString::fromLatin1(m_contentType)); + + QByteArray asciiHeader = responseHeader.toString().toAscii(); + m_tcpConnection->write(asciiHeader); + + m_tcpConnection->write(response); + m_tcpConnection->flush(); + m_tcpConnection->close(); + + return; + } +} + +void InspectorServerRequestHandlerQt::tcpConnectionDisconnected() +{ + if (m_inspectorClient) + m_inspectorClient->detachRemoteFrontend(); + m_tcpConnection->deleteLater(); + m_tcpConnection = 0; +} + +int InspectorServerRequestHandlerQt::webSocketSend(QByteArray payload) +{ + Q_ASSERT(m_tcpConnection); + m_tcpConnection->putChar(0x00); + int nBytes = m_tcpConnection->write(payload); + m_tcpConnection->putChar(0xFF); + m_tcpConnection->flush(); + return nBytes; +} + +int InspectorServerRequestHandlerQt::webSocketSend(const char* data, size_t length) +{ + Q_ASSERT(m_tcpConnection); + m_tcpConnection->putChar(0x00); + int nBytes = m_tcpConnection->write(data, length); + m_tcpConnection->putChar(0xFF); + m_tcpConnection->flush(); + return nBytes; +} + +void InspectorServerRequestHandlerQt::webSocketReadyRead() +{ + Q_ASSERT(m_tcpConnection); + if (!m_tcpConnection->bytesAvailable()) + return; + QByteArray content = m_tcpConnection->read(m_tcpConnection->bytesAvailable()); + m_data.append(content); + while (m_data.size() > 0) { + // first byte in websocket frame should be 0 + Q_ASSERT(!m_data[0]); + + // Start of WebSocket frame is indicated by 0 + if (m_data[0]) { + qCritical() << "webSocketReadyRead: unknown frame type" << m_data[0]; + m_data.clear(); + m_tcpConnection->close(); + return; + } + + // End of WebSocket frame indicated by 0xff. + int pos = m_data.indexOf(0xff, 1); + if (pos < 1) + return; + + // After above checks, length will be >= 0. + size_t length = pos - 1; + if (length <= 0) + return; + + QByteArray payload = m_data.mid(1, length); + + if (m_inspectorClient) { + InspectorController* inspectorController = m_inspectorClient->m_inspectedWebPage->d->page->inspectorController(); + inspectorController->inspectorBackendDispatcher()->dispatch(QString::fromUtf8(payload)); + } + + // Remove this WebSocket message from m_data (payload, start-of-frame byte, end-of-frame byte). + m_data = m_data.mid(length + 2); + } +} + +RemoteFrontendChannel::RemoteFrontendChannel(InspectorServerRequestHandlerQt* requestHandler) + : QObject(requestHandler) + , m_requestHandler(requestHandler) +{ +} + +bool RemoteFrontendChannel::sendMessageToFrontend(const String& message) +{ + if (!m_requestHandler) + return false; + CString cstr = message.utf8(); + return m_requestHandler->webSocketSend(cstr.data(), cstr.length()); +} + +} diff --git a/WebKit/qt/WebCoreSupport/InspectorServerQt.h b/WebKit/qt/WebCoreSupport/InspectorServerQt.h new file mode 100644 index 0000000..74e8c2f --- /dev/null +++ b/WebKit/qt/WebCoreSupport/InspectorServerQt.h @@ -0,0 +1,110 @@ +/* + 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 InspectorServerQt_h +#define InspectorServerQt_h + +#include <QList> +#include <QMap> +#include <QObject> +#include <QPair> +#include <QString> +#include <wtf/Forward.h> + +class QTcpServer; +class QTcpSocket; +class QWebPage; + +namespace WebCore { +class InspectorServerRequestHandlerQt; +class InspectorClientQt; + +class InspectorServerQt : public QObject { + Q_OBJECT +public: + + static InspectorServerQt* server(); + + void listen(quint16 port); + + void registerClient(InspectorClientQt* client); + void unregisterClient(InspectorClientQt* client); + + void close(); + InspectorClientQt* inspectorClientForPage(int pageNum); + +protected: + InspectorServerQt(); + virtual ~InspectorServerQt(); + +private slots: + void newConnection(); + +private: + QTcpServer* m_tcpServer; + QMap<int, InspectorClientQt*> m_inspectorClients; + int m_pageNumber; + + friend class InspectorServerRequestHandlerQt; +}; + +class RemoteFrontendChannel : public QObject { + Q_OBJECT +public: + + RemoteFrontendChannel(InspectorServerRequestHandlerQt* requestHandler); + bool sendMessageToFrontend(const String& message); + +private: + InspectorServerRequestHandlerQt* m_requestHandler; +}; + +class InspectorServerRequestHandlerQt : public QObject { + Q_OBJECT +public: + + InspectorServerRequestHandlerQt(QTcpSocket *tcpConnection, InspectorServerQt *server); + virtual ~InspectorServerRequestHandlerQt(); + virtual int webSocketSend(QByteArray payload); + virtual int webSocketSend(const char *payload, size_t length); + +private slots: + void tcpReadyRead(); + void tcpConnectionDisconnected(); + void webSocketReadyRead(); + +private: + QTcpSocket* m_tcpConnection; + InspectorServerQt* m_server; + + QString m_path; + QByteArray m_contentType; + int m_contentLength; + bool m_endOfHeaders; + QByteArray m_data; + InspectorClientQt* m_inspectorClient; + + void handleInspectorRequest(QStringList words); + void handleFromFrontendRequest(); + void handleResourceRequest(QStringList words); + +}; + +} +#endif diff --git a/WebKit/qt/WebCoreSupport/PageClientQt.cpp b/WebKit/qt/WebCoreSupport/PageClientQt.cpp index 62f48ff..ea209d9 100644 --- a/WebKit/qt/WebCoreSupport/PageClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/PageClientQt.cpp @@ -48,12 +48,10 @@ bool PageClientQWidget::inputMethodEnabled() const return view->testAttribute(Qt::WA_InputMethodEnabled); } -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) void PageClientQWidget::setInputMethodHints(Qt::InputMethodHints hints) { view->setInputMethodHints(hints); } -#endif #ifndef QT_NO_CURSOR QCursor PageClientQWidget::cursor() const @@ -215,26 +213,18 @@ void PageClientQGraphicsWidget::updateTiledBackingStoreScale() void PageClientQGraphicsWidget::setInputMethodEnabled(bool enable) { -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) view->setFlag(QGraphicsItem::ItemAcceptsInputMethod, enable); -#endif } bool PageClientQGraphicsWidget::inputMethodEnabled() const { -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) return view->flags() & QGraphicsItem::ItemAcceptsInputMethod; -#else - return false; -#endif } -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) void PageClientQGraphicsWidget::setInputMethodHints(Qt::InputMethodHints hints) { view->setInputMethodHints(hints); } -#endif #ifndef QT_NO_CURSOR QCursor PageClientQGraphicsWidget::cursor() const @@ -318,9 +308,6 @@ QStyle* PageClientQGraphicsWidget::style() const QRectF PageClientQGraphicsWidget::windowRect() const { - if (!view->deviceSize().isEmpty()) - return QRectF(QRect(QPoint(0, 0), view->deviceSize())); - if (!view->scene()) return QRectF(); diff --git a/WebKit/qt/WebCoreSupport/PageClientQt.h b/WebKit/qt/WebCoreSupport/PageClientQt.h index 65ee849..eea7f40 100644 --- a/WebKit/qt/WebCoreSupport/PageClientQt.h +++ b/WebKit/qt/WebCoreSupport/PageClientQt.h @@ -58,9 +58,7 @@ public: virtual void update(const QRect& dirtyRect); virtual void setInputMethodEnabled(bool enable); virtual bool inputMethodEnabled() const; -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) virtual void setInputMethodHints(Qt::InputMethodHints hints); -#endif #ifndef QT_NO_CURSOR virtual QCursor cursor() const; @@ -93,9 +91,7 @@ class QGraphicsItemOverlay : public QGraphicsItem { , page(p) { setPos(0, 0); -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, true); -#endif setCacheMode(QGraphicsItem::DeviceCoordinateCache); } @@ -146,9 +142,7 @@ public: virtual void update(const QRect& dirtyRect); virtual void setInputMethodEnabled(bool enable); virtual bool inputMethodEnabled() const; -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) virtual void setInputMethodHints(Qt::InputMethodHints hints); -#endif #ifndef QT_NO_CURSOR virtual QCursor cursor() const; diff --git a/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp b/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp index fd86e91..1f91d8c 100644 --- a/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp +++ b/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp @@ -91,16 +91,20 @@ QWebKitPlatformPlugin* QtPlatformPlugin::plugin() QWebSelectMethod* QtPlatformPlugin::createSelectInputMethod() { QWebKitPlatformPlugin* p = plugin(); - return p ? p->createSelectInputMethod() : 0; + return p ? qobject_cast<QWebSelectMethod*>(p->createExtension(QWebKitPlatformPlugin::MultipleSelections)) : 0; } QWebNotificationPresenter* QtPlatformPlugin::createNotificationPresenter() { QWebKitPlatformPlugin* p = plugin(); - if (!p) - return 0; - return p->createNotificationPresenter(); + return p ? qobject_cast<QWebNotificationPresenter*>(p->createExtension(QWebKitPlatformPlugin::Notifications)) : 0; +} + +QWebHapticFeedbackPlayer* QtPlatformPlugin::createHapticFeedbackPlayer() +{ + QWebKitPlatformPlugin* p = plugin(); + return p ? qobject_cast<QWebHapticFeedbackPlayer*>(p->createExtension(QWebKitPlatformPlugin::Haptics)) : 0; } } diff --git a/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h b/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h index 9bdab75..a3e50c2 100644 --- a/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h +++ b/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h @@ -26,6 +26,7 @@ class QWebSelectMethod; class QWebKitPlatformPlugin; class QWebNotificationPresenter; +class QWebHapticFeedbackPlayer; class QWebSelectData; namespace WebCore { @@ -37,6 +38,7 @@ public: QWebSelectMethod* createSelectInputMethod(); QWebNotificationPresenter* createNotificationPresenter(); + QWebHapticFeedbackPlayer* createHapticFeedbackPlayer(); QWebKitPlatformPlugin* plugin(); diff --git a/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp b/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp index 948e0cd..7cd255f 100644 --- a/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp +++ b/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp @@ -30,8 +30,10 @@ #include "config.h" #include "WebPlatformStrategies.h" -#include "NotImplemented.h" +#include "Chrome.h" +#include "ChromeClientQt.h" #include <IntSize.h> +#include "NotImplemented.h" #include <Page.h> #include <PageGroup.h> #include <PluginDatabase.h> @@ -43,14 +45,13 @@ using namespace WebCore; -void WebPlatformStrategies::initialize(QWebPage* webPage) +void WebPlatformStrategies::initialize() { - DEFINE_STATIC_LOCAL(WebPlatformStrategies, platformStrategies, (webPage)); + DEFINE_STATIC_LOCAL(WebPlatformStrategies, platformStrategies, ()); Q_UNUSED(platformStrategies); } -WebPlatformStrategies::WebPlatformStrategies(QWebPage* webPage) - : m_page(webPage) +WebPlatformStrategies::WebPlatformStrategies() { setPlatformStrategies(this); } @@ -78,10 +79,11 @@ void WebPlatformStrategies::refreshPlugins() PluginDatabase::installedPlugins()->refresh(); } -void WebPlatformStrategies::getPluginInfo(Vector<WebCore::PluginInfo>& outPlugins) +void WebPlatformStrategies::getPluginInfo(const WebCore::Page* page, Vector<WebCore::PluginInfo>& outPlugins) { - QWebPluginFactory* factory = m_page->pluginFactory(); - if (factory) { + QWebPage* qPage = static_cast<ChromeClientQt*>(page->chrome()->client())->m_webPage; + QWebPluginFactory* factory; + if (qPage && (factory = qPage->pluginFactory())) { QList<QWebPluginFactory::Plugin> qplugins = factory->plugins(); for (int i = 0; i < qplugins.count(); ++i) { @@ -198,6 +200,56 @@ String WebPlatformStrategies::contextMenuItemTagCopyImageToClipboard() return QCoreApplication::translate("QWebPage", "Copy Image", "Copy Link context menu item"); } +String WebPlatformStrategies::contextMenuItemTagOpenVideoInNewWindow() +{ + return QCoreApplication::translate("QWebPage", "Open Video", "Open Video in New Window"); +} + +String WebPlatformStrategies::contextMenuItemTagOpenAudioInNewWindow() +{ + return QCoreApplication::translate("QWebPage", "Open Audio", "Open Audio in New Window"); +} + +String WebPlatformStrategies::contextMenuItemTagCopyVideoLinkToClipboard() +{ + return QCoreApplication::translate("QWebPage", "Copy Video", "Copy Video Link Location"); +} + +String WebPlatformStrategies::contextMenuItemTagCopyAudioLinkToClipboard() +{ + return QCoreApplication::translate("QWebPage", "Copy Audio", "Copy Audio Link Location"); +} + +String WebPlatformStrategies::contextMenuItemTagToggleMediaControls() +{ + return QCoreApplication::translate("QWebPage", "Toggle Controls", "Toggle Media Controls"); +} + +String WebPlatformStrategies::contextMenuItemTagToggleMediaLoop() +{ + return QCoreApplication::translate("QWebPage", "Toggle Loop", "Toggle Media Loop Playback"); +} + +String WebPlatformStrategies::contextMenuItemTagEnterVideoFullscreen() +{ + return QCoreApplication::translate("QWebPage", "Enter Fullscreen", "Switch Video to Fullscreen"); +} + +String WebPlatformStrategies::contextMenuItemTagMediaPlay() +{ + return QCoreApplication::translate("QWebPage", "Play", "Play"); +} + +String WebPlatformStrategies::contextMenuItemTagMediaPause() +{ + return QCoreApplication::translate("QWebPage", "Pause", "Pause"); +} + +String WebPlatformStrategies::contextMenuItemTagMediaMute() +{ + return QCoreApplication::translate("QWebPage", "Mute", "Mute"); +} + String WebPlatformStrategies::contextMenuItemTagOpenFrameInNewWindow() { return QCoreApplication::translate("QWebPage", "Open Frame", "Open Frame in New Window context menu item"); diff --git a/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h b/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h index 8ea60d9..ea366e0 100644 --- a/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h +++ b/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h @@ -33,14 +33,16 @@ #include <PluginStrategy.h> #include <VisitedLinkStrategy.h> -class QWebPage; +namespace WebCore { +class Page; +} class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::PluginStrategy, private WebCore::LocalizationStrategy, private WebCore::VisitedLinkStrategy { public: - static void initialize(QWebPage* webPage); + static void initialize(); private: - WebPlatformStrategies(QWebPage* webPage); + WebPlatformStrategies(); // WebCore::PlatformStrategies virtual WebCore::PluginStrategy* createPluginStrategy(); @@ -49,7 +51,7 @@ private: // WebCore::PluginStrategy virtual void refreshPlugins(); - virtual void getPluginInfo(Vector<WebCore::PluginInfo>&); + virtual void getPluginInfo(const WebCore::Page*, Vector<WebCore::PluginInfo>&); // WebCore::LocalizationStrategy virtual WTF::String inputElementAltText(); @@ -95,6 +97,16 @@ private: virtual WTF::String contextMenuItemTagLeftToRight(); virtual WTF::String contextMenuItemTagRightToLeft(); virtual WTF::String contextMenuItemTagInspectElement(); + virtual WTF::String contextMenuItemTagOpenVideoInNewWindow(); + virtual WTF::String contextMenuItemTagOpenAudioInNewWindow(); + virtual WTF::String contextMenuItemTagCopyVideoLinkToClipboard(); + virtual WTF::String contextMenuItemTagCopyAudioLinkToClipboard(); + virtual WTF::String contextMenuItemTagToggleMediaControls(); + virtual WTF::String contextMenuItemTagToggleMediaLoop(); + virtual WTF::String contextMenuItemTagEnterVideoFullscreen(); + virtual WTF::String contextMenuItemTagMediaPlay(); + virtual WTF::String contextMenuItemTagMediaPause(); + virtual WTF::String contextMenuItemTagMediaMute(); virtual WTF::String searchMenuNoRecentSearchesText(); virtual WTF::String searchMenuRecentSearchesText(); virtual WTF::String searchMenuClearRecentSearchesText(); @@ -134,8 +146,6 @@ private: // WebCore::VisitedLinkStrategy virtual bool isLinkVisited(WebCore::Page*, WebCore::LinkHash); virtual void addVisitedLink(WebCore::Page*, WebCore::LinkHash); - - QWebPage* m_page; }; #endif // WebPlatformStrategies_h diff --git a/WebKit/qt/examples/examples.pro b/WebKit/qt/examples/examples.pro new file mode 100644 index 0000000..f8dc589 --- /dev/null +++ b/WebKit/qt/examples/examples.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS = platformplugin
\ No newline at end of file diff --git a/WebKit/qt/examples/platformplugin/README b/WebKit/qt/examples/platformplugin/README index 47ef797..e220d04 100644 --- a/WebKit/qt/examples/platformplugin/README +++ b/WebKit/qt/examples/platformplugin/README @@ -6,6 +6,9 @@ that will provide combo boxes popups to QtWebKit. QtWebKit will look for the plugins automatically so there is no need to make any other configuration to put the plugin into use. To stop using the plugin just remove the directory $$[QT_INSTALL_PLUGINS]/webkit. +A copy of qwebkitplatformplugin.h is provided with the example, as platform plugins should not depend +on the precense of QtWebKit to build. + This plugin can provide popups for <select multiple> elements but to use this feature QtWebKit must be compiled with NO_LISTBOX_RENDERING enabled. diff --git a/WebKit/qt/examples/platformplugin/WebPlugin.cpp b/WebKit/qt/examples/platformplugin/WebPlugin.cpp index c3efb80..23b938e 100644 --- a/WebKit/qt/examples/platformplugin/WebPlugin.cpp +++ b/WebKit/qt/examples/platformplugin/WebPlugin.cpp @@ -210,15 +210,30 @@ MultipleSelectionPopup::MultipleSelectionPopup(const QWebSelectData& data) bool WebPlugin::supportsExtension(Extension extension) const { - if (extension == MultipleSelections) + switch (extension) { + case MultipleSelections: return true; - if (extension == Notifications) #if ENABLE_NOTIFICATIONS + case Notifications: return true; -#else +#endif + default: return false; + } +} + +QObject* WebPlugin::createExtension(Extension extension) const +{ + switch (extension) { + case MultipleSelections: + return new WebPopup(); +#if ENABLE_NOTIFICATIONS + case Notifications: + return new WebNotificationPresenter(); #endif - return false; + default: + return 0; + } } Q_EXPORT_PLUGIN2(platformplugin, WebPlugin) diff --git a/WebKit/qt/examples/platformplugin/WebPlugin.h b/WebKit/qt/examples/platformplugin/WebPlugin.h index 4af19f9..3df345f 100644 --- a/WebKit/qt/examples/platformplugin/WebPlugin.h +++ b/WebKit/qt/examples/platformplugin/WebPlugin.h @@ -87,14 +87,8 @@ class WebPlugin : public QObject, public QWebKitPlatformPlugin Q_OBJECT Q_INTERFACES(QWebKitPlatformPlugin) public: - virtual QWebSelectMethod* createSelectInputMethod() const { return new WebPopup(); } virtual bool supportsExtension(Extension extension) const; - virtual QWebNotificationPresenter* createNotificationPresenter() const { - return new WebNotificationPresenter(); - } - virtual QWebHapticFeedbackPlayer* createHapticFeedbackPlayer() const { - return 0; - } + virtual QObject* createExtension(Extension extension) const; }; #endif // WEBPLUGIN_H diff --git a/WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h b/WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h index 76496c5..faa6989 100644 --- a/WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h +++ b/WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h @@ -110,12 +110,9 @@ public: }; virtual bool supportsExtension(Extension extension) const = 0; - virtual QWebSelectMethod* createSelectInputMethod() const = 0; - virtual QWebNotificationPresenter* createNotificationPresenter() const = 0; - virtual QWebHapticFeedbackPlayer* createHapticFeedbackPlayer() const = 0; - + virtual QObject* createExtension(Extension extension) const = 0; }; -Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.4"); +Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.5"); #endif // QWEBKITPLATFORMPLUGIN_H diff --git a/WebKit/qt/symbian/eabi/QtWebKitu.def b/WebKit/qt/symbian/eabi/QtWebKitu.def index 8291197..2b917e1 100644 --- a/WebKit/qt/symbian/eabi/QtWebKitu.def +++ b/WebKit/qt/symbian/eabi/QtWebKitu.def @@ -799,7 +799,6 @@ EXPORTS _ZN8QWebPage23allowGeolocationRequestEP9QWebFrame @ 798 NONAME _ZN8QWebPage23viewportChangeRequestedERKNS_13ViewportHintsE @ 799 NONAME ABSENT _ZNK15QWebScriptWorld5worldEv @ 800 NONAME - _ZN16QGraphicsWebView13setDeviceSizeERK5QSize @ 801 NONAME _ZN23DumpRenderTreeSupportQt12pagePropertyEP9QWebFrameRK7QStringi @ 802 NONAME _ZN23DumpRenderTreeSupportQt16isPageBoxVisibleEP9QWebFramei @ 803 NONAME _ZN23DumpRenderTreeSupportQt16resumeAnimationsEP9QWebFrame @ 804 NONAME @@ -811,7 +810,6 @@ EXPORTS _ZN8QWebPage23checkPermissionFromUserEP9QWebFrameNS_16PermissionDomainERNS_16PermissionPolicyE @ 810 NONAME _ZN8QWebPage25requestPermissionFromUserEP9QWebFrameNS_16PermissionDomainE @ 811 NONAME _ZN8QWebPage27cancelRequestsForPermissionEP9QWebFrameNS_16PermissionDomainE @ 812 NONAME - _ZNK16QGraphicsWebView10deviceSizeEv @ 813 NONAME _ZN23DumpRenderTreeSupportQt14viewportAsTextEP8QWebPageRK5QSize @ 814 NONAME _ZN23DumpRenderTreeSupportQt32simulateDesktopNotificationClickERK7QString @ 815 NONAME _ZN8QWebPage23viewportChangeRequestedEv @ 816 NONAME diff --git a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 2c63739..ec8a39e 100644 --- a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -2604,6 +2604,7 @@ void tst_QWebFrame::popupFocus() "</html>"); view.resize(400, 100); view.show(); + QTest::qWaitForWindowShown(&view); view.setFocus(); QTRY_VERIFY(view.hasFocus()); @@ -2946,12 +2947,7 @@ void tst_QWebFrame::evaluateWillCauseRepaint() view.setHtml(html); view.show(); -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) QTest::qWaitForWindowShown(&view); -#else - QTest::qWait(2000); -#endif - view.page()->mainFrame()->evaluateJavaScript( "document.getElementById('junk').style.display = 'none';"); diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 10af94c..36fa050 100644 --- a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -1368,12 +1368,9 @@ void tst_QWebPage::inputMethods_data() { QTest::addColumn<QString>("viewType"); QTest::newRow("QWebView") << "QWebView"; -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) QTest::newRow("QGraphicsWebView") << "QGraphicsWebView"; -#endif } -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) static Qt::InputMethodHints inputMethodHints(QObject* object) { if (QGraphicsObject* o = qobject_cast<QGraphicsObject*>(object)) @@ -1382,14 +1379,11 @@ static Qt::InputMethodHints inputMethodHints(QObject* object) return w->inputMethodHints(); return Qt::InputMethodHints(); } -#endif static bool inputMethodEnabled(QObject* object) { -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) if (QGraphicsObject* o = qobject_cast<QGraphicsObject*>(object)) return o->flags() & QGraphicsItem::ItemAcceptsInputMethod; -#endif if (QWidget* w = qobject_cast<QWidget*>(object)) return w->testAttribute(Qt::WA_InputMethodEnabled); return false; @@ -1406,9 +1400,7 @@ void tst_QWebPage::inputMethods() wv->setPage(page); view = wv; container = view; - } -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - else if (viewType == "QGraphicsWebView") { + } else if (viewType == "QGraphicsWebView") { QGraphicsWebView* wv = new QGraphicsWebView; wv->setPage(page); view = wv; @@ -1420,9 +1412,7 @@ void tst_QWebPage::inputMethods() wv->setGeometry(QRect(0, 0, 500, 500)); container = gv; - } -#endif - else + } else QVERIFY2(false, "Unknown view type"); page->settings()->setFontFamily(QWebSettings::SerifFont, "FooSerifFont"); @@ -1441,7 +1431,6 @@ void tst_QWebPage::inputMethods() QMouseEvent evrel(QEvent::MouseButtonRelease, inputs.at(0).geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier); page->event(&evrel); -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) // This part of the test checks if the SIP (Software Input Panel) is triggered, // which normally happens on mobile platforms, when a user input form receives // a mouse click. @@ -1463,15 +1452,11 @@ void tst_QWebPage::inputMethods() QVERIFY(viewEventSpy.contains(QEvent::RequestSoftwareInputPanel)); else QVERIFY(!viewEventSpy.contains(QEvent::RequestSoftwareInputPanel)); -#endif viewEventSpy.clear(); page->event(&evpres); page->event(&evrel); - -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) QVERIFY(viewEventSpy.contains(QEvent::RequestSoftwareInputPanel)); -#endif //ImMicroFocus QVariant variant = page->inputMethodQuery(Qt::ImMicroFocus); @@ -1499,7 +1484,6 @@ void tst_QWebPage::inputMethods() page->event(&eventText); } -#if QT_VERSION >= 0x040600 //ImMaximumTextLength variant = page->inputMethodQuery(Qt::ImMaximumTextLength); QCOMPARE(20, variant.toInt()); @@ -1548,14 +1532,12 @@ void tst_QWebPage::inputMethods() variant = page->inputMethodQuery(Qt::ImCurrentSelection); selectionValue = variant.value<QString>(); QCOMPARE(selectionValue, QString("tWebK")); -#endif //ImSurroundingText variant = page->inputMethodQuery(Qt::ImSurroundingText); QString value = variant.value<QString>(); QCOMPARE(value, QString("QtWebKit")); -#if QT_VERSION >= 0x040600 { QList<QInputMethodEvent::Attribute> attributes; // Clear the selection, so the next test does not clear any contents. @@ -1569,7 +1551,6 @@ void tst_QWebPage::inputMethods() variant = page->inputMethodQuery(Qt::ImSurroundingText); value = variant.value<QString>(); QCOMPARE(value, QString("QtWebKit")); -#endif // Cancel current composition first inputAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 0, 0, QVariant()); @@ -1670,13 +1651,11 @@ void tst_QWebPage::inputMethods() page->event(&evrelPassword); QVERIFY(inputMethodEnabled(view)); -#if QT_VERSION >= 0x040600 QVERIFY(inputMethodHints(view) & Qt::ImhHiddenText); page->event(&evpres); page->event(&evrel); QVERIFY(!(inputMethodHints(view) & Qt::ImhHiddenText)); -#endif page->mainFrame()->setHtml("<html><body><p>nothing to input here"); viewEventSpy.clear(); @@ -1689,11 +1668,8 @@ void tst_QWebPage::inputMethods() page->event(&evrel); } -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) QVERIFY(!viewEventSpy.contains(QEvent::RequestSoftwareInputPanel)); -#endif -#if QT_VERSION >= 0x040600 //START - Test for sending empty QInputMethodEvent page->mainFrame()->setHtml("<html><body>" \ "<input type='text' id='input3' value='QtWebKit2'/>" \ @@ -1707,7 +1683,6 @@ void tst_QWebPage::inputMethods() QString inputValue = page->mainFrame()->evaluateJavaScript("document.getElementById('input3').value").toString(); QCOMPARE(inputValue, QString("QtWebKit2")); //END - Test for sending empty QInputMethodEvent -#endif delete container; } @@ -2089,10 +2064,8 @@ void tst_QWebPage::originatingObjectInNetworkRequests() QList<QWebFrame*> childFrames = m_page->mainFrame()->childFrames(); QCOMPARE(childFrames.count(), 2); -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) for (int i = 0; i < 2; ++i) QVERIFY(qobject_cast<QWebFrame*>(networkManager->requests.at(i).originatingObject()) == childFrames.at(i)); -#endif } /** @@ -2189,23 +2162,23 @@ void tst_QWebPage::testStopScheduledPageRefresh() QWebPage page1; page1.setNetworkAccessManager(new TestNetworkManager(&page1)); page1.mainFrame()->setHtml("<html><head>" - "<meta http-equiv=\"refresh\"content=\"0;URL=http://qt.nokia.com/favicon.ico\">" + "<meta http-equiv=\"refresh\"content=\"0;URL=qrc:///resources/index.html\">" "</head><body><h1>Page redirects immediately...</h1>" "</body></html>"); QVERIFY(::waitForSignal(&page1, SIGNAL(loadFinished(bool)))); QTest::qWait(500); - QCOMPARE(page1.mainFrame()->url().toString(), QString("http://qt.nokia.com/favicon.ico")); + QCOMPARE(page1.mainFrame()->url(), QUrl(QLatin1String("qrc:///resources/index.html"))); // With QWebPage::StopScheduledPageRefresh QWebPage page2; page2.setNetworkAccessManager(new TestNetworkManager(&page2)); page2.mainFrame()->setHtml("<html><head>" - "<meta http-equiv=\"refresh\"content=\"1;URL=http://qt.nokia.com/favicon.ico\">" + "<meta http-equiv=\"refresh\"content=\"1;URL=qrc:///resources/index.html\">" "</head><body><h1>Page redirect test with 1 sec timeout...</h1>" "</body></html>"); page2.triggerAction(QWebPage::StopScheduledPageRefresh); QTest::qWait(1500); - QCOMPARE(page2.mainFrame()->url().toString(), QString("about:blank")); + QCOMPARE(page2.mainFrame()->url().toString(), QLatin1String("about:blank")); } void tst_QWebPage::findText() diff --git a/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/WebKit/qt/tests/qwebview/tst_qwebview.cpp index fd4978d..8cd2f3f 100644 --- a/WebKit/qt/tests/qwebview/tst_qwebview.cpp +++ b/WebKit/qt/tests/qwebview/tst_qwebview.cpp @@ -142,22 +142,14 @@ void tst_QWebView::reusePage() } view1->show(); -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) QTest::qWaitForWindowShown(view1); -#else - QTest::qWait(2000); -#endif delete view1; QVERIFY(page != 0); // deleting view must not have deleted the page, since it's not a child of view QWebView *view2 = new QWebView; view2->setPage(page); view2->show(); // in Windowless mode, you should still be able to see the plugin here -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) QTest::qWaitForWindowShown(view2); -#else - QTest::qWait(2000); -#endif delete view2; delete page; // must not crash |