From dcc8cf2e65d1aa555cce12431a16547e66b469ee Mon Sep 17 00:00:00 2001 From: Steve Block Date: Tue, 27 Apr 2010 16:31:00 +0100 Subject: Merge webkit.org at r58033 : Initial merge by git Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1 --- WebKit/qt/Api/DerivedSources.pro | 5 +- WebKit/qt/Api/qgraphicswebview.cpp | 282 +++- WebKit/qt/Api/qgraphicswebview.h | 7 + WebKit/qt/Api/qwebelement.cpp | 20 +- WebKit/qt/Api/qwebelement.h | 11 +- WebKit/qt/Api/qwebframe.cpp | 335 +--- WebKit/qt/Api/qwebframe.h | 4 +- WebKit/qt/Api/qwebframe_p.h | 6 +- WebKit/qt/Api/qwebinspector.cpp | 6 +- WebKit/qt/Api/qwebinspector.h | 1 + WebKit/qt/Api/qwebkitglobal.h | 6 + WebKit/qt/Api/qwebpage.cpp | 238 +-- WebKit/qt/Api/qwebpage.h | 11 + WebKit/qt/Api/qwebpage_p.h | 8 + WebKit/qt/Api/qwebsecurityorigin.cpp | 15 - WebKit/qt/Api/qwebsettings.cpp | 101 +- WebKit/qt/Api/qwebsettings.h | 13 +- WebKit/qt/Api/qwebview.cpp | 39 +- WebKit/qt/Api/qwebview.h | 2 + WebKit/qt/ChangeLog | 1604 ++++++++++++++++++++ WebKit/qt/QGVLauncher/QGVLauncher.pro | 16 - WebKit/qt/QGVLauncher/main.cpp | 536 ------- WebKit/qt/WebCoreSupport/ChromeClientQt.cpp | 122 +- WebKit/qt/WebCoreSupport/ChromeClientQt.h | 24 +- .../qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp | 372 +++++ WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h | 87 ++ WebKit/qt/WebCoreSupport/EditCommandQt.cpp | 1 - WebKit/qt/WebCoreSupport/EditorClientQt.cpp | 32 +- WebKit/qt/WebCoreSupport/EditorClientQt.h | 2 +- WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp | 100 +- WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h | 1 - WebKit/qt/WebCoreSupport/InspectorClientQt.cpp | 177 ++- WebKit/qt/WebCoreSupport/InspectorClientQt.h | 66 +- .../NotificationPresenterClientQt.cpp | 109 ++ .../WebCoreSupport/NotificationPresenterClientQt.h | 61 + WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp | 82 +- WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h | 5 + WebKit/qt/WebCoreSupport/QtMaemoWebPopup.cpp | 220 +++ WebKit/qt/WebCoreSupport/QtMaemoWebPopup.h | 89 ++ WebKit/qt/docs/qtwebkit.qdoc | 3 - WebKit/qt/symbian/eabi/QtWebKitu.def | 29 +- WebKit/qt/tests/benchmarks/loading/loading.pro | 1 + WebKit/qt/tests/benchmarks/painting/painting.pro | 1 + .../qt/tests/benchmarks/painting/tst_painting.cpp | 27 + WebKit/qt/tests/hybridPixmap/hybridPixmap.pro | 1 + .../qt/tests/qgraphicswebview/qgraphicswebview.pro | 1 + WebKit/qt/tests/qwebelement/qwebelement.pro | 1 + WebKit/qt/tests/qwebframe/qwebframe.pro | 1 + WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 130 +- WebKit/qt/tests/qwebhistory/qwebhistory.pro | 1 + .../qwebhistoryinterface/qwebhistoryinterface.pro | 1 + WebKit/qt/tests/qwebinspector/qwebinspector.pro | 1 + WebKit/qt/tests/qwebpage/qwebpage.pro | 1 + WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 90 +- .../qwebplugindatabase/qwebplugindatabase.pro | 1 + WebKit/qt/tests/tests.pri | 5 +- WebKit/qt/tests/tests.pro | 2 +- 57 files changed, 3809 insertions(+), 1304 deletions(-) delete mode 100644 WebKit/qt/QGVLauncher/QGVLauncher.pro delete mode 100644 WebKit/qt/QGVLauncher/main.cpp create mode 100644 WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp create mode 100644 WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h create mode 100644 WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp create mode 100644 WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h create mode 100644 WebKit/qt/WebCoreSupport/QtMaemoWebPopup.cpp create mode 100644 WebKit/qt/WebCoreSupport/QtMaemoWebPopup.h (limited to 'WebKit/qt') diff --git a/WebKit/qt/Api/DerivedSources.pro b/WebKit/qt/Api/DerivedSources.pro index a8f2684..389fb5f 100644 --- a/WebKit/qt/Api/DerivedSources.pro +++ b/WebKit/qt/Api/DerivedSources.pro @@ -32,8 +32,6 @@ regex = ".*\sclass\sQWEBKIT_EXPORT\s(\w+)\s(.*)" for(HEADER, WEBKIT_API_HEADERS) { # 1. Append to QtWebKit header that includes all other header files - - qtheader_module.depends += $$HEADER # Quotes need to be escaped once more when placed in eval() eval(qtheader_module.commands += echo $${DOUBLE_ESCAPED_QUOTE}\$${LITERAL_HASH}include \\\"$$basename(HEADER)\\\"$${DOUBLE_ESCAPED_QUOTE} >> $${qtheader_module.target} &&) @@ -53,6 +51,7 @@ for(HEADER, WEBKIT_API_HEADERS) { eval($${HEADER_TARGET}.commands = echo $${DOUBLE_ESCAPED_QUOTE}\$${LITERAL_HASH}include \\\"$$PATH_TO_HEADER\\\"$${DOUBLE_ESCAPED_QUOTE} > $$eval($${HEADER_TARGET}.target)) QMAKE_EXTRA_TARGETS += $$HEADER_TARGET + qtheader_module.depends += $$eval($${HEADER_TARGET}.target) # 3. Extract class names of exported classes from the headers and generate # the class name header files @@ -97,7 +96,7 @@ qtheader_module.commands += echo $${QUOTE}$${LITERAL_HASH}endif // QT_QTWEBKIT_M QMAKE_EXTRA_TARGETS += qtheader_module qtheader_pri.target = $${DESTDIR}/classheaders.pri -qtheader_pri.depends = $${WEBKIT_API_HEADERS} $${_PRO_FILE_} +qtheader_pri.depends += $${_PRO_FILE_} qtheader_pri.commands = echo $${QUOTE}WEBKIT_CLASS_HEADERS = $${WEBKIT_CLASS_HEADERS}$${QUOTE} > $${qtheader_pri.target} QMAKE_EXTRA_TARGETS += qtheader_pri diff --git a/WebKit/qt/Api/qgraphicswebview.cpp b/WebKit/qt/Api/qgraphicswebview.cpp index 9720e0c..c865c4d 100644 --- a/WebKit/qt/Api/qgraphicswebview.cpp +++ b/WebKit/qt/Api/qgraphicswebview.cpp @@ -26,7 +26,10 @@ #include "qwebpage.h" #include "qwebpage_p.h" #include "QWebPageClient.h" -#include +#include "FrameView.h" +#include "GraphicsContext.h" +#include "IntRect.h" +#include "TiledBackingStore.h" #include #include #include @@ -35,14 +38,14 @@ #include #include #include +#include #include +#include #if defined(Q_WS_X11) #include #endif #include -#if USE(ACCELERATED_COMPOSITING) - // 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 QGraphicsWebViewOverlay : public QGraphicsItem { @@ -52,7 +55,9 @@ class QGraphicsWebViewOverlay : public QGraphicsItem { , q(view) { setPos(0, 0); +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, true); +#endif setCacheMode(QGraphicsItem::DeviceCoordinateCache); } @@ -70,8 +75,6 @@ class QGraphicsWebViewOverlay : public QGraphicsItem { QGraphicsWebView* q; }; -#endif - class QGraphicsWebViewPrivate : public QWebPageClient { public: QGraphicsWebViewPrivate(QGraphicsWebView* parent) @@ -92,6 +95,7 @@ public: } virtual ~QGraphicsWebViewPrivate(); + virtual void scroll(int dx, int dy, const QRect&); virtual void update(const QRect& dirtyRect); virtual void setInputMethodEnabled(bool enable); @@ -108,6 +112,7 @@ public: virtual QPalette palette() const; virtual int screenNumber() const; virtual QWidget* ownerWidget() const; + virtual QRect geometryRelativeToOwnerWidget() const; virtual QObject* pluginParent() const; @@ -117,34 +122,49 @@ public: virtual void setRootGraphicsLayer(QGraphicsItem* layer); virtual void markForSync(bool scheduleSync); void updateCompositingScrollPosition(); + + // QGraphicsWebView can render composited layers + virtual bool allowsAcceleratedCompositing() const { return true; } #endif - + void updateResizesToContentsForPage(); + QRectF graphicsItemVisibleRect() const; +#if ENABLE(TILED_BACKING_STORE) + void updateTiledBackingStoreScale(); +#endif + + void createOrDeleteOverlay(); void syncLayers(); + + void unsetPageIfExists(); + void _q_doLoadFinished(bool success); void _q_contentsSizeChanged(const QSize&); + void _q_scaleChanged(); + + void _q_updateMicroFocus(); + void _q_pageDestroyed(); QGraphicsWebView* q; QWebPage* page; bool resizesToContents; -#if USE(ACCELERATED_COMPOSITING) - QGraphicsItem* rootGraphicsLayer; - // the overlay gets instantiated when the root layer is attached, and get deleted when it's detached QSharedPointer overlay; + // we need to put the root graphics layer behind the overlay (which contains the scrollbar) + enum { RootGraphicsLayerZValue, OverlayZValue }; + +#if USE(ACCELERATED_COMPOSITING) + QGraphicsItem* rootGraphicsLayer; // we need to sync the layers if we get a special call from the WebCore // compositor telling us to do so. We'll get that call from ChromeClientQt bool shouldSync; // we have to flush quite often, so we use a meta-method instead of QTimer::singleShot for putting the event in the queue QMetaMethod syncMetaMethod; - - // we need to put the root graphics layer behind the overlay (which contains the scrollbar) - enum { RootGraphicsLayerZValue, OverlayZValue }; #endif }; @@ -160,6 +180,26 @@ QGraphicsWebViewPrivate::~QGraphicsWebViewPrivate() #endif } +void QGraphicsWebViewPrivate::createOrDeleteOverlay() +{ + bool useOverlay = false; + if (!resizesToContents) { +#if USE(ACCELERATED_COMPOSITING) + useOverlay = useOverlay || rootGraphicsLayer; +#endif +#if ENABLE(TILED_BACKING_STORE) + useOverlay = useOverlay || QWebFramePrivate::core(q->page()->mainFrame())->tiledBackingStore(); +#endif + } + if (useOverlay == !!overlay) + return; + if (useOverlay) { + overlay = QSharedPointer(new QGraphicsWebViewOverlay(q)); + overlay->setZValue(OverlayZValue); + } else + overlay.clear(); +} + #if USE(ACCELERATED_COMPOSITING) void QGraphicsWebViewPrivate::setRootGraphicsLayer(QGraphicsItem* layer) { @@ -175,15 +215,9 @@ void QGraphicsWebViewPrivate::setRootGraphicsLayer(QGraphicsItem* layer) layer->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); layer->setParentItem(q); layer->setZValue(RootGraphicsLayerZValue); - if (!overlay) { - overlay = QSharedPointer(new QGraphicsWebViewOverlay(q)); - overlay->setZValue(OverlayZValue); - } updateCompositingScrollPosition(); - } else { - // we don't have compositing layers, we can render the scrollbars and content in one go - overlay.clear(); } + createOrDeleteOverlay(); } void QGraphicsWebViewPrivate::markForSync(bool scheduleSync) @@ -200,7 +234,6 @@ void QGraphicsWebViewPrivate::updateCompositingScrollPosition() rootGraphicsLayer->setPos(-scrollPosition); } } - #endif void QGraphicsWebViewPrivate::syncLayers() @@ -222,9 +255,30 @@ void QGraphicsWebViewPrivate::_q_doLoadFinished(bool success) emit q->loadFinished(success); } +void QGraphicsWebViewPrivate::_q_updateMicroFocus() +{ +#if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) + // Ideally, this should be handled by a common call to an updateMicroFocus function + // in QGraphicsItem. See http://bugreports.qt.nokia.com/browse/QTBUG-7578. + QList views = q->scene()->views(); + for (int c = 0; c < views.size(); ++c) { + QInputContext* ic = views.at(c)->inputContext(); + if (ic) + ic->update(); + } +#endif +} + +void QGraphicsWebViewPrivate::_q_pageDestroyed() +{ + page = 0; + q->setPage(0); +} + void QGraphicsWebViewPrivate::scroll(int dx, int dy, const QRect& rectToScroll) { q->scroll(qreal(dx), qreal(dy), QRectF(rectToScroll)); + #if USE(ACCELERATED_COMPOSITING) updateCompositingScrollPosition(); #endif @@ -233,9 +287,11 @@ void QGraphicsWebViewPrivate::scroll(int dx, int dy, const QRect& rectToScroll) void QGraphicsWebViewPrivate::update(const QRect & dirtyRect) { q->update(QRectF(dirtyRect)); -#if USE(ACCELERATED_COMPOSITING) + + createOrDeleteOverlay(); if (overlay) overlay->update(QRectF(dirtyRect)); +#if USE(ACCELERATED_COMPOSITING) syncLayers(); #endif } @@ -286,10 +342,12 @@ QPalette QGraphicsWebViewPrivate::palette() const int QGraphicsWebViewPrivate::screenNumber() const { #if defined(Q_WS_X11) - const QList views = q->scene()->views(); + if (QGraphicsScene* scene = q->scene()) { + const QList views = scene->views(); - if (!views.isEmpty()) - return views.at(0)->x11Info().screen(); + if (!views.isEmpty()) + return views.at(0)->x11Info().screen(); + } #endif return 0; @@ -297,8 +355,24 @@ int QGraphicsWebViewPrivate::screenNumber() const QWidget* QGraphicsWebViewPrivate::ownerWidget() const { - const QList views = q->scene()->views(); - return views.value(0); + if (QGraphicsScene* scene = q->scene()) { + const QList views = scene->views(); + return views.value(0); + } + return 0; +} + +QRect QGraphicsWebViewPrivate::geometryRelativeToOwnerWidget() const +{ + if (!q->scene()) + return QRect(); + + QList views = q->scene()->views(); + if (views.isEmpty()) + return QRect(); + + QGraphicsView* view = views.at(0); + return view->mapFromScene(q->boundingRect()).boundingRect(); } QObject* QGraphicsWebViewPrivate::pluginParent() const @@ -340,6 +414,42 @@ void QGraphicsWebViewPrivate::_q_contentsSizeChanged(const QSize& size) q->setGeometry(QRectF(q->geometry().topLeft(), size)); } +void QGraphicsWebViewPrivate::_q_scaleChanged() +{ +#if ENABLE(TILED_BACKING_STORE) + updateTiledBackingStoreScale(); +#endif +} + +QRectF QGraphicsWebViewPrivate::graphicsItemVisibleRect() const +{ + if (!q->scene()) + return QRectF(); + QList views = q->scene()->views(); + if (views.size() > 1) { +#ifndef QT_NO_DEBUG_STREAM + qDebug() << "QGraphicsWebView is in more than one graphics views, unable to compute the visible rect"; +#endif + return QRectF(); + } + if (views.size() < 1) + return QRectF(); + + int xPosition = views[0]->horizontalScrollBar()->value(); + int yPosition = views[0]->verticalScrollBar()->value(); + return q->mapRectFromScene(QRectF(QPoint(xPosition, yPosition), views[0]->viewport()->size())); +} + +#if ENABLE(TILED_BACKING_STORE) +void QGraphicsWebViewPrivate::updateTiledBackingStoreScale() +{ + WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(page->mainFrame())->tiledBackingStore(); + if (!backingStore) + return; + backingStore->setContentsScale(q->scale()); +} +#endif + /*! \class QGraphicsWebView \brief The QGraphicsWebView class allows Web content to be added to a GraphicsView. @@ -433,6 +543,9 @@ QGraphicsWebView::QGraphicsWebView(QGraphicsItem* parent) #endif setFocusPolicy(Qt::StrongFocus); setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); +#if ENABLE(TILED_BACKING_STORE) + QObject::connect(this, SIGNAL(scaleChanged()), this, SLOT(_q_scaleChanged())); +#endif } /*! @@ -482,6 +595,21 @@ QWebPage* QGraphicsWebView::page() const */ void QGraphicsWebView::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget*) { +#if ENABLE(TILED_BACKING_STORE) + if (WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(page()->mainFrame())->tiledBackingStore()) { + // FIXME: We should set the backing store viewport earlier than in paint + if (d->resizesToContents) + backingStore->viewportChanged(WebCore::IntRect(d->graphicsItemVisibleRect())); + else { + QRectF visibleRect(d->page->mainFrame()->scrollPosition(), d->page->mainFrame()->geometry().size()); + backingStore->viewportChanged(WebCore::IntRect(visibleRect)); + } + // QWebFrame::render is a public API, bypass it for tiled rendering so behavior does not need to change. + WebCore::GraphicsContext context(painter); + page()->mainFrame()->d->renderFromTiledBackingStore(&context, option->exposedRect.toAlignedRect()); + return; + } +#endif #if USE(ACCELERATED_COMPOSITING) page()->mainFrame()->render(painter, d->overlay ? QWebFrame::ContentsLayer : QWebFrame::AllLayers, option->exposedRect.toAlignedRect()); #else @@ -589,6 +717,29 @@ bool QGraphicsWebView::event(QEvent* event) return QGraphicsWidget::event(event); } +void QGraphicsWebViewPrivate::unsetPageIfExists() +{ + if (!page) + return; + + // if the page client is the special client constructed for + // delegating the responsibilities to a QWidget, we need + // to destroy it. + + if (page->d->client && page->d->client->isQWidgetClient()) + delete page->d->client; + + page->d->client = 0; + + // if the page was created by us, we own it and need to + // destroy it as well. + + if (page->parent() == q) + delete page; + else + page->disconnect(q); +} + /*! Makes \a page the new web page of the web graphicsitem. @@ -603,26 +754,20 @@ void QGraphicsWebView::setPage(QWebPage* page) if (d->page == page) return; - if (d->page) { - d->page->d->client = 0; // unset the page client - if (d->page->parent() == this) - delete d->page; - else - d->page->disconnect(this); - } - + d->unsetPageIfExists(); d->page = page; + if (!d->page) return; -#if USE(ACCELERATED_COMPOSITING) + + d->page->d->client = d; // set the page client + if (d->overlay) d->overlay->prepareGeometryChange(); -#endif - d->page->d->client = d; // set the page client QSize size = geometry().size().toSize(); page->setViewportSize(size); - + if (d->resizesToContents) d->updateResizesToContentsForPage(); @@ -644,6 +789,10 @@ void QGraphicsWebView::setPage(QWebPage* page) this, SIGNAL(statusBarMessage(QString))); connect(d->page, SIGNAL(linkClicked(QUrl)), this, SIGNAL(linkClicked(QUrl))); + connect(d->page, SIGNAL(microFocusChanged()), + this, SLOT(_q_updateMicroFocus())); + connect(d->page, SIGNAL(destroyed()), + this, SLOT(_q_pageDestroyed())); } /*! @@ -724,11 +873,8 @@ qreal QGraphicsWebView::zoomFactor() const */ void QGraphicsWebView::updateGeometry() { - -#if USE(ACCELERATED_COMPOSITING) if (d->overlay) d->overlay->prepareGeometryChange(); -#endif QGraphicsWidget::updateGeometry(); @@ -745,10 +891,8 @@ void QGraphicsWebView::setGeometry(const QRectF& rect) { QGraphicsWidget::setGeometry(rect); -#if USE(ACCELERATED_COMPOSITING) if (d->overlay) d->overlay->prepareGeometryChange(); -#endif if (!d->page) return; @@ -920,7 +1064,12 @@ QWebSettings* QGraphicsWebView::settings() const */ QAction *QGraphicsWebView::pageAction(QWebPage::WebAction action) const { +#ifdef QT_NO_ACTION + Q_UNUSED(action) + return 0; +#else return page()->action(action); +#endif } /*! @@ -964,12 +1113,13 @@ bool QGraphicsWebView::findText(const QString &subString, QWebPage::FindFlags op If this property is set, the QGraphicsWebView will automatically change its size to match the size of the main frame contents. As a result the top level frame - will never have scrollbars. + will never have scrollbars. It will also make CSS fixed positioning to behave like absolute positioning + with elements positioned relative to the document instead of the viewport. This property should be used in conjunction with the QWebPage::preferredContentsSize property. If not explicitly set, the preferredContentsSize is automatically set to a reasonable value. - \sa QWebPage::setPreferredContentsSize + \sa QWebPage::setPreferredContentsSize() */ void QGraphicsWebView::setResizesToContents(bool enabled) { @@ -985,6 +1135,48 @@ bool QGraphicsWebView::resizesToContents() const return d->resizesToContents; } +/*! + \property QGraphicsWebView::tiledBackingStoreFrozen + \brief whether the tiled backing store updates its contents + \since 4.7 + + If the tiled backing store is enabled using QWebSettings::TiledBackingStoreEnabled attribute, this property + can be used to disable backing store updates temporarily. This can be useful for example for running + a smooth animation that changes the scale of the QGraphicsWebView. + + When the backing store is unfrozen, its contents will be automatically updated to match the current + state of the document. If the QGraphicsWebView scale was changed, the backing store is also + re-rendered using the new scale. + + If the tiled backing store is not enabled, this property does nothing. + + \sa QWebSettings::TiledBackingStoreEnabled + \sa QGraphicsObject::scale +*/ +bool QGraphicsWebView::isTiledBackingStoreFrozen() const +{ +#if ENABLE(TILED_BACKING_STORE) + WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(page()->mainFrame())->tiledBackingStore(); + if (!backingStore) + return false; + return backingStore->contentsFrozen(); +#else + return false; +#endif +} + +void QGraphicsWebView::setTiledBackingStoreFrozen(bool frozen) +{ +#if ENABLE(TILED_BACKING_STORE) + WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(page()->mainFrame())->tiledBackingStore(); + if (!backingStore) + return; + backingStore->setContentsFrozen(frozen); +#else + UNUSED_PARAM(frozen); +#endif +} + /*! \reimp */ void QGraphicsWebView::hoverMoveEvent(QGraphicsSceneHoverEvent* ev) diff --git a/WebKit/qt/Api/qgraphicswebview.h b/WebKit/qt/Api/qgraphicswebview.h index 14de9d5..88729d3 100644 --- a/WebKit/qt/Api/qgraphicswebview.h +++ b/WebKit/qt/Api/qgraphicswebview.h @@ -46,6 +46,7 @@ class QWEBKIT_EXPORT QGraphicsWebView : public QGraphicsWidget { Q_PROPERTY(bool modified READ isModified) Q_PROPERTY(bool resizesToContents READ resizesToContents WRITE setResizesToContents) + Q_PROPERTY(bool tiledBackingStoreFrozen READ isTiledBackingStoreFrozen WRITE setTiledBackingStoreFrozen) public: explicit QGraphicsWebView(QGraphicsItem* parent = 0); @@ -82,6 +83,9 @@ public: bool resizesToContents() const; void setResizesToContents(bool enabled); + + bool isTiledBackingStoreFrozen() const; + void setTiledBackingStoreFrozen(bool frozen); virtual void setGeometry(const QRectF& rect); virtual void updateGeometry(); @@ -138,10 +142,13 @@ protected: private: Q_PRIVATE_SLOT(d, void _q_doLoadFinished(bool success)) + Q_PRIVATE_SLOT(d, void _q_updateMicroFocus()) + Q_PRIVATE_SLOT(d, void _q_pageDestroyed()) // we don't want to change the moc based on USE() macro, so this function is here // but will be empty if ACCLERATED_COMPOSITING is disabled Q_PRIVATE_SLOT(d, void syncLayers()) Q_PRIVATE_SLOT(d, void _q_contentsSizeChanged(const QSize&)) + Q_PRIVATE_SLOT(d, void _q_scaleChanged()) QGraphicsWebViewPrivate* const d; friend class QGraphicsWebViewPrivate; diff --git a/WebKit/qt/Api/qwebelement.cpp b/WebKit/qt/Api/qwebelement.cpp index 9d4d0d0..8af7203 100644 --- a/WebKit/qt/Api/qwebelement.cpp +++ b/WebKit/qt/Api/qwebelement.cpp @@ -26,7 +26,6 @@ #include "CSSRule.h" #include "CSSRuleList.h" #include "CSSStyleRule.h" -#include "CString.h" #include "Document.h" #include "DocumentFragment.h" #include "FrameView.h" @@ -45,6 +44,7 @@ #include "runtime_root.h" #include #include +#include #include @@ -864,25 +864,7 @@ QStringList QWebElement::classes() const return QStringList(); QStringList classes = attribute(QLatin1String("class")).simplified().split(QLatin1Char(' '), QString::SkipEmptyParts); -#if QT_VERSION >= 0x040500 classes.removeDuplicates(); -#else - int n = classes.size(); - int j = 0; - QSet seen; - seen.reserve(n); - for (int i = 0; i < n; ++i) { - const QString& s = classes.at(i); - if (seen.contains(s)) - continue; - seen.insert(s); - if (j != i) - classes[j] = s; - ++j; - } - if (n != j) - classes.erase(classes.begin() + j, classes.end()); -#endif return classes; } diff --git a/WebKit/qt/Api/qwebelement.h b/WebKit/qt/Api/qwebelement.h index 156d24b..c488d12 100644 --- a/WebKit/qt/Api/qwebelement.h +++ b/WebKit/qt/Api/qwebelement.h @@ -20,11 +20,11 @@ #ifndef QWEBELEMENT_H #define QWEBELEMENT_H -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "qwebkitglobal.h" namespace WebCore { @@ -154,6 +154,7 @@ private: static QWebElement enclosingElement(WebCore::Node*); + friend class DumpRenderTreeSupportQt; friend class QWebFrame; friend class QWebElementCollection; friend class QWebHitTestResult; diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp index 15b5c00..e6ee00f 100644 --- a/WebKit/qt/Api/qwebframe.cpp +++ b/WebKit/qt/Api/qwebframe.cpp @@ -58,6 +58,7 @@ #include "SelectionController.h" #include "SubstituteData.h" #include "SVGSMILElement.h" +#include "TiledBackingStore.h" #include "htmlediting.h" #include "markup.h" #include "qt_instance.h" @@ -87,182 +88,80 @@ QT_BEGIN_NAMESPACE extern Q_GUI_EXPORT int qt_defaultDpi(); QT_END_NAMESPACE -bool QWEBKIT_EXPORT qt_drt_hasDocumentElement(QWebFrame* qframe) +static bool webframe_scrollOverflow(WebCore::Frame* frame, int dx, int dy, const QPoint& pos) { - return QWebFramePrivate::core(qframe)->document()->documentElement(); -} - -void QWEBKIT_EXPORT qt_drt_setJavaScriptProfilingEnabled(QWebFrame* qframe, bool enabled) -{ -#if ENABLE(JAVASCRIPT_DEBUGGER) - Frame* frame = QWebFramePrivate::core(qframe); - InspectorController* controller = frame->page()->inspectorController(); - if (!controller) - return; - if (enabled) - controller->enableProfiler(); - else - controller->disableProfiler(); -#endif -} - -// Pause a given CSS animation or transition on the target node at a specific time. -// If the animation or transition is already paused, it will update its pause time. -// This method is only intended to be used for testing the CSS animation and transition system. -bool QWEBKIT_EXPORT qt_drt_pauseAnimation(QWebFrame *qframe, const QString &animationName, double time, const QString &elementId) -{ - Frame* frame = QWebFramePrivate::core(qframe); - if (!frame) - return false; - - AnimationController* controller = frame->animation(); - if (!controller) + if (!frame || !frame->document() || !frame->view() || !frame->eventHandler()) return false; - Document* doc = frame->document(); - Q_ASSERT(doc); - - Node* coreNode = doc->getElementById(elementId); - if (!coreNode || !coreNode->renderer()) - return false; - - return controller->pauseAnimationAtTime(coreNode->renderer(), animationName, time); -} - -bool QWEBKIT_EXPORT qt_drt_pauseTransitionOfProperty(QWebFrame *qframe, const QString &propertyName, double time, const QString &elementId) -{ - Frame* frame = QWebFramePrivate::core(qframe); - if (!frame) - return false; - - AnimationController* controller = frame->animation(); - if (!controller) - return false; - - Document* doc = frame->document(); - Q_ASSERT(doc); - - Node* coreNode = doc->getElementById(elementId); - if (!coreNode || !coreNode->renderer()) - return false; - - return controller->pauseTransitionAtTime(coreNode->renderer(), propertyName, time); -} - -// Pause a given SVG animation on the target node at a specific time. -// This method is only intended to be used for testing the SVG animation system. -bool QWEBKIT_EXPORT qt_drt_pauseSVGAnimation(QWebFrame *qframe, const QString &animationId, double time, const QString &elementId) -{ -#if !ENABLE(SVG) - return false; -#else - Frame* frame = QWebFramePrivate::core(qframe); - if (!frame) - return false; - - Document* doc = frame->document(); - Q_ASSERT(doc); - - if (!doc->svgExtensions()) + QPoint contentsPos = frame->view()->windowToContents(pos); + Node* node = frame->document()->elementFromPoint(contentsPos.x(), contentsPos.y()); + if (!node) return false; - Node* coreNode = doc->getElementById(animationId); - if (!coreNode || !SVGSMILElement::isSMILElement(coreNode)) + RenderObject* renderer = node->renderer(); + if (!renderer) return false; - return doc->accessSVGExtensions()->sampleAnimationAtTime(elementId, static_cast(coreNode), time); -#endif -} - -// Returns the total number of currently running animations (includes both CSS transitions and CSS animations). -int QWEBKIT_EXPORT qt_drt_numberOfActiveAnimations(QWebFrame *qframe) -{ - Frame* frame = QWebFramePrivate::core(qframe); - if (!frame) + if (renderer->isListBox()) return false; - AnimationController* controller = frame->animation(); - if (!controller) + RenderLayer* renderLayer = renderer->enclosingLayer(); + if (!renderLayer) return false; - return controller->numberOfActiveAnimations(); -} - -void QWEBKIT_EXPORT qt_drt_clearFrameName(QWebFrame* qFrame) -{ - Frame* frame = QWebFramePrivate::core(qFrame); - frame->tree()->clearName(); -} + bool scrolledHorizontal = false; + bool scrolledVertical = false; -int QWEBKIT_EXPORT qt_drt_javaScriptObjectsCount() -{ - return JSDOMWindowBase::commonJSGlobalData()->heap.globalObjectCount(); -} + if (dx > 0) + scrolledHorizontal = renderLayer->scroll(ScrollRight, ScrollByPixel, dx); + else if (dx < 0) + scrolledHorizontal = renderLayer->scroll(ScrollLeft, ScrollByPixel, qAbs(dx)); -void QWEBKIT_EXPORT qt_drt_garbageCollector_collect() -{ - gcController().garbageCollectNow(); -} + if (dy > 0) + scrolledVertical = renderLayer->scroll(ScrollDown, ScrollByPixel, dy); + else if (dy < 0) + scrolledVertical = renderLayer->scroll(ScrollUp, ScrollByPixel, qAbs(dy)); -void QWEBKIT_EXPORT qt_drt_garbageCollector_collectOnAlternateThread(bool waitUntilDone) -{ - gcController().garbageCollectOnAlternateThreadForDebugging(waitUntilDone); + return (scrolledHorizontal || scrolledVertical); } -// Returns the value of counter in the element specified by \a id. -QString QWEBKIT_EXPORT qt_drt_counterValueForElementById(QWebFrame* qFrame, const QString& id) -{ - Frame* frame = QWebFramePrivate::core(qFrame); - if (Document* document = frame->document()) { - Element* element = document->getElementById(id); - return WebCore::counterValueForElement(element); - } - return QString(); -} -int QWEBKIT_EXPORT qt_drt_pageNumberForElementById(QWebFrame* qFrame, const QString& id, float width, float height) +/*! + \internal + Scrolls nested frames starting at this frame, \a dx pixels to the right + and \a dy pixels downward. Both \a dx and \a dy may be negative. First attempts + to scroll elements with CSS overflow at position pos, followed by this frame. If this + frame doesn't scroll, attempts to scroll the parent +*/ +void QWEBKIT_EXPORT qtwebkit_webframe_scrollRecursively(QWebFrame* qFrame, int dx, int dy, const QPoint& pos) { - Frame* frame = QWebFramePrivate::core(qFrame); - if (!frame) - return -1; + if (!qFrame) + return; - Element* element = frame->document()->getElementById(AtomicString(id)); - if (!element) - return -1; + if (webframe_scrollOverflow(QWebFramePrivate::core(qFrame), dx, dy, pos)) + return; - return PrintContext::pageNumberForElement(element, FloatSize(width, height)); -} + bool scrollHorizontal = false; + bool scrollVertical = false; -int QWEBKIT_EXPORT qt_drt_numberOfPages(QWebFrame* qFrame, float width, float height) -{ - Frame* frame = QWebFramePrivate::core(qFrame); - if (!frame) - return -1; + do { + if (dx > 0) // scroll right + scrollHorizontal = qFrame->scrollBarValue(Qt::Horizontal) < qFrame->scrollBarMaximum(Qt::Horizontal); + else if (dx < 0) // scroll left + scrollHorizontal = qFrame->scrollBarValue(Qt::Horizontal) > qFrame->scrollBarMinimum(Qt::Horizontal); - return PrintContext::numberOfPages(frame, FloatSize(width, height)); -} + if (dy > 0) // scroll down + scrollVertical = qFrame->scrollBarValue(Qt::Vertical) < qFrame->scrollBarMaximum(Qt::Vertical); + else if (dy < 0) //scroll up + scrollVertical = qFrame->scrollBarValue(Qt::Vertical) > qFrame->scrollBarMinimum(Qt::Vertical); -// Suspend active DOM objects in this frame. -void QWEBKIT_EXPORT qt_suspendActiveDOMObjects(QWebFrame* qFrame) -{ - Frame* frame = QWebFramePrivate::core(qFrame); - if (frame->document()) - frame->document()->suspendActiveDOMObjects(); -} - -// Resume active DOM objects in this frame. -void QWEBKIT_EXPORT qt_resumeActiveDOMObjects(QWebFrame* qFrame) -{ - Frame* frame = QWebFramePrivate::core(qFrame); - if (frame->document()) - frame->document()->resumeActiveDOMObjects(); -} + if (scrollHorizontal || scrollVertical) { + qFrame->scroll(dx, dy); + return; + } -void QWEBKIT_EXPORT qt_drt_evaluateScriptInIsolatedWorld(QWebFrame* qFrame, int worldId, const QString& script) -{ - Frame* frame = QWebFramePrivate::core(qFrame); - if (frame) - JSC::JSValue result = frame->script()->executeScriptInWorld(mainThreadNormalWorld(), script, true).jsValue(); + qFrame = qFrame->parentFrame(); + } while (qFrame); } QWebFrameData::QWebFrameData(WebCore::Page* parentPage, WebCore::Frame* parentFrame, @@ -327,8 +226,11 @@ WebCore::Scrollbar* QWebFramePrivate::verticalScrollBar() const return frame->view()->verticalScrollbar(); } -void QWebFramePrivate::renderContentsLayerAbsoluteCoords(GraphicsContext* context, const QRegion& clip) +#if ENABLE(TILED_BACKING_STORE) +void QWebFramePrivate::renderFromTiledBackingStore(GraphicsContext* context, const QRegion& clip) { + ASSERT(frame->tiledBackingStore()); + if (!frame->view() || !frame->contentRenderer()) return; @@ -339,21 +241,25 @@ void QWebFramePrivate::renderContentsLayerAbsoluteCoords(GraphicsContext* contex QPainter* painter = context->platformContext(); WebCore::FrameView* view = frame->view(); - view->layoutIfNeededRecursive(); + + int scrollX = view->scrollX(); + int scrollY = view->scrollY(); + context->translate(-scrollX, -scrollY); for (int i = 0; i < vector.size(); ++i) { const QRect& clipRect = vector.at(i); painter->save(); - painter->setClipRect(clipRect, Qt::IntersectClip); + + QRect rect = clipRect.translated(scrollX, scrollY); + painter->setClipRect(rect, Qt::IntersectClip); - context->save(); - view->paintContents(context, clipRect); - context->restore(); + frame->tiledBackingStore()->paint(context, rect); painter->restore(); } } +#endif void QWebFramePrivate::renderRelativeCoords(GraphicsContext* context, QWebFrame::RenderLayer layer, const QRegion& clip) { @@ -421,45 +327,6 @@ void QWebFramePrivate::renderRelativeCoords(GraphicsContext* context, QWebFrame: } } -bool QWebFramePrivate::scrollOverflow(int dx, int dy) -{ - if (!frame || !frame->document() || !frame->eventHandler()) - return false; - - Node* node = frame->document()->focusedNode(); - if (!node) - node = frame->document()->elementFromPoint(frame->eventHandler()->currentMousePosition().x(), - frame->eventHandler()->currentMousePosition().y()); - if (!node) - return false; - - RenderObject* renderer = node->renderer(); - if (!renderer) - return false; - - if (renderer->isListBox()) - return false; - - RenderLayer* renderLayer = renderer->enclosingLayer(); - if (!renderLayer) - return false; - - bool scrolledHorizontal = false; - bool scrolledVertical = false; - - if (dx > 0) - scrolledHorizontal = renderLayer->scroll(ScrollRight, ScrollByPixel, dx); - else if (dx < 0) - scrolledHorizontal = renderLayer->scroll(ScrollLeft, ScrollByPixel, qAbs(dx)); - - if (dy > 0) - scrolledVertical = renderLayer->scroll(ScrollDown, ScrollByPixel, dy); - else if (dy < 0) - scrolledVertical = renderLayer->scroll(ScrollUp, ScrollByPixel, qAbs(dy)); - - return (scrolledHorizontal || scrolledVertical); -} - /*! \class QWebFrame \since 4.4 @@ -731,8 +598,8 @@ static inline QUrl ensureAbsoluteUrl(const QUrl &url) void QWebFrame::setUrl(const QUrl &url) { - d->frame->loader()->begin(ensureAbsoluteUrl(url)); - d->frame->loader()->end(); + d->frame->loader()->writer()->begin(ensureAbsoluteUrl(url)); + d->frame->loader()->writer()->end(); load(ensureAbsoluteUrl(url)); } @@ -807,6 +674,8 @@ QString QWebFrame::frameName() const /*! The web page that contains this frame. + + \sa pageChanged() */ QWebPage *QWebFrame::page() const { @@ -831,7 +700,7 @@ void QWebFrame::load(const QUrl &url) \a body is optional and is only used for POST operations. - \note The view remains the same until enough data has arrived to display the new \a url. + \note The view remains the same until enough data has arrived to display the new content. \sa setUrl() */ @@ -990,13 +859,13 @@ void QWebFrame::setScrollBarPolicy(Qt::Orientation orientation, Qt::ScrollBarPol if (orientation == Qt::Horizontal) { d->horizontalScrollBarPolicy = policy; if (d->frame->view()) { - d->frame->view()->setHorizontalScrollbarMode((ScrollbarMode)policy); + d->frame->view()->setHorizontalScrollbarMode((ScrollbarMode)policy, policy != Qt::ScrollBarAsNeeded /* lock */); d->frame->view()->updateCanHaveScrollbars(); } } else { d->verticalScrollBarPolicy = policy; if (d->frame->view()) { - d->frame->view()->setVerticalScrollbarMode((ScrollbarMode)policy); + d->frame->view()->setVerticalScrollbarMode((ScrollbarMode)policy, policy != Qt::ScrollBarAsNeeded /* lock */); d->frame->view()->updateCanHaveScrollbars(); } } @@ -1099,55 +968,6 @@ void QWebFrame::scroll(int dx, int dy) } /*! - \since 4.7 - Scrolls nested frames starting at this frame, \a dx pixels to the right - and \a dy pixels downward. Both \a dx and \a dy may be negative. First attempts - to scroll elements with CSS overflow followed by this frame. If this - frame doesn't scroll, attempts to scroll the parent - - \sa QWebFrame::scroll -*/ -bool QWebFrame::scrollRecursively(int dx, int dy) -{ - bool scrolledHorizontal = false; - bool scrolledVertical = false; - bool scrolledOverflow = d->scrollOverflow(dx, dy); - - if (!scrolledOverflow) { - Frame* frame = d->frame; - if (!frame || !frame->view()) - return false; - - do { - IntSize scrollOffset = frame->view()->scrollOffset(); - IntPoint maxScrollOffset = frame->view()->maximumScrollPosition(); - - if (dx > 0) // scroll right - scrolledHorizontal = scrollOffset.width() < maxScrollOffset.x(); - else if (dx < 0) // scroll left - scrolledHorizontal = scrollOffset.width() > 0; - - if (dy > 0) // scroll down - scrolledVertical = scrollOffset.height() < maxScrollOffset.y(); - else if (dy < 0) //scroll up - scrolledVertical = scrollOffset.height() > 0; - - if (scrolledHorizontal || scrolledVertical) { - frame->view()->scrollBy(IntSize(dx, dy)); - return true; - } - frame = frame->tree()->parent(); - } while (frame && frame->view()); - } - return (scrolledHorizontal || scrolledVertical || scrolledOverflow); -} - -bool QWEBKIT_EXPORT qtwebkit_webframe_scrollRecursively(QWebFrame* qFrame, int dx, int dy) -{ - return qFrame->scrollRecursively(dx, dy); -} - -/*! \property QWebFrame::scrollPosition \since 4.5 \brief the position the frame is currently scrolled to. @@ -1245,7 +1065,7 @@ void QWebFrame::render(QPainter* painter) */ void QWebFrame::setTextSizeMultiplier(qreal factor) { - d->frame->setZoomFactor(factor, /*isTextOnly*/true); + d->frame->setZoomFactor(factor, ZoomTextOnly); } /*! @@ -1264,7 +1084,7 @@ qreal QWebFrame::textSizeMultiplier() const void QWebFrame::setZoomFactor(qreal factor) { - d->frame->setZoomFactor(factor, d->frame->isZoomFactorTextOnly()); + d->frame->setZoomFactor(factor, d->frame->zoomMode()); } qreal QWebFrame::zoomFactor() const @@ -1621,6 +1441,15 @@ QWebFrame* QWebFramePrivate::kit(WebCore::Frame* coreFrame) */ /*! + \fn void QWebFrame::pageChanged() + \since 4.7 + + This signal is emitted when this frame has been moved to a different QWebPage. + + \sa page() +*/ + +/*! \class QWebHitTestResult \since 4.4 \brief The QWebHitTestResult class provides information about the web diff --git a/WebKit/qt/Api/qwebframe.h b/WebKit/qt/Api/qwebframe.h index 68594fd..ecd31de 100644 --- a/WebKit/qt/Api/qwebframe.h +++ b/WebKit/qt/Api/qwebframe.h @@ -50,6 +50,7 @@ class QWebSecurityOrigin; class QWebElement; class QWebElementCollection; +class DumpRenderTreeSupportQt; namespace WebCore { class WidgetPrivate; class FrameLoaderClientQt; @@ -156,7 +157,6 @@ public: QRect scrollBarGeometry(Qt::Orientation orientation) const; void scroll(int, int); - bool scrollRecursively(int, int); QPoint scrollPosition() const; void setScrollPosition(const QPoint &pos); @@ -222,9 +222,11 @@ Q_SIGNALS: void pageChanged(); private: + friend class QGraphicsWebView; friend class QWebPage; friend class QWebPagePrivate; friend class QWebFramePrivate; + friend class DumpRenderTreeSupportQt; friend class WebCore::WidgetPrivate; friend class WebCore::FrameLoaderClientQt; friend class WebCore::ChromeClientQt; diff --git a/WebKit/qt/Api/qwebframe_p.h b/WebKit/qt/Api/qwebframe_p.h index 7d79474..fcc37e7 100644 --- a/WebKit/qt/Api/qwebframe_p.h +++ b/WebKit/qt/Api/qwebframe_p.h @@ -84,9 +84,9 @@ public: static QWebFrame* kit(WebCore::Frame*); void renderRelativeCoords(WebCore::GraphicsContext*, QWebFrame::RenderLayer, const QRegion& clip); - void renderContentsLayerAbsoluteCoords(WebCore::GraphicsContext*, const QRegion& clip); - - bool scrollOverflow(int dx, int dy); +#if ENABLE(TILED_BACKING_STORE) + void renderFromTiledBackingStore(WebCore::GraphicsContext*, const QRegion& clip); +#endif QWebFrame *q; Qt::ScrollBarPolicy horizontalScrollBarPolicy; diff --git a/WebKit/qt/Api/qwebinspector.cpp b/WebKit/qt/Api/qwebinspector.cpp index c3ef530..c0e5277 100644 --- a/WebKit/qt/Api/qwebinspector.cpp +++ b/WebKit/qt/Api/qwebinspector.cpp @@ -161,6 +161,10 @@ void QWebInspector::showEvent(QShowEvent* event) /*! \reimp */ void QWebInspector::hideEvent(QHideEvent* event) { +#if ENABLE(INSPECTOR) + if (d->page) + d->page->d->inspectorController()->close(); +#endif } /*! \reimp */ @@ -168,7 +172,7 @@ void QWebInspector::closeEvent(QCloseEvent* event) { #if ENABLE(INSPECTOR) if (d->page) - d->page->d->inspectorController()->setWindowVisible(false); + d->page->d->inspectorController()->close(); #endif } diff --git a/WebKit/qt/Api/qwebinspector.h b/WebKit/qt/Api/qwebinspector.h index 6cda479..f192e92 100644 --- a/WebKit/qt/Api/qwebinspector.h +++ b/WebKit/qt/Api/qwebinspector.h @@ -52,5 +52,6 @@ private: friend class QWebPage; friend class QWebPagePrivate; friend class WebCore::InspectorClientQt; + friend class WebCore::InspectorFrontendClientQt; }; #endif diff --git a/WebKit/qt/Api/qwebkitglobal.h b/WebKit/qt/Api/qwebkitglobal.h index 9e8979f..665bf1b 100644 --- a/WebKit/qt/Api/qwebkitglobal.h +++ b/WebKit/qt/Api/qwebkitglobal.h @@ -22,6 +22,12 @@ #include +#define QTWEBKIT_VERSION_STR "2.0.0" +// QTWEBKIT_VERSION is (major << 16) + (minor << 8) + patch. Similar to Qt. +#define QTWEBKIT_VERSION 0x020000 +// Use: #if (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 0, 0)). Similar to Qt. +#define QTWEBKIT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) + #if defined(QT_MAKEDLL) /* create a Qt DLL library */ # if defined(BUILD_WEBKIT) # define QWEBKIT_EXPORT Q_DECL_EXPORT diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp index 2a8aced..0e11c15 100644 --- a/WebKit/qt/Api/qwebpage.cpp +++ b/WebKit/qt/Api/qwebpage.cpp @@ -80,6 +80,7 @@ #include "Cache.h" #include "runtime/InitializeThreading.h" #include "PageGroup.h" +#include "NotificationPresenterClientQt.h" #include "QWebPageClient.h" #include "WorkerThread.h" @@ -119,81 +120,16 @@ using namespace WebCore; -void QWEBKIT_EXPORT qt_drt_overwritePluginDirectories() +void QWEBKIT_EXPORT qt_wrt_setViewMode(QWebPage* page, const QString& mode) { - PluginDatabase* db = PluginDatabase::installedPlugins(/* populate */ false); - - Vector paths; - String qtPath(qgetenv("QTWEBKIT_PLUGIN_PATH").data()); - qtPath.split(UChar(':'), /* allowEmptyEntries */ false, paths); - - db->setPluginDirectories(paths); - db->refresh(); -} - -int QWEBKIT_EXPORT qt_drt_workerThreadCount() -{ -#if ENABLE(WORKERS) - return WebCore::WorkerThread::workerThreadCount(); -#else - return 0; -#endif + QWebPagePrivate::priv(page)->viewMode = mode; + WebCore::Frame* frame = QWebFramePrivate::core(page->mainFrame()); + WebCore::FrameView* view = frame->view(); + frame->document()->updateStyleSelector(); + view->forceLayout(); } bool QWebPagePrivate::drtRun = false; -void QWEBKIT_EXPORT qt_drt_run(bool b) -{ - QWebPagePrivate::drtRun = b; -} - -void QWEBKIT_EXPORT qt_drt_setFrameSetFlatteningEnabled(QWebPage* page, bool enabled) -{ - QWebPagePrivate::core(page)->settings()->setFrameSetFlatteningEnabled(enabled); -} - -void QWEBKIT_EXPORT qt_webpage_setGroupName(QWebPage* page, const QString& groupName) -{ - page->handle()->page->setGroupName(groupName); -} - -QString QWEBKIT_EXPORT qt_webpage_groupName(QWebPage* page) -{ - return page->handle()->page->groupName(); -} - -#if ENABLE(INSPECTOR) -void QWEBKIT_EXPORT qt_drt_webinspector_executeScript(QWebPage* page, long callId, const QString& script) -{ - if (!page->handle()->page->inspectorController()) - return; - page->handle()->page->inspectorController()->evaluateForTestInFrontend(callId, script); -} - -void QWEBKIT_EXPORT qt_drt_webinspector_close(QWebPage* page) -{ - if (!page->handle()->page->inspectorController()) - return; - page->handle()->page->inspectorController()->close(); -} - -void QWEBKIT_EXPORT qt_drt_webinspector_show(QWebPage* page) -{ - if (!page->handle()->page->inspectorController()) - return; - page->handle()->page->inspectorController()->show(); -} - -void QWEBKIT_EXPORT qt_drt_setTimelineProfilingEnabled(QWebPage* page, bool enabled) -{ - InspectorController* controller = page->handle()->page->inspectorController(); - if (!controller) - return; - if (enabled) - controller->startTimelineProfiler(); - else - controller->stopTimelineProfiler(); -} -#endif class QWebPageWidgetClient : public QWebPageClient { public: @@ -203,6 +139,8 @@ public: Q_ASSERT(view); } + virtual bool isQWidgetClient() const { return true; } + virtual void scroll(int dx, int dy, const QRect&); virtual void update(const QRect& dirtyRect); virtual void setInputMethodEnabled(bool enable); @@ -219,6 +157,7 @@ public: virtual QPalette palette() const; virtual int screenNumber() const; virtual QWidget* ownerWidget() const; + virtual QRect geometryRelativeToOwnerWidget() const; virtual QObject* pluginParent() const; @@ -276,10 +215,8 @@ QPalette QWebPageWidgetClient::palette() const int QWebPageWidgetClient::screenNumber() const { #if defined(Q_WS_X11) - if (view) - return view->x11Info().screen(); + return view->x11Info().screen(); #endif - return 0; } @@ -288,6 +225,11 @@ QWidget* QWebPageWidgetClient::ownerWidget() const return view; } +QRect QWebPageWidgetClient::geometryRelativeToOwnerWidget() const +{ + return view->geometry(); +} + QObject* QWebPageWidgetClient::pluginParent() const { return view; @@ -464,11 +406,17 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) #ifndef QT_NO_CONTEXTMENU currentContextMenu = 0; #endif + smartInsertDeleteEnabled = false; + selectTrailingWhitespaceEnabled = false; history.d = new QWebHistoryPrivate(page->backForwardList()); memset(actions, 0, sizeof(actions)); PageGroup::setShouldTrackVisitedLinks(true); + +#if ENABLE(NOTIFICATIONS) + notificationPresenterClient = new NotificationPresenterClientQt(); +#endif } QWebPagePrivate::~QWebPagePrivate() @@ -481,6 +429,10 @@ QWebPagePrivate::~QWebPagePrivate() #endif delete settings; delete page; + +#if ENABLE(NOTIFICATIONS) + delete notificationPresenterClient; +#endif } WebCore::Page* QWebPagePrivate::core(QWebPage* page) @@ -488,6 +440,11 @@ WebCore::Page* QWebPagePrivate::core(QWebPage* page) return page->d->page; } +QWebPagePrivate* QWebPagePrivate::priv(QWebPage* page) +{ + return page->d; +} + bool QWebPagePrivate::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type) { if (insideOpenCall @@ -542,7 +499,10 @@ static QWebPage::WebAction webActionForContextMenuAction(WebCore::ContextMenuAct QMenu *QWebPagePrivate::createContextMenu(const WebCore::ContextMenu *webcoreMenu, const QList *items, QBitArray *visitedWebActions) { - QMenu* menu = new QMenu(q->view()); + if (!client) + return 0; + + QMenu* menu = new QMenu(client->ownerWidget()); for (int i = 0; i < items->count(); ++i) { const ContextMenuItem &item = items->at(i); switch (item.type()) { @@ -591,6 +551,7 @@ QMenu *QWebPagePrivate::createContextMenu(const WebCore::ContextMenu *webcoreMen } #endif // QT_NO_CONTEXTMENU +#ifndef QT_NO_ACTION void QWebPagePrivate::_q_webActionTriggered(bool checked) { QAction *a = qobject_cast(q->sender()); @@ -599,6 +560,7 @@ void QWebPagePrivate::_q_webActionTriggered(bool checked) QWebPage::WebAction action = static_cast(a->data().toInt()); q->triggerAction(action, checked); } +#endif // QT_NO_ACTION void QWebPagePrivate::_q_cleanupLeakMessages() { @@ -610,6 +572,9 @@ void QWebPagePrivate::_q_cleanupLeakMessages() void QWebPagePrivate::updateAction(QWebPage::WebAction action) { +#ifdef QT_NO_ACTION + Q_UNUSED(action) +#else QAction *a = actions[action]; if (!a || !mainFrame) return; @@ -669,6 +634,7 @@ void QWebPagePrivate::updateAction(QWebPage::WebAction action) if (a->isCheckable()) a->setChecked(checked); +#endif // QT_NO_ACTION } void QWebPagePrivate::updateNavigationActions() @@ -769,6 +735,11 @@ void QWebPagePrivate::mousePressEvent(QGraphicsSceneMouseEvent* ev) if (!frame->view()) return; + RefPtr oldNode; + Frame* focusedFrame = page->focusController()->focusedFrame(); + if (Document* focusedDocument = focusedFrame ? focusedFrame->document() : 0) + oldNode = focusedDocument->focusedNode(); + if (tripleClickTimer.isActive() && (ev->pos().toPoint() - tripleClick).manhattanLength() < QApplication::startDragDistance()) { @@ -782,6 +753,14 @@ void QWebPagePrivate::mousePressEvent(QGraphicsSceneMouseEvent* ev) if (mev.button() != NoButton) accepted = frame->eventHandler()->handleMousePressEvent(mev); ev->setAccepted(accepted); + + RefPtr newNode; + focusedFrame = page->focusController()->focusedFrame(); + if (Document* focusedDocument = focusedFrame ? focusedFrame->document() : 0) + newNode = focusedDocument->focusedNode(); + + if (newNode && oldNode != newNode) + clickCausedFocus = true; } void QWebPagePrivate::mousePressEvent(QMouseEvent *ev) @@ -791,9 +770,9 @@ void QWebPagePrivate::mousePressEvent(QMouseEvent *ev) return; RefPtr oldNode; - if (page->focusController()->focusedFrame() - && page->focusController()->focusedFrame()->document()) - oldNode = page->focusController()->focusedFrame()->document()->focusedNode(); + Frame* focusedFrame = page->focusController()->focusedFrame(); + if (Document* focusedDocument = focusedFrame ? focusedFrame->document() : 0) + oldNode = focusedDocument->focusedNode(); if (tripleClickTimer.isActive() && (ev->pos() - tripleClick).manhattanLength() @@ -810,9 +789,9 @@ void QWebPagePrivate::mousePressEvent(QMouseEvent *ev) ev->setAccepted(accepted); RefPtr newNode; - if (page->focusController()->focusedFrame() - && page->focusController()->focusedFrame()->document()) - newNode = page->focusController()->focusedFrame()->document()->focusedNode(); + focusedFrame = page->focusController()->focusedFrame(); + if (Document* focusedDocument = focusedFrame ? focusedFrame->document() : 0) + newNode = focusedDocument->focusedNode(); if (newNode && oldNode != newNode) clickCausedFocus = true; @@ -1050,10 +1029,8 @@ QWebPage::WebAction QWebPagePrivate::editorActionForKeyEvent(QKeyEvent* event) { QKeySequence::SelectEndOfDocument, QWebPage::SelectEndOfDocument }, { QKeySequence::DeleteStartOfWord, QWebPage::DeleteStartOfWord }, { QKeySequence::DeleteEndOfWord, QWebPage::DeleteEndOfWord }, -#if QT_VERSION >= 0x040500 { QKeySequence::InsertParagraphSeparator, QWebPage::InsertParagraphSeparator }, { QKeySequence::InsertLineSeparator, QWebPage::InsertLineSeparator }, -#endif { QKeySequence::SelectAll, QWebPage::SelectAll }, { QKeySequence::UnknownKey, QWebPage::NoWebAction } }; @@ -1078,8 +1055,8 @@ void QWebPagePrivate::keyPressEvent(QKeyEvent *ev) if (!handled) { handled = true; QFont defaultFont; - if (q->view()) - defaultFont = q->view()->font(); + if (client) + defaultFont = client->ownerWidget()->font(); QFontMetrics fm(defaultFont); if (!handleScrolling(ev, frame)) { switch (ev->key()) { @@ -1294,7 +1271,7 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) case QInputMethodEvent::TextFormat: { QTextCharFormat textCharFormat = a.value.value().toCharFormat(); QColor qcolor = textCharFormat.underlineColor(); - underlines.append(CompositionUnderline(a.start, a.length, Color(makeRGBA(qcolor.red(), qcolor.green(), qcolor.blue(), qcolor.alpha())), false)); + underlines.append(CompositionUnderline(qMin(a.start, (a.start + a.length)), qMax(a.start, (a.start + a.length)), Color(makeRGBA(qcolor.red(), qcolor.green(), qcolor.blue(), qcolor.alpha())), false)); break; } case QInputMethodEvent::Cursor: { @@ -1311,8 +1288,8 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) #if QT_VERSION >= 0x040600 case QInputMethodEvent::Selection: { if (renderTextControl) { - renderTextControl->setSelectionStart(a.start); - renderTextControl->setSelectionEnd(a.start + a.length); + renderTextControl->setSelectionStart(qMin(a.start, (a.start + a.length))); + renderTextControl->setSelectionEnd(qMax(a.start, (a.start + a.length))); } break; } @@ -1777,7 +1754,7 @@ QWebPage::QWebPage(QObject *parent) : QObject(parent) , d(new QWebPagePrivate(this)) { - setView(qobject_cast(parent)); + setView(qobject_cast(parent)); connect(this, SIGNAL(loadProgress(int)), this, SLOT(_q_onLoadProgressChanged(int))); #ifndef NDEBUG @@ -1861,21 +1838,28 @@ QWebHistory *QWebPage::history() const \sa view() */ -void QWebPage::setView(QWidget *view) -{ - if (this->view() != view) { - d->view = view; - if (!view) { - delete d->client; - d->client = 0; - } else { - if (!d->client) - d->client = new QWebPageWidgetClient(view); - else - static_cast(d->client)->view = view; - } - setViewportSize(view ? view->size() : QSize(0, 0)); +void QWebPage::setView(QWidget* view) +{ + if (this->view() == view) + return; + + d->view = view; + setViewportSize(view ? view->size() : QSize(0, 0)); + + // If we have no client, we install a special client delegating + // the responsibility to the QWidget. This is the code path + // handling a.o. the "legacy" QWebView. + // + // If such a special delegate already exist, we substitute the view. + + if (d->client) { + if (d->client->isQWidgetClient()) + static_cast(d->client)->view = view; + return; } + + if (view) + d->client = new QWebPageWidgetClient(view); } /*! @@ -1916,7 +1900,8 @@ void QWebPage::javaScriptAlert(QWebFrame *frame, const QString& msg) { Q_UNUSED(frame) #ifndef QT_NO_MESSAGEBOX - QMessageBox::information(view(), tr("JavaScript Alert - %1").arg(mainFrame()->url().host()), Qt::escape(msg), QMessageBox::Ok); + QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; + QMessageBox::information(parent, tr("JavaScript Alert - %1").arg(mainFrame()->url().host()), Qt::escape(msg), QMessageBox::Ok); #endif } @@ -1932,7 +1917,8 @@ bool QWebPage::javaScriptConfirm(QWebFrame *frame, const QString& msg) #ifdef QT_NO_MESSAGEBOX return true; #else - return QMessageBox::Yes == QMessageBox::information(view(), tr("JavaScript Confirm - %1").arg(mainFrame()->url().host()), Qt::escape(msg), QMessageBox::Yes, QMessageBox::No); + QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; + return QMessageBox::Yes == QMessageBox::information(parent, tr("JavaScript Confirm - %1").arg(mainFrame()->url().host()), Qt::escape(msg), QMessageBox::Yes, QMessageBox::No); #endif } @@ -1951,7 +1937,8 @@ bool QWebPage::javaScriptPrompt(QWebFrame *frame, const QString& msg, const QStr Q_UNUSED(frame) bool ok = false; #ifndef QT_NO_INPUTDIALOG - QString x = QInputDialog::getText(view(), tr("JavaScript Prompt - %1").arg(mainFrame()->url().host()), Qt::escape(msg), QLineEdit::Normal, defaultValue, &ok); + QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; + QString x = QInputDialog::getText(parent, tr("JavaScript Prompt - %1").arg(mainFrame()->url().host()), Qt::escape(msg), QLineEdit::Normal, defaultValue, &ok); if (ok && result) *result = x; #endif @@ -1976,7 +1963,8 @@ bool QWebPage::shouldInterruptJavaScript() #ifdef QT_NO_MESSAGEBOX return false; #else - return QMessageBox::Yes == QMessageBox::information(view(), tr("JavaScript Problem - %1").arg(mainFrame()->url().host()), tr("The script on this page appears to have a problem. Do you want to stop the script?"), QMessageBox::Yes, QMessageBox::No); + QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; + return QMessageBox::Yes == QMessageBox::information(parent, tr("JavaScript Problem - %1").arg(mainFrame()->url().host()), tr("The script on this page appears to have a problem. Do you want to stop the script?"), QMessageBox::Yes, QMessageBox::No); #endif } @@ -1995,7 +1983,7 @@ bool QWebPage::shouldInterruptJavaScript() */ QWebPage *QWebPage::createWindow(WebWindowType type) { - QWebView *webView = qobject_cast(view()); + QWebView *webView = qobject_cast(view()); if (webView) { QWebView *newView = webView->createWindow(type); if (newView) @@ -2260,6 +2248,7 @@ QString QWebPage::selectedText() const return d->page->focusController()->focusedOrMainFrame()->selectedText(); } +#ifndef QT_NO_ACTION /*! Returns a QAction for the specified WebAction \a action. @@ -2279,7 +2268,7 @@ QAction *QWebPage::action(WebAction action) const QString text; QIcon icon; - QStyle *style = view() ? view()->style() : qApp->style(); + QStyle *style = d->client ? d->client->style() : qApp->style(); bool checkable = false; switch (action) { @@ -2532,6 +2521,7 @@ QAction *QWebPage::action(WebAction action) const d->updateAction(action); return a; } +#endif // QT_NO_ACTION /*! \property QWebPage::modified @@ -2801,6 +2791,7 @@ bool QWebPage::swallowContextMenuEvent(QContextMenuEvent *event) */ void QWebPage::updatePositionDependentActions(const QPoint &pos) { +#ifndef QT_NO_ACTION // First we disable all actions, but keep track of which ones were originally enabled. QBitArray originallyEnabledWebActions(QWebPage::WebActionCount); for (int i = ContextMenuItemTagNoAction; i < ContextMenuItemBaseApplicationTag; ++i) { @@ -2810,6 +2801,7 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) a->setEnabled(false); } } +#endif // QT_NO_ACTION d->createMainFrame(); WebCore::Frame* focusedFrame = d->page->focusController()->focusedOrMainFrame(); @@ -2836,6 +2828,7 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) d->currentContextMenu = d->createContextMenu(&menu, menu.platformDescription(), &visitedWebActions); #endif // QT_NO_CONTEXTMENU +#ifndef QT_NO_ACTION // Finally, we restore the original enablement for the actions that were not put into the menu. originallyEnabledWebActions &= ~visitedWebActions; // Mask out visited actions (they're part of the menu) for (int i = 0; i < QWebPage::WebActionCount; ++i) { @@ -2844,6 +2837,7 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) a->setEnabled(true); } } +#endif // QT_NO_ACTION // This whole process ensures that any actions put into to the context menu has the right // enablement, while also keeping the correct enablement for actions that were left out of @@ -2976,7 +2970,8 @@ bool QWebPage::extension(Extension extension, const ExtensionOption *option, Ext if (extension == ChooseMultipleFilesExtension) { // FIXME: do not ignore suggestedFiles QStringList suggestedFiles = static_cast(option)->suggestedFileNames; - QStringList names = QFileDialog::getOpenFileNames(view(), QString::null); + QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; + QStringList names = QFileDialog::getOpenFileNames(parent, QString::null); static_cast(output)->fileNames = names; return true; } @@ -3058,7 +3053,8 @@ QString QWebPage::chooseFile(QWebFrame *parentFrame, const QString& suggestedFil { Q_UNUSED(parentFrame) #ifndef QT_NO_FILEDIALOG - return QFileDialog::getOpenFileName(view(), QString::null, suggestedFile); + QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; + return QFileDialog::getOpenFileName(parent, QString::null, suggestedFile); #else return QString::null; #endif @@ -3129,6 +3125,8 @@ QWebPluginFactory *QWebPage::pluginFactory() const "Mozilla/5.0 (%Platform%; %Security%; %Subplatform%; %Locale%) AppleWebKit/%WebKitVersion% (KHTML, like Gecko) %AppVersion Safari/%WebKitVersion%" + On mobile platforms such as Symbian S60 and Maemo, "Mobile Safari" is used instead of "Safari". + In this string the following values are replaced at run-time: \list \o %Platform% and %Subplatform% are expanded to the windowing system and the operation system. @@ -3336,8 +3334,8 @@ QString QWebPage::userAgentForUrl(const QUrl& url) const // Language QLocale locale; - if (view()) - locale = view()->locale(); + if (d->client && d->client->ownerWidget()) + locale = d->client->ownerWidget()->locale(); QString name = locale.name(); name[2] = QLatin1Char('-'); ua.append(name); @@ -3360,9 +3358,11 @@ QString QWebPage::userAgentForUrl(const QUrl& url) const ua.append(QLatin1String(qVersion())); } - ua.append(QString(QLatin1String(" Safari/%1")) - .arg(qWebKitVersion())); - +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + ua.append(QString(QLatin1String(" Mobile Safari/%1")).arg(qWebKitVersion())); +#else + ua.append(QString(QLatin1String(" Safari/%1")).arg(qWebKitVersion())); +#endif return ua; } @@ -3515,7 +3515,11 @@ quint64 QWebPage::bytesReceived() const /*! \fn void QWebPage::unsupportedContent(QNetworkReply *reply) - This signal is emitted when WebKit cannot handle a link the user navigated to. + This signal is emitted when WebKit cannot handle a link the user navigated to or a + web server's response includes a "Content-Disposition" header with the 'attachment' + directive. If "Content-Disposition" is present in \a reply, the web server is indicating + that the client should prompt the user to save the content regardless of content-type. + See RFC 2616 sections 19.5.1 for details about Content-Disposition. At signal emission time the meta-data of the QNetworkReply \a reply is available. diff --git a/WebKit/qt/Api/qwebpage.h b/WebKit/qt/Api/qwebpage.h index 4766cbd..c085fd7 100644 --- a/WebKit/qt/Api/qwebpage.h +++ b/WebKit/qt/Api/qwebpage.h @@ -54,6 +54,8 @@ namespace WebCore { class EditorClientQt; class FrameLoaderClientQt; class InspectorClientQt; + class InspectorFrontendClientQt; + class NotificationPresenterClientQt; class ResourceHandle; class HitTestResult; class QNetworkReplyHandler; @@ -219,7 +221,9 @@ public: QString selectedText() const; +#ifndef QT_NO_ACTION QAction *action(WebAction action) const; +#endif virtual void triggerAction(WebAction action, bool checked = false); QSize viewportSize() const; @@ -347,7 +351,9 @@ protected: private: Q_PRIVATE_SLOT(d, void _q_onLoadProgressChanged(int)) +#ifndef QT_NO_ACTION Q_PRIVATE_SLOT(d, void _q_webActionTriggered(bool checked)) +#endif Q_PRIVATE_SLOT(d, void _q_cleanupLeakMessages()) QWebPagePrivate *d; @@ -355,14 +361,19 @@ private: friend class QWebFrame; friend class QWebPagePrivate; friend class QWebView; + friend class QWebViewPrivate; friend class QGraphicsWebView; + friend class QGraphicsWebViewPrivate; friend class QWebInspector; friend class WebCore::ChromeClientQt; friend class WebCore::EditorClientQt; friend class WebCore::FrameLoaderClientQt; friend class WebCore::InspectorClientQt; + friend class WebCore::InspectorFrontendClientQt; + friend class WebCore::NotificationPresenterClientQt; friend class WebCore::ResourceHandle; friend class WebCore::QNetworkReplyHandler; + friend class DumpRenderTreeSupportQt; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QWebPage::FindFlags) diff --git a/WebKit/qt/Api/qwebpage_p.h b/WebKit/qt/Api/qwebpage_p.h index 15ddfb2..f40053b 100644 --- a/WebKit/qt/Api/qwebpage_p.h +++ b/WebKit/qt/Api/qwebpage_p.h @@ -44,6 +44,7 @@ namespace WebCore { class EditorClientQt; class Element; class InspectorController; + class NotificationPresenterClientQt; class Node; class Page; class Frame; @@ -64,6 +65,7 @@ public: ~QWebPagePrivate(); static WebCore::Page* core(QWebPage*); + static QWebPagePrivate* priv(QWebPage*); void createMainFrame(); #ifndef QT_NO_CONTEXTMENU @@ -162,6 +164,8 @@ public: QNetworkAccessManager *networkManager; bool forwardUnsupportedContent; + bool smartInsertDeleteEnabled; + bool selectTrailingWhitespaceEnabled; QWebPage::LinkDelegationPolicy linkPolicy; QSize viewportSize; @@ -184,6 +188,10 @@ public: QWebInspector* inspector; bool inspectorIsInternalOnly; // True if created through the Inspect context menu action Qt::DropAction m_lastDropAction; + + WebCore::NotificationPresenterClientQt* notificationPresenterClient; + + QString viewMode; static bool drtRun; }; diff --git a/WebKit/qt/Api/qwebsecurityorigin.cpp b/WebKit/qt/Api/qwebsecurityorigin.cpp index 6c26bd7..b69f24d 100644 --- a/WebKit/qt/Api/qwebsecurityorigin.cpp +++ b/WebKit/qt/Api/qwebsecurityorigin.cpp @@ -30,21 +30,6 @@ using namespace WebCore; -void QWEBKIT_EXPORT qt_drt_whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains) -{ - SecurityOrigin::whiteListAccessFromOrigin(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains); -} - -void QWEBKIT_EXPORT qt_drt_resetOriginAccessWhiteLists() -{ - SecurityOrigin::resetOriginAccessWhiteLists(); -} - -void QWEBKIT_EXPORT qt_drt_setDomainRelaxationForbiddenForURLScheme(bool forbidden, const QString& scheme) -{ - SecurityOrigin::setDomainRelaxationForbiddenForURLScheme(forbidden, scheme); -} - /*! \class QWebSecurityOrigin \since 4.5 diff --git a/WebKit/qt/Api/qwebsettings.cpp b/WebKit/qt/Api/qwebsettings.cpp index d60f09c..1dff037 100644 --- a/WebKit/qt/Api/qwebsettings.cpp +++ b/WebKit/qt/Api/qwebsettings.cpp @@ -26,6 +26,7 @@ #include "Cache.h" #include "CrossOriginPreflightResultCache.h" +#include "Database.h" #include "FontCache.h" #include "Page.h" #include "PageCache.h" @@ -73,6 +74,7 @@ public: QString localStoragePath; QString offlineWebApplicationCachePath; qint64 offlineStorageDefaultQuota; + QUrl inspectorLocation; void apply(); WebCore::Settings* settings; @@ -158,6 +160,13 @@ void QWebSettingsPrivate::apply() settings->setAcceleratedCompositingEnabled(value); #endif +#if ENABLE(3D_CANVAS) + value = attributes.value(QWebSettings::WebGLEnabled, + global->attributes.value(QWebSettings::WebGLEnabled)); + + settings->setWebGLEnabled(value); +#endif + value = attributes.value(QWebSettings::JavascriptCanOpenWindows, global->attributes.value(QWebSettings::JavascriptCanOpenWindows)); settings->setJavaScriptCanOpenWindowsAutomatically(value); @@ -174,6 +183,10 @@ void QWebSettingsPrivate::apply() global->attributes.value(QWebSettings::PrivateBrowsingEnabled)); settings->setPrivateBrowsingEnabled(value); + value = attributes.value(QWebSettings::SpatialNavigationEnabled, + global->attributes.value(QWebSettings::SpatialNavigationEnabled)); + settings->setSpatialNavigationEnabled(value); + value = attributes.value(QWebSettings::JavascriptCanAccessClipboard, global->attributes.value(QWebSettings::JavascriptCanAccessClipboard)); settings->setDOMPasteAllowed(value); @@ -182,6 +195,10 @@ void QWebSettingsPrivate::apply() global->attributes.value(QWebSettings::DeveloperExtrasEnabled)); settings->setDeveloperExtrasEnabled(value); + value = attributes.value(QWebSettings::FrameFlatteningEnabled, + global->attributes.value(QWebSettings::FrameFlatteningEnabled)); + settings->setFrameFlatteningEnabled(value); + QUrl location = !userStyleSheetLocation.isEmpty() ? userStyleSheetLocation : global->userStyleSheetLocation; settings->setUserStyleSheetLocation(WebCore::KURL(location)); @@ -193,15 +210,17 @@ void QWebSettingsPrivate::apply() value = attributes.value(QWebSettings::ZoomTextOnly, global->attributes.value(QWebSettings::ZoomTextOnly)); - settings->setZoomsTextOnly(value); + settings->setZoomMode(value ? WebCore::ZoomTextOnly : WebCore::ZoomPage); value = attributes.value(QWebSettings::PrintElementBackgrounds, global->attributes.value(QWebSettings::PrintElementBackgrounds)); settings->setShouldPrintBackgrounds(value); +#if ENABLE(DATABASE) value = attributes.value(QWebSettings::OfflineStorageDatabaseEnabled, global->attributes.value(QWebSettings::OfflineStorageDatabaseEnabled)); - settings->setDatabasesEnabled(value); + WebCore::Database::setIsAvailable(value); +#endif value = attributes.value(QWebSettings::OfflineWebApplicationCacheEnabled, global->attributes.value(QWebSettings::OfflineWebApplicationCacheEnabled)); @@ -219,10 +238,16 @@ void QWebSettingsPrivate::apply() global->attributes.value(QWebSettings::LocalContentCanAccessFileUrls)); settings->setAllowFileAccessFromFileURLs(value); - value = attributes.value(QWebSettings::XSSAuditorEnabled, - global->attributes.value(QWebSettings::XSSAuditorEnabled)); + value = attributes.value(QWebSettings::XSSAuditingEnabled, + global->attributes.value(QWebSettings::XSSAuditingEnabled)); settings->setXSSAuditorEnabled(value); +#if ENABLE(TILED_BACKING_STORE) + value = attributes.value(QWebSettings::TiledBackingStoreEnabled, + global->attributes.value(QWebSettings::TiledBackingStoreEnabled)); + settings->setTiledBackingStoreEnabled(value); +#endif + settings->setUsesPageCache(WebCore::pageCache()->capacity()); } else { QList settings = *::allSettings(); @@ -326,6 +351,7 @@ QWebSettings* QWebSettings::globalSettings() \value MissingPluginGraphic The replacement graphic shown when a plugin could not be loaded. \value DefaultFrameIconGraphic The default icon for QWebFrame::icon(). \value TextAreaSizeGripCornerGraphic The graphic shown for the size grip of text areas. + \value DeleteButtonGraphic The graphic shown for the WebKit-Editing-Delete-Button in Deletion UI. */ /*! @@ -352,6 +378,13 @@ QWebSettings* QWebSettings::globalSettings() Currently this enables the "Inspect" element in the context menu as well as the use of QWebInspector which controls the WebKit WebInspector for web site debugging. + \value SpatialNavigationEnabled Enables or disables the Spatial Navigation + feature, which consists in the ability to navigate between focusable + elements in a Web page, such as hyperlinks and form controls, by using + Left, Right, Up and Down arrow keys. For example, if an user presses the + Right key, heuristics determine whether there is an element he might be + trying to reach towards the right, and if there are multiple elements, + which element he probably wants. \value LinksIncludedInFocusChain Specifies whether hyperlinks should be included in the keyboard focus chain. \value ZoomTextOnly Specifies whether the zoom factor on a frame applies to @@ -367,8 +400,25 @@ QWebSettings* QWebSettings::globalSettings() \value LocalStorageDatabaseEnabled \e{This enum value is deprecated.} Use QWebSettings::LocalStorageEnabled instead. \value LocalContentCanAccessRemoteUrls Specifies whether locally loaded documents are allowed to access remote urls. - \value LocalContentCanAccessFileUrls Specifies whether locally loaded documents are allowed to access other local urls. - \value XSSAuditorEnabled Specifies whether load requests should be monitored for cross-site scripting attempts. + \value LocalContentCanAccessFileUrls Specifies whether locally loaded documents are allowed to access other local urls. + \value XSSAuditingEnabled Specifies whether load requests should be monitored for cross-site scripting attempts. + \value AcceleratedCompositingEnabled This feature, when used in conjunction with + QGraphicsWebView, accelerates animations of web content. CSS animations of the transform and + opacity properties will be rendered by composing the cached content of the animated elements. + This feature is enabled by default + \value TiledBackingStoreEnabled This setting enables the tiled backing store feature + for a QGraphicsWebView. With the tiled backing store enabled, the web page contents in and around + the current visible area is speculatively cached to bitmap tiles. The tiles are automatically kept + in sync with the web page as it changes. Enabling tiling can significantly speed up painting heavy + operations like scrolling. Enabling the feature increases memory consumption. It does not work well + with contents using CSS fixed positioning (see also \l{QGraphicsWebView::}{resizesToContents} property). + \l{QGraphicsWebView::}{tiledBackingStoreFrozen} property allows application to temporarily freeze the contents of the backing store. + \value FrameFlatteningEnabled With this setting each subframe is expanded to its contents. + On touch devices, it is desired to not have any scrollable sub parts of the page + as it results in a confusing user experience, with scrolling sometimes scrolling sub parts + and at other times scrolling the page itself. For this reason iframes and framesets are + barely usable on touch devices. This will flatten all the frames to become one scrollable page. + Disabled by default. */ /*! @@ -392,6 +442,7 @@ QWebSettings::QWebSettings() d->attributes.insert(QWebSettings::AutoLoadImages, true); d->attributes.insert(QWebSettings::DnsPrefetchEnabled, false); d->attributes.insert(QWebSettings::JavascriptEnabled, true); + d->attributes.insert(QWebSettings::SpatialNavigationEnabled, false); d->attributes.insert(QWebSettings::LinksIncludedInFocusChain, true); d->attributes.insert(QWebSettings::ZoomTextOnly, false); d->attributes.insert(QWebSettings::PrintElementBackgrounds, true); @@ -400,7 +451,10 @@ QWebSettings::QWebSettings() d->attributes.insert(QWebSettings::LocalStorageEnabled, false); d->attributes.insert(QWebSettings::LocalContentCanAccessRemoteUrls, false); d->attributes.insert(QWebSettings::LocalContentCanAccessFileUrls, true); - d->attributes.insert(QWebSettings::AcceleratedCompositingEnabled, false); + d->attributes.insert(QWebSettings::AcceleratedCompositingEnabled, true); + d->attributes.insert(QWebSettings::WebGLEnabled, false); + d->attributes.insert(QWebSettings::TiledBackingStoreEnabled, false); + d->attributes.insert(QWebSettings::FrameFlatteningEnabled, false); d->offlineStorageDefaultQuota = 5 * 1024 * 1024; d->defaultTextEncoding = QLatin1String("iso-8859-1"); } @@ -469,7 +523,8 @@ void QWebSettings::resetFontSize(FontSize type) The \a location must be either a path on the local filesystem, or a data URL with UTF-8 and Base64 encoded data, such as: - "data:text/css;charset=utf-8;base64,cCB7IGJhY2tncm91bmQtY29sb3I6IHJlZCB9Ow==;" + "data:text/css;charset=utf-8;base64,cCB7IGJhY2tncm91bmQtY29sb3I6IHJlZCB9Ow==" + NOTE: In case the base 64 data is not valid the style will not be applied. \sa userStyleSheetUrl() */ @@ -902,6 +957,8 @@ QString QWebSettings::offlineWebApplicationCachePath() void QWebSettings::setOfflineWebApplicationCacheQuota(qint64 maximumSize) { #if ENABLE(OFFLINE_WEB_APPLICATIONS) + WebCore::cacheStorage().empty(); + WebCore::cacheStorage().vacuumDatabaseFile(); WebCore::cacheStorage().setMaximumSize(maximumSize); #endif } @@ -941,6 +998,31 @@ void QWebSettings::setLocalStoragePath(const QString& path) } /*! + \since 4.7 + + Specifies the \a location of a frontend to load with each web page when using Web Inspector. + + \sa inspectorUrl() +*/ +void QWebSettings::setInspectorUrl(const QUrl& location) +{ + d->inspectorLocation = location; + d->apply(); +} + +/*! + \since 4.7 + + Returns the location of the Web Inspector frontend. + + \sa setInspectorUrl() +*/ +QUrl QWebSettings::inspectorUrl() const +{ + return d->inspectorLocation; +} + +/*! \since 4.6 \relates QWebSettings @@ -969,8 +1051,9 @@ void QWebSettings::enablePersistentStorage(const QString& path) QString storagePath; if (path.isEmpty()) { +#ifndef QT_NO_DESKTOPSERVICES storagePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation); - +#endif if (storagePath.isEmpty()) storagePath = WebCore::pathByAppendingComponent(QDir::homePath(), QCoreApplication::applicationName()); } else diff --git a/WebKit/qt/Api/qwebsettings.h b/WebKit/qt/Api/qwebsettings.h index b1f5cf2..bd728d8 100644 --- a/WebKit/qt/Api/qwebsettings.h +++ b/WebKit/qt/Api/qwebsettings.h @@ -67,10 +67,14 @@ public: LocalStorageDatabaseEnabled = LocalStorageEnabled, #endif LocalContentCanAccessRemoteUrls, - LocalContentCanAccessFileUrls, DnsPrefetchEnabled, - XSSAuditorEnabled, - AcceleratedCompositingEnabled + XSSAuditingEnabled, + AcceleratedCompositingEnabled, + WebGLEnabled, + SpatialNavigationEnabled, + LocalContentCanAccessFileUrls, + TiledBackingStoreEnabled, + FrameFlatteningEnabled }; enum WebGraphic { MissingImageGraphic, @@ -133,6 +137,9 @@ public: void setLocalStoragePath(const QString& path); QString localStoragePath() const; + void setInspectorUrl(const QUrl &location); + QUrl inspectorUrl() const; + static void clearMemoryCaches(); static void enablePersistentStorage(const QString& path = QString()); diff --git a/WebKit/qt/Api/qwebview.cpp b/WebKit/qt/Api/qwebview.cpp index 79c16c7..3ba1678 100644 --- a/WebKit/qt/Api/qwebview.cpp +++ b/WebKit/qt/Api/qwebview.cpp @@ -45,6 +45,7 @@ public: } void _q_pageDestroyed(); + void unsetPageIfExists(); QWebView *view; QWebPage *page; @@ -347,6 +348,29 @@ QWebPage *QWebView::page() const return d->page; } +void QWebViewPrivate::unsetPageIfExists() +{ + if (!page) + return; + + // if the page client is the special client constructed for + // delegating the responsibilities to a QWidget, we need + // to destroy it. + + if (page->d->client && page->d->client->isQWidgetClient()) + delete page->d->client; + + page->d->client = 0; + + // if the page was created by us, we own it and need to + // destroy it as well. + + if (page->parent() == view) + delete page; + else + page->disconnect(view); +} + /*! Makes \a page the new web page of the web view. @@ -360,14 +384,10 @@ void QWebView::setPage(QWebPage* page) { if (d->page == page) return; - if (d->page) { - d->page->d->client = 0; // unset the page client - if (d->page->parent() == this) - delete d->page; - else - d->page->disconnect(this); - } + + d->unsetPageIfExists(); d->page = page; + if (d->page) { d->page->setView(this); d->page->setPalette(palette()); @@ -397,9 +417,6 @@ void QWebView::setPage(QWebPage* page) this, SLOT(_q_pageDestroyed())); } setAttribute(Qt::WA_OpaquePaintEvent, d->page); -#if USE(ACCELERATED_COMPOSITING) - d->page->d->page->settings()->setAcceleratedCompositingEnabled(false); -#endif update(); } @@ -565,6 +582,7 @@ QString QWebView::selectedText() const return QString(); } +#ifndef QT_NO_ACTION /*! Returns a pointer to a QAction that encapsulates the specified web action \a action. */ @@ -572,6 +590,7 @@ QAction *QWebView::pageAction(QWebPage::WebAction action) const { return page()->action(action); } +#endif /*! Triggers the specified \a action. If it is a checkable action the specified diff --git a/WebKit/qt/Api/qwebview.h b/WebKit/qt/Api/qwebview.h index f681fbc..1d651d5 100644 --- a/WebKit/qt/Api/qwebview.h +++ b/WebKit/qt/Api/qwebview.h @@ -75,7 +75,9 @@ public: QString selectedText() const; +#ifndef QT_NO_ACTION QAction* pageAction(QWebPage::WebAction action) const; +#endif void triggerPageAction(QWebPage::WebAction action, bool checked = false); bool isModified() const; diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog index fb832b3..54f5f65 100644 --- a/WebKit/qt/ChangeLog +++ b/WebKit/qt/ChangeLog @@ -1,3 +1,1607 @@ +2010-04-21 Jakub Wieczorek + + Reviewed by Darin Adler. + + List item markers are not always updated after changes in the DOM. + https://bugs.webkit.org/show_bug.cgi?id=37060 + + * Api/qwebelement.h: Make DumpRenderTreeSupportQt a friend class. + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::markerTextForListItem): Add a private API to get the marker text for a list item. + +2010-04-21 Yi Shen + + Reviewed by Simon Hausmann. + + [Qt] Check the request empty or not in ChromeClientQt::createWindow() + https://bugs.webkit.org/show_bug.cgi?id=37821 + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::createWindow): + +2010-04-21 Shu Chang + + Reviewed by Simon Hausmann. + + [Qt] Fix Symbian build where QT_NO_SYSTEMTRAYICON is defined. + https://bugs.webkit.org/show_bug.cgi?id=37442 + + * WebCoreSupport/NotificationPresenterClientQt.cpp: + (NotificationPresenterClientQt::show): + * WebCoreSupport/NotificationPresenterClientQt.h: + +2010-04-21 Eric Seidel + + Unreviewed, rolling out r57963. + http://trac.webkit.org/changeset/57963 + https://bugs.webkit.org/show_bug.cgi?id=37759 + + Three tests started crashing on the Qt bot. + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::isCommandEnabled): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + +2010-04-21 Yi Shen + + Reviewed by Simon Hausmann. + + [Qt] Add LayoutTestController interface: computedStyleIncludingVisitedInfo + https://bugs.webkit.org/show_bug.cgi?id=37759 + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::computedStyleIncludingVisitedInfo): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + +2010-04-21 No'am Rosenthal + + Reviewed by Simon Fraser. + + [Qt] Fix or remove the runtime flag for accelerated compositing. + https://bugs.webkit.org/show_bug.cgi?id=37313 + + This lets the QWebPageClient "veto" the settings value for accelerated compositing. + In this case we allow accelerated compositing only on QGraphicsWebView. + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::allowsAcceleratedCompositing): + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::allowsAcceleratedCompositing): + * WebCoreSupport/ChromeClientQt.h: + +2010-04-20 Adam Barth + + Unreviewed build fix. + + * Api/qwebframe.cpp: + (QWebFrame::setUrl): + +2010-04-20 Adam Barth + + Reviewed by Eric Seidel. + + Factor DocumentWriter out of FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=37175 + + Update these callsites because the method moved to DocumentWriter. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::finishedLoading): + (WebCore::FrameLoaderClientQt::setMainDocumentError): + (WebCore::FrameLoaderClientQt::committedLoad): + (WebCore::FrameLoaderClientQt::dispatchDidFailLoading): + +2010-04-20 Kent Tamura + + Reviewed by Darin Adler. + + Change a parameter type of chooseIconForFiles() + https://bugs.webkit.org/show_bug.cgi?id=37504 + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::chooseIconForFiles): + * WebCoreSupport/ChromeClientQt.h: + +2010-04-19 Jocelyn Turcotte + + Reviewed by Simon Hausmann. + + [Qt] Fix compilation against namespaced Qt. + + * WebCoreSupport/ChromeClientQt.h: + * WebCoreSupport/QtFallbackWebPopup.h: + +2010-04-18 Robert Hogan + + Reviewed by Simon Hausmann. + + [Qt] Add support for LayoutTestController commands: + setSmartInsertDeleteEnabled + setSelectTrailingWhitespaceEnabled + execCommand + isCommandEnabled + + https://bugs.webkit.org/show_bug.cgi?id=35844 + + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + * Api/qwebpage_p.h: + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::setSmartInsertDeleteEnabled): + (DumpRenderTreeSupportQt::setSelectTrailingWhitespaceEnabled): + (DumpRenderTreeSupportQt::executeCoreCommandByName): + (DumpRenderTreeSupportQt::isCommandEnabled): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + * WebCoreSupport/EditorClientQt.cpp: + (WebCore::EditorClientQt::smartInsertDeleteEnabled): + (WebCore::EditorClientQt::toggleSmartInsertDelete): + (WebCore::EditorClientQt::isSelectTrailingWhitespaceEnabled): + * WebCoreSupport/EditorClientQt.h: + +2010-04-15 Kent Hansen + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Mark QWebFrame::overloadedSlots autotest as expected failure + + https://bugs.webkit.org/show_bug.cgi?id=37319 + + * tests/qwebframe/tst_qwebframe.cpp: + +2010-04-09 Antonio Gomes + + Reviewed by Kenneth Christiansen and Tor Arne Vestbø. + + REGRESSION(r56552): Broken scrollbars size + https://bugs.webkit.org/show_bug.cgi?id=36853 + + The regression was caused by r56552, which introduced a fix to bug + webkit.org/b/21300. The bug solved an issue with the resize handle on mac, + but did it in a way that affected all Qt platforms and thus broke the behavior + on non-mac platforms. + + This patch makes the mac specific change ifdef'ed and only applied for the mac + platform. + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::windowResizerRect): + +2010-04-15 Bruno Schmidt + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Null QObjects properties cause Segmentation Fault + https://bugs.webkit.org/show_bug.cgi?id=34730 + + QObjects exported to the QWebkit javascript with properties that are + a null "QObject*" cause Segmentation Fault. + + If an QObject is added to the javascript context and it contains + properties of the type QObject* with NULL value, calling the property + causes Segmentation Fault. + + Follow the tests for the corrections done over WebCore. + + * tests/qwebframe/tst_qwebframe.cpp: + (MyQObject::MyQObject): init the field m_objectStar + (MyQObject::objectStarProperty): read the Object* prop + (MyQObject::setObjectStarProperty): write the Object* prop + (tst_QWebFrame::getSetStaticProperty): new tests for the new prop + +2010-04-14 Luiz Agostini + + Reviewed by Kenneth Rohde Christiansen. + + Changing view mode names due to specification changes + https://bugs.webkit.org/show_bug.cgi?id=37615 + + test: fast/media/media-feature-wgt-view-mode.html + + specification: http://dev.w3.org/2006/waf/widgets-vmmf/ + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::isWindowed): + (WebCore::ChromeClientQt::isFullscreen): + (WebCore::ChromeClientQt::isMaximized): + (WebCore::ChromeClientQt::isMinimized): + * WebCoreSupport/ChromeClientQt.h: + +2010-04-14 Luiz Agostini + + Reviewed by Simon Hausmann. + + [Qt] Moving setViewMode from DumpRenderTreeSupportQt to qwebpage.cpp + https://bugs.webkit.org/show_bug.cgi?id=37622 + + Method qt_wrt_setViewMode was removed from qwebpage.cpp by mistake in r57433 + (bug 35844). Moving it back. + + * Api/qwebpage.cpp: + (qt_wrt_setViewMode): + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::setMediaType): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + +2010-04-14 Andreas Kling + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Rendering artifacts on Qt plugins when scrolling the page + https://bugs.webkit.org/show_bug.cgi?id=37152 + + Because we no longer repaint the entire viewport on scroll, + we must trigger a repaint of QtPluginWidgets when their geometry changes. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + +2010-04-14 Aaron Boodman + + Reviewed by David Levin. + + Support relative URLs for notifications on Chromium. They weren't working previously because WebCore was inserting + the relative URL into a KURL instance, but when KURL is backed by GURL as it is on Chromium, relative URLs are + unsupported. Fixed by resolving the relative URL first. + + https://bugs.webkit.org/show_bug.cgi?id=36623 + + Adding tests for this is difficult because we don't currently have DRT support for notifications on Mac, only Windows. + + * WebCoreSupport/NotificationPresenterClientQt.cpp: + (NotificationPresenterClientQt::show): Return type of NotificationContents::iconURL() changed. + +2010-04-13 Timothy Hatcher + + Rename SecurityOrigin::whiteListAccessFromOrigin to addOriginAccessWhitelistEntry. + And SecurityOrigin::resetOriginAccessWhiteLists to resetOriginAccessWhitelists. + + SecurityOrigin needs a way to remove individual OriginAccessEntries + https://bugs.webkit.org/show_bug.cgi?id=37449 + + Reviewed by Dave Hyatt. + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::whiteListAccessFromOrigin): + (DumpRenderTreeSupportQt::resetOriginAccessWhiteLists): + +2010-04-11 Sheriff Bot + + Unreviewed, rolling out r57468. + http://trac.webkit.org/changeset/57468 + https://bugs.webkit.org/show_bug.cgi?id=37433 + + Broke the world... Must have applied the patch wrong + (Requested by abarth on #webkit). + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::finishedLoading): + (WebCore::FrameLoaderClientQt::setMainDocumentError): + (WebCore::FrameLoaderClientQt::committedLoad): + (WebCore::FrameLoaderClientQt::dispatchDidFailLoading): + +2010-04-11 Adam Barth + + Reviewed by Eric Seidel. + + Factor DocumentWriter out of FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=37175 + + Update these callsites because the method moved to DocumentWriter. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::finishedLoading): + (WebCore::FrameLoaderClientQt::setMainDocumentError): + (WebCore::FrameLoaderClientQt::committedLoad): + (WebCore::FrameLoaderClientQt::dispatchDidFailLoading): + +2010-04-11 Robert Hogan + + Reviewed by Simon Hausmann. + + [Qt] Add setWillSendRequestReturnsNull and setWillSendRequestClearHeader + + https://bugs.webkit.org/show_bug.cgi?id=37410 + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (qt_set_will_send_request_returns_null): + (qt_set_will_send_request_clear_headers): + (WebCore::FrameLoaderClientQt::dispatchWillSendRequest): + +2010-04-10 Robert Hogan + + Reviewed by Kenneth Rohde Christiansen. + + Refactor Qt DRT support in QtWebKit + + Move all QT DRT support functions to a static class. + + https://bugs.webkit.org/show_bug.cgi?id=35844 + + * Api/qwebframe.cpp: Remove static functions. + * Api/qwebframe.h: Make DumpRenderTreeSupportQt a friend. + * Api/qwebpage.cpp: Remove static functions. + * Api/qwebpage.h: Make DumpRenderTreeSupportQt a friend. + * Api/qwebsecurityorigin.cpp: Remove static functions. + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: Added. + (DumpRenderTreeSupportQt::DumpRenderTreeSupportQt): + (DumpRenderTreeSupportQt::~DumpRenderTreeSupportQt): + (DumpRenderTreeSupportQt::overwritePluginDirectories): + (DumpRenderTreeSupportQt::workerThreadCount): + (DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled): + (DumpRenderTreeSupportQt::setFrameFlatteningEnabled): + (DumpRenderTreeSupportQt::webPageSetGroupName): + (DumpRenderTreeSupportQt::webPageGroupName): + (DumpRenderTreeSupportQt::webInspectorExecuteScript): + (DumpRenderTreeSupportQt::webInspectorClose): + (DumpRenderTreeSupportQt::webInspectorShow): + (DumpRenderTreeSupportQt::setTimelineProfilingEnabled): + (DumpRenderTreeSupportQt::hasDocumentElement): + (DumpRenderTreeSupportQt::setJavaScriptProfilingEnabled): + (DumpRenderTreeSupportQt::pauseAnimation): + (DumpRenderTreeSupportQt::pauseTransitionOfProperty): + (DumpRenderTreeSupportQt::pauseSVGAnimation): + (DumpRenderTreeSupportQt::numberOfActiveAnimations): + (DumpRenderTreeSupportQt::clearFrameName): + (DumpRenderTreeSupportQt::javaScriptObjectsCount): + (DumpRenderTreeSupportQt::garbageCollectorCollect): + (DumpRenderTreeSupportQt::garbageCollectorCollectOnAlternateThread): + (DumpRenderTreeSupportQt::counterValueForElementById): + (DumpRenderTreeSupportQt::pageNumberForElementById): + (DumpRenderTreeSupportQt::numberOfPages): + (DumpRenderTreeSupportQt::suspendActiveDOMObjects): + (DumpRenderTreeSupportQt::resumeActiveDOMObjects): + (DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld): + (DumpRenderTreeSupportQt::whiteListAccessFromOrigin): + (DumpRenderTreeSupportQt::resetOriginAccessWhiteLists): + (DumpRenderTreeSupportQt::setDomainRelaxationForbiddenForURLScheme): + (DumpRenderTreeSupportQt::setCaretBrowsingEnabled): + (DumpRenderTreeSupportQt::setMediaType): + (DumpRenderTreeSupportQt::setViewMode): + * WebCoreSupport/DumpRenderTreeSupportQt.h: Added. + * WebCoreSupport/EditorClientQt.h: + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::multiplePageGroupsAndLocalStorage): + (tst_QWebPage::inputMethodsTextFormat): + (tst_QWebPage::protectBindingsRuntimeObjectsFromCollector): + +2010-04-11 Robert Hogan + + Reviewed by Simon Hausmann. + + [Qt] Update layoutTestController.DumpResourceLoadCallbacks to match other ports. + + Unskip http/tests/xmlhttprequest/abort-should-cancel-load.html + http/tests/misc/will-send-request-returns-null-on-redirect.html + fast/loader/user-style-sheet-resource-load-callbacks.html + http/tests/misc/window-dot-stop.html + http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag-parent-same-origin-allow.html + http/tests/security/XFrameOptions/x-frame-options-deny.html + http/tests/security/XFrameOptions/x-frame-options-parent-same-origin-allow.html + http/tests/security/XFrameOptions/x-frame-options-parent-same-origin-deny.html + http/tests/xmlhttprequest/abort-should-cancel-load.html + + QNetworkReply::OperationCanceledError has a value of 5, so update expected results accordingly. + + https://bugs.webkit.org/show_bug.cgi?id=37237 + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (qt_set_will_send_request_returns_null_on_redirect): + (drtDescriptionSuitableForTestResult): + (WebCore::FrameLoaderClientQt::dispatchWillSendRequest): + (WebCore::FrameLoaderClientQt::dispatchDidReceiveResponse): + (WebCore::FrameLoaderClientQt::dispatchDidFinishLoading): + (WebCore::FrameLoaderClientQt::dispatchDidFailLoading): + +2010-04-10 Laszlo Gombos + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Implement Desktop Notifications API for QtWebKit + https://bugs.webkit.org/show_bug.cgi?id=35503 + + Map WebKit notifications to Qt's SystemTray API and + implement DRT tracing. + + This patch does not implement the security part of + WebKit notifications. + + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + * Api/qwebpage.h: + * Api/qwebpage_p.h: + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::notificationPresenter): + * WebCoreSupport/ChromeClientQt.h: + * WebCoreSupport/NotificationPresenterClientQt.cpp: Added. + (qt_dump_notification): + (NotificationPresenterClientQt::NotificationPresenterClientQt): + (NotificationPresenterClientQt::show): + (NotificationPresenterClientQt::cancel): + (NotificationPresenterClientQt::notificationObjectDestroyed): + (NotificationPresenterClientQt::requestPermission): + (NotificationPresenterClientQt::checkPermission): + * WebCoreSupport/NotificationPresenterClientQt.h: Added. + +2010-04-09 Tasuku Suzuki + + Reviewed by Simon Hausmann. + + [Qt]Fix compile error with QT_NO_IM + https://bugs.webkit.org/show_bug.cgi?id=36533 + + * WebCoreSupport/QtFallbackWebPopup.cpp: + (WebCore::QtFallbackWebPopupCombo::hidePopup): + +2010-04-09 Yi Shen + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] tst_QWebFrame::popupFocus() fails + https://bugs.webkit.org/show_bug.cgi?id=37320 + + The QWebPopup class has been moved & renamed, so tst_QWebFrame::popupFocus() should use + the class name "QComboBox", rather than "WebCore::QWebPopup" to find the popup menu. + + * tests/qwebframe/tst_qwebframe.cpp: + +2010-04-09 Antonio Gomes + + Reviewed by Holger Freyther. + + Removing the use of topLevelWidget of QWidget class since it is deprecated/obsolete + since Qt 4.5. window() method is being used instead now. + + See http://doc.trolltech.com/4.5/qwidget-obsolete.html#topLevelWidget for more info. + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::windowRect): + (WebCore::ChromeClientQt::show): + (WebCore::ChromeClientQt::windowResizerRect): + +2010-04-09 Tasuku Suzuki + + Reviewed by Simon Hausmann. + + [Qt] Fix compile error with QT_NO_ACTION + https://bugs.webkit.org/show_bug.cgi?id=36529 + + Make sure QT_NO_ACTION is not defined to use QAction + + * Api/qgraphicswebview.cpp: + (QGraphicsWebView::pageAction): + * Api/qwebpage.cpp: + (QWebPagePrivate::updateAction): + (QWebPage::updatePositionDependentActions): + * Api/qwebpage.h: + * Api/qwebview.cpp: + * Api/qwebview.h: + +2010-04-09 Simon Hausmann + + Reviewed by Lars Knoll. + + [Qt] tests/qgraphicswebview fails + https://bugs.webkit.org/show_bug.cgi?id=37317 + + * Api/qwebpage.cpp: + (QWebPage::userAgentForUrl): Don't crash if the ownerWidget is null. + +2010-04-08 Benjamin Poulain + + Reviewed by Simon Hausmann. + + [Qt] Warnings when compiling InspectorClientQt.cpp + https://bugs.webkit.org/show_bug.cgi?id=37266 + + Add a default: for the switch()-case to avoid + warnings. + + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::variantToSetting): + +2010-04-01 Antonio Gomes + + Reviewed by David Hyatt. + + [Qt] REGRESSION:(r50665) QWebFrame::setScrollBarPolicy(Qt::Vertical,Qt::ScrollBarAlwaysOff) has no effect. + https://bugs.webkit.org/show_bug.cgi?id=29431 + + Make use of the new lock parameter of set{Vertical,Horizontal}ScrollbarMode. + + Always added a qt auto test for set scrollbar policy feature. + + * Api/qwebframe.cpp: + (QWebFrame::setScrollBarPolicy): + * tests/qwebframe/tst_qwebframe.cpp: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (FrameLoaderClientQt::transitionToCommittedForNewPage): + +2010-04-08 Joe Ligman + + Reviewed by Simon Hausmann. + + [Qt] WebKit crashes while input text through input method. + The formatted text underline painting crashes when painting with invalid indexes. + https://bugs.webkit.org/show_bug.cgi?id=36870 + + * Api/qwebpage.cpp: + (QWebPagePrivate::inputMethodEvent): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::inputMethodsTextFormat_data): + (tst_QWebPage::inputMethodsTextFormat): + +2010-04-08 Joe Ligman + + Reviewed by Simon Hausmann. + + [Qt] qtwebkit_webframe_scrollRecursively scrolls when body.style.overflow="hidden" + https://bugs.webkit.org/show_bug.cgi?id=36674 + + The scrolling check was based on the frameview's scrolloffset, and + maximumScrollPosition, which does not acknowledge the overflow properties. + + I am now basing the scrolling off the scrollbar position. The scrollbars are + affected by the overflow properties indicating when not to scroll. The scrollbar + positions also continue to work for CSS ::-webkit-scrollbar styles. + + * Api/qwebframe.cpp: + (qtwebkit_webframe_scrollRecursively): + +2010-04-07 Andrey Kosyakov + + Reviewed by Yury Semikhatsky. + + Removed redundant FrameLoaderClient::dispatchDidLoadResourceByXMLHttpRequest() + https://bugs.webkit.org/show_bug.cgi?id=36949 + + * WebCoreSupport/FrameLoaderClientQt.cpp: + * WebCoreSupport/FrameLoaderClientQt.h: + +2010-04-07 Dawit Alemayehu + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=36827 + + Updated the WebCore::shouldTreatAsAttachement function call with the + new more generic replacement WebCore::contentDispositionType. + + See comments 39-42 in https://bugs.webkit.org/show_bug.cgi?id=36395 + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForMIMEType): + +2010-04-07 Andreas Kling + + Reviewed by Simon Hausmann. + + [Qt] When providing a widget for the PDF mime type it will cause a crash + + m_pluginView may actually be a Widget (for embedded Qt widgets), + so always check isPluginView() before calling PluginView specific methods. + + https://bugs.webkit.org/show_bug.cgi?id=29450 + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::finishedLoading): + (WebCore::FrameLoaderClientQt::setMainDocumentError): + (WebCore::FrameLoaderClientQt::committedLoad): + +2010-04-06 Diego Gonzalez + + Reviewed by Simon Hausmann. + + [Qt] Add mechanism to detect QtWebKit 2.0 via the preprocessor + https://bugs.webkit.org/show_bug.cgi?id=36538 + + * Api/qwebkitglobal.h: + +2010-04-02 Laszlo Gombos + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] [Symbian] Rebaseline Symbian def file + https://bugs.webkit.org/show_bug.cgi?id=37038 + + Switch the ordinal numbers for qtwebkit_webframe_scrollRecursively + and QWebInspector::closeEvent to match QtWebkit 4.6 branch + + Fix the signature for qt_drt_setFrameFlatteningEnabled + after r56718. + + Add new QtWebKit API symbols introduced not listed in the file yet. + + * symbian/eabi/QtWebKitu.def: + +2010-03-30 Antonio Gomes + + Reviewed by Adam Treat. + + Stored focused frame and document in a vars, instead of querying for them many times. + + * Api/qwebpage.cpp: + (QWebPagePrivate::mousePressEvent(QEvent* ev)): + (QWebPagePrivate::mousePressEvent(QGraphicsSceneMouseEvent* ev): + +2010-04-02 Tasuku Suzuki + + Reviewed by Eric Seidel. + + [Qt]Fix compile error with QT_NO_SETTINGS + https://bugs.webkit.org/show_bug.cgi?id=36533 + + If QT_NO_SETTINGS is defined, QSettings is not available. + + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::populateSetting): + (WebCore::InspectorClientQt::storeSetting): + +2010-04-02 Luiz Agostini + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Maemo5 theme - customized popup for "); + bodyElement.appendInside(markup); + } + + /* force a layout */ + QWebFrame* mainFrame = m_page->mainFrame(); + mainFrame->toPlainText(); + + QPixmap pixmap(mainFrame->contentsSize()); + QBENCHMARK { + QPainter painter(&pixmap); + mainFrame->render(&painter, QRect(QPoint(0, 0), mainFrame->contentsSize())); + painter.end(); + } +} + QTEST_MAIN(tst_Painting) #include "tst_painting.moc" diff --git a/WebKit/qt/tests/hybridPixmap/hybridPixmap.pro b/WebKit/qt/tests/hybridPixmap/hybridPixmap.pro index 0e49a70..9e80870 100644 --- a/WebKit/qt/tests/hybridPixmap/hybridPixmap.pro +++ b/WebKit/qt/tests/hybridPixmap/hybridPixmap.pro @@ -1,6 +1,7 @@ # ------------------------------------------------- # Project created by QtCreator 2009-12-10T11:25:02 # ------------------------------------------------- +isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../.. include(../tests.pri) TARGET = hybridPixmap SOURCES += widget.cpp diff --git a/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro b/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro index 4ca2bf6..d056014 100644 --- a/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro +++ b/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro @@ -1 +1,2 @@ +isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../.. include(../tests.pri) \ No newline at end of file diff --git a/WebKit/qt/tests/qwebelement/qwebelement.pro b/WebKit/qt/tests/qwebelement/qwebelement.pro index 4ca2bf6..d056014 100644 --- a/WebKit/qt/tests/qwebelement/qwebelement.pro +++ b/WebKit/qt/tests/qwebelement/qwebelement.pro @@ -1 +1,2 @@ +isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../.. include(../tests.pri) \ No newline at end of file diff --git a/WebKit/qt/tests/qwebframe/qwebframe.pro b/WebKit/qt/tests/qwebframe/qwebframe.pro index 4ca2bf6..d056014 100644 --- a/WebKit/qt/tests/qwebframe/qwebframe.pro +++ b/WebKit/qt/tests/qwebframe/qwebframe.pro @@ -1 +1,2 @@ +isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../.. include(../tests.pri) \ No newline at end of file diff --git a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 5ac3769..5f5a2f2 100644 --- a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -67,6 +67,7 @@ class MyQObject : public QObject Q_PROPERTY(QKeySequence shortcut READ shortcut WRITE setShortcut) Q_PROPERTY(CustomType propWithCustomType READ propWithCustomType WRITE setPropWithCustomType) Q_PROPERTY(QWebElement webElementProperty READ webElementProperty WRITE setWebElementProperty) + Q_PROPERTY(QObject* objectStarProperty READ objectStarProperty WRITE setObjectStarProperty) Q_ENUMS(Policy Strategy) Q_FLAGS(Ability) @@ -104,6 +105,7 @@ public: m_hiddenValue(456.0), m_writeOnlyValue(789), m_readOnlyValue(987), + m_objectStar(0), m_qtFunctionInvoked(-1) { } ~MyQObject() { } @@ -197,6 +199,15 @@ public: m_customType = c; } + QObject* objectStarProperty() const { + return m_objectStar; + } + + void setObjectStarProperty(QObject* object) { + m_objectStar = object; + } + + int qtFunctionInvoked() const { return m_qtFunctionInvoked; } @@ -482,6 +493,7 @@ private: QKeySequence m_shortcut; QWebElement m_webElement; CustomType m_customType; + QObject* m_objectStar; int m_qtFunctionInvoked; QVariantList m_actuals; }; @@ -585,9 +597,9 @@ private slots: void render(); void scrollPosition(); void scrollToAnchor(); + void scrollbarsOff(); void evaluateWillCauseRepaint(); void qObjectWrapperWithSameIdentity(); - void scrollRecursively(); void introspectQtMethods_data(); void introspectQtMethods(); @@ -878,6 +890,21 @@ void tst_QWebFrame::getSetStaticProperty() QCOMPARE(evalJS("myObject.readOnlyProperty = 654;" "myObject.readOnlyProperty == 987"), sTrue); QCOMPARE(m_myObject->readOnlyProperty(), 987); + + // QObject* property + m_myObject->setObjectStarProperty(0); + QCOMPARE(m_myObject->objectStarProperty(), (QObject*)0); + QCOMPARE(evalJS("myObject.objectStarProperty == null"), sTrue); + QCOMPARE(evalJS("typeof myObject.objectStarProperty"), sObject); + QCOMPARE(evalJS("Boolean(myObject.objectStarProperty)"), sFalse); + QCOMPARE(evalJS("String(myObject.objectStarProperty) == 'null'"), sTrue); + QCOMPARE(evalJS("myObject.objectStarProperty.objectStarProperty"), + sUndefined); + m_myObject->setObjectStarProperty(this); + QCOMPARE(evalJS("myObject.objectStarProperty != null"), sTrue); + QCOMPARE(evalJS("typeof myObject.objectStarProperty"), sObject); + QCOMPARE(evalJS("Boolean(myObject.objectStarProperty)"), sTrue); + QCOMPARE(evalJS("String(myObject.objectStarProperty) != 'null'"), sTrue); } void tst_QWebFrame::getSetDynamicProperty() @@ -1908,6 +1935,7 @@ void tst_QWebFrame::overloadedSlots() // should pick myOverloadedSlot(QRegExp) m_myObject->resetQtFunctionInvoked(); evalJS("myObject.myOverloadedSlot(document.body)"); + QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=37319", Continue); QCOMPARE(m_myObject->qtFunctionInvoked(), 36); // should pick myOverloadedSlot(QObject*) @@ -2515,7 +2543,7 @@ void tst_QWebFrame::popupFocus() // open the popup by clicking. check if focus is on the popup QTest::mouseClick(&view, Qt::LeftButton, 0, QPoint(25, 25)); - QObject* webpopup = firstChildByClassName(&view, "WebCore::QWebPopup"); + QObject* webpopup = firstChildByClassName(&view, "QComboBox"); QComboBox* combo = qobject_cast(webpopup); QVERIFY(combo != 0); QTRY_VERIFY(!view.hasFocus() && combo->view()->hasFocus()); // Focus should be on the popup @@ -2797,6 +2825,38 @@ void tst_QWebFrame::scrollToAnchor() QVERIFY(frame->scrollPosition().y() != 0); } + +void tst_QWebFrame::scrollbarsOff() +{ + QWebView view; + QWebFrame* mainFrame = view.page()->mainFrame(); + + mainFrame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff); + mainFrame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff); + + QString html("" \ + "" \ + "
" \ + " End" \ + "
" \ + "" \ + ""); + + + view.setHtml(html); + ::waitForSignal(&view, SIGNAL(loadFinished(bool))); + + mainFrame->evaluateJavaScript("checkScrollbar();"); + QCOMPARE(mainFrame->documentElement().findAll("span").at(0).toPlainText(), QString("SUCCESS")); +} + void tst_QWebFrame::evaluateWillCauseRepaint() { QWebView view; @@ -2808,7 +2868,7 @@ void tst_QWebFrame::evaluateWillCauseRepaint() #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) QTest::qWaitForWindowShown(&view); #else - QTest::qWait(2000); + QTest::qWait(2000); #endif view.page()->mainFrame()->evaluateJavaScript( @@ -2855,70 +2915,6 @@ void tst_QWebFrame::qObjectWrapperWithSameIdentity() QCOMPARE(mainFrame->toPlainText(), QString("test2")); } -void tst_QWebFrame::scrollRecursively() -{ - // The test content is - // a nested frame set - // The main frame scrolls - // and has two children - // an iframe and a div overflow - // both scroll - QWebView webView; - QWebPage* webPage = webView.page(); - QSignalSpy loadSpy(webPage, SIGNAL(loadFinished(bool))); - QUrl url = QUrl("qrc:///testiframe.html"); - webPage->mainFrame()->load(url); - QTRY_COMPARE(loadSpy.count(), 1); - - QList children = webPage->mainFrame()->childFrames(); - QVERIFY(children.count() == 1); - - // 1st test - // call scrollRecursively over mainframe - // verify scrolled - // verify scroll postion changed - QPoint scrollPosition(webPage->mainFrame()->scrollPosition()); - QVERIFY(webPage->mainFrame()->scrollRecursively(10, 10)); - QVERIFY(scrollPosition != webPage->mainFrame()->scrollPosition()); - - // 2nd test - // call scrollRecursively over child iframe - // verify scrolled - // verify child scroll position changed - // verify parent's scroll position did not change - scrollPosition = webPage->mainFrame()->scrollPosition(); - QPoint childScrollPosition = children.at(0)->scrollPosition(); - QVERIFY(children.at(0)->scrollRecursively(10, 10)); - QVERIFY(scrollPosition == webPage->mainFrame()->scrollPosition()); - QVERIFY(childScrollPosition != children.at(0)->scrollPosition()); - - // 3rd test - // call scrollRecursively over div overflow - // verify scrolled == true - // verify parent and child frame's scroll postion did not change - QWebElement div = webPage->mainFrame()->documentElement().findFirst("#content1"); - QMouseEvent evpres(QEvent::MouseMove, div.geometry().center(), Qt::NoButton, Qt::NoButton, Qt::NoModifier); - webPage->event(&evpres); - scrollPosition = webPage->mainFrame()->scrollPosition(); - childScrollPosition = children.at(0)->scrollPosition(); - QVERIFY(webPage->mainFrame()->scrollRecursively(5, 5)); - QVERIFY(childScrollPosition == children.at(0)->scrollPosition()); - QVERIFY(scrollPosition == webPage->mainFrame()->scrollPosition()); - - // 4th test - // call scrollRecursively twice over childs iframe - // verify scrolled == true first time - // verify parent's scroll == true second time - // verify parent and childs scroll position changed - childScrollPosition = children.at(0)->scrollPosition(); - QVERIFY(children.at(0)->scrollRecursively(-10, -10)); - QVERIFY(childScrollPosition != children.at(0)->scrollPosition()); - scrollPosition = webPage->mainFrame()->scrollPosition(); - QVERIFY(children.at(0)->scrollRecursively(-10, -10)); - QVERIFY(scrollPosition != webPage->mainFrame()->scrollPosition()); - -} - void tst_QWebFrame::introspectQtMethods_data() { QTest::addColumn("objectExpression"); diff --git a/WebKit/qt/tests/qwebhistory/qwebhistory.pro b/WebKit/qt/tests/qwebhistory/qwebhistory.pro index 4ca2bf6..d056014 100644 --- a/WebKit/qt/tests/qwebhistory/qwebhistory.pro +++ b/WebKit/qt/tests/qwebhistory/qwebhistory.pro @@ -1 +1,2 @@ +isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../.. include(../tests.pri) \ No newline at end of file diff --git a/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro b/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro index 4ca2bf6..d056014 100644 --- a/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro +++ b/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro @@ -1 +1,2 @@ +isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../.. include(../tests.pri) \ No newline at end of file diff --git a/WebKit/qt/tests/qwebinspector/qwebinspector.pro b/WebKit/qt/tests/qwebinspector/qwebinspector.pro index e99c7f4..ac51929 100644 --- a/WebKit/qt/tests/qwebinspector/qwebinspector.pro +++ b/WebKit/qt/tests/qwebinspector/qwebinspector.pro @@ -1 +1,2 @@ +isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../.. include(../tests.pri) diff --git a/WebKit/qt/tests/qwebpage/qwebpage.pro b/WebKit/qt/tests/qwebpage/qwebpage.pro index 4ca2bf6..d056014 100644 --- a/WebKit/qt/tests/qwebpage/qwebpage.pro +++ b/WebKit/qt/tests/qwebpage/qwebpage.pro @@ -1 +1,2 @@ +isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../.. include(../tests.pri) \ No newline at end of file diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index ba7a87e..c857b00 100644 --- a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -20,12 +20,14 @@ */ #include "../util.h" +#include "../WebCoreSupport/DumpRenderTreeSupportQt.h" #include #include #include #include #include #include +#include #include #include #include @@ -98,6 +100,8 @@ private slots: void consoleOutput(); void inputMethods_data(); void inputMethods(); + void inputMethodsTextFormat_data(); + void inputMethodsTextFormat(); void defaultTextEncoding(); void errorPageExtension(); void errorPageExtensionInIFrames(); @@ -722,10 +726,6 @@ void tst_QWebPage::createViewlessPlugin() } -// import private API -void QWEBKIT_EXPORT qt_webpage_setGroupName(QWebPage* page, const QString& groupName); -QString QWEBKIT_EXPORT qt_webpage_groupName(QWebPage* page); - void tst_QWebPage::multiplePageGroupsAndLocalStorage() { QDir dir(QDir::currentPath()); @@ -737,12 +737,12 @@ void tst_QWebPage::multiplePageGroupsAndLocalStorage() view1.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); view1.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(QDir::currentPath() + "/path1")); - qt_webpage_setGroupName(view1.page(), "group1"); + DumpRenderTreeSupportQt::webPageSetGroupName(view1.page(), "group1"); view2.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); view2.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(QDir::currentPath() + "/path2")); - qt_webpage_setGroupName(view2.page(), "group2"); - QCOMPARE(qt_webpage_groupName(view1.page()), QString("group1")); - QCOMPARE(qt_webpage_groupName(view2.page()), QString("group2")); + DumpRenderTreeSupportQt::webPageSetGroupName(view2.page(), "group2"); + QCOMPARE(DumpRenderTreeSupportQt::webPageGroupName(view1.page()), QString("group1")); + QCOMPARE(DumpRenderTreeSupportQt::webPageGroupName(view2.page()), QString("group2")); view1.setHtml(QString(" "), QUrl("http://www.myexample.com")); @@ -1403,6 +1403,26 @@ void tst_QWebPage::inputMethods() variant = page->inputMethodQuery(Qt::ImCurrentSelection); QString selectionValue = variant.value(); QCOMPARE(selectionValue, QString("eb")); + + //Set selection with negative length + inputAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 6, -5, QVariant()); + QInputMethodEvent eventSelection2("",inputAttributes); + page->event(&eventSelection2); + + //ImAnchorPosition + variant = page->inputMethodQuery(Qt::ImAnchorPosition); + anchorPosition = variant.toInt(); + QCOMPARE(anchorPosition, 1); + + //ImCursorPosition + variant = page->inputMethodQuery(Qt::ImCursorPosition); + cursorPosition = variant.toInt(); + QCOMPARE(cursorPosition, 6); + + //ImCurrentSelection + variant = page->inputMethodQuery(Qt::ImCurrentSelection); + selectionValue = variant.value(); + QCOMPARE(selectionValue, QString("tWebK")); #endif //ImSurroundingText @@ -1459,8 +1479,56 @@ void tst_QWebPage::inputMethods() delete container; } -// import a little DRT helper function to trigger the garbage collector -void QWEBKIT_EXPORT qt_drt_garbageCollector_collect(); +void tst_QWebPage::inputMethodsTextFormat_data() +{ + QTest::addColumn("string"); + QTest::addColumn("start"); + QTest::addColumn("length"); + + QTest::newRow("") << QString("") << 0 << 0; + QTest::newRow("Q") << QString("Q") << 0 << 1; + QTest::newRow("Qt") << QString("Qt") << 0 << 1; + QTest::newRow("Qt") << QString("Qt") << 0 << 2; + QTest::newRow("Qt") << QString("Qt") << 1 << 1; + QTest::newRow("Qt ") << QString("Qt ") << 0 << 1; + QTest::newRow("Qt ") << QString("Qt ") << 1 << 1; + QTest::newRow("Qt ") << QString("Qt ") << 2 << 1; + QTest::newRow("Qt ") << QString("Qt ") << 2 << -1; + QTest::newRow("Qt ") << QString("Qt ") << -2 << 3; + QTest::newRow("Qt ") << QString("Qt ") << 0 << 3; + QTest::newRow("Qt by") << QString("Qt by") << 0 << 1; + QTest::newRow("Qt by Nokia") << QString("Qt by Nokia") << 0 << 1; +} + + +void tst_QWebPage::inputMethodsTextFormat() +{ + QWebPage* page = new QWebPage; + QWebView* view = new QWebView; + view->setPage(page); + page->settings()->setFontFamily(QWebSettings::SerifFont, "FooSerifFont"); + page->mainFrame()->setHtml("" \ + ""); + page->mainFrame()->evaluateJavaScript("document.getElementById('input1').focus()"); + page->mainFrame()->setFocus(); + view->show(); + + QFETCH(QString, string); + QFETCH(int, start); + QFETCH(int, length); + + QList attrs; + QTextCharFormat format; + format.setUnderlineStyle(QTextCharFormat::SingleUnderline); + format.setUnderlineColor(Qt::red); + attrs.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, start, length, format)); + QInputMethodEvent im(string, attrs); + page->event(&im); + + QTest::qWait(1000); + + delete view; +} void tst_QWebPage::protectBindingsRuntimeObjectsFromCollector() { @@ -1478,7 +1546,7 @@ void tst_QWebPage::protectBindingsRuntimeObjectsFromCollector() newPage->mainFrame()->evaluateJavaScript("testme('foo')"); - qt_drt_garbageCollector_collect(); + DumpRenderTreeSupportQt::garbageCollectorCollect(); // don't crash! newPage->mainFrame()->evaluateJavaScript("testme('bar')"); diff --git a/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro b/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro index e99c7f4..ac51929 100644 --- a/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro +++ b/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro @@ -1 +1,2 @@ +isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../.. include(../tests.pri) diff --git a/WebKit/qt/tests/tests.pri b/WebKit/qt/tests/tests.pri index 187950a..0bdf6f6 100644 --- a/WebKit/qt/tests/tests.pri +++ b/WebKit/qt/tests/tests.pri @@ -1,8 +1,9 @@ TEMPLATE = app CONFIG -= app_bundle -TARGET = tst_$$TARGET -SOURCES += $$_PRO_FILE_PWD_/$${TARGET}.cpp +VPATH += $$_PRO_FILE_PWD_ +!CONFIG(QTDIR_build):TARGET = tst_$$TARGET +SOURCES += $${TARGET}.cpp INCLUDEPATH += \ $$PWD \ $$PWD/../Api diff --git a/WebKit/qt/tests/tests.pro b/WebKit/qt/tests/tests.pro index 5e19202..22fece5 100644 --- a/WebKit/qt/tests/tests.pro +++ b/WebKit/qt/tests/tests.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs SUBDIRS = qwebframe qwebpage qwebelement qgraphicswebview qwebhistoryinterface qwebview qwebhistory qwebinspector hybridPixmap -greaterThan(QT_MINOR_VERSION, 4): SUBDIRS += benchmarks/painting benchmarks/loading +SUBDIRS += benchmarks/painting benchmarks/loading -- cgit v1.1