diff options
author | Steve Block <steveblock@google.com> | 2010-04-27 16:31:00 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-05-11 14:42:12 +0100 |
commit | dcc8cf2e65d1aa555cce12431a16547e66b469ee (patch) | |
tree | 92a8d65cd5383bca9749f5327fb5e440563926e6 /WebKit/qt | |
parent | ccac38a6b48843126402088a309597e682f40fe6 (diff) | |
download | external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.zip external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.gz external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.bz2 |
Merge webkit.org at r58033 : Initial merge by git
Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1
Diffstat (limited to 'WebKit/qt')
57 files changed, 3809 insertions, 1304 deletions
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 <FrameView.h> +#include "FrameView.h" +#include "GraphicsContext.h" +#include "IntRect.h" +#include "TiledBackingStore.h" #include <QtCore/qmetaobject.h> #include <QtCore/qsharedpointer.h> #include <QtCore/qtimer.h> @@ -35,14 +38,14 @@ #include <QtGui/qgraphicssceneevent.h> #include <QtGui/qgraphicsview.h> #include <QtGui/qpixmapcache.h> +#include <QtGui/qscrollbar.h> #include <QtGui/qstyleoption.h> +#include <QtGui/qinputcontext.h> #if defined(Q_WS_X11) #include <QX11Info> #endif #include <Settings.h> -#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<QGraphicsWebViewOverlay> 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<QGraphicsWebViewOverlay>(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<QGraphicsWebViewOverlay>(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<QGraphicsView*> 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<QGraphicsView*> views = q->scene()->views(); + if (QGraphicsScene* scene = q->scene()) { + const QList<QGraphicsView*> 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<QGraphicsView*> views = q->scene()->views(); - return views.value(0); + if (QGraphicsScene* scene = q->scene()) { + const QList<QGraphicsView*> views = scene->views(); + return views.value(0); + } + return 0; +} + +QRect QGraphicsWebViewPrivate::geometryRelativeToOwnerWidget() const +{ + if (!q->scene()) + return QRect(); + + QList<QGraphicsView*> 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<QGraphicsView*> 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 <parser/SourceCode.h> #include <wtf/Vector.h> +#include <wtf/text/CString.h> #include <QPainter> @@ -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<QString> 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 <QString> -#include <QStringList> -#include <QRect> -#include <QVariant> -#include <QExplicitlySharedDataPointer> +#include <QtCore/qstring.h> +#include <QtCore/qstringlist.h> +#include <QtCore/qrect.h> +#include <QtCore/qvariant.h> +#include <QtCore/qshareddata.h> #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<SVGSMILElement*>(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 <QtCore/qglobal.h> +#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<String> 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<WebCore::ContextMenuItem> *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<QAction *>(q->sender()); @@ -599,6 +560,7 @@ void QWebPagePrivate::_q_webActionTriggered(bool checked) QWebPage::WebAction action = static_cast<QWebPage::WebAction>(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<WebCore::Node> 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<WebCore::Node> 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<WebCore::Node> 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<WebCore::Node> 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<QTextFormat>().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<QWidget *>(parent)); + setView(qobject_cast<QWidget*>(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<QWebPageWidgetClient*>(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<QWebPageWidgetClient*>(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<QWebView *>(view()); + QWebView *webView = qobject_cast<QWebView*>(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<const ChooseMultipleFilesExtensionOption*>(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<ChooseMultipleFilesExtensionReturn*>(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<QWebSettingsPrivate*> 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 <jwieczorek@webkit.org> + + 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 <yi.4.shen@nokia.com> + + 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 <chang.shu@nokia.com> + + 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 <eric@webkit.org> + + 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 <yi.4.shen@nokia.com> + + 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 <noam.rosenthal@nokia.com> + + 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 <abarth@webkit.org> + + Unreviewed build fix. + + * Api/qwebframe.cpp: + (QWebFrame::setUrl): + +2010-04-20 Adam Barth <abarth@webkit.org> + + 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 <tkent@chromium.org> + + 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 <jocelyn.turcotte@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Fix compilation against namespaced Qt. + + * WebCoreSupport/ChromeClientQt.h: + * WebCoreSupport/QtFallbackWebPopup.h: + +2010-04-18 Robert Hogan <robert@webkit.org> + + 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 <kent.hansen@nokia.com> + + 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 <tonikitoo@webkit.org> + + 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 <bruno.schmidt@gmail.com> + + 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 <luiz.agostini@openbossa.org> + + 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 <luiz.agostini@openbossa.org> + + 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 <andreas.kling@nokia.com> + + 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 <aa@chromium.org> + + 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 <timothy@apple.com> + + 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 <webkit.review.bot@gmail.com> + + 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 <abarth@webkit.org> + + 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 <robert@webkit.org> + + 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 <robert@webkit.org> + + 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 <robert@webkit.org> + + 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 <laszlo.1.gombos@nokia.com> + + 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 <tasuku.suzuki@nokia.com> + + 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 <yi.4.shen@nokia.com> + + 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 <tonikitoo@webkit.org> + + 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 <tasuku.suzuki@nokia.com> + + 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 <simon.hausmann@nokia.com> + + 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 <benjamin.poulain@nokia.com> + + 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 <tonikitoo@webkit.org> + + 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 <joseph.ligman@nokia.com> + + 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 <joseph.ligman@nokia.com> + + 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 <caseq@chromium.org> + + 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 <adawit@kde.org> + + 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 <andreas.kling@nokia.com> + + 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 <diego.gonzalez@openbossa.org> + + 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 <laszlo.1.gombos@nokia.com> + + 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 <tonikitoo@webkit.org> + + 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 <tasuku.suzuki@nokia.com> + + 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 <luiz.agostini@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Maemo5 theme - customized popup for <select multiple> elements + https://bugs.webkit.org/show_bug.cgi?id=36368 + + Using QtMaemoWebPopup instead of QtFallbackWebPopup for Maemo. + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::createSelectPopup): + * WebCoreSupport/QtFallbackWebPopup.cpp: + (WebCore::QtFallbackWebPopup::show): + (WebCore::QtFallbackWebPopup::populate): + +2010-04-01 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + Add Single and Multiple Selection Popup for Maemo 5. + + [Qt] Maemo5 theme - popup dialogs + https://bugs.webkit.org/show_bug.cgi?id=36789 + + * WebCoreSupport/QtMaemoWebPopup.cpp: + (WebCore::Maemo5Popup::populateList): + (WebCore::Maemo5Popup::onItemSelected): + (WebCore::QtMaemoWebPopup::createSingleSelectionPopup): + (WebCore::QtMaemoWebPopup::createMultipleSelectionPopup): + (WebCore::Maemo5SingleSelectionPopup::Maemo5SingleSelectionPopup): + (WebCore::MultipleItemListDelegate::MultipleItemListDelegate): + (WebCore::MultipleItemListDelegate::paint): + (WebCore::Maemo5MultipleSelectionPopup::Maemo5MultipleSelectionPopup): + * WebCoreSupport/QtMaemoWebPopup.h: + +2010-03-31 Marcus Bulach <bulach@chromium.org> + + Reviewed by Jeremy Orlow. + + Adds Geolocation param for cancelGeolocationPermissionRequestForFrame. + https://bugs.webkit.org/show_bug.cgi?id=35031 + + * WebCoreSupport/ChromeClientQt.h: + (WebCore::ChromeClientQt::cancelGeolocationPermissionRequestForFrame): + +2010-03-31 Antti Koivisto <koivisto@iki.fi> + + Reviewed by Kenneth Rohde Christiansen. + + https://bugs.webkit.org/show_bug.cgi?id=36446 + [Qt] QWebSettings::TiledBackingStoreEnabled attribute lacks documentation and default value + + * Api/qgraphicswebview.cpp: + * Api/qwebsettings.cpp: + (QWebSettings::QWebSettings): + +2010-03-30 Gavin Barraclough <barraclough@apple.com> + + Rubber stamped by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=36866 + Move CString to WTF + + * Api/qwebelement.cpp: + +2010-03-30 Joe Ligman <joseph.ligman@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] QGraphicsScene mousePressEvent does not set the clickCausedFocus flag + https://bugs.webkit.org/show_bug.cgi?id=35259 + + The clickCausedFocus flag is not being set in method + mousePressEvent(QGraphicsSceneMouseEvent* ev). This flag is used + in conjunction with QStyle::RSIP_OnMouseClickAndAlreadyFocused when + deciding to launch the software input panel. + + * Api/qwebpage.cpp: + (QWebPagePrivate::mousePressEvent): + +2010-03-30 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Maemo5 theme - QtMaemoWebPopup class + https://bugs.webkit.org/show_bug.cgi?id=36790 + + A new QtAbstractWebPopup descendant class to be used for maemo menu lists. + This is the first step. The next step will be the dialogs implementation that + will come in bug 36789 and finally to use QtMaemoWebPopup instead of QtFallbackWebPopup + that will come in bug 36368. + + * WebCoreSupport/QtMaemoWebPopup.cpp: Added. + (WebCore::QtMaemoWebPopup::QtMaemoWebPopup): + (WebCore::QtMaemoWebPopup::~QtMaemoWebPopup): + (WebCore::QtMaemoWebPopup::createSingleSelectionPopup): + (WebCore::QtMaemoWebPopup::createMultipleSelectionPopup): + (WebCore::QtMaemoWebPopup::createPopup): + (WebCore::QtMaemoWebPopup::show): + (WebCore::QtMaemoWebPopup::hide): + (WebCore::QtMaemoWebPopup::popupClosed): + (WebCore::QtMaemoWebPopup::itemClicked): + * WebCoreSupport/QtMaemoWebPopup.h: Added. + (WebCore::Maemo5Popup::Maemo5Popup): + +2010-03-29 Dawit Alemayehu <adawit@kde.org> + + Reviewed by Simon Hausmann. + + [Qt] Added support for handling the HTTP "Content-Disposition" header. + + https://bugs.webkit.org/show_bug.cgi?id=36395 + + Whenever a server response contains a "Content-Disposition: attachment..." header, + treat the request as a download and emit the unsupportedContent signal. + + * Api/qwebpage.cpp: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::download): + (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForMIMEType): + +2010-03-22 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Fraser. + + Add support for Widgets 1.0: View Mode Media Feature + https://bugs.webkit.org/show_bug.cgi?id=35446 + + Add an internal Qt API for changing the view mode media feature + (http://www.w3.org/TR/widgets-vmmf/). + + * Api/qwebpage.cpp: + (qt_wrt_setViewMode): + (QWebPagePrivate::priv): + * Api/qwebpage_p.h: + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::isDocked): + (WebCore::ChromeClientQt::isFloating): + (WebCore::ChromeClientQt::isApplication): + (WebCore::ChromeClientQt::isFullscreen): + * WebCoreSupport/ChromeClientQt.h: + +2010-03-29 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Antti Koivisto. + + Use 'Mobile Safari' instead of 'Safari' on mobile Qt platforms. + + * Api/qwebpage.cpp: + (QWebPage::userAgentForUrl): + +2010-03-29 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] unit tests don't compile inside of Qt + + https://bugs.webkit.org/show_bug.cgi?id=36756 + + * tests/tests.pri: Don't do the target substitution inside Qt and find the sources + through VPATH instead of relying on the location of the .pro file exclusively. + +2010-03-26 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Antti Koivisto. + + Change due to renaming of frame flattening setting. + + * Api/qwebpage.cpp: + (qt_drt_setFrameFlatteningEnabled): + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): + * symbian/eabi/QtWebKitu.def: + +2010-03-28 Alexey Proskuryakov <ap@apple.com> + + Build fix. Include WindowsKeyboardCodes.h instead of KeyboardCodes.h. + + * WebCoreSupport/EditorClientQt.cpp: + +2010-03-26 Olivier Goffart <ogoffart@trolltech.com> + + Reviewed by Simon Hausmann. + + [Qt] Compile with QT_USE_FAST_OPERATOR_PLUS + + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::populateSetting): + (WebCore::InspectorClientQt::storeSetting): + +2010-03-26 David Boddie <dboddie@trolltech.com> + + Reviewed by Simon Hausmann. + + [Qt] Doc: Simplified Commercial Editions for Qt 4.7. + + * docs/qtwebkit.qdoc: + +2010-03-26 Simon Hausmann <simon.hausmann@nokia.com> + + Symbian build fix. + + [Qt] Updated the def file with new exports used by QtLauncher. + + * symbian/eabi/QtWebKitu.def: + +2010-03-25 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] QtLauncher crashes on Mac OS and Linux when exiting with QGraphicsView mode enabled + https://bugs.webkit.org/show_bug.cgi?id=35251 + + Followed the way QWebView registers for the signal QWebPage::destroyed(), to prevent + QGraphicsWebView from referencing QWebPage after it was deleted. + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::_q_pageDestroyed): + (QGraphicsWebView::setPage): + * Api/qgraphicswebview.h: + +2010-03-25 Kent Hansen <kent.hansen@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] QWebFrame::pageChanged() signal is not documented + https://bugs.webkit.org/show_bug.cgi?id=36609 + + * Api/qwebframe.cpp: + +2010-03-25 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Implement ChromeClient::windowResizerRect() + + https://bugs.webkit.org/show_bug.cgi?id=21300 + + We assume the resize corner to be in the lower right corner of + the window and having the width and height of the scrollbars. + + The helper function geometryRelativeToOwnerWidget() in the page + client is used to clip the resize rect to the actual size of the + viewport, not the size of the QGraphicsView. + + * Api/qgraphicswebview.cpp: + * Api/qwebpage.cpp: + * WebCoreSupport/ChromeClientQt.cpp: + +2010-03-25 Shu Chang <chang.shu@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Added documentation for delete button. + https://bugs.webkit.org/show_bug.cgi?id=31560 + + * Api/qwebsettings.cpp: + +2010-03-25 Tasuku Suzuki <tasuku.suzuki@nokia.com> + + Reviewed by Eric Seidel. + + [Qt]Fix compile error with QT_NO_DESKTOPSERVICES + https://bugs.webkit.org/show_bug.cgi?id=36533 + + * Api/qwebsettings.cpp: + (QWebSettings::enablePersistentStorage): + +2010-03-25 Tasuku Suzuki <tasuku.suzuki@nokia.com> + + Reviewed by Eric Seidel. + + [Qt]Fix compile error with QT_NO_DEBUG_STREAM + https://bugs.webkit.org/show_bug.cgi?id=36533 + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::graphicsItemVisibleRect): + +2010-03-25 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Eric Seidel. + + Make QWebPage not depend on view() but use the client->ownerWidget() + instead. Also, handle the case where there is not page client. + + * Api/qwebpage.cpp: + (QWebPagePrivate::createContextMenu): + (QWebPagePrivate::keyPressEvent): + (QWebPage::javaScriptAlert): + (QWebPage::javaScriptConfirm): + (QWebPage::javaScriptPrompt): + (QWebPage::shouldInterruptJavaScript): + (QWebPage::createWindow): + (QWebPage::action): + (QWebPage::extension): + (QWebPage::chooseFile): + (QWebPage::userAgentForUrl): + +2010-03-24 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + Add the FrameFlatteningEnabled WebAttribute to QWebSettings. + + [Qt] Missing QWebSettings for Frame Flattening + https://bugs.webkit.org/show_bug.cgi?id=36553 + + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): + (QWebSettings::QWebSettings): + * Api/qwebsettings.h: + +2010-03-24 Viatcheslav Ostapenko <ostapenko.viatcheslav@nokia.com> + + Reviewed by Laszlo Gombos. + + Auto-uppercase and predictive text need to be disabled for S60 (as for maemo) + https://bugs.webkit.org/show_bug.cgi?id=33176 + + * WebCoreSupport/EditorClientQt.cpp: + +2010-03-24 Kent Hansen <kent.hansen@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Rename QWebSettings::XSSAuditorEnabled to XSSAuditingEnabled + https://bugs.webkit.org/show_bug.cgi?id=36522 + + For consistency with other QWebSettings attributes. + + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): + * Api/qwebsettings.h: + +2010-03-23 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + Calling setView(0) on a QWebPage being shown by a QGraphicsWebView, + would uninstall the page client, deleting the QGraphicsWebViewPrivate + instance. If called with an argument, it would do a wrong static_cast + and crash. + + * Api/qwebpage.cpp: + (QWebPageWidgetClient::QWebPageWidgetClient): + (QWebPageWidgetClient::isQWidgetClient): + (QWebPageWidgetClient::screenNumber): + (QWebPage::QWebPage): + (QWebPage::setView): + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::unsetPageIfExists): + (QGraphicsWebView::setPage): + * Api/qwebpage.cpp: + (QWebPageWidgetClient::isQWidgetClient): + (QWebPageWidgetClient::screenNumber): + (QWebPage::QWebPage): + (QWebPage::setView): + * Api/qwebpage.h: + * Api/qwebview.cpp: + (QWebViewPrivate::unsetPageIfExists): + (QWebView::setPage): + +2010-03-24 Kent Tamura <tkent@chromium.org> + + Reviewed by Darin Adler. + + Make Icon::createIconForFiles() optional. + https://bugs.webkit.org/show_bug.cgi?id=35072 + + - Rename iconForFiles() to chooseIconForFiles(). + - Call Icon::createIconForFiles() from chooseIconForFiles(). + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::chooseIconForFiles): + * WebCoreSupport/ChromeClientQt.h: + +2010-03-23 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + QGraphicsWebView crash when calling setView on the QWebPage... + https://bugs.webkit.org/show_bug.cgi?id=36436 + + Checking for pageClient existance before showing popups. + + * WebCoreSupport/QtFallbackWebPopup.cpp: + (WebCore::QtFallbackWebPopup::show): + +2010-03-23 Anders Bakken <anders.bakken@nokia.com>, Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + Check if q->scene() is available before actually using it + on QGraphicsWebViewPrivate. + + QGraphicsWebView crash + https://bugs.webkit.org/show_bug.cgi?id=32670 + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::screenNumber): + (QGraphicsWebViewPrivate::ownerWidget): + +2010-03-23 David Leong <david.leong@nokia.com> + + Reviewed by Laszlo Gombos. + + Build fix for Symbian Def file. + + * symbian/eabi/QtWebKitu.def: + +2010-03-23 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Remove support for Qt v4.4 + https://bugs.webkit.org/show_bug.cgi?id=36389 + + * Api/qwebelement.cpp: + (QWebElement::classes): + * Api/qwebpage.cpp: + (QWebPagePrivate::editorActionForKeyEvent): + (QWebPage::userAgentForUrl): + * WebCoreSupport/EditorClientQt.cpp: + (WebCore::EditorClientQt::handleKeyboardEvent): + * tests/tests.pro: + +2010-03-22 Kent Hansen <kent.hansen@nokia.com> + + Reviewed by Laszlo Gombos. + + [Qt] Fix qdoc warnings + https://bugs.webkit.org/show_bug.cgi?id=36447 + + * Api/qgraphicswebview.cpp: Add missing (). + * Api/qwebframe.cpp: Remove reference to non-existent parameter "url". + * Api/qwebsettings.cpp: Document parameter "location". + +2010-03-22 Jakub Wieczorek <jwieczorek@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] Don't construct a QLineEdit every time when painting a text field + https://bugs.webkit.org/show_bug.cgi?id=36373 + + Add a simple benchmark covering this area. + + * tests/benchmarks/painting/tst_painting.cpp: + (tst_Painting::textAreas): + +2010-03-22 Yi Shen <shenyi2006@gmail.com> + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=35933 + [Qt] [Symbian] Can not backward select (highlight) text using virtual keyboard + Make sure the selection start index is smaller than the selection end index. + + * Api/qwebpage.cpp: + (QWebPagePrivate::inputMethodEvent): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::inputMethods): + +2010-03-21 Kristian Amlie <kristian.amlie@nokia.com> + + Reviewed by Simon Hausmann. + + Fixed updating the VKB display when inputting into QGraphicsWebView. + https://bugs.webkit.org/show_bug.cgi?id=36292 + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::_q_updateMicroFocus): + (QGraphicsWebView::setPage): + * Api/qgraphicswebview.h: + +2010-03-19 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Unreviewed. + + Buildfix for Qt v4.5. + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewOverlay::q): + +2010-03-18 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Darin Adler. + + Make it possible for the Qt DRT to set the media type from + the LayoutTestController. + + * Api/qwebframe.cpp: + (qt_drt_setMediaType): + +2010-03-18 Joe Ligman <joseph.ligman@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] New API scrollRecursively has several problems. + https://bugs.webkit.org/show_bug.cgi?id=35873 + + Remove scrollRecursively from the Qt 4.7 API + Update the internal API to accept a hit test position + for nested scrolling + + * Api/qwebframe.cpp: + (webframe_scrollOverflow): + (qtwebkit_webframe_scrollRecursively): + * Api/qwebframe.h: + * Api/qwebframe_p.h: + * tests/qwebframe/tst_qwebframe.cpp: + +2010-03-18 Antti Koivisto <koivisto@iki.fi> + + Reviewed by Kenneth Rohde Christiansen. + + https://bugs.webkit.org/show_bug.cgi?id=36102 + [Qt] Scaling control API for tiled backing store + + The scale is set by passing the QGraphicsWebView scale to the backing store. The + only new API is the tiledBackingStoreFrozen property which allows disabling + all updates (for example during zoom animation). + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::_q_scaleChanged): + (QGraphicsWebViewPrivate::updateTiledBackingStoreScale): + (QGraphicsWebView::QGraphicsWebView): + (QGraphicsWebView::isTiledBackingStoreFrozen): + (QGraphicsWebView::setTiledBackingStoreFrozen): + * Api/qgraphicswebview.h: + * Api/qwebframe.cpp: + * Api/qwebframe_p.h: + +2010-03-17 Antti Koivisto <koivisto@iki.fi> + + Reviewed by Tor Arne Vestbø. + + Fix Qt build with tiled backing store disabled. + + * Api/qwebframe.cpp: + * Api/qwebframe_p.h: + +2010-03-17 Chang Shu <chang.shu@nokia.com> + + Reviewed by Laszlo Gombos. + + https://bugs.webkit.org/show_bug.cgi?id=36139 + [Qt] Clean up cache while setting cache quota. This behavior matches other platforms, + such as mac and gtk. + + * Api/qwebsettings.cpp: + (QWebSettings::setOfflineWebApplicationCacheQuota): + +2010-03-17 Csaba Osztrogonác <ossy@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Enable accelerated compositing by default + https://bugs.webkit.org/show_bug.cgi?id=35866 + + * Api/qwebsettings.cpp: + (QWebSettings::QWebSettings): + +2010-03-15 Antti Koivisto <koivisto@iki.fi> + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=36121 + [Qt] Make WebKit scrollbars work with tiling + + - Use the scrollbar overlay (implemented for accelerated compositing) when in tiled mode. + - Make overlay compile unconditionally, enable on demand. This removes bunch of unneeded ifdefs. + - Update the scroll position to the backing store as needed. + - Renamed some methods. + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::): + (QGraphicsWebViewPrivate::createOrDeleteOverlay): + (QGraphicsWebViewPrivate::setRootGraphicsLayer): + (QGraphicsWebViewPrivate::updateCompositingScrollPosition): + (QGraphicsWebViewPrivate::scroll): + (QGraphicsWebViewPrivate::update): + (QGraphicsWebViewPrivate::graphicsItemVisibleRect): + (QGraphicsWebView::paint): + (QGraphicsWebView::setPage): + (QGraphicsWebView::updateGeometry): + (QGraphicsWebView::setGeometry): + * Api/qwebframe.cpp: + (QWebFramePrivate::renderFromTiledBackingStore): + * Api/qwebframe_p.h: + +2010-03-15 Robert Hogan <robert@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] Fix crash in QWebView::setPage() + + tst_qwebpage was crashing on setPage(0) + + https://bugs.webkit.org/show_bug.cgi?id=36137 + + * Api/qwebview.cpp: + (QWebView::setPage): + +2010-03-16 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Introduce InspectorFrontendClient that provides InspectorFrontend with an interface to the embedder. InspectorClient now serves as a delegate for InspectorController and does not contain methods for managing inspector frontend window. That allows to create remote InspectorFrontendHost. + + Introduce InspectorFrontendClient that would provide InspectorFrontend with an interface to the embedder + https://bugs.webkit.org/show_bug.cgi?id=35036 + + * Api/qwebinspector.cpp: + (QWebInspector::hideEvent): + (QWebInspector::closeEvent): + * Api/qwebinspector.h: + * Api/qwebpage.h: + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::openInspectorFrontend): + (WebCore::InspectorFrontendClientQt::InspectorFrontendClientQt): + (WebCore::InspectorFrontendClientQt::frontendLoaded): + (WebCore::InspectorFrontendClientQt::localizedStringsURL): + (WebCore::InspectorFrontendClientQt::hiddenPanels): + (WebCore::InspectorFrontendClientQt::bringToFront): + (WebCore::InspectorFrontendClientQt::closeWindow): + (WebCore::InspectorFrontendClientQt::attachWindow): + (WebCore::InspectorFrontendClientQt::detachWindow): + (WebCore::InspectorFrontendClientQt::setAttachedWindowHeight): + (WebCore::InspectorFrontendClientQt::inspectedURLChanged): + (WebCore::InspectorFrontendClientQt::updateWindowTitle): + * WebCoreSupport/InspectorClientQt.h: + +2010-03-15 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Unreviewed. + + [Qt] Build fix if TILED_BACKING_STORE is disabled. + + * Api/qwebframe.cpp: + (QWebFramePrivate::renderContentsLayerAbsoluteCoords): + +2010-03-14 Chang Shu <chang.shu@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] [Symbian] Use Symbian native dialog providers for combo pupups. + https://bugs.webkit.org/show_bug.cgi?id=35919 + + * WebCoreSupport/QtFallbackWebPopup.cpp: + (WebCore::QtFallbackWebPopup::show): + (WebCore::ResetAndDestroy): + (WebCore::QtFallbackWebPopup::showS60BrowserDialog): + * WebCoreSupport/QtFallbackWebPopup.h: + +2010-03-14 Antti Koivisto <koivisto@iki.fi> + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=35146 + Support tiled backing store + + Implements a basic tiled backing store mechanism. Tiles are created and + deleted on demand. The page content is cached to the tiles. Tile content + is kept in sync with the document. Since the backing store covers area + larger than the currently visible viewport, the document can be scrolled + quickly without having to enter rendering tree painting. + + The tile management code is platform independent. This patch has simple QPixmap + based tile implementation for Qt. + + The feature is behind ENABLE_TILED_BACKING_STORE flag. + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::visibleRect): + (QGraphicsWebView::paint): + * Api/qwebframe.cpp: + (QWebFramePrivate::renderContentsLayerAbsoluteCoords): + * Api/qwebframe.h: + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): + * Api/qwebsettings.h: + +2010-03-13 Csaba Osztrogonác <ossy@webkit.org> + + [Qt] Enable accelerated compositing by default + https://bugs.webkit.org/show_bug.cgi?id=35866 + + Unreviewed. Roll-out r55955, because it broke 3 tests: + - animations/fill-mode-transform.html + - animations/play-state.html + - animations/simultaneous-start-left.html + + * Api/qwebsettings.cpp: + (QWebSettings::QWebSettings): + +2010-03-13 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Enable accelerated compositing by default + https://bugs.webkit.org/show_bug.cgi?id=35866 + + * Api/qwebsettings.cpp: + (QWebSettings::QWebSettings): + +2010-03-11 Anders Carlsson <andersca@apple.com> + + Reviewed by David Hyatt. + + Remove invalidateContents, it isn't used and it never makes sense to only invalidate the contents. + + * WebCoreSupport/ChromeClientQt.cpp: + * WebCoreSupport/ChromeClientQt.h: + +2010-03-10 Robert Hogan <robert@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] Add Support for WebKitEnableCaretBrowsing to Qt DRT + + Unskip test fast/events/multiline-link-arrow-navigation.html + Fix typo (superfluous space) in QWebSettings docs. + + https://bugs.webkit.org/show_bug.cgi?id=35593 + + * Api/qwebpage.cpp: + (qt_drt_enableCaretBrowsing): + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): fix typo in docs + +2010-03-02 Adam Treat <atreat@rim.com> + + Reviewed by Dave Hyatt. + + Adapt the qt port to the refactoring of repaint methods. + + https://bugs.webkit.org/show_bug.cgi?id=34214 + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::invalidateContents): + (WebCore::ChromeClientQt::invalidateWindow): + (WebCore::ChromeClientQt::invalidateContentsAndWindow): + (WebCore::ChromeClientQt::invalidateContentsForSlowScroll): + * WebCoreSupport/ChromeClientQt.h: + +2010-03-08 Eric Uhrhane <ericu@chromium.org> + + Reviewed by David Levin. + + Remove the now-redundant Settings fields for the Database + https://bugs.webkit.org/show_bug.cgi?id=35763 + + No new tests; this code isn't called. + + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): Remove the call into Settings. + +2010-03-08 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Laszlo Gombos. + + [Qt] Binary incompatibility between Qt 4.6's WebKit and trunk in QWebSettings + https://bugs.webkit.org/show_bug.cgi?id=35858 + + Moved the enum value added in r54873 to the end of the enum, to preserve + binary compatibility. DnsPrefetchEnabled was in the last release and needs + to remain after LocalContentCanAccessRemoteUrls. + + * Api/qwebsettings.h: + +2010-03-06 Mark Rowe <mrowe@apple.com> + + Rubber-stamped by Sam Weinig. + + Remove unnecessary includes of wtf/Platform.h. This is already pulled in by the prefix header. + + * WebCoreSupport/EditCommandQt.cpp: + +2010-03-02 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Simon Hausmann. + Patch by Antonio Gomes <tonikitoo@webkit.org> + + [Qt] QWebSettings attribute for toggle Spatial Navigation on/off + https://bugs.webkit.org/show_bug.cgi?id=33714 (Qt API part) + + Added 'SpatialNavigationEnabled' attribute to QWebSettings. + + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): + * Api/qwebsettings.h: + +2010-03-04 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] qwebelement.h does not include QtCore headers correctly + https://bugs.webkit.org/show_bug.cgi?id=35748 + + The header files of QtCore must be included as QtCore/foo.h. + + See also http://bugreports.qt.nokia.com/browse/QTBUG-8661 + + * Api/qwebelement.h: + +2010-03-04 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Make the OUTPUT_DIR variable in qmake projects independent of build-webkit's logic. + + This also allows shadow builds relying only on qmake to work properly. + + * tests/benchmarks/loading/loading.pro: + * tests/benchmarks/painting/painting.pro: + * tests/hybridPixmap/hybridPixmap.pro: + * tests/qgraphicswebview/qgraphicswebview.pro: + * tests/qwebelement/qwebelement.pro: + * tests/qwebframe/qwebframe.pro: + * tests/qwebhistory/qwebhistory.pro: + * tests/qwebhistoryinterface/qwebhistoryinterface.pro: + * tests/qwebinspector/qwebinspector.pro: + * tests/qwebpage/qwebpage.pro: + * tests/qwebplugindatabase/qwebplugindatabase.pro: + +2010-03-02 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Fix generation of forwarding headers + + The dependencies were a bit wrong, so we ended up not generating + forwarding headers for qwebkitversion.h and qwebkitglobal.h + + The forwarding headers are now the only targets depending on the + real headers. All other targets either depend on the generated + class headers, or the forwarding headers. + + * Api/DerivedSources.pro: + +2010-03-02 Eric Uhrhane <ericu@chromium.org> + + Reviewed by David Levin. + + Move database enable bit fully out of settings + This is stage one of a three-stage commit [webkit, then chromium, then + webkit again]. In this change I'm adding calls to + Database::setIsAvailable inside Settings::setDatabaseEnabled and + anywhere else that called it, and switching webkit fully over to using + that flag [added in a previous checkin]. Phase two will remove + Chromium's use of Settings for the Database, and phase three will remove + the Setting for the Database enable entirely, leaving only + Database::isAvailable/setIsAvailable. + + No new tests; tested by existing storage tests. + + https://bugs.webkit.org/show_bug.cgi?id=35310 + + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): Add a call to Database::setIsAvailable + +2010-03-02 Simon Hausmann <simon.hausmann@nokia.com> + + Symbian build fix. + + [Qt] Updated the def file with one new export, to fix + QtLauncher linkage. + + * symbian/eabi/QtWebKitu.def: + +2010-03-01 Jakob Petsovits <jpetsovits@rim.com> + + Reviewed by Adam Barth. + + Adapt to the new ZoomMode enum. + https://bugs.webkit.org/show_bug.cgi?id=35347 + + * Api/qwebframe.cpp: + (QWebFrame::setTextSizeMultiplier): + (QWebFrame::setZoomFactor): + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): + +2010-02-26 Diego Gonzalez <diego.gonzalez@openbossa.org> + + Reviewed by Simon Hausmann. + + Fix documentation of QWebSettings::setUserStyleSheetUrl method + + The base 64 data in the exemple shows a not valid code. + + REGRESSION: QWebSettings::setUserStyleSheetUrl is not working with a data URL (Base64) + https://bugs.webkit.org/show_bug.cgi?id=34802 + + * Api/qwebsettings.cpp: + +2010-02-26 Jamey Hicks <jamey.hicks@nokia.com> + + Reviewed by Laszlo Gombos. + + [Qt] added QWebSettings::setInspectorUrl() and QWebSettings::inspectorUrl() + + Enables the use of alternate Web Inspector frontends by changing + the location of the frontend. + + This is required so that the Web Inspector may be run from an + external process or an external tool such as Eclipse or Aptana may + be used instead of the in-process Web Inspector UI. + + https://bugs.webkit.org/show_bug.cgi?id=35340 + + * Api/qwebsettings.cpp: + (QWebSettings::QWebSettings): + (QWebSettings::setInspectorUrl): + (QWebSettings::inspectorUrl): + * Api/qwebsettings.h: + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::createPage): + +2010-02-25 Jarkko Sakkinen <jarkko.sakkinen@tieto.com> + + Reviewed by Kenneth Rohde Christiansen. + + Qt WebGL support + + Adds enabling and disabling of WebGL support to QWebSettings. + https://bugs.webkit.org/show_bug.cgi?id=35153 + + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): + (QWebSettings::QWebSettings): + * Api/qwebsettings.h: + +2010-02-19 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Remove QGVLauncher + + https://bugs.webkit.org/show_bug.cgi?id=35292 + + * QGVLauncher/QGVLauncher.pro: Removed. + * QGVLauncher/main.cpp: Removed. + +2010-02-23 Steve Block <steveblock@google.com> + + Reviewed by Darin Adler. + + Adds ChromeClient::cancelGeolocationPermissionRequestForFrame + https://bugs.webkit.org/show_bug.cgi?id=34962 + + This method is required so that a Geolocation object can cancel an + asynchronous permission request. This allows the chrome client to cancel + any UI it is showing for the permission request. + + * WebCoreSupport/ChromeClientQt.h: + (WebCore::ChromeClientQt::cancelGeolocationPermissionRequestForFrame): + +2010-02-22 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Unreviewed Symbian build fix. + + [Qt] Updated the def file with new exports to enable + building DumpRenderTree. + + * symbian/eabi/QtWebKitu.def: + 2010-02-18 Noam Rosenthal <noam.rosenthal@nokia.com> Reviewed by Kenneth Rohde Christiansen. diff --git a/WebKit/qt/QGVLauncher/QGVLauncher.pro b/WebKit/qt/QGVLauncher/QGVLauncher.pro deleted file mode 100644 index 059ec1a..0000000 --- a/WebKit/qt/QGVLauncher/QGVLauncher.pro +++ /dev/null @@ -1,16 +0,0 @@ -TEMPLATE = app -SOURCES += main.cpp -CONFIG -= app_bundle -CONFIG += uitools -DESTDIR = ../../../bin - -include(../../../WebKit.pri) - -QT += network -macx:QT+=xml -QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR - -symbian { - TARGET.UID3 = 0xA000E544 - TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices -} diff --git a/WebKit/qt/QGVLauncher/main.cpp b/WebKit/qt/QGVLauncher/main.cpp deleted file mode 100644 index 448b4b0..0000000 --- a/WebKit/qt/QGVLauncher/main.cpp +++ /dev/null @@ -1,536 +0,0 @@ -/* - * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) - * Copyright (C) 2006 George Staikos <staikos@kde.org> - * Copyright (C) 2006 Dirk Mueller <mueller@kde.org> - * Copyright (C) 2006 Zack Rusin <zack@kde.org> - * Copyright (C) 2006 Simon Hausmann <hausmann@kde.org> - * Copyright (C) 2009 Kenneth Christiansen <kenneth@webkit.org> - * Copyright (C) 2009 Antonio Gomes <antonio.gomes@openbossa.org> - * Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in> - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <QDebug> -#include <QFile> -#include <QGraphicsScene> -#include <QGraphicsView> -#include <QGraphicsWidget> -#include <QNetworkRequest> -#include <QTextStream> -#include <QVector> -#include <QtGui> -#include <QtNetwork/QNetworkProxy> -#include <cstdio> -#include <qwebelement.h> -#include <qwebframe.h> -#include <qgraphicswebview.h> -#include <qwebpage.h> -#include <qwebsettings.h> -#include <qwebview.h> - -static QUrl urlFromUserInput(const QString& string) -{ - QString input(string); - QFileInfo fi(input); - if (fi.exists() && fi.isRelative()) - input = fi.absoluteFilePath(); - -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - return QUrl::fromUserInput(input); -#else - return QUrl(input); -#endif -} - -class WebView : public QGraphicsWebView { - Q_OBJECT - Q_PROPERTY(qreal yRotation READ yRotation WRITE setYRotation) - -public: - WebView(QGraphicsItem* parent = 0) - : QGraphicsWebView(parent) - { - if (QApplication::instance()->arguments().contains("--cacheWebView")) - setCacheMode(QGraphicsItem::DeviceCoordinateCache); - if (QApplication::instance()->arguments().contains("--resizesToContents")) - setResizesToContents(true); - } - void setYRotation(qreal angle) - { -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - QRectF r = boundingRect(); - setTransform(QTransform() - .translate(r.width() / 2, r.height() / 2) - .rotate(angle, Qt::YAxis) - .translate(-r.width() / 2, -r.height() / 2)); -#endif - m_yRotation = angle; - } - qreal yRotation() const - { - return m_yRotation; - } - -private: - qreal m_yRotation; -}; - -class WebPage : public QWebPage { - Q_OBJECT - -public: - WebPage(QObject* parent = 0) - : QWebPage(parent) - { - applyProxy(); - } - virtual QWebPage* createWindow(QWebPage::WebWindowType); - -private: - void applyProxy() - { - QUrl proxyUrl = urlFromUserInput(qgetenv("http_proxy")); - - if (proxyUrl.isValid() && !proxyUrl.host().isEmpty()) { - int proxyPort = (proxyUrl.port() > 0) ? proxyUrl.port() : 8080; - networkAccessManager()->setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, proxyUrl.host(), proxyPort)); - } - } -}; - -class MainView : public QGraphicsView { - Q_OBJECT - -public: - MainView(QWidget* parent) - : QGraphicsView(parent) - , m_mainWidget(0) - , m_measureFps(QApplication::instance()->arguments().contains("--show-fps")) - , m_numTotalPaints(0) - , m_numPaintsSinceLastMeasure(0) - { - // Use the graphics view scrollbars when the webview is set to size to the content. - if (!QApplication::instance()->arguments().contains("--resizesToContents")) { - setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - } - - setFrameShape(QFrame::NoFrame); - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - if (m_measureFps) { - QTimer* fpsTimer = new QTimer(this); - fpsTimer->setInterval(5000); - m_totalStartTime = m_startTime = QTime::currentTime(); - connect(fpsTimer, SIGNAL(timeout()), this, SLOT(printFps())); - fpsTimer->start(); - } - } - - void setMainWidget(WebView* widget) - { - m_mainWidget = widget; - if (m_mainWidget->resizesToContents()) - return; - QRectF rect(QRect(QPoint(0, 0), size())); - m_mainWidget->setGeometry(rect); - } - - void resizeEvent(QResizeEvent* event) - { - QGraphicsView::resizeEvent(event); - if (!m_mainWidget || m_mainWidget->resizesToContents()) - return; - QRectF rect(QPoint(0, 0), event->size()); - m_mainWidget->setGeometry(rect); - } - - void paintEvent(QPaintEvent* event) - { - QGraphicsView::paintEvent(event); - if (m_measureFps) { - ++m_numPaintsSinceLastMeasure; - ++m_numTotalPaints; - } - } - - void setWaitCursor() - { - m_mainWidget->setCursor(Qt::WaitCursor); - } - - void resetCursor() - { - m_mainWidget->unsetCursor(); - } - -public slots: - void flip() - { -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - QSizeF center = m_mainWidget->boundingRect().size() / 2; - QPointF centerPoint = QPointF(center.width(), center.height()); - m_mainWidget->setTransformOriginPoint(centerPoint); - - m_mainWidget->setRotation(m_mainWidget->rotation() ? 0 : 180); -#endif - } - - void animatedFlip() - { -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - QSizeF center = m_mainWidget->boundingRect().size() / 2; - QPointF centerPoint = QPointF(center.width(), center.height()); - m_mainWidget->setTransformOriginPoint(centerPoint); - - QPropertyAnimation* animation = new QPropertyAnimation(m_mainWidget, "rotation", this); - animation->setDuration(1000); - - int rotation = int(m_mainWidget->rotation()); - - animation->setStartValue(rotation); - animation->setEndValue(rotation + 180 - (rotation % 180)); - - animation->start(QAbstractAnimation::DeleteWhenStopped); -#endif - } - - void animatedYFlip() - { - emit flipRequest(); - } - - void printFps() - { - // note that this might have a bug if you measure right around midnight, but we can live with that - QTime now = QTime::currentTime(); - int msecs = m_startTime.msecsTo(now); - int totalMsecs = m_totalStartTime.msecsTo(now); - int totalFps = totalMsecs ? m_numTotalPaints * 1000 / totalMsecs : 0; - int curFps = msecs ? m_numPaintsSinceLastMeasure * 1000 / msecs : 0; - qDebug("[FPS] From start: %d, from last paint: %d", totalFps, curFps); - m_startTime = now; - m_numPaintsSinceLastMeasure = 0; - } - -signals: - void flipRequest(); - -private: - WebView* m_mainWidget; - bool m_measureFps; - int m_numTotalPaints; - int m_numPaintsSinceLastMeasure; - QTime m_startTime; - QTime m_totalStartTime; -}; - -class SharedScene : public QSharedData { -public: - SharedScene() - { - m_scene = new QGraphicsScene; - m_item = new WebView; - m_item->setPage((m_page = new WebPage)); - - m_scene->addItem(m_item); - m_scene->setActiveWindow(m_item); - } - - ~SharedScene() - { - delete m_item; - delete m_scene; - delete m_page; - } - - QGraphicsScene* scene() const { return m_scene; } - WebView* webView() const { return m_item; } - -private: - QGraphicsScene* m_scene; - WebView* m_item; - WebPage* m_page; -}; - -class MainWindow : public QMainWindow { - Q_OBJECT - -public: - MainWindow(QExplicitlySharedDataPointer<SharedScene> other) - : QMainWindow() - , view(new MainView(this)) - , scene(other) - { - init(); - } - - MainWindow() - : QMainWindow() - , view(new MainView(this)) - , scene(new SharedScene()) - { - init(); - } - - void init() - { - setAttribute(Qt::WA_DeleteOnClose); - - view->setScene(scene->scene()); - const QStringList arguments = QApplication::instance()->arguments(); - const int indexOfViewportUpdateMode = arguments.indexOf("--updateMode"); - if (indexOfViewportUpdateMode > 1 && indexOfViewportUpdateMode < arguments.count() - 1) { - const QString updateMode = arguments[indexOfViewportUpdateMode+1] + "ViewportUpdate"; - view->setViewportUpdateMode(static_cast<QGraphicsView::ViewportUpdateMode>(QGraphicsView::staticMetaObject.enumerator(QGraphicsView::staticMetaObject.indexOfEnumerator("ViewportUpdateMode")).keysToValue(updateMode.toAscii()))); - } - - setCentralWidget(view); - - view->setMainWidget(scene->webView()); - - connect(scene->webView(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool))); - connect(scene->webView(), SIGNAL(titleChanged(const QString&)), this, SLOT(setWindowTitle(const QString&))); - connect(scene->webView()->page(), SIGNAL(windowCloseRequested()), this, SLOT(close())); - -#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - QStateMachine *machine = new QStateMachine(this); - QState *s0 = new QState(machine); - s0->assignProperty(scene->webView(), "yRotation", 0); - - QState *s1 = new QState(machine); - s1->assignProperty(scene->webView(), "yRotation", 90); - - QAbstractTransition *t1 = s0->addTransition(view, SIGNAL(flipRequest()), s1); - QPropertyAnimation *yRotationAnim = new QPropertyAnimation(scene->webView(), "yRotation", this); - yRotationAnim->setDuration(1000); - t1->addAnimation(yRotationAnim); - - QState *s2 = new QState(machine); - s2->assignProperty(scene->webView(), "yRotation", -90); - s1->addTransition(s1, SIGNAL(propertiesAssigned()), s2); - - QAbstractTransition *t2 = s2->addTransition(s0); - t2->addAnimation(yRotationAnim); - - machine->setInitialState(s0); - machine->start(); -#endif - - resize(640, 480); - buildUI(); - } - - void load(const QString& url) - { - QUrl deducedUrl = urlFromUserInput(url); - if (!deducedUrl.isValid()) - deducedUrl = QUrl("http://" + url + "/"); - - loadURL(deducedUrl); - } - - QWebPage* page() const - { - return scene->webView()->page(); - } - -protected slots: - - void openFile() - { - static const QString filter("HTML Files (*.htm *.html);;Text Files (*.txt);;Image Files (*.gif *.jpg *.png);;All Files (*)"); - - QFileDialog fileDialog(this, tr("Open"), QString(), filter); - fileDialog.setAcceptMode(QFileDialog::AcceptOpen); - fileDialog.setFileMode(QFileDialog::ExistingFile); - fileDialog.setOptions(QFileDialog::ReadOnly); - - if (fileDialog.exec()) { - QString selectedFile = fileDialog.selectedFiles()[0]; - if (!selectedFile.isEmpty()) - loadURL(QUrl::fromLocalFile(selectedFile)); - } - } - - void changeLocation() - { - load(urlEdit->text()); - } - - void loadFinished(bool) - { - QUrl url = scene->webView()->url(); - urlEdit->setText(url.toString()); - - QUrl::FormattingOptions opts; - opts |= QUrl::RemoveScheme; - opts |= QUrl::RemoveUserInfo; - opts |= QUrl::StripTrailingSlash; - QString s = url.toString(opts); - s = s.mid(2); - if (s.isEmpty()) - return; - //FIXME: something missing here - } - -public slots: - void newWindow(const QString &url = QString()) - { - MainWindow* mw = new MainWindow(); - mw->load(url); - mw->show(); - } - - void clone() - { - MainWindow* mw = new MainWindow(scene); - mw->show(); - } - - void setWaitCursor() - { - view->setWaitCursor(); - } - - void resetCursor() - { - view->resetCursor(); - } - - void flip() - { - view->flip(); - } - - void animatedFlip() - { - view->animatedFlip(); - } - - void animatedYFlip() - { - view->animatedYFlip(); - } - -private: - - void loadURL(const QUrl& url) - { - if (!url.isValid()) - return; - - urlEdit->setText(url.toString()); - scene->webView()->load(url); - scene->webView()->setFocus(Qt::OtherFocusReason); - } - - void buildUI() - { - QWebPage* page = scene->webView()->page(); - urlEdit = new QLineEdit(this); - urlEdit->setSizePolicy(QSizePolicy::Expanding, urlEdit->sizePolicy().verticalPolicy()); - connect(urlEdit, SIGNAL(returnPressed()), SLOT(changeLocation())); - - QToolBar* bar = addToolBar("Navigation"); - bar->addAction(page->action(QWebPage::Back)); - bar->addAction(page->action(QWebPage::Forward)); - bar->addAction(page->action(QWebPage::Reload)); - bar->addAction(page->action(QWebPage::Stop)); - bar->addWidget(urlEdit); - - QMenu* fileMenu = menuBar()->addMenu("&File"); - fileMenu->addAction("New Window", this, SLOT(newWindow()), QKeySequence::New); - fileMenu->addAction("Open File...", this, SLOT(openFile()), QKeySequence::Open); - fileMenu->addAction("Clone Window", this, SLOT(clone())); - fileMenu->addAction("Close Window", this, SLOT(close()), QKeySequence::Close); - fileMenu->addSeparator(); - fileMenu->addAction("Quit", QApplication::instance(), SLOT(closeAllWindows()), QKeySequence(Qt::CTRL | Qt::Key_Q)); - - QMenu* viewMenu = menuBar()->addMenu("&View"); - viewMenu->addAction(page->action(QWebPage::Stop)); - viewMenu->addAction(page->action(QWebPage::Reload)); - - QMenu* testMenu = menuBar()->addMenu("&Tests"); - testMenu->addAction("Set Wait Cursor", this, SLOT(setWaitCursor()), QKeySequence("Ctrl+W")); - testMenu->addAction("Reset Cursor", this, SLOT(resetCursor()), QKeySequence("Ctrl+Shift+W")); - - QMenu* fxMenu = menuBar()->addMenu("&Effects"); - fxMenu->addAction("Flip", this, SLOT(flip())); - fxMenu->addAction("Animated Flip", this, SLOT(animatedFlip()), QKeySequence("Ctrl+R")); - fxMenu->addAction("Animated Y-Flip", this, SLOT(animatedYFlip()), QKeySequence("Ctrl+Y")); - } - -private: - MainView* view; - QExplicitlySharedDataPointer<SharedScene> scene; - - QLineEdit* urlEdit; -}; - -QWebPage* WebPage::createWindow(QWebPage::WebWindowType) -{ - MainWindow* mw = new MainWindow; - mw->show(); - return mw->page(); -} - -int main(int argc, char** argv) -{ - QApplication app(argc, argv); - if (app.arguments().contains("--help")) { - qDebug() << "Usage: QGVLauncher [--url url] [--compositing] [--updateMode Full|Minimal|Smart|No|BoundingRect] [--cacheWebView] [--resizesToContents]\n"; - return 0; - } - QString url = QString("file://%1/%2").arg(QDir::homePath()).arg(QLatin1String("index.html")); - - app.setApplicationName("GQVLauncher"); - - QWebSettings::setObjectCacheCapacities((16 * 1024 * 1024) / 8, (16 * 1024 * 1024) / 8, 16 * 1024 * 1024); - QWebSettings::setMaximumPagesInCache(4); - QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true); - QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); - QWebSettings::enablePersistentStorage(); - - const QStringList args = app.arguments(); - const int indexOfUrl = args.indexOf("--url"); - if (indexOfUrl > 0 && indexOfUrl < args.count() - 1) - url = args.at(indexOfUrl+1); - else if (args.count() > 1) - url = args.at(1); - if (args.contains("--compositing")) - QWebSettings::globalSettings()->setAttribute(QWebSettings::AcceleratedCompositingEnabled, true); - - MainWindow* window = new MainWindow; - window->load(url); - - for (int i = 2; i < args.count(); ++i) - if (!args.at(i).startsWith("-") && !args.at(i - 1).startsWith("-")) - window->newWindow(args.at(i)); - - window->show(); - return app.exec(); -} - -#include "main.moc" diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index ecbabe4..5ea072d 100644 --- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -36,10 +36,17 @@ #include "FrameLoaderClientQt.h" #include "FrameView.h" #include "HitTestResult.h" +#include "Icon.h" +#include "NotificationPresenterClientQt.h" #include "NotImplemented.h" +#include "ScrollbarTheme.h" #include "WindowFeatures.h" #include "DatabaseTracker.h" +#if defined(Q_WS_MAEMO_5) +#include "QtMaemoWebPopup.h" +#else #include "QtFallbackWebPopup.h" +#endif #include "QWebPageClient.h" #include "SecurityOrigin.h" @@ -91,7 +98,7 @@ FloatRect ChromeClientQt::windowRect() QWidget* view = m_webPage->view(); if (!view) return FloatRect(); - return IntRect(view->topLevelWidget()->geometry()); + return IntRect(view->window()->geometry()); } @@ -159,7 +166,9 @@ Page* ChromeClientQt::createWindow(Frame*, const FrameLoadRequest& request, cons QWebPage *newPage = m_webPage->createWindow(features.dialog ? QWebPage::WebModalDialog : QWebPage::WebBrowserWindow); if (!newPage) return 0; - newPage->mainFrame()->load(request.resourceRequest().url()); + + if (!request.isEmpty()) + newPage->mainFrame()->load(request.resourceRequest().url()); return newPage->d->page; } @@ -170,7 +179,7 @@ void ChromeClientQt::show() QWidget* view = m_webPage->view(); if (!view) return; - view->topLevelWidget()->show(); + view->window()->show(); } @@ -324,26 +333,66 @@ bool ChromeClientQt::tabsToLinks() const IntRect ChromeClientQt::windowResizerRect() const { +#if defined(Q_WS_MAC) + if (!m_webPage) + return IntRect(); + + QWebPageClient* pageClient = platformPageClient(); + if (!pageClient) + return IntRect(); + + QWidget* ownerWidget = pageClient->ownerWidget(); + if (!ownerWidget) + return IntRect(); + + QWidget* topLevelWidget = ownerWidget->window(); + QRect topLevelGeometry(topLevelWidget->geometry()); + + // There's no API in Qt to query for the size of the resizer, so we assume + // it has the same width and height as the scrollbar thickness. + int scollbarThickness = ScrollbarTheme::nativeTheme()->scrollbarThickness(); + + // There's no API in Qt to query for the position of the resizer. Sometimes + // it's drawn by the system, and sometimes it's a QSizeGrip. For RTL locales + // it might even be on the lower left side of the window, but in WebKit we + // always draw scrollbars on the right hand side, so we assume this to be the + // location when computing the resize rect to reserve for WebKit. + QPoint resizeCornerTopLeft = ownerWidget->mapFrom(topLevelWidget, + QPoint(topLevelGeometry.width(), topLevelGeometry.height()) + - QPoint(scollbarThickness, scollbarThickness)); + + QRect resizeCornerRect = QRect(resizeCornerTopLeft, QSize(scollbarThickness, scollbarThickness)); + return resizeCornerRect.intersected(pageClient->geometryRelativeToOwnerWidget()); +#else return IntRect(); +#endif } -void ChromeClientQt::repaint(const IntRect& windowRect, bool contentChanged, bool, bool) +void ChromeClientQt::invalidateWindow(const IntRect&, bool) +{ + notImplemented(); +} + +void ChromeClientQt::invalidateContentsAndWindow(const IntRect& windowRect, bool immediate) { // No double buffer, so only update the QWidget if content changed. - if (contentChanged) { - if (platformPageClient()) { - QRect rect(windowRect); - rect = rect.intersected(QRect(QPoint(0, 0), m_webPage->viewportSize())); - if (!rect.isEmpty()) - platformPageClient()->update(rect); - } - emit m_webPage->repaintRequested(windowRect); + if (platformPageClient()) { + QRect rect(windowRect); + rect = rect.intersected(QRect(QPoint(0, 0), m_webPage->viewportSize())); + if (!rect.isEmpty()) + platformPageClient()->update(rect); } + emit m_webPage->repaintRequested(windowRect); // FIXME: There is no "immediate" support for window painting. This should be done always whenever the flag // is set. } +void ChromeClientQt::invalidateContentsForSlowScroll(const IntRect& windowRect, bool immediate) +{ + invalidateContentsAndWindow(windowRect, immediate); +} + void ChromeClientQt::scroll(const IntSize& delta, const IntRect& scrollViewRect, const IntRect&) { if (platformPageClient()) @@ -431,6 +480,13 @@ void ChromeClientQt::reachedMaxAppCacheSize(int64_t) } #endif +#if ENABLE(NOTIFICATIONS) +NotificationPresenter* ChromeClientQt::notificationPresenter() const +{ + return m_webPage->d->notificationPresenterClient; +} +#endif + void ChromeClientQt::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> prpFileChooser) { RefPtr<FileChooser> fileChooser = prpFileChooser; @@ -463,10 +519,9 @@ void ChromeClientQt::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> prpFileC } } -void ChromeClientQt::iconForFiles(const Vector<String>&, PassRefPtr<FileChooser>) +void ChromeClientQt::chooseIconForFiles(const Vector<String>& filenames, FileChooser* chooser) { - // FIXME: Move the code of Icon::createIconForFiles() here. - notImplemented(); + chooser->iconLoaded(Icon::createIconForFiles(filenames)); } bool ChromeClientQt::setCursor(PlatformCursorHandle) @@ -501,11 +556,48 @@ void ChromeClientQt::scheduleCompositingLayerSync() if (platformPageClient()) platformPageClient()->markForSync(true); } + +bool ChromeClientQt::allowsAcceleratedCompositing() const +{ + return (platformPageClient() && platformPageClient()->allowsAcceleratedCompositing()); +} + #endif QtAbstractWebPopup* ChromeClientQt::createSelectPopup() { +#if defined(Q_WS_MAEMO_5) + return new QtMaemoWebPopup; +#else return new QtFallbackWebPopup; +#endif +} + +#if ENABLE(WIDGETS_10_SUPPORT) +bool ChromeClientQt::isWindowed() +{ + return m_webPage->d->viewMode == "windowed"; +} + +bool ChromeClientQt::isFloating() +{ + return m_webPage->d->viewMode == "floating"; } +bool ChromeClientQt::isFullscreen() +{ + return m_webPage->d->viewMode == "fullscreen"; +} + +bool ChromeClientQt::isMaximized() +{ + return m_webPage->d->viewMode == "maximized"; +} + +bool ChromeClientQt::isMinimized() +{ + return m_webPage->d->viewMode == "minimized"; +} +#endif + } diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/WebKit/qt/WebCoreSupport/ChromeClientQt.h index 3d5cbe9..a4575e2 100644 --- a/WebKit/qt/WebCoreSupport/ChromeClientQt.h +++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.h @@ -34,7 +34,10 @@ #include "KURL.h" #include "PlatformString.h" +QT_BEGIN_NAMESPACE class QEventLoop; +QT_END_NAMESPACE + class QWebPage; namespace WebCore { @@ -105,8 +108,11 @@ namespace WebCore { virtual bool tabsToLinks() const; virtual IntRect windowResizerRect() const; - virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false, bool repaintContentOnly = false); + virtual void invalidateWindow(const IntRect&, bool); + virtual void invalidateContentsAndWindow(const IntRect&, bool); + virtual void invalidateContentsForSlowScroll(const IntRect&, bool); virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); + virtual IntPoint screenToWindow(const IntPoint&) const; virtual IntRect windowToScreen(const IntRect&) const; virtual PlatformPageClient platformPageClient() const; @@ -125,12 +131,17 @@ namespace WebCore { virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); #endif +#if ENABLE(NOTIFICATIONS) + virtual NotificationPresenter* notificationPresenter() const; +#endif + #if USE(ACCELERATED_COMPOSITING) // see ChromeClient.h // this is a hook for WebCore to tell us what we need to do with the GraphicsLayers virtual void attachRootGraphicsLayer(Frame*, GraphicsLayer*); virtual void setNeedsOneShotDrawingSynchronization(); virtual void scheduleCompositingLayerSync(); + virtual bool allowsAcceleratedCompositing() const; #endif #if ENABLE(TOUCH_EVENTS) @@ -138,7 +149,7 @@ namespace WebCore { #endif virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>); - virtual void iconForFiles(const Vector<String>&, PassRefPtr<FileChooser>); + virtual void chooseIconForFiles(const Vector<String>&, FileChooser*); virtual void formStateDidChange(const Node*) { } @@ -149,6 +160,15 @@ namespace WebCore { virtual void scrollRectIntoView(const IntRect&, const ScrollView*) const {} virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*); + virtual void cancelGeolocationPermissionRequestForFrame(Frame*, Geolocation*) { } + +#if ENABLE(WIDGETS_10_SUPPORT) + virtual bool isWindowed(); + virtual bool isFloating(); + virtual bool isFullscreen(); + virtual bool isMaximized(); + virtual bool isMinimized(); +#endif QtAbstractWebPopup* createSelectPopup(); diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp new file mode 100644 index 0000000..3f2e221 --- /dev/null +++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -0,0 +1,372 @@ +/* + Copyright (C) 2010 Robert Hogan <robert@roberthogan.net> + Copyright (C) 2008,2009,2010 Nokia Corporation and/or its subsidiary(-ies) + Copyright (C) 2007 Staikos Computing Services Inc. + Copyright (C) 2007 Apple Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" +#include "DumpRenderTreeSupportQt.h" + +#include "ContextMenu.h" +#include "ContextMenuClientQt.h" +#include "ContextMenuController.h" +#include "Editor.h" +#include "Element.h" +#include "FocusController.h" +#include "Frame.h" +#include "FrameView.h" +#include "GCController.h" +#include "InspectorController.h" +#include "Page.h" +#include "PageGroup.h" +#include "PluginDatabase.h" +#include "PrintContext.h" +#include "RenderListItem.h" +#include "RenderTreeAsText.h" +#include "SecurityOrigin.h" +#include "Settings.h" +#if ENABLE(SVG) +#include "SVGSMILElement.h" +#endif +#include "WorkerThread.h" + +#include "qwebframe.h" +#include "qwebframe_p.h" +#include "qwebpage.h" +#include "qwebpage_p.h" + +using namespace WebCore; + +DumpRenderTreeSupportQt::DumpRenderTreeSupportQt() +{ +} + +DumpRenderTreeSupportQt::~DumpRenderTreeSupportQt() +{ +} + +void DumpRenderTreeSupportQt::overwritePluginDirectories() +{ + PluginDatabase* db = PluginDatabase::installedPlugins(/* populate */ false); + + Vector<String> paths; + String qtPath(qgetenv("QTWEBKIT_PLUGIN_PATH").data()); + qtPath.split(UChar(':'), /* allowEmptyEntries */ false, paths); + + db->setPluginDirectories(paths); + db->refresh(); +} + +int DumpRenderTreeSupportQt::workerThreadCount() +{ +#if ENABLE(WORKERS) + return WebCore::WorkerThread::workerThreadCount(); +#else + return 0; +#endif +} + +void DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(bool b) +{ + QWebPagePrivate::drtRun = b; +} + +void DumpRenderTreeSupportQt::setFrameFlatteningEnabled(QWebPage* page, bool enabled) +{ + QWebPagePrivate::core(page)->settings()->setFrameFlatteningEnabled(enabled); +} + +void DumpRenderTreeSupportQt::webPageSetGroupName(QWebPage* page, const QString& groupName) +{ + page->handle()->page->setGroupName(groupName); +} + +QString DumpRenderTreeSupportQt::webPageGroupName(QWebPage* page) +{ + return page->handle()->page->groupName(); +} + +#if ENABLE(INSPECTOR) +void DumpRenderTreeSupportQt::webInspectorExecuteScript(QWebPage* page, long callId, const QString& script) +{ + if (!page->handle()->page->inspectorController()) + return; + page->handle()->page->inspectorController()->evaluateForTestInFrontend(callId, script); +} + +void DumpRenderTreeSupportQt::webInspectorClose(QWebPage* page) +{ + if (!page->handle()->page->inspectorController()) + return; + page->handle()->page->inspectorController()->close(); +} + +void DumpRenderTreeSupportQt::webInspectorShow(QWebPage* page) +{ + if (!page->handle()->page->inspectorController()) + return; + page->handle()->page->inspectorController()->show(); +} + +void DumpRenderTreeSupportQt::setTimelineProfilingEnabled(QWebPage* page, bool enabled) +{ + InspectorController* controller = page->handle()->page->inspectorController(); + if (!controller) + return; + if (enabled) + controller->startTimelineProfiler(); + else + controller->stopTimelineProfiler(); +} + +#endif + +bool DumpRenderTreeSupportQt::hasDocumentElement(QWebFrame* frame) +{ + return QWebFramePrivate::core(frame)->document()->documentElement(); +} + +void DumpRenderTreeSupportQt::setJavaScriptProfilingEnabled(QWebFrame* frame, bool enabled) +{ +#if ENABLE(JAVASCRIPT_DEBUGGER) + Frame* coreFrame = QWebFramePrivate::core(frame); + InspectorController* controller = coreFrame->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 DumpRenderTreeSupportQt::pauseAnimation(QWebFrame *frame, const QString &animationName, double time, const QString &elementId) +{ + Frame* coreFrame = QWebFramePrivate::core(frame); + if (!coreFrame) + return false; + + AnimationController* controller = coreFrame->animation(); + if (!controller) + return false; + + Document* doc = coreFrame->document(); + Q_ASSERT(doc); + + Node* coreNode = doc->getElementById(elementId); + if (!coreNode || !coreNode->renderer()) + return false; + + return controller->pauseAnimationAtTime(coreNode->renderer(), animationName, time); +} + +bool DumpRenderTreeSupportQt::pauseTransitionOfProperty(QWebFrame *frame, const QString &propertyName, double time, const QString &elementId) +{ + Frame* coreFrame = QWebFramePrivate::core(frame); + if (!coreFrame) + return false; + + AnimationController* controller = coreFrame->animation(); + if (!controller) + return false; + + Document* doc = coreFrame->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 DumpRenderTreeSupportQt::pauseSVGAnimation(QWebFrame *frame, const QString &animationId, double time, const QString &elementId) +{ +#if !ENABLE(SVG) + return false; +#else + Frame* coreFrame = QWebFramePrivate::core(frame); + if (!coreFrame) + return false; + + Document* doc = coreFrame->document(); + Q_ASSERT(doc); + + if (!doc->svgExtensions()) + return false; + + Node* coreNode = doc->getElementById(animationId); + if (!coreNode || !SVGSMILElement::isSMILElement(coreNode)) + return false; + + return doc->accessSVGExtensions()->sampleAnimationAtTime(elementId, static_cast<SVGSMILElement*>(coreNode), time); +#endif +} + +// Returns the total number of currently running animations (includes both CSS transitions and CSS animations). +int DumpRenderTreeSupportQt::numberOfActiveAnimations(QWebFrame *frame) +{ + Frame* coreFrame = QWebFramePrivate::core(frame); + if (!coreFrame) + return false; + + AnimationController* controller = coreFrame->animation(); + if (!controller) + return false; + + return controller->numberOfActiveAnimations(); +} + +void DumpRenderTreeSupportQt::clearFrameName(QWebFrame* frame) +{ + Frame* coreFrame = QWebFramePrivate::core(frame); + coreFrame->tree()->clearName(); +} + +int DumpRenderTreeSupportQt::javaScriptObjectsCount() +{ + return JSDOMWindowBase::commonJSGlobalData()->heap.globalObjectCount(); +} + +void DumpRenderTreeSupportQt::garbageCollectorCollect() +{ + gcController().garbageCollectNow(); +} + +void DumpRenderTreeSupportQt::garbageCollectorCollectOnAlternateThread(bool waitUntilDone) +{ + gcController().garbageCollectOnAlternateThreadForDebugging(waitUntilDone); +} + +// Returns the value of counter in the element specified by \a id. +QString DumpRenderTreeSupportQt::counterValueForElementById(QWebFrame* frame, const QString& id) +{ + Frame* coreFrame = QWebFramePrivate::core(frame); + if (Document* document = coreFrame->document()) { + Element* element = document->getElementById(id); + return WebCore::counterValueForElement(element); + } + return QString(); +} + +int DumpRenderTreeSupportQt::pageNumberForElementById(QWebFrame* frame, const QString& id, float width, float height) +{ + Frame* coreFrame = QWebFramePrivate::core(frame); + if (!coreFrame) + return -1; + + Element* element = coreFrame->document()->getElementById(AtomicString(id)); + if (!element) + return -1; + + return PrintContext::pageNumberForElement(element, FloatSize(width, height)); +} + +int DumpRenderTreeSupportQt::numberOfPages(QWebFrame* frame, float width, float height) +{ + Frame* coreFrame = QWebFramePrivate::core(frame); + if (!coreFrame) + return -1; + + return PrintContext::numberOfPages(coreFrame, FloatSize(width, height)); +} + +// Suspend active DOM objects in this frame. +void DumpRenderTreeSupportQt::suspendActiveDOMObjects(QWebFrame* frame) +{ + Frame* coreFrame = QWebFramePrivate::core(frame); + if (coreFrame->document()) + coreFrame->document()->suspendActiveDOMObjects(); +} + +// Resume active DOM objects in this frame. +void DumpRenderTreeSupportQt::resumeActiveDOMObjects(QWebFrame* frame) +{ + Frame* coreFrame = QWebFramePrivate::core(frame); + if (coreFrame->document()) + coreFrame->document()->resumeActiveDOMObjects(); +} + +void DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(QWebFrame* frame, int worldId, const QString& script) +{ + Frame* coreFrame = QWebFramePrivate::core(frame); + if (coreFrame) + JSC::JSValue result = coreFrame->script()->executeScriptInWorld(mainThreadNormalWorld(), script, true).jsValue(); +} + +void DumpRenderTreeSupportQt::whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains) +{ + SecurityOrigin::addOriginAccessWhitelistEntry(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains); +} + +void DumpRenderTreeSupportQt::resetOriginAccessWhiteLists() +{ + SecurityOrigin::resetOriginAccessWhitelists(); +} + +void DumpRenderTreeSupportQt::setDomainRelaxationForbiddenForURLScheme(bool forbidden, const QString& scheme) +{ + SecurityOrigin::setDomainRelaxationForbiddenForURLScheme(forbidden, scheme); +} + +void DumpRenderTreeSupportQt::setCaretBrowsingEnabled(QWebPage* page, bool value) +{ + page->handle()->page->settings()->setCaretBrowsingEnabled(value); +} + +void DumpRenderTreeSupportQt::setMediaType(QWebFrame* frame, const QString& type) +{ + WebCore::Frame* coreFrame = QWebFramePrivate::core(frame); + WebCore::FrameView* view = coreFrame->view(); + view->setMediaType(type); + coreFrame->document()->updateStyleSelector(); + view->forceLayout(); +} + +void DumpRenderTreeSupportQt::setSmartInsertDeleteEnabled(QWebPage* page, bool enabled) +{ + page->d->smartInsertDeleteEnabled = enabled; +} + + +void DumpRenderTreeSupportQt::setSelectTrailingWhitespaceEnabled(QWebPage* page, bool enabled) +{ + page->d->selectTrailingWhitespaceEnabled = enabled; +} + + +void DumpRenderTreeSupportQt::executeCoreCommandByName(QWebPage* page, const QString& name, const QString& value) +{ + page->handle()->page->focusController()->focusedOrMainFrame()->editor()->command(name).execute(value); +} + +bool DumpRenderTreeSupportQt::isCommandEnabled(QWebPage* page, const QString& name) +{ + return page->handle()->page->focusController()->focusedOrMainFrame()->editor()->command(name).isEnabled(); +} + +QString DumpRenderTreeSupportQt::markerTextForListItem(const QWebElement& listItem) +{ + return WebCore::markerTextForListItem(listItem.m_element); +} diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h new file mode 100644 index 0000000..b92b86a --- /dev/null +++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h @@ -0,0 +1,87 @@ +/* + Copyright (C) 2010 Robert Hogan <robert@roberthogan.net> + Copyright (C) 2008,2009,2010 Nokia Corporation and/or its subsidiary(-ies) + Copyright (C) 2007 Staikos Computing Services Inc. + Copyright (C) 2007 Apple Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef DumpRenderTreeSupportQt_h +#define DumpRenderTreeSupportQt_h + +#include "qwebkitglobal.h" + +#include "qwebelement.h" + +class QWebPage; +class QWebFrame; + +class QWEBKIT_EXPORT DumpRenderTreeSupportQt { + +public: + + DumpRenderTreeSupportQt(); + ~DumpRenderTreeSupportQt(); + + + static void executeCoreCommandByName(QWebPage* page, const QString& name, const QString& value); + static bool isCommandEnabled(QWebPage* page, const QString& name); + static void setSmartInsertDeleteEnabled(QWebPage* page, bool enabled); + static void setSelectTrailingWhitespaceEnabled(QWebPage* page, bool enabled); + + static bool pauseAnimation(QWebFrame*, const QString& name, double time, const QString& elementId); + static bool pauseTransitionOfProperty(QWebFrame*, const QString& name, double time, const QString& elementId); + static bool pauseSVGAnimation(QWebFrame*, const QString& animationId, double time, const QString& elementId); + static void suspendActiveDOMObjects(QWebFrame* frame); + static void resumeActiveDOMObjects(QWebFrame* frame); + + static void setDomainRelaxationForbiddenForURLScheme(bool forbidden, const QString& scheme); + static void setFrameFlatteningEnabled(QWebPage*, bool); + static void setCaretBrowsingEnabled(QWebPage* page, bool value); + static void setMediaType(QWebFrame* qframe, const QString& type); + static void setDumpRenderTreeModeEnabled(bool b); + + static void evaluateScriptInIsolatedWorld(QWebFrame* frame, int worldId, const QString& script); + static void garbageCollectorCollect(); + static void garbageCollectorCollectOnAlternateThread(bool waitUntilDone); + static void setJavaScriptProfilingEnabled(QWebFrame*, bool enabled); + static int javaScriptObjectsCount(); + + static void setTimelineProfilingEnabled(QWebPage*, bool enabled); + static void webInspectorExecuteScript(QWebPage* page, long callId, const QString& script); + static void webInspectorShow(QWebPage* page); + static void webInspectorClose(QWebPage* page); + + static QString webPageGroupName(QWebPage *page); + static QString counterValueForElementById(QWebFrame* frame, const QString& id); + static void webPageSetGroupName(QWebPage* page, const QString& groupName); + static void clearFrameName(QWebFrame* frame); + static void overwritePluginDirectories(); + static int numberOfActiveAnimations(QWebFrame*); + static int numberOfPages(QWebFrame* frame, float width, float height); + static int pageNumberForElementById(QWebFrame* frame, const QString& id, float width, float height); + static bool hasDocumentElement(QWebFrame* frame); + + static void whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains); + static void resetOriginAccessWhiteLists(); + + static int workerThreadCount(); + + static QString markerTextForListItem(const QWebElement& listItem); +}; + +#endif diff --git a/WebKit/qt/WebCoreSupport/EditCommandQt.cpp b/WebKit/qt/WebCoreSupport/EditCommandQt.cpp index a166840..756ba4c 100644 --- a/WebKit/qt/WebCoreSupport/EditCommandQt.cpp +++ b/WebKit/qt/WebCoreSupport/EditCommandQt.cpp @@ -18,7 +18,6 @@ */ #include "config.h" -#include <wtf/Platform.h> #include "EditCommandQt.h" using namespace WebCore; diff --git a/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp index 90ebb1d..8a0aa08 100644 --- a/WebKit/qt/WebCoreSupport/EditorClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp @@ -43,7 +43,6 @@ #include "HTMLElement.h" #include "HTMLInputElement.h" #include "HTMLNames.h" -#include "KeyboardCodes.h" #include "KeyboardEvent.h" #include "NotImplemented.h" #include "Page.h" @@ -51,6 +50,7 @@ #include "PlatformKeyboardEvent.h" #include "QWebPageClient.h" #include "Range.h" +#include "WindowsKeyboardCodes.h" #include <stdio.h> @@ -333,14 +333,18 @@ void EditorClientQt::pageDestroyed() bool EditorClientQt::smartInsertDeleteEnabled() { - notImplemented(); - return false; + return m_page->d->smartInsertDeleteEnabled; +} + +void EditorClientQt::toggleSmartInsertDelete() +{ + bool current = m_page->d->smartInsertDeleteEnabled; + m_page->d->smartInsertDeleteEnabled = !current; } bool EditorClientQt::isSelectTrailingWhitespaceEnabled() { - notImplemented(); - return false; + return m_page->d->selectTrailingWhitespaceEnabled; } void EditorClientQt::toggleContinuousSpellChecking() @@ -384,18 +388,6 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event) } else #endif // QT_NO_SHORTCUT switch (kevent->windowsVirtualKeyCode()) { -#if QT_VERSION < 0x040500 - case VK_RETURN: -#ifdef QT_WS_MAC - if (kevent->shiftKey() || kevent->metaKey()) -#else - if (kevent->shiftKey()) -#endif - frame->editor()->command("InsertLineBreak").execute(); - else - frame->editor()->command("InsertNewline").execute(); - break; -#endif case VK_BACK: frame->editor()->deleteWithDirection(SelectionController::BACKWARD, CharacterGranularity, false, true); @@ -625,11 +617,11 @@ void EditorClientQt::setInputMethodState(bool active) } } webPageClient->setInputMethodHint(Qt::ImhHiddenText, isPasswordField); -#ifdef Q_WS_MAEMO_5 - // Maemo 5 MicroB Browser disables auto-uppercase and predictive text, thus, so do we. +#if defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN) + // disables auto-uppercase and predictive text for mobile devices webPageClient->setInputMethodHint(Qt::ImhNoAutoUppercase, true); webPageClient->setInputMethodHint(Qt::ImhNoPredictiveText, true); -#endif // Q_WS_MAEMO_5 +#endif // Q_WS_MAEMO_5 || Q_OS_SYMBIAN #endif // QT_VERSION check webPageClient->setInputMethodEnabled(active); } diff --git a/WebKit/qt/WebCoreSupport/EditorClientQt.h b/WebKit/qt/WebCoreSupport/EditorClientQt.h index 42a402f..6c20898 100644 --- a/WebKit/qt/WebCoreSupport/EditorClientQt.h +++ b/WebKit/qt/WebCoreSupport/EditorClientQt.h @@ -48,13 +48,13 @@ public: virtual bool shouldDeleteRange(Range*); virtual bool shouldShowDeleteInterface(HTMLElement*); virtual bool smartInsertDeleteEnabled(); + virtual void toggleSmartInsertDelete(); virtual bool isSelectTrailingWhitespaceEnabled(); virtual bool isContinuousSpellCheckingEnabled(); virtual void toggleContinuousSpellChecking(); virtual bool isGrammarCheckingEnabled(); virtual void toggleGrammarChecking(); virtual int spellCheckerDocumentTag(); - virtual bool selectWordBeforeMenuEvent(); virtual bool isEditable(); diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 2eb2761..f93b1cc 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -50,6 +50,7 @@ #include "HTMLAppletElement.h" #include "HTMLFormElement.h" #include "HTMLPlugInElement.h" +#include "HTTPParsers.h" #include "NotImplemented.h" #include "QNetworkReplyHandler.h" #include "ResourceHandleInternal.h" @@ -74,10 +75,14 @@ #include <QGraphicsWidget> #include <QNetworkRequest> #include <QNetworkReply> +#include <QStringList> #include "qwebhistory_p.h" static bool dumpFrameLoaderCallbacks = false; static bool dumpResourceLoadCallbacks = false; +static bool sendRequestReturnsNullOnRedirect = false; +static bool sendRequestReturnsNull = false; +static QStringList sendRequestClearHeaders; static QMap<unsigned long, QString> dumpAssignedUrls; @@ -91,6 +96,21 @@ void QWEBKIT_EXPORT qt_dump_resource_load_callbacks(bool b) dumpResourceLoadCallbacks = b; } +void QWEBKIT_EXPORT qt_set_will_send_request_returns_null_on_redirect(bool b) +{ + sendRequestReturnsNullOnRedirect = b; +} + +void QWEBKIT_EXPORT qt_set_will_send_request_returns_null(bool b) +{ + sendRequestReturnsNull = b; +} + +void QWEBKIT_EXPORT qt_set_will_send_request_clear_headers(const QStringList& headers) +{ + sendRequestClearHeaders = headers; +} + // Compare with WebKitTools/DumpRenderTree/mac/FrameLoadDelegate.mm static QString drtDescriptionSuitableForTestResult(WebCore::Frame* _frame) { @@ -124,16 +144,16 @@ static QString drtDescriptionSuitableForTestResult(const WebCore::ResourceError& static QString drtDescriptionSuitableForTestResult(const WebCore::ResourceRequest& request) { QString url = request.url().string(); - return QString::fromLatin1("<NSURLRequest %1>").arg(url); + QString httpMethod = request.httpMethod(); + QString mainDocumentUrl = request.firstPartyForCookies().string(); + return QString::fromLatin1("<NSURLRequest URL %1, main document URL %2, http method %3>").arg(url).arg(mainDocumentUrl).arg(httpMethod); } static QString drtDescriptionSuitableForTestResult(const WebCore::ResourceResponse& response) { - QString text = response.httpStatusText(); - if (text.isEmpty()) - return QLatin1String("(null)"); - - return text; + QString url = response.url().string(); + int httpStatusCode = response.httpStatusCode(); + return QString::fromLatin1("<NSURLResponse %1, http status code %2>").arg(url).arg(httpStatusCode); } @@ -214,12 +234,17 @@ void FrameLoaderClientQt::transitionToCommittedForNewPage() QWebPage* page = m_webFrame->page(); const QSize preferredLayoutSize = page->preferredContentsSize(); + ScrollbarMode hScrollbar = (ScrollbarMode) m_webFrame->scrollBarPolicy(Qt::Horizontal); + ScrollbarMode vScrollbar = (ScrollbarMode) m_webFrame->scrollBarPolicy(Qt::Vertical); + bool hLock = hScrollbar != ScrollbarAuto; + bool vLock = vScrollbar != ScrollbarAuto; + m_frame->createView(m_webFrame->page()->viewportSize(), backgroundColor, !backgroundColor.alpha(), preferredLayoutSize.isValid() ? IntSize(preferredLayoutSize) : IntSize(), preferredLayoutSize.isValid(), - (ScrollbarMode)m_webFrame->scrollBarPolicy(Qt::Horizontal), - (ScrollbarMode)m_webFrame->scrollBarPolicy(Qt::Vertical)); + hScrollbar, hLock, + vScrollbar, vLock); } @@ -511,12 +536,13 @@ void FrameLoaderClientQt::finishedLoading(DocumentLoader* loader) if (!m_pluginView) { if(m_firstData) { FrameLoader *fl = loader->frameLoader(); - fl->setEncoding(m_response.textEncodingName(), false); + fl->writer()->setEncoding(m_response.textEncodingName(), false); m_firstData = false; } } else { - m_pluginView->didFinishLoading(); + if (m_pluginView->isPluginView()) + m_pluginView->didFinishLoading(); m_pluginView = 0; m_hasSentResponseToPlugin = false; } @@ -701,11 +727,12 @@ void FrameLoaderClientQt::setMainDocumentError(WebCore::DocumentLoader* loader, { if (!m_pluginView) { if (m_firstData) { - loader->frameLoader()->setEncoding(m_response.textEncodingName(), false); + loader->frameLoader()->writer()->setEncoding(m_response.textEncodingName(), false); m_firstData = false; } } else { - m_pluginView->didFail(error); + if (m_pluginView->isPluginView()) + m_pluginView->didFail(error); m_pluginView = 0; m_hasSentResponseToPlugin = false; } @@ -718,14 +745,14 @@ void FrameLoaderClientQt::committedLoad(WebCore::DocumentLoader* loader, const c return; FrameLoader *fl = loader->frameLoader(); if (m_firstData) { - fl->setEncoding(m_response.textEncodingName(), false); + fl->writer()->setEncoding(m_response.textEncodingName(), false); m_firstData = false; } fl->addData(data, length); } // We re-check here as the plugin can have been created - if (m_pluginView) { + if (m_pluginView && m_pluginView->isPluginView()) { if (!m_hasSentResponseToPlugin) { m_pluginView->didReceiveResponse(loader->response()); // didReceiveResponse sets up a new stream to the plug-in. on a full-page plug-in, a failure in @@ -819,7 +846,7 @@ void FrameLoaderClientQt::download(WebCore::ResourceHandle* handle, const WebCor if (reply) { QWebPage *page = m_webFrame->page(); if (page->forwardUnsupportedContent()) - emit m_webFrame->page()->unsupportedContent(reply); + emit page->unsupportedContent(reply); else reply->abort(); } @@ -833,11 +860,23 @@ void FrameLoaderClientQt::assignIdentifierToInitialRequest(unsigned long identif void FrameLoaderClientQt::dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long identifier, WebCore::ResourceRequest& newRequest, const WebCore::ResourceResponse& redirectResponse) { + if (dumpResourceLoadCallbacks) printf("%s - willSendRequest %s redirectResponse %s\n", qPrintable(dumpAssignedUrls[identifier]), qPrintable(drtDescriptionSuitableForTestResult(newRequest)), - qPrintable(drtDescriptionSuitableForTestResult(redirectResponse))); + (redirectResponse.isNull()) ? "(null)" : qPrintable(drtDescriptionSuitableForTestResult(redirectResponse))); + + if (sendRequestReturnsNull) + newRequest.setURL(QUrl()); + + if (sendRequestReturnsNullOnRedirect && !redirectResponse.isNull()) { + printf("Returning null for this redirect\n"); + newRequest.setURL(QUrl()); + } + + for (int i = 0; i < sendRequestClearHeaders.size(); ++i) + newRequest.setHTTPHeaderField(sendRequestClearHeaders.at(i).toLocal8Bit().constData(), QString()); // seems like the Mac code doesn't do anything here by default neither //qDebug() << "FrameLoaderClientQt::dispatchWillSendRequest" << request.isNull() << request.url().string`(); @@ -860,11 +899,15 @@ void FrameLoaderClientQt::dispatchDidCancelAuthenticationChallenge(DocumentLoade notImplemented(); } -void FrameLoaderClientQt::dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long, const WebCore::ResourceResponse& response) +void FrameLoaderClientQt::dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse& response) { m_response = response; m_firstData = true; + if (dumpResourceLoadCallbacks) + printf("%s - didReceiveResponse %s\n", + qPrintable(dumpAssignedUrls[identifier]), + qPrintable(drtDescriptionSuitableForTestResult(response))); //qDebug() << " got response from" << response.url().string(); } @@ -872,18 +915,23 @@ void FrameLoaderClientQt::dispatchDidReceiveContentLength(WebCore::DocumentLoade { } -void FrameLoaderClientQt::dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long) +void FrameLoaderClientQt::dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier) { + if (dumpResourceLoadCallbacks) + printf("%s - didFinishLoading\n", + (dumpAssignedUrls.contains(identifier) ? qPrintable(dumpAssignedUrls[identifier]) : "<unknown>")); } void FrameLoaderClientQt::dispatchDidFailLoading(WebCore::DocumentLoader* loader, unsigned long identifier, const WebCore::ResourceError& error) { if (dumpResourceLoadCallbacks) - printf("%s - didFailLoadingWithError: %s\n", qPrintable(dumpAssignedUrls[identifier]), qPrintable(drtDescriptionSuitableForTestResult(error))); + printf("%s - didFailLoadingWithError: %s\n", + (dumpAssignedUrls.contains(identifier) ? qPrintable(dumpAssignedUrls[identifier]) : "<unknown>"), + qPrintable(drtDescriptionSuitableForTestResult(error))); if (m_firstData) { FrameLoader *fl = loader->frameLoader(); - fl->setEncoding(m_response.textEncodingName(), false); + fl->writer()->setEncoding(m_response.textEncodingName(), false); m_firstData = false; } } @@ -894,11 +942,6 @@ bool FrameLoaderClientQt::dispatchDidLoadResourceFromMemoryCache(WebCore::Docume return false; } -void FrameLoaderClientQt::dispatchDidLoadResourceByXMLHttpRequest(unsigned long, const WebCore::ScriptString&) -{ - notImplemented(); -} - void FrameLoaderClientQt::callErrorPageExtension(const WebCore::ResourceError& error) { QWebPage* page = m_webFrame->page(); @@ -966,7 +1009,10 @@ WebCore::Frame* FrameLoaderClientQt::dispatchCreatePage() void FrameLoaderClientQt::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const WebCore::String& MIMEType, const WebCore::ResourceRequest&) { // we need to call directly here - if (canShowMIMEType(MIMEType)) + const ResourceResponse& response = m_frame->loader()->activeDocumentLoader()->response(); + if (WebCore::contentDispositionType(response.httpHeaderField("Content-Disposition")) == WebCore::ContentDispositionAttachment) + callPolicyFunction(function, PolicyDownload); + else if (canShowMIMEType(MIMEType)) callPolicyFunction(function, PolicyUse); else callPolicyFunction(function, PolicyDownload); @@ -1165,6 +1211,8 @@ public: platformWidget()->setMask(clipRegion); handleVisibility(); + + platformWidget()->update(); } virtual void show() diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index adeb31c..2756871 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -96,7 +96,6 @@ namespace WebCore { virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long); virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long, const WebCore::ResourceError&); virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int); - virtual void dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const WebCore::ScriptString& sourceString); virtual void dispatchDidHandleOnloadEvents(); virtual void dispatchDidReceiveServerRedirectForProvisionalLoad(); diff --git a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index 5f343ff..7fabbda 100644 --- a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -81,64 +81,21 @@ void InspectorClientQt::inspectorDestroyed() delete this; } -Page* InspectorClientQt::createPage() -{ - QWebView* inspectorView = m_inspectorView.get(); - if (!inspectorView) { - inspectorView = new QWebView; - InspectorClientWebPage* inspectorPage = new InspectorClientWebPage(inspectorView); - inspectorView->setPage(inspectorPage); - m_inspectorView.set(inspectorView); - } + +void InspectorClientQt::openInspectorFrontend(WebCore::InspectorController*) +{ + QWebView* inspectorView = new QWebView; + InspectorClientWebPage* inspectorPage = new InspectorClientWebPage(inspectorView); + inspectorView->setPage(inspectorPage); - inspectorView->page()->mainFrame()->load(QString::fromLatin1("qrc:/webkit/inspector/inspector.html")); + QUrl inspectorUrl = m_inspectedWebPage->settings()->inspectorUrl(); + if (!inspectorUrl.isValid()) + inspectorUrl = QUrl("qrc:/webkit/inspector/inspector.html"); + inspectorView->page()->mainFrame()->load(inspectorUrl); m_inspectedWebPage->d->inspectorFrontend = inspectorView; m_inspectedWebPage->d->getOrCreateInspector()->d->setFrontend(inspectorView); - return inspectorView->page()->d->page; -} - -String InspectorClientQt::localizedStringsURL() -{ - notImplemented(); - return String(); -} - -String InspectorClientQt::hiddenPanels() -{ - notImplemented(); - return String(); -} - -void InspectorClientQt::showWindow() -{ - updateWindowTitle(); - -#if ENABLE(INSPECTOR) - m_inspectedWebPage->d->inspectorController()->setWindowVisible(true, true); -#endif -} - -void InspectorClientQt::closeWindow() -{ -#if ENABLE(INSPECTOR) - m_inspectedWebPage->d->inspectorController()->setWindowVisible(false); -#endif -} - -void InspectorClientQt::attachWindow() -{ - notImplemented(); -} - -void InspectorClientQt::detachWindow() -{ - notImplemented(); -} - -void InspectorClientQt::setAttachedWindowHeight(unsigned) -{ - notImplemented(); + inspectorView->page()->d->page->inspectorController()->setInspectorFrontendClient(new InspectorFrontendClientQt(m_inspectedWebPage, inspectorView)); } void InspectorClientQt::highlight(Node*) @@ -151,27 +108,13 @@ void InspectorClientQt::hideHighlight() notImplemented(); } -void InspectorClientQt::inspectedURLChanged(const String& newURL) -{ - m_inspectedURL = newURL; - updateWindowTitle(); -} - -void InspectorClientQt::inspectorWindowObjectCleared() -{ - notImplemented(); -} - -void InspectorClientQt::updateWindowTitle() -{ - if (m_inspectedWebPage->d->inspector) { - QString caption = QCoreApplication::translate("QWebPage", "Web Inspector - %2").arg(m_inspectedURL); - m_inspectedWebPage->d->inspector->setWindowTitle(caption); - } -} - void InspectorClientQt::populateSetting(const String& key, String* setting) { +#ifdef QT_NO_SETTINGS + Q_UNUSED(key) + Q_UNUSED(setting) + qWarning("QWebInspector: QSettings is not supported by Qt."); +#else QSettings qsettings; if (qsettings.status() == QSettings::AccessError) { // QCoreApplication::setOrganizationName and QCoreApplication::setApplicationName haven't been called @@ -180,15 +123,21 @@ void InspectorClientQt::populateSetting(const String& key, String* setting) return; } - QString settingKey(settingStoragePrefix + key); + QString settingKey(settingStoragePrefix + QString(key)); QString storedValueType = qsettings.value(settingKey + settingStorageTypeSuffix).toString(); QVariant storedValue = qsettings.value(settingKey); storedValue.convert(QVariant::nameToType(storedValueType.toAscii().data())); *setting = variantToSetting(storedValue); +#endif // QT_NO_SETTINGS } void InspectorClientQt::storeSetting(const String& key, const String& setting) { +#ifdef QT_NO_SETTINGS + Q_UNUSED(key) + Q_UNUSED(setting) + qWarning("QWebInspector: QSettings is not supported by Qt."); +#else QSettings qsettings; if (qsettings.status() == QSettings::AccessError) { qWarning("QWebInspector: QSettings couldn't persist configuration setting [%s].", @@ -197,9 +146,10 @@ void InspectorClientQt::storeSetting(const String& key, const String& setting) } QVariant valueToStore = settingToVariant(setting); - QString settingKey(settingStoragePrefix + key); + QString settingKey(settingStoragePrefix + QString(key)); qsettings.setValue(settingKey, valueToStore); qsettings.setValue(settingKey + settingStorageTypeSuffix, QVariant::typeToName(valueToStore.type())); +#endif // QT_NO_SETTINGS } static String variantToSetting(const QVariant& qvariant) @@ -211,6 +161,8 @@ static String variantToSetting(const QVariant& qvariant) retVal = qvariant.toBool() ? "true" : "false"; case QVariant::String: retVal = qvariant.toString(); + default: + break; } return retVal; @@ -223,6 +175,81 @@ static QVariant settingToVariant(const String& setting) return retVal; } +InspectorFrontendClientQt::InspectorFrontendClientQt(QWebPage* inspectedWebPage, PassOwnPtr<QWebView> inspectorView) + : InspectorFrontendClientLocal(inspectedWebPage->d->page->inspectorController(), inspectorView->page()->d->page) + , m_inspectedWebPage(inspectedWebPage) + , m_inspectorView(inspectorView) + , m_destroyingInspectorView(false) +{ +} + +void InspectorFrontendClientQt::frontendLoaded() +{ + InspectorFrontendClientLocal::frontendLoaded(); + setAttachedWindow(true); +} + +String InspectorFrontendClientQt::localizedStringsURL() +{ + notImplemented(); + return String(); +} + +String InspectorFrontendClientQt::hiddenPanels() +{ + notImplemented(); + return String(); +} + +void InspectorFrontendClientQt::bringToFront() +{ + updateWindowTitle(); +} + +void InspectorFrontendClientQt::closeWindow() +{ + if (m_destroyingInspectorView) + return; + m_destroyingInspectorView = true; + + // Clear reference from QWebInspector to the frontend view. + m_inspectedWebPage->d->getOrCreateInspector()->d->setFrontend(0); +#if ENABLE(INSPECTOR) + m_inspectedWebPage->d->inspectorController()->disconnectFrontend(); +#endif + // Clear pointer before deleting WebView to avoid recursive calls to its destructor. + delete m_inspectorView.release(); +} + +void InspectorFrontendClientQt::attachWindow() +{ + notImplemented(); +} + +void InspectorFrontendClientQt::detachWindow() +{ + notImplemented(); +} + +void InspectorFrontendClientQt::setAttachedWindowHeight(unsigned) +{ + notImplemented(); +} + +void InspectorFrontendClientQt::inspectedURLChanged(const String& newURL) +{ + m_inspectedURL = newURL; + updateWindowTitle(); +} + +void InspectorFrontendClientQt::updateWindowTitle() +{ + if (m_inspectedWebPage->d->inspector) { + QString caption = QCoreApplication::translate("QWebPage", "Web Inspector - %2").arg(m_inspectedURL); + m_inspectedWebPage->d->inspector->setWindowTitle(caption); + } +} + } #include "InspectorClientQt.moc" diff --git a/WebKit/qt/WebCoreSupport/InspectorClientQt.h b/WebKit/qt/WebCoreSupport/InspectorClientQt.h index 923bab4..4beadab 100644 --- a/WebKit/qt/WebCoreSupport/InspectorClientQt.h +++ b/WebKit/qt/WebCoreSupport/InspectorClientQt.h @@ -31,52 +31,64 @@ #define InspectorClientQt_h #include "InspectorClient.h" +#include "InspectorFrontendClientLocal.h" #include "OwnPtr.h" +#include "PassOwnPtr.h" #include <QtCore/QString> class QWebPage; class QWebView; namespace WebCore { - class Node; - class Page; - class String; +class Node; +class Page; +class String; - class InspectorClientQt : public InspectorClient { - public: - InspectorClientQt(QWebPage*); +class InspectorClientQt : public InspectorClient { +public: + InspectorClientQt(QWebPage*); - virtual void inspectorDestroyed(); + virtual void inspectorDestroyed(); - virtual Page* createPage(); + virtual void openInspectorFrontend(WebCore::InspectorController*); - virtual String localizedStringsURL(); + virtual void highlight(Node*); + virtual void hideHighlight(); - virtual String hiddenPanels(); + virtual void populateSetting(const String& key, String* value); + virtual void storeSetting(const String& key, const String& value); - virtual void showWindow(); - virtual void closeWindow(); +private: + QWebPage* m_inspectedWebPage; +}; - virtual void attachWindow(); - virtual void detachWindow(); +class InspectorFrontendClientQt : public InspectorFrontendClientLocal { +public: + InspectorFrontendClientQt(QWebPage* inspectedWebPage, PassOwnPtr<QWebView> inspectorView); - virtual void setAttachedWindowHeight(unsigned height); + virtual void frontendLoaded(); - virtual void highlight(Node*); - virtual void hideHighlight(); - virtual void inspectedURLChanged(const String& newURL); + virtual String localizedStringsURL(); - virtual void populateSetting(const String& key, String* value); - virtual void storeSetting(const String& key, const String& value); + virtual String hiddenPanels(); - virtual void inspectorWindowObjectCleared(); + virtual void bringToFront(); + virtual void closeWindow(); - private: - void updateWindowTitle(); - QWebPage* m_inspectedWebPage; - OwnPtr<QWebView> m_inspectorView; - QString m_inspectedURL; - }; + virtual void attachWindow(); + virtual void detachWindow(); + + virtual void setAttachedWindowHeight(unsigned height); + + virtual void inspectedURLChanged(const String& newURL); + +private: + void updateWindowTitle(); + QWebPage* m_inspectedWebPage; + OwnPtr<QWebView> m_inspectorView; + QString m_inspectedURL; + bool m_destroyingInspectorView; +}; } #endif diff --git a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp new file mode 100644 index 0000000..e440837 --- /dev/null +++ b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "NotificationPresenterClientQt.h" + +#include "Document.h" +#include "KURL.h" +#include "NotImplemented.h" +#include "SecurityOrigin.h" + +#include "qwebkitglobal.h" + +#include <QtGui> + +static bool dumpNotification = false; + +void QWEBKIT_EXPORT qt_dump_notification(bool b) +{ + dumpNotification = b; +} + +#if ENABLE(NOTIFICATIONS) + +using namespace WebCore; + +NotificationPresenterClientQt::NotificationPresenterClientQt() +{ +} + +bool NotificationPresenterClientQt::show(Notification* notification) +{ + if (dumpNotification) { + if (notification->isHTML()) + printf("DESKTOP NOTIFICATION: contents at %s\n", QString(notification->url().string()).toUtf8().constData()); + else { + printf("DESKTOP NOTIFICATION: icon %s, title %s, text %s\n", + QString(notification->contents().icon().string()).toUtf8().constData(), QString(notification->contents().title()).toUtf8().constData(), + QString(notification->contents().body()).toUtf8().constData()); + } + } + +#ifndef QT_NO_SYSTEMTRAYICON + m_tray.show(); + m_tray.showMessage(notification->contents().title(), notification->contents().body(), QSystemTrayIcon::Information); +#endif + return true; +} + +void NotificationPresenterClientQt::cancel(Notification* notification) +{ + if (dumpNotification) { + if (notification->isHTML()) + printf("DESKTOP NOTIFICATION CLOSED: %s\n", QString(notification->url().string()).toUtf8().constData()); + else + printf("DESKTOP NOTIFICATION CLOSED: %s\n", QString(notification->contents().title()).toUtf8().constData()); + } + + notImplemented(); +} + +void NotificationPresenterClientQt::notificationObjectDestroyed(Notification* notification) +{ + notImplemented(); +} + +void NotificationPresenterClientQt::requestPermission(SecurityOrigin* origin, PassRefPtr<VoidCallback> callback) +{ + if (dumpNotification) + printf("DESKTOP NOTIFICATION PERMISSION REQUESTED: %s\n", QString(origin->toString()).toUtf8().constData()); + + notImplemented(); +} + +NotificationPresenter::Permission NotificationPresenterClientQt::checkPermission(const KURL&) +{ + // FIXME Implement permission policy + return NotificationPresenter::PermissionAllowed; +} + +#endif // ENABLE(NOTIFICATIONS) diff --git a/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h new file mode 100644 index 0000000..272c661 --- /dev/null +++ b/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "Notification.h" +#include "NotificationPresenter.h" + +#include <QSystemTrayIcon> + +#if ENABLE(NOTIFICATIONS) + +namespace WebCore { +class Document; +class KURL; + +class NotificationPresenterClientQt : public NotificationPresenter { +public: + NotificationPresenterClientQt(); + + /* WebCore::NotificationPresenter interface */ + virtual bool show(Notification*); + virtual void cancel(Notification*); + virtual void notificationObjectDestroyed(Notification*); + virtual void requestPermission(SecurityOrigin*, PassRefPtr<VoidCallback>); + virtual NotificationPresenter::Permission checkPermission(const KURL&); + +private: +#ifndef QT_NO_SYSTEMTRAYICON + QSystemTrayIcon m_tray; +#endif +}; +} + +#endif diff --git a/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp b/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp index c553c45..7514077 100644 --- a/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp +++ b/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp @@ -23,8 +23,8 @@ #include "HostWindow.h" #include "PopupMenuClient.h" -#include "qgraphicswebview.h" #include "QWebPageClient.h" +#include "qgraphicswebview.h" #include <QAbstractItemView> #include <QApplication> #include <QGraphicsProxyWidget> @@ -34,6 +34,12 @@ #include <QMouseEvent> #include <QStandardItemModel> +#if ENABLE(SYMBIAN_DIALOG_PROVIDERS) +#include <BrCtlDialogsProvider.h> +#include <BrowserDialogsProvider.h> // S60 platform private header file +#include <e32base.h> +#endif + namespace WebCore { QtFallbackWebPopupCombo::QtFallbackWebPopupCombo(QtFallbackWebPopup& ownerPopup) @@ -49,6 +55,7 @@ void QtFallbackWebPopupCombo::showPopup() void QtFallbackWebPopupCombo::hidePopup() { +#ifndef QT_NO_IM QWidget* activeFocus = QApplication::focusWidget(); if (activeFocus && activeFocus == QComboBox::view() && activeFocus->testAttribute(Qt::WA_InputMethodEnabled)) { @@ -58,6 +65,7 @@ void QtFallbackWebPopupCombo::hidePopup() qic->setFocusWidget(0); } } +#endif // QT_NO_IM QComboBox::hidePopup(); @@ -93,17 +101,15 @@ QtFallbackWebPopup::~QtFallbackWebPopup() void QtFallbackWebPopup::show() { + if (!pageClient()) + return; + +#if ENABLE(SYMBIAN_DIALOG_PROVIDERS) + TRAP_IGNORE(showS60BrowserDialog()); +#else populate(); m_combo->setCurrentIndex(currentIndex()); -#if defined(Q_WS_MAEMO_5) - // Comboboxes with Qt on Maemo 5 come up in their full width on the screen, so neither - // the proxy widget, nor the coordinates are needed. - m_combo->setParent(pageClient()->ownerWidget()); - m_combo->showPopup(); - return; -#endif - QRect rect = geometry(); if (QGraphicsWebView *webView = qobject_cast<QGraphicsWebView*>(pageClient()->pluginParent())) { if (!m_proxy) { @@ -119,13 +125,65 @@ void QtFallbackWebPopup::show() } - // QCursor::pos() is not a great idea for a touch screen, but as Maemo 5 is handled - // separately above, this should be okay. QMouseEvent event(QEvent::MouseButtonPress, QCursor::pos(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); QCoreApplication::sendEvent(m_combo, &event); +#endif +} + +#if ENABLE(SYMBIAN_DIALOG_PROVIDERS) + +static void ResetAndDestroy(TAny* aPtr) +{ + RPointerArray<HBufC>* items = reinterpret_cast<RPointerArray<HBufC>* >(aPtr); + items->ResetAndDestroy(); } +void QtFallbackWebPopup::showS60BrowserDialog() +{ + static MBrCtlDialogsProvider* dialogs = CBrowserDialogsProvider::NewL(0); + if (!dialogs) + return; + + int size = itemCount(); + CArrayFix<TBrCtlSelectOptionData>* options = new CArrayFixFlat<TBrCtlSelectOptionData>(qMax(1, size)); + RPointerArray<HBufC> items(qMax(1, size)); + CleanupStack::PushL(TCleanupItem(&ResetAndDestroy, &items)); + + for (int i = 0; i < size; i++) { + if (itemType(i) == Separator) { + TBrCtlSelectOptionData data(_L("----------"), false, false, false); + options->AppendL(data); + } else { + HBufC16* itemStr = HBufC16::NewL(itemText(i).length()); + itemStr->Des().Copy((const TUint16*)itemText(i).utf16(), itemText(i).length()); + CleanupStack::PushL(itemStr); + TBrCtlSelectOptionData data(*itemStr, i == currentIndex(), false, itemIsEnabled(i)); + options->AppendL(data); + items.AppendL(itemStr); + CleanupStack::Pop(); + } + } + + dialogs->DialogSelectOptionL(KNullDesC(), (TBrCtlSelectOptionType)(ESelectTypeSingle | ESelectTypeWithFindPane), *options); + + CleanupStack::PopAndDestroy(&items); + + int newIndex; + for (newIndex = 0; newIndex < options->Count() && !options->At(newIndex).IsSelected(); newIndex++) {} + if (newIndex == options->Count()) + newIndex = currentIndex(); + + m_popupVisible = false; + popupDidHide(); + + if (currentIndex() != newIndex && newIndex >= 0) + valueChanged(newIndex); + + delete options; +} +#endif + void QtFallbackWebPopup::hide() { m_combo->hidePopup(); @@ -138,7 +196,7 @@ void QtFallbackWebPopup::populate() QStandardItemModel* model = qobject_cast<QStandardItemModel*>(m_combo->model()); Q_ASSERT(model); -#if !defined(Q_WS_S60) && !defined(Q_WS_MAEMO_5) +#if !defined(Q_WS_S60) m_combo->setFont(font()); #endif for (int i = 0; i < itemCount(); ++i) { diff --git a/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h b/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h index 3924bf6..62b8aea 100644 --- a/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h +++ b/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h @@ -23,7 +23,9 @@ #include "QtAbstractWebPopup.h" #include <QComboBox> +QT_BEGIN_NAMESPACE class QGraphicsProxyWidget; +QT_END_NAMESPACE namespace WebCore { @@ -48,6 +50,9 @@ private: QGraphicsProxyWidget* m_proxy; void populate(); +#if ENABLE(SYMBIAN_DIALOG_PROVIDERS) + void showS60BrowserDialog(); +#endif }; class QtFallbackWebPopupCombo : public QComboBox { diff --git a/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.cpp b/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.cpp new file mode 100644 index 0000000..29a16cb --- /dev/null +++ b/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.cpp @@ -0,0 +1,220 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ +#include "config.h" +#include "QtMaemoWebPopup.h" + +#include <QHBoxLayout> +#include <QListWidget> +#include <QListWidgetItem> +#include <QPainter> +#include <QPushButton> +#include <QStyledItemDelegate> +#include <QVBoxLayout> + +#include <libintl.h> + + +namespace WebCore { + +static const int gMaemoListItemSize = 70; +static const int gMaemoListPadding = 38; +static const int gMaemoMaxVisibleItems = 5; + +void Maemo5Popup::populateList() +{ + QListWidgetItem* listItem; + for (int i = 0; i < m_data.itemCount(); ++i) { + if (m_data.itemType(i) == QtAbstractWebPopup::Option) { + listItem = new QListWidgetItem(m_data.itemText(i)); + m_list->addItem(listItem); + listItem->setSelected(m_data.itemIsSelected(i)); + } else if (m_data.itemType(i) == QtAbstractWebPopup::Group) { + listItem = new QListWidgetItem(m_data.itemText(i)); + m_list->addItem(listItem); + listItem->setSelected(false); + listItem->setFlags(Qt::NoItemFlags); + } + } + connect(m_list, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(onItemSelected(QListWidgetItem*))); +} + +void Maemo5Popup::onItemSelected(QListWidgetItem* item) +{ + if (item->flags() != Qt::NoItemFlags) + emit itemClicked(m_list->row(item)); +} + +QtMaemoWebPopup::QtMaemoWebPopup() + : QtAbstractWebPopup() + , m_popup(0) +{ +} + +QtMaemoWebPopup::~QtMaemoWebPopup() +{ + if (m_popup) + m_popup->deleteLater(); +} + +Maemo5Popup* QtMaemoWebPopup::createSingleSelectionPopup() +{ + return new Maemo5SingleSelectionPopup(*this); +} + +Maemo5Popup* QtMaemoWebPopup::createMultipleSelectionPopup() +{ + return new Maemo5MultipleSelectionPopup(*this); +} + +Maemo5Popup* QtMaemoWebPopup::createPopup() +{ + Maemo5Popup* result = multiple() ? createMultipleSelectionPopup() : createSingleSelectionPopup(); + connect(result, SIGNAL(finished(int)), this, SLOT(popupClosed())); + connect(result, SIGNAL(itemClicked(int)), this, SLOT(itemClicked(int))); + return result; +} + +void QtMaemoWebPopup::show() +{ + if (!pageClient() || m_popup) + return; + + m_popup = createPopup(); + m_popup->show(); +} + +void QtMaemoWebPopup::hide() +{ + if (!m_popup) + return; + + m_popup->accept(); +} + +void QtMaemoWebPopup::popupClosed() +{ + if (!m_popup) + return; + + m_popup->deleteLater(); + m_popup = 0; + popupDidHide(); +} + +void QtMaemoWebPopup::itemClicked(int idx) +{ + selectItem(idx, true, false); +} + +Maemo5SingleSelectionPopup::Maemo5SingleSelectionPopup(QtAbstractWebPopup& data) + : Maemo5Popup(data) +{ + // we try to get the standard list title the web browser is using + const char* title = ::dgettext("osso-browser-ui", "weba_ti_texlist_single"); + if (qstrcmp(title, "weba_ti_texlist_single")) + setWindowTitle(QString::fromUtf8(title)); + else + setWindowTitle("Select item"); + + QHBoxLayout* hLayout = new QHBoxLayout(this); + hLayout->setContentsMargins(0, 0, 0, 0); + + m_list = new QListWidget(this); + populateList(); + + hLayout->addSpacing(gMaemoListPadding); + hLayout->addWidget(m_list); + hLayout->addSpacing(gMaemoListPadding); + + connect(m_list, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(accept())); + + const int visibleItemCount = (m_list->count() > gMaemoMaxVisibleItems) ? gMaemoMaxVisibleItems : m_list->count(); + resize(size().width(), visibleItemCount * gMaemoListItemSize); +} + + +class MultipleItemListDelegate : public QStyledItemDelegate { +public: + MultipleItemListDelegate(QObject* parent = 0) + : QStyledItemDelegate(parent) + { + tickMark = QIcon::fromTheme("widgets_tickmark_list").pixmap(48, 48); + } + + void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const + { + QStyledItemDelegate::paint(painter, option, index); + + if (option.state & QStyle::State_Selected) + painter->drawPixmap(option.rect.width() - tickMark.rect().width(), option.rect.y() + (option.rect.height() / 2 - tickMark.rect().height() / 2), tickMark); + } + +private: + QPixmap tickMark; +}; + +Maemo5MultipleSelectionPopup::Maemo5MultipleSelectionPopup(QtAbstractWebPopup& data) + : Maemo5Popup(data) +{ + // we try to get the standard list title the web browser is using + const char* title = ::dgettext("osso-browser-ui", "weba_ti_textlist_multi"); + if (qstrcmp(title, "weba_ti_textlist_multi")) + setWindowTitle(QString::fromUtf8(title)); + else + setWindowTitle("Select items"); + + QHBoxLayout* hLayout = new QHBoxLayout(this); + hLayout->setContentsMargins(0, 0, 0, 0); + + m_list = new QListWidget(this); + m_list->setSelectionMode(QAbstractItemView::MultiSelection); + populateList(); + + MultipleItemListDelegate* delegate = new MultipleItemListDelegate(this); + m_list->setItemDelegate(delegate); + + hLayout->addSpacing(gMaemoListPadding); + hLayout->addWidget(m_list); + + QVBoxLayout* vLayout = new QVBoxLayout(); + + const int visibleItemCount = (m_list->count() > gMaemoMaxVisibleItems) ? gMaemoMaxVisibleItems : m_list->count(); + vLayout->addSpacing((visibleItemCount - 1) * gMaemoListItemSize); + + // we try to get the standard Done button title + QPushButton* done = new QPushButton(this); + title = ::dgettext("hildon-libs", "wdgt_bd_done"); + if (qstrcmp(title, "wdgt_bd_done")) + done->setText(QString::fromUtf8(title)); + else + done->setText("Done"); + + done->setMinimumWidth(178); + vLayout->addWidget(done); + + hLayout->addSpacing(8); + hLayout->addLayout(vLayout); + hLayout->addSpacing(18); + + connect(done, SIGNAL(clicked()), this, SLOT(accept())); + resize(size().width(), visibleItemCount * gMaemoListItemSize); +} + +} diff --git a/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.h b/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.h new file mode 100644 index 0000000..a163a20 --- /dev/null +++ b/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ +#ifndef QtMaemoWebPopup_h +#define QtMaemoWebPopup_h + +#include "QtAbstractWebPopup.h" + +#include <QDialog> + +class QListWidgetItem; +class QListWidget; + + +namespace WebCore { + +class Maemo5Popup : public QDialog { + Q_OBJECT +public: + Maemo5Popup(QtAbstractWebPopup& data) : m_data(data) {} + +signals: + void itemClicked(int idx); + +protected slots: + void onItemSelected(QListWidgetItem* item); + +protected: + void populateList(); + + QtAbstractWebPopup& m_data; + QListWidget* m_list; +}; + + +class QtMaemoWebPopup : public QObject, public QtAbstractWebPopup { + Q_OBJECT +public: + QtMaemoWebPopup(); + ~QtMaemoWebPopup(); + + virtual void show(); + virtual void hide(); + +private slots: + void popupClosed(); + void itemClicked(int idx); + +private: + Maemo5Popup* m_popup; + + Maemo5Popup* createPopup(); + Maemo5Popup* createSingleSelectionPopup(); + Maemo5Popup* createMultipleSelectionPopup(); +}; + + +class Maemo5SingleSelectionPopup : public Maemo5Popup { + Q_OBJECT +public: + Maemo5SingleSelectionPopup(QtAbstractWebPopup& data); +}; + + +class Maemo5MultipleSelectionPopup : public Maemo5Popup { + Q_OBJECT +public: + Maemo5MultipleSelectionPopup(QtAbstractWebPopup& data); +}; + +} + +#endif // QtMaemoWebPopup_h diff --git a/WebKit/qt/docs/qtwebkit.qdoc b/WebKit/qt/docs/qtwebkit.qdoc index 411762a..9e653e4 100644 --- a/WebKit/qt/docs/qtwebkit.qdoc +++ b/WebKit/qt/docs/qtwebkit.qdoc @@ -83,9 +83,6 @@ QtWebKit is based on the Open Source WebKit engine. More information about WebKit itself can be found on the \l{WebKit Open Source Project} Web site. - The QtWebKit module is part of the \l{Qt Full Framework Edition}, and the - \l{Open Source Versions of Qt}. - \note Building the QtWebKit module with debugging symbols is problematic on many platforms due to the size of the WebKit engine. We recommend building the module only in release mode for embedded platforms. diff --git a/WebKit/qt/symbian/eabi/QtWebKitu.def b/WebKit/qt/symbian/eabi/QtWebKitu.def index f53bb0d..145fe0b 100644 --- a/WebKit/qt/symbian/eabi/QtWebKitu.def +++ b/WebKit/qt/symbian/eabi/QtWebKitu.def @@ -693,9 +693,30 @@ EXPORTS _Z23qt_networkAccessAllowedb @ 692 NONAME _Z25qt_resumeActiveDOMObjectsP9QWebFrame @ 693 NONAME _Z26qt_suspendActiveDOMObjectsP9QWebFrame @ 694 NONAME - _Z35qtwebkit_webframe_scrollRecursivelyP9QWebFrameii @ 695 NONAME - _ZN13QWebInspector10closeEventEP11QCloseEvent @ 696 NONAME - _ZN9QWebFrame17scrollRecursivelyEii @ 697 NONAME + _Z35qtwebkit_webframe_scrollRecursivelyP9QWebFrameii @ 695 NONAME ABSENT + _Z35qtwebkit_webframe_scrollRecursivelyP9QWebFrameiiRK6QPoint @ 696 NONAME + _ZN9QWebFrame17scrollRecursivelyEii @ 697 NONAME ABSENT _ZN16QGraphicsWebView20setResizesToContentsEb @ 698 NONAME _ZNK16QGraphicsWebView17resizesToContentsEv @ 699 NONAME - + _Z20qt_drt_numberOfPagesP9QWebFrameff @ 700 NONAME + _Z24qt_drt_pauseSVGAnimationP9QWebFrameRK7QStringdS3_ @ 701 NONAME + _Z24qt_drt_webinspector_showP8QWebPage @ 702 NONAME + _Z24qt_drt_workerThreadCountv @ 703 NONAME + _Z25qt_drt_hasDocumentElementP9QWebFrame @ 704 NONAME + _Z25qt_drt_webinspector_closeP8QWebPage @ 705 NONAME + _Z31qt_drt_pageNumberForElementByIdP9QWebFrameRK7QStringff @ 706 NONAME + _Z33qt_drt_webinspector_executeScriptP8QWebPagelRK7QString @ 707 NONAME + _Z34qt_drt_setTimelineProfilingEnabledP8QWebPageb @ 708 NONAME + _Z32qt_drt_setFrameFlatteningEnabledP8QWebPageb @ 709 NONAME + _Z36qt_drt_evaluateScriptInIsolatedWorldP9QWebFrameiRK7QString @ 710 NONAME + _Z47qt_drt_setDomainRelaxationForbiddenForURLSchemebRK7QString @ 711 NONAME + _ZN9QWebFrame11pageChangedEv @ 712 NONAME + _ZN9QWebFrame14scrollToAnchorERK7QString @ 713 NONAME + _ZN12QWebSettings15setInspectorUrlERK4QUrl @ 714 NONAME + _ZN13QWebInspector10closeEventEP11QCloseEvent @ 715 NONAME + _ZN16QGraphicsWebView26setTiledBackingStoreFrozenEb @ 716 NONAME + _ZNK16QGraphicsWebView25isTiledBackingStoreFrozenEv @ 717 NONAME + _Z18qt_wrt_setViewModeP8QWebPageRK7QString @ 718 NONAME + _Z19qt_drt_setMediaTypeP9QWebFrameRK7QString @ 719 NONAME + _Z26qt_drt_enableCaretBrowsingP8QWebPageb @ 720 NONAME + _ZNK12QWebSettings12inspectorUrlEv @ 721 NONAME diff --git a/WebKit/qt/tests/benchmarks/loading/loading.pro b/WebKit/qt/tests/benchmarks/loading/loading.pro index 8b24274..024211f 100644 --- a/WebKit/qt/tests/benchmarks/loading/loading.pro +++ b/WebKit/qt/tests/benchmarks/loading/loading.pro @@ -1 +1,2 @@ +isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../../.. include(../../tests.pri) diff --git a/WebKit/qt/tests/benchmarks/painting/painting.pro b/WebKit/qt/tests/benchmarks/painting/painting.pro index 8acdd5c..b4fc56a 100644 --- a/WebKit/qt/tests/benchmarks/painting/painting.pro +++ b/WebKit/qt/tests/benchmarks/painting/painting.pro @@ -1 +1,2 @@ +isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../../.. include(../../tests.pri)
\ No newline at end of file diff --git a/WebKit/qt/tests/benchmarks/painting/tst_painting.cpp b/WebKit/qt/tests/benchmarks/painting/tst_painting.cpp index f4531fd..fc5b8e3 100644 --- a/WebKit/qt/tests/benchmarks/painting/tst_painting.cpp +++ b/WebKit/qt/tests/benchmarks/painting/tst_painting.cpp @@ -19,6 +19,7 @@ #include <QtTest/QtTest> +#include <qwebelement.h> #include <qwebframe.h> #include <qwebview.h> #include <qpainter.h> @@ -59,6 +60,7 @@ public Q_SLOTS: private Q_SLOTS: void paint_data(); void paint(); + void textAreas(); private: QWebView* m_view; @@ -105,5 +107,30 @@ void tst_Painting::paint() } } +void tst_Painting::textAreas() +{ + m_view->load(QUrl("data:text/html;<html><body></body></html>")); + ::waitForSignal(m_view, SIGNAL(loadFinished(bool))); + + QWebElement bodyElement = m_page->mainFrame()->findFirstElement("body"); + + int count = 100; + while (count--) { + QString markup("<textarea cols='1' rows='1'></textarea>"); + 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<QComboBox*>(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("<script>" \ + " function checkScrollbar() {" \ + " if (innerWidth === document.documentElement.offsetWidth)" \ + " document.getElementById('span1').innerText = 'SUCCESS';" \ + " else" \ + " document.getElementById('span1').innerText = 'FAIL';" \ + " }" \ + "</script>" \ + "<body>" \ + " <div style='margin-top:1000px ; margin-left:1000px'>" \ + " <a id='offscreen' href='a'>End</a>" \ + " </div>" \ + "<span id='span1'></span>" \ + "</body>"); + + + 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<QWebFrame*> 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<QString>("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 <QDir> #include <QGraphicsWidget> #include <QLineEdit> #include <QMenu> #include <QPushButton> #include <QtTest/QtTest> +#include <QTextCharFormat> #include <qgraphicsscene.h> #include <qgraphicsview.h> #include <qgraphicswebview.h> @@ -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("<html><body> </body></html>"), QUrl("http://www.myexample.com")); @@ -1403,6 +1403,26 @@ void tst_QWebPage::inputMethods() variant = page->inputMethodQuery(Qt::ImCurrentSelection); QString selectionValue = variant.value<QString>(); 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<QString>(); + 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<QString>("string"); + QTest::addColumn<int>("start"); + QTest::addColumn<int>("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("<html><body>" \ + "<input type='text' id='input1' style='font-family: serif' value='' maxlength='20'/>"); + page->mainFrame()->evaluateJavaScript("document.getElementById('input1').focus()"); + page->mainFrame()->setFocus(); + view->show(); + + QFETCH(QString, string); + QFETCH(int, start); + QFETCH(int, length); + + QList<QInputMethodEvent::Attribute> 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 |