diff options
author | Morten Johan Sørvig <morten.sorvig@nokia.com> | 2009-11-05 06:26:24 (GMT) |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@nokia.com> | 2009-11-05 06:26:24 (GMT) |
commit | ee88b2d8408396188eb2ce52d740c395c6cd4656 (patch) | |
tree | 1f59ea0612fecbaca595594d3812dd2aab64cf63 /src/3rdparty/webkit/WebKit/qt | |
parent | 673973acc20ce4e068d63fa5b0391f5c785be8a3 (diff) | |
parent | aa58293b57a05cd52b36ba14a05958dceb65c603 (diff) | |
download | Qt-ee88b2d8408396188eb2ce52d740c395c6cd4656.zip Qt-ee88b2d8408396188eb2ce52d740c395c6cd4656.tar.gz Qt-ee88b2d8408396188eb2ce52d740c395c6cd4656.tar.bz2 |
Merge remote branch 'qt-official/4.6' into 4.6
Diffstat (limited to 'src/3rdparty/webkit/WebKit/qt')
46 files changed, 1707 insertions, 579 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/headers.pri b/src/3rdparty/webkit/WebKit/qt/Api/headers.pri index 5a95c67..1a42597 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/headers.pri +++ b/src/3rdparty/webkit/WebKit/qt/Api/headers.pri @@ -8,7 +8,6 @@ WEBKIT_API_HEADERS = $$PWD/qwebframe.h \ $$PWD/qwebdatabase.h \ $$PWD/qwebsecurityorigin.h \ $$PWD/qwebelement.h \ - $$PWD/qwebplugindatabase.h \ $$PWD/qwebpluginfactory.h \ $$PWD/qwebhistory.h \ $$PWD/qwebinspector.h \ diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp index 0cb4204..b22109b 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp @@ -280,7 +280,11 @@ QGraphicsWebView::QGraphicsWebView(QGraphicsItem* parent) QGraphicsWebView::~QGraphicsWebView() { if (d->page) { +#if QT_VERSION >= 0x040600 + d->page->d->view.clear(); +#else d->page->d->view = 0; +#endif d->page->d->client = 0; // unset the page client } @@ -330,6 +334,28 @@ bool QGraphicsWebView::sceneEvent(QEvent* event) /*! \reimp */ +QVariant QGraphicsWebView::itemChange(GraphicsItemChange change, const QVariant& value) +{ + switch (change) { + // Differently from QWebView, it is interesting to QGraphicsWebView to handle + // post mouse cursor change notifications. Reason: 'ItemCursorChange' is sent + // as the first action in QGraphicsItem::setCursor implementation, and at that + // item widget's cursor has not been effectively changed yet. + // After cursor is properly set (at 'ItemCursorHasChanged' emission time), we + // fire 'CursorChange'. + case ItemCursorChange: + return value; + case ItemCursorHasChanged: + QEvent event(QEvent::CursorChange); + QApplication::sendEvent(this, &event); + return value; + } + + return QGraphicsWidget::itemChange(change, value); +} + +/*! \reimp +*/ bool QGraphicsWebView::event(QEvent* event) { // Re-implemented in order to allows fixing event-related bugs in patch releases. diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h index 26f7374..43cf59a 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h @@ -85,6 +85,7 @@ public: virtual void setGeometry(const QRectF& rect); virtual void updateGeometry(); virtual void paint(QPainter*, const QStyleOptionGraphicsItem* options, QWidget* widget = 0); + virtual QVariant itemChange(GraphicsItemChange change, const QVariant& value); virtual bool event(QEvent*); public Q_SLOTS: diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp index 5b83870..6305d10 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp @@ -202,23 +202,9 @@ bool QWebElement::isNull() const \sa findFirst() */ -QList<QWebElement> QWebElement::findAll(const QString &selectorQuery) const +QWebElementCollection QWebElement::findAll(const QString &selectorQuery) const { - QList<QWebElement> elements; - if (!m_element) - return elements; - - ExceptionCode exception = 0; // ### - RefPtr<NodeList> nodes = m_element->querySelectorAll(selectorQuery, exception); - if (!nodes) - return elements; - - for (unsigned i = 0; i < nodes->length(); ++i) { - WebCore::Node* n = nodes->item(i); - elements.append(QWebElement(static_cast<Element*>(n))); - } - - return elements; + return QWebElementCollection(*this, selectorQuery); } /*! @@ -682,7 +668,7 @@ static bool setupScriptContext(WebCore::Element* element, JSC::JSValue& thisValu if (!scriptController) return false; - state = scriptController->globalObject()->globalExec(); + state = scriptController->globalObject(mainThreadNormalWorld())->globalExec(); if (!state) return false; @@ -1137,7 +1123,7 @@ QWebElement QWebElement::clone() const The element is still valid after removal, and can be inserted into other parts of the document. - \sa removeChildren(), removeFromDocument() + \sa removeAllChildren(), removeFromDocument() */ QWebElement &QWebElement::takeFromDocument() { @@ -1153,7 +1139,7 @@ QWebElement &QWebElement::takeFromDocument() /*! Removes this element from the document and makes it a null element. - \sa removeChildren(), takeFromDocument() + \sa removeAllChildren(), takeFromDocument() */ void QWebElement::removeFromDocument() { @@ -1171,7 +1157,7 @@ void QWebElement::removeFromDocument() \sa removeFromDocument(), takeFromDocument() */ -void QWebElement::removeChildren() +void QWebElement::removeAllChildren() { if (!m_element) return; @@ -1450,3 +1436,391 @@ void QWebElement::render(QPainter* painter) context.restore(); } +class QWebElementCollectionPrivate : public QSharedData +{ +public: + static QWebElementCollectionPrivate* create(const PassRefPtr<Node> &context, const QString &query); + + RefPtr<NodeList> m_result; + +private: + inline QWebElementCollectionPrivate() {} +}; + +QWebElementCollectionPrivate* QWebElementCollectionPrivate::create(const PassRefPtr<Node> &context, const QString &query) +{ + if (!context) + return 0; + + // Let WebKit do the hard work hehehe + ExceptionCode exception = 0; // ### + RefPtr<NodeList> nodes = context->querySelectorAll(query, exception); + if (!nodes) + return 0; + + QWebElementCollectionPrivate* priv = new QWebElementCollectionPrivate; + priv->m_result = nodes; + return priv; +} + +/*! + \class QWebElementCollection + \since 4.6 + \brief The QWebElementCollection class represents a collection of web elements. + \preliminary + + Elements in a document can be selected using QWebElement::findAll() or using the + QWebElement constructor. The collection is composed by choosing all elements in the + document that match a specified CSS selector expression. + + The number of selected elements is provided through the count() property. Individual + elements can be retrieved by index using at(). + + It is also possible to iterate through all elements in the collection using Qt's foreach + macro: + + \code + QWebElementCollection collection = document.findAll("p"); + foreach (QWebElement paraElement, collection) { + ... + } + \endcode +*/ + +/*! + Constructs an empty collection. +*/ +QWebElementCollection::QWebElementCollection() +{ +} + +/*! + Constructs a copy of \a other. +*/ +QWebElementCollection::QWebElementCollection(const QWebElementCollection &other) + : d(other.d) +{ +} + +/*! + Constructs a collection of elements from the list of child elements of \a contextElement that + match the specified CSS selector \a query. +*/ +QWebElementCollection::QWebElementCollection(const QWebElement &contextElement, const QString &query) +{ + d = QExplicitlySharedDataPointer<QWebElementCollectionPrivate>(QWebElementCollectionPrivate::create(contextElement.m_element, query)); +} + +/*! + Assigns \a other to this collection and returns a reference to this collection. +*/ +QWebElementCollection &QWebElementCollection::operator=(const QWebElementCollection &other) +{ + d = other.d; + return *this; +} + +/*! + Destroys the collection. +*/ +QWebElementCollection::~QWebElementCollection() +{ +} + +/*! \fn QWebElementCollection &QWebElementCollection::operator+=(const QWebElementCollection &other) + + Appends the items of the \a other list to this list and returns a + reference to this list. + + \sa operator+(), append() +*/ + +/*! + Returns a collection that contains all the elements of this collection followed + by all the elements in the \a other collection. Duplicates may occur in the result. + + \sa operator+=() +*/ +QWebElementCollection QWebElementCollection::operator+(const QWebElementCollection &other) const +{ + QWebElementCollection n = *this; n.d.detach(); n += other; return n; +} + +/*! + Extends the collection by appending all items of \a other. + + The resulting collection may include duplicate elements. + + \sa operator+=() +*/ +void QWebElementCollection::append(const QWebElementCollection &other) +{ + if (!d) { + *this = other; + return; + } + if (!other.d) + return; + Vector<RefPtr<Node> > nodes; + RefPtr<NodeList> results[] = { d->m_result, other.d->m_result }; + nodes.reserveInitialCapacity(results[0]->length() + results[1]->length()); + + for (int i = 0; i < 2; ++i) { + int j = 0; + Node* n = results[i]->item(j); + while (n) { + nodes.append(n); + n = results[i]->item(++j); + } + } + + d->m_result = StaticNodeList::adopt(nodes); +} + +/*! + Returns the number of elements in the collection. +*/ +int QWebElementCollection::count() const +{ + if (!d) + return 0; + return d->m_result->length(); +} + +/*! + Returns the element at index position \a i in the collection. +*/ +QWebElement QWebElementCollection::at(int i) const +{ + if (!d) + return QWebElement(); + Node* n = d->m_result->item(i); + return QWebElement(static_cast<Element*>(n)); +} + +/*! + \fn const QWebElement QWebElementCollection::operator[](int position) const + + Returns the element at the specified \a position in the collection. +*/ + +/*! \fn QWebElement QWebElementCollection::first() const + + Returns the first element in the collection. + + \sa last(), operator[](), at(), count() +*/ + +/*! \fn QWebElement QWebElementCollection::last() const + + Returns the last element in the collection. + + \sa first(), operator[](), at(), count() +*/ + +/*! + Returns a QList object with the elements contained in this collection. +*/ +QList<QWebElement> QWebElementCollection::toList() const +{ + if (!d) + return QList<QWebElement>(); + QList<QWebElement> elements; + int i = 0; + Node* n = d->m_result->item(i); + while (n) { + if (n->isElementNode()) + elements.append(QWebElement(static_cast<Element*>(n))); + n = d->m_result->item(++i); + } + return elements; +} + +/*! + \fn QWebElementCollection::const_iterator QWebElementCollection::begin() const + + Returns an STL-style iterator pointing to the first element in the collection. + + \sa end() +*/ + +/*! + \fn QWebElementCollection::const_iterator QWebElementCollection::end() const + + Returns an STL-style iterator pointing to the imaginary element after the + last element in the list. + + \sa begin() +*/ + +/*! + \class QWebElementCollection::const_iterator + \since 4.6 + \brief The QWebElementCollection::const_iterator class provides an STL-style const iterator for QWebElementCollection. + + QWebElementCollection provides STL style const iterators for fast low-level access to the elements. + + QWebElementCollection::const_iterator allows you to iterate over a QWebElementCollection. + + The default QWebElementCollection::const_iterator constructors creates an uninitialized iterator. You must initialize + it using a QWebElementCollection function like QWebElementCollection::begin() or QWebElementCollection::end() before you + can start iterating. +*/ + +/*! + \fn QWebElementCollection::const_iterator::const_iterator() + + Constructs an uninitialized iterator. + + Functions like operator*() and operator++() should not be called on + an uninitialized iterator. Use operator=() to assign a value + to it before using it. + + \sa QWebElementCollection::begin() +*/ + +/*! + \fn QWebElementCollection::const_iterator::const_iterator(const const_iterator &other) + + Constructs a copy of \a other. +*/ + +/*! + \fn QWebElementCollection::const_iterator::const_iterator(const QWebElementCollection *collection, int index) + \internal +*/ + +/*! + \fn const QWebElement QWebElementCollection::const_iterator::operator*() const + + Returns the current element. +*/ + +/*! + \fn bool QWebElementCollection::const_iterator::operator==(const const_iterator &other) const + + Returns true if \a other points to the same item as this iterator; + otherwise returns false. + + \sa operator!=() +*/ + +/*! + \fn bool QWebElementCollection::const_iterator::operator!=(const const_iterator &other) const + + Returns true if \a other points to a different element than this; + iterator; otherwise returns false. + + \sa operator==() +*/ + +/*! + \fn QWebElementCollection::const_iterator &QWebElementCollection::const_iterator::operator++() + + The prefix ++ operator (\c{++it}) advances the iterator to the next element in the collection + and returns an iterator to the new current element. + + Calling this function on QWebElementCollection::end() leads to undefined results. + + \sa operator--() +*/ + +/*! + \fn QWebElementCollection::const_iterator QWebElementCollection::const_iterator::operator++(int) + + \overload + + The postfix ++ operator (\c{it++}) advances the iterator to the next element in the collection + and returns an iterator to the previously current element. + + Calling this function on QWebElementCollection::end() leads to undefined results. +*/ + +/*! + \fn QWebElementCollection::const_iterator &QWebElementCollection::const_iterator::operator--() + + The prefix -- operator (\c{--it}) makes the preceding element current and returns an + iterator to the new current element. + + Calling this function on QWebElementCollection::begin() leads to undefined results. + + \sa operator++() +*/ + +/*! + \fn QWebElementCollection::const_iterator QWebElementCollection::const_iterator::operator--(int) + + \overload + + The postfix -- operator (\c{it--}) makes the preceding element current and returns + an iterator to the previously current element. +*/ + +/*! + \fn QWebElementCollection::const_iterator &QWebElementCollection::const_iterator::operator+=(int j) + + Advances the iterator by \a j elements. If \a j is negative, the iterator goes backward. + + \sa operator-=(), operator+() +*/ + +/*! + \fn QWebElementCollection::const_iterator &QWebElementCollection::const_iterator::operator-=(int j) + + Makes the iterator go back by \a j elements. If \a j is negative, the iterator goes forward. + + \sa operator+=(), operator-() +*/ + +/*! + \fn QWebElementCollection::const_iterator QWebElementCollection::const_iterator::operator+(int j) const + + Returns an iterator to the element at \a j positions forward from this iterator. If \a j + is negative, the iterator goes backward. + + \sa operator-(), operator+=() +*/ + +/*! + \fn QWebElementCollection::const_iterator QWebElementCollection::const_iterator::operator-(int j) const + + Returns an iterator to the element at \a j positiosn backward from this iterator. + If \a j is negative, the iterator goes forward. + + \sa operator+(), operator-=() +*/ + +/*! + \fn int QWebElementCollection::const_iterator::operator-(const_iterator other) const + + Returns the number of elements between the item point to by \a other + and the element pointed to by this iterator. +*/ + +/*! + \fn bool QWebElementCollection::const_iterator::operator<(const const_iterator &other) const + + Returns true if the element pointed to by this iterator is less than the element pointed to + by the \a other iterator. +*/ + +/*! + \fn bool QWebElementCollection::const_iterator::operator<=(const const_iterator &other) const + + Returns true if the element pointed to by this iterator is less than or equal to the + element pointed to by the \a other iterator. +*/ + +/*! + \fn bool QWebElementCollection::const_iterator::operator>(const const_iterator &other) const + + Returns true if the element pointed to by this iterator is greater than the element pointed to + by the \a other iterator. +*/ + +/*! + \fn bool QWebElementCollection::const_iterator::operator>=(const const_iterator &other) const + + Returns true if the element pointed to by this iterator is greater than or equal to the + element pointed to by the \a other iterator. +*/ diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h index 351ccb4..a18d262 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h @@ -36,6 +36,7 @@ class QPainter; QT_END_NAMESPACE class QWebFrame; +class QWebElementCollection; class QWebElementPrivate; class QWEBKIT_EXPORT QWebElement { @@ -50,8 +51,8 @@ public: bool isNull() const; - QList<QWebElement> findAll(const QString& selectorQuery) const; - QWebElement findFirst(const QString& selectorQuery) const; + QWebElementCollection findAll(const QString &selectorQuery) const; + QWebElement findFirst(const QString &selectorQuery) const; void setPlainText(const QString& text); QString toPlainText() const; @@ -96,7 +97,7 @@ public: QWebElement document() const; QWebFrame *webFrame() const; - // TODO: Add QList<QWebElement> overloads + // TODO: Add QWebElementCollection overloads // docs need example snippet void appendInside(const QString& markup); void appendInside(const QWebElement& element); @@ -125,7 +126,7 @@ public: QWebElement clone() const; QWebElement& takeFromDocument(); void removeFromDocument(); - void removeChildren(); + void removeAllChildren(); QVariant evaluateJavaScript(const QString& scriptSource); @@ -146,6 +147,7 @@ private: static QWebElement enclosingElement(WebCore::Node*); friend class QWebFrame; + friend class QWebElementCollection; friend class QWebHitTestResult; friend class QWebHitTestResultPrivate; friend class QWebPage; @@ -154,4 +156,70 @@ private: WebCore::Element* m_element; }; +class QWebElementCollectionPrivate; + +class QWEBKIT_EXPORT QWebElementCollection +{ +public: + QWebElementCollection(); + QWebElementCollection(const QWebElement &contextElement, const QString &query); + QWebElementCollection(const QWebElementCollection &); + QWebElementCollection &operator=(const QWebElementCollection &); + ~QWebElementCollection(); + + QWebElementCollection operator+(const QWebElementCollection &other) const; + inline QWebElementCollection &operator+=(const QWebElementCollection &other) + { + append(other); return *this; + } + + void append(const QWebElementCollection &collection); + + int count() const; + QWebElement at(int i) const; + + inline QWebElement first() const { return at(0); } + inline QWebElement last() const { return at(count() - 1); } + + QList<QWebElement> toList() const; + + class const_iterator { + public: + int i; + const QWebElementCollection *s; + + inline const_iterator(const QWebElementCollection *collection, int index) : i(index), s(collection) {} + inline const_iterator(const const_iterator &o) : i(o.i), s(o.s) {} + + inline const QWebElement operator*() const { return s->at(i); } + + inline bool operator==(const const_iterator& o) const { return i == o.i && s == o.s; } + inline bool operator!=(const const_iterator& o) const { return i != o.i || s != o.s; } + inline bool operator<(const const_iterator& o) const { return i < o.i; } + inline bool operator<=(const const_iterator& o) const { return i <= o.i; } + inline bool operator>(const const_iterator& o) const { return i > o.i; } + inline bool operator>=(const const_iterator& o) const { return i >= o.i; } + + inline const_iterator &operator++() { ++i; return *this; } + inline const_iterator operator++(int) { const_iterator n(s, i); ++i; return n; } + inline const_iterator &operator--() { i--; return *this; } + inline const_iterator operator--(int) { const_iterator n(s, i); i--; return n; } + inline const_iterator &operator+=(int j) { i += j; return *this; } + inline const_iterator &operator-=(int j) { i -= j; return *this; } + inline const_iterator operator+(int j) const { return const_iterator(s, i + j); } + inline const_iterator operator-(int j) const { return const_iterator(s, i - j); } + inline int operator-(const_iterator j) const { return i - j.i; } + private: + inline const_iterator() : i(0), s(0) {} + }; + friend class const_iterator; + + inline const_iterator begin() const { return const_iterator(this, 0); } + inline const_iterator end() const { return const_iterator(this, count()); } + inline QWebElement operator[](int i) const { return at(i); } + +private: + QExplicitlySharedDataPointer<QWebElementCollectionPrivate> d; +}; + #endif // QWEBELEMENT_H diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp index d2c324d..17a0118 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp @@ -185,6 +185,17 @@ void QWEBKIT_EXPORT qt_drt_garbageCollector_collectOnAlternateThread(bool waitUn gcController().garbageCollectOnAlternateThreadForDebugging(waitUntilDone); } +// 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(); +} + QWebFrameData::QWebFrameData(WebCore::Page* parentPage, WebCore::Frame* parentFrame, WebCore::HTMLFrameOwnerElement* ownerFrameElement, const WebCore::String& frameName) @@ -232,7 +243,7 @@ WebCore::Scrollbar* QWebFramePrivate::verticalScrollBar() const return frame->view()->verticalScrollbar(); } -void QWebFramePrivate::renderPrivate(QPainter *painter, const QRegion &clip) +void QWebFramePrivate::renderPrivate(QPainter *painter, QWebFrame::RenderLayer layer, const QRegion &clip) { if (!frame->view() || !frame->contentRenderer()) return; @@ -241,24 +252,58 @@ void QWebFramePrivate::renderPrivate(QPainter *painter, const QRegion &clip) if (vector.isEmpty()) return; - WebCore::FrameView* view = frame->view(); - view->layoutIfNeededRecursive(); - GraphicsContext context(painter); + if (context.paintingDisabled() && !context.updatingControlTints()) + return; - if (clipRenderToViewport) - view->paint(&context, vector.first()); - else - view->paintContents(&context, vector.first()); + WebCore::FrameView* view = frame->view(); + view->layoutIfNeededRecursive(); - for (int i = 1; i < vector.size(); ++i) { + for (int i = 0; i < vector.size(); ++i) { const QRect& clipRect = vector.at(i); + QRect intersectedRect = clipRect.intersected(view->frameRect()); + painter->save(); painter->setClipRect(clipRect, Qt::IntersectClip); - if (clipRenderToViewport) - view->paint(&context, clipRect); - else - view->paintContents(&context, clipRect); + + int x = view->x(); + int y = view->y(); + + if (layer & QWebFrame::ContentsLayer) { + context.save(); + + int scrollX = view->scrollX(); + int scrollY = view->scrollY(); + + QRect rect = intersectedRect; + context.translate(x, y); + rect.translate(-x, -y); + context.translate(-scrollX, -scrollY); + rect.translate(scrollX, scrollY); + context.clip(view->visibleContentRect()); + + view->paintContents(&context, rect); + + context.restore(); + } + + if (layer & QWebFrame::ScrollBarLayer + && !view->scrollbarsSuppressed() + && (view->horizontalScrollbar() || view->verticalScrollbar())) { + context.save(); + + QRect rect = intersectedRect; + context.translate(x, y); + rect.translate(-x, -y); + + view->paintScrollbars(&context, rect); + + context.restore(); + } + + if (layer & QWebFrame::PanIconLayer) + view->paintPanScrollIcon(&context); + painter->restore(); } } @@ -386,7 +431,7 @@ void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object return; JSC::JSLock lock(JSC::SilenceAssertionsOnly); - JSDOMWindow* window = toJSDOMWindow(d->frame); + JSDOMWindow* window = toJSDOMWindow(d->frame, mainThreadNormalWorld()); JSC::Bindings::RootObject* root = d->frame->script()->bindingRootObject(); if (!window) { qDebug() << "Warning: couldn't get window object"; @@ -689,6 +734,11 @@ void QWebFrame::load(const QNetworkRequest &req, case QNetworkAccessManager::PostOperation: request.setHTTPMethod("POST"); break; +#if QT_VERSION >= 0x040600 + case QNetworkAccessManager::DeleteOperation: + request.setHTTPMethod("DELETE"); + break; +#endif case QNetworkAccessManager::UnknownOperation: // eh? break; @@ -946,44 +996,37 @@ void QWebFrame::setScrollPosition(const QPoint &pos) } /*! - Render the frame into \a painter clipping to \a clip. + \since 4.6 + Render the \a layer of the frame using \a painter clipping to \a clip. \sa print() */ -void QWebFrame::render(QPainter *painter, const QRegion &clip) -{ - d->renderPrivate(painter, clip); -} -/*! - Render the frame into \a painter. -*/ -void QWebFrame::render(QPainter *painter) +void QWebFrame::render(QPainter* painter, RenderLayer layer, const QRegion& clip) { - if (!d->frame->view()) - return; - - d->renderPrivate(painter, QRegion(d->frame->view()->frameRect())); + if (!clip.isEmpty()) + d->renderPrivate(painter, layer, clip); + else if (d->frame->view()) + d->renderPrivate(painter, layer, QRegion(d->frame->view()->frameRect())); } /*! - \since 4.6 - \property QWebFrame::clipRenderToViewport - - Returns true if render will clip content to viewport; otherwise returns false. + Render the frame into \a painter clipping to \a clip. */ -bool QWebFrame::clipRenderToViewport() const +void QWebFrame::render(QPainter *painter, const QRegion &clip) { - return d->clipRenderToViewport; + d->renderPrivate(painter, AllLayers, clip); } /*! - \since 4.6 - Sets whether the content of a frame will be clipped to viewport when rendered. + Render the frame into \a painter. */ -void QWebFrame::setClipRenderToViewport(bool clipRenderToViewport) +void QWebFrame::render(QPainter *painter) { - d->clipRenderToViewport = clipRenderToViewport; + if (!d->frame->view()) + return; + + d->renderPrivate(painter, AllLayers, QRegion(d->frame->view()->frameRect())); } /*! @@ -1114,7 +1157,7 @@ QWebElement QWebFrame::documentElement() const \sa QWebElement::findAll() */ -QList<QWebElement> QWebFrame::findAllElements(const QString &selectorQuery) const +QWebElementCollection QWebFrame::findAllElements(const QString &selectorQuery) const { return documentElement().findAll(selectorQuery); } @@ -1264,7 +1307,7 @@ QVariant QWebFrame::evaluateJavaScript(const QString& scriptSource) if (proxy) { JSC::JSValue v = d->frame->script()->executeScript(ScriptSourceCode(scriptSource)).jsValue(); int distance = 0; - rc = JSC::Bindings::convertValueToQVariant(proxy->globalObject()->globalExec(), v, QMetaType::Void, &distance); + rc = JSC::Bindings::convertValueToQVariant(proxy->globalObject(mainThreadNormalWorld())->globalExec(), v, QMetaType::Void, &distance); } return rc; } @@ -1402,7 +1445,6 @@ QWebHitTestResultPrivate::QWebHitTestResultPrivate(const WebCore::HitTestResult if (!hitTest.innerNode()) return; pos = hitTest.point(); - boundingRect = hitTest.boundingBox(); WebCore::TextDirection dir; title = hitTest.title(dir); linkText = hitTest.textContent(); @@ -1412,6 +1454,7 @@ QWebHitTestResultPrivate::QWebHitTestResultPrivate(const WebCore::HitTestResult imageUrl = hitTest.absoluteImageURL(); innerNode = hitTest.innerNode(); innerNonSharedNode = hitTest.innerNonSharedNode(); + boundingRect = innerNonSharedNode ? innerNonSharedNode->renderer()->absoluteBoundingBoxRect(true) : IntRect(); WebCore::Image *img = hitTest.image(); if (img) { QPixmap *pix = img->nativeImageForCurrentFrame(); @@ -1659,4 +1702,3 @@ QWebFrame *QWebHitTestResult::frame() const return 0; return d->frame; } - diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h index 55c73b4..08285f8 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h @@ -50,6 +50,7 @@ class QWebHitTestResult; class QWebHistoryItem; class QWebSecurityOrigin; class QWebElement; +class QWebElementCollection; namespace WebCore { class WidgetPrivate; @@ -112,7 +113,6 @@ class QWEBKIT_EXPORT QWebFrame : public QObject { Q_PROPERTY(QIcon icon READ icon) Q_PROPERTY(QSize contentsSize READ contentsSize) Q_PROPERTY(QPoint scrollPosition READ scrollPosition WRITE setScrollPosition) - Q_PROPERTY(bool clipRenderToViewport READ clipRenderToViewport WRITE setClipRenderToViewport) Q_PROPERTY(bool focus READ hasFocus) private: QWebFrame(QWebPage *parent, QWebFrameData *frameData); @@ -165,10 +165,17 @@ public: QPoint scrollPosition() const; void setScrollPosition(const QPoint &pos); - void render(QPainter *painter, const QRegion &clip); - void render(QPainter *painter); - bool clipRenderToViewport() const; - void setClipRenderToViewport(bool clipRenderToViewport); + enum RenderLayer { + ContentsLayer = 0x10, + ScrollBarLayer = 0x20, + PanIconLayer = 0x40, + + AllLayers = 0xff + }; + + void render(QPainter*); + void render(QPainter*, const QRegion& clip); + void render(QPainter*, RenderLayer layer, const QRegion& clip = QRegion()); void setTextSizeMultiplier(qreal factor); qreal textSizeMultiplier() const; @@ -184,7 +191,7 @@ public: QSize contentsSize() const; QWebElement documentElement() const; - QList<QWebElement> findAllElements(const QString &selectorQuery) const; + QWebElementCollection findAllElements(const QString &selectorQuery) const; QWebElement findFirstElement(const QString &selectorQuery) const; QWebHitTestResult hitTestContent(const QPoint &pos) const; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h index 632f83a..081e65d 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h @@ -70,7 +70,6 @@ public: , allowsScrolling(true) , marginWidth(-1) , marginHeight(-1) - , clipRenderToViewport(true) {} void init(QWebFrame* qframe, QWebFrameData* frameData); @@ -82,7 +81,7 @@ public: static WebCore::Frame* core(QWebFrame*); static QWebFrame* kit(WebCore::Frame*); - void renderPrivate(QPainter *painter, const QRegion &clip); + void renderPrivate(QPainter*, QWebFrame::RenderLayer, const QRegion& clip); QWebFrame *q; Qt::ScrollBarPolicy horizontalScrollBarPolicy; @@ -94,7 +93,6 @@ public: bool allowsScrolling; int marginWidth; int marginHeight; - bool clipRenderToViewport; }; class QWebHitTestResultPrivate { diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp index 5752d66..d852012 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp @@ -31,6 +31,11 @@ #include <QSharedData> #include <QDebug> +enum { + InitialHistoryVersion = 1, + DefaultHistoryVersion = InitialHistoryVersion +}; + /*! \class QWebHistoryItem \since 4.4 @@ -226,7 +231,8 @@ bool QWebHistoryItem::isValid() const number of items is given by count(), and the history can be cleared with the clear() function. - QWebHistory's state can be saved with saveState() and loaded with restoreState(). + QWebHistory's state can be saved to a QDataStream using the >> operator and loaded + by using the << operator. \sa QWebHistoryItem, QWebHistoryInterface, QWebPage */ @@ -475,135 +481,72 @@ void QWebHistory::setMaximumItemCount(int count) } /*! - \enum QWebHistory::HistoryStateVersion + \since 4.6 + \fn QDataStream& operator<<(QDataStream& stream, const QWebHistory& history) + \relates QWebHistory - This enum describes the versions available for QWebHistory's saveState() function: + \brief The operator<< function streams a history into a data stream. - \value HistoryVersion_1 Version 1 (Qt 4.6) - \value DefaultHistoryVersion The current default version in 1. + It saves the \a history into the specified \a stream. */ +QDataStream& operator<<(QDataStream& target, const QWebHistory& history) +{ + QWebHistoryPrivate* d = history.d; + + int version = DefaultHistoryVersion; + + target << version; + target << history.count() << history.currentItemIndex(); + + const WebCore::HistoryItemVector &items = d->lst->entries(); + for (unsigned i = 0; i < items.size(); i++) + items[i].get()->saveState(target, version); + + return target; +} + /*! + \fn QDataStream& operator>>(QDataStream& stream, QWebHistory& history) + \relates QWebHistory \since 4.6 - Restores the state of QWebHistory from the given \a buffer. Returns true - if the history was successfully restored; otherwise returns false. + \brief The operator>> function loads a history from a data stream. - \sa saveState() + Loads a QWebHistory from the specified \a stream into the given \a history. */ -bool QWebHistory::restoreState(const QByteArray& buffer) + +QDataStream& operator>>(QDataStream& source, QWebHistory& history) { - QDataStream stream(buffer); + QWebHistoryPrivate* d = history.d; + int version; - bool result = false; - stream >> version; - switch (version) { - case HistoryVersion_1: { + source >> version; + + if (version == 1) { int count; int currentIndex; - stream >> count >> currentIndex; + source >> count >> currentIndex; - clear(); + history.clear(); // only if there are elements if (count) { // after clear() is new clear HistoryItem (at the end we had to remove it) - WebCore::HistoryItem *nullItem = d->lst->currentItem(); - for (int i = 0;i < count;i++) { + WebCore::HistoryItem* nullItem = d->lst->currentItem(); + for (int i = 0; i < count; i++) { WTF::PassRefPtr<WebCore::HistoryItem> item = WebCore::HistoryItem::create(); - item->restoreState(stream, version); + item->restoreState(source, version); d->lst->addItem(item); } d->lst->removeItem(nullItem); - goToItem(itemAt(currentIndex)); - result = stream.status() == QDataStream::Ok; + history.goToItem(history.itemAt(currentIndex)); } - break; - } - default: {} // result is false; } d->page()->updateNavigationActions(); - return result; -}; - -/*! - \since 4.6 - Saves the state of this QWebHistory into a QByteArray. - - Saves the current state of this QWebHistory. The version number, \a version, is - stored as part of the data. - - To restore the saved state, pass the return value to restoreState(). - - \sa restoreState() -*/ -QByteArray QWebHistory::saveState(HistoryStateVersion version) const -{ - QByteArray buffer; - QDataStream stream(&buffer, QIODevice::WriteOnly); - stream << version; - - switch (version) { - case HistoryVersion_1: { - stream << count() << currentItemIndex(); - - const WebCore::HistoryItemVector &items = d->lst->entries(); - for (unsigned i = 0; i < items.size(); i++) - items[i].get()->saveState(stream, version); - - if (stream.status() != QDataStream::Ok) - buffer = QByteArray(); // make buffer isNull()==true and isEmpty()==true - break; - } - default: - buffer.clear(); - - } - - return buffer; -} - -/*! - \since 4.6 - \fn QDataStream& operator<<(QDataStream& stream, const QWebHistory& history) - \relates QWebHistory - - \brief The operator<< function streams a history into a data stream. - - It saves the \a history into the specified \a stream. This is a - convenience function and is equivalent to calling the saveState() - method. - - \sa QWebHistory::saveState() -*/ - -QDataStream& operator<<(QDataStream& stream, const QWebHistory& history) -{ - return stream << history.saveState(); -} - -/*! - \fn QDataStream& operator>>(QDataStream& stream, QWebHistory& history) - \relates QWebHistory - \since 4.6 - - \brief The operator>> function loads a history from a data stream. - - Loads a QWebHistory from the specified \a stream into the given \a history. - This is a convenience function and it is equivalent to calling the restoreState() - method. - - \sa QWebHistory::restoreState() -*/ - -QDataStream& operator>>(QDataStream& stream, QWebHistory& history) -{ - QByteArray buffer; - stream >> buffer; - history.restoreState(buffer); - return stream; + return source; } QWebPagePrivate* QWebHistoryPrivate::page() diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.h index e46f124..cce4553 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.h @@ -42,9 +42,6 @@ public: QWebHistoryItem &operator=(const QWebHistoryItem &other); ~QWebHistoryItem(); - //bool restoreState(QByteArray& buffer); - //QByteArray saveState(QWebHistory::HistoryStateVersion version = DefaultHistoryVersion) const; - QUrl originalUrl() const; QUrl url() const; @@ -69,22 +66,10 @@ private: QExplicitlySharedDataPointer<QWebHistoryItemPrivate> d; }; -//QWEBKIT_EXPORT QDataStream & operator<<(QDataStream& out,const QWebHistoryItem& hist); -//QWEBKIT_EXPORT QDataStream & operator>>(QDataStream& in,QWebHistoryItem& hist); - class QWebHistoryPrivate; class QWEBKIT_EXPORT QWebHistory { public: - enum HistoryStateVersion { - HistoryVersion_1, - /*, HistoryVersion_2, */ - DefaultHistoryVersion = HistoryVersion_1 - }; - - bool restoreState(const QByteArray& buffer); - QByteArray saveState(HistoryStateVersion version = DefaultHistoryVersion) const; - void clear(); QList<QWebHistoryItem> items() const; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp index 4578dc9..409e1a0 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp @@ -188,9 +188,3 @@ void QWebInspectorPrivate::adjustFrontendSize(const QSize& size) frontend->resize(size); } -/*! - \fn void QWebInspector::windowTitleChanged(const QString& newTitle); - - This is emitted to signal that this widget's title changed to \a newTitle. -*/ - diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.h index bb5bd64..a5c1ed5 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.h @@ -39,9 +39,6 @@ public: QSize sizeHint() const; bool event(QEvent*); -Q_SIGNALS: - void windowTitleChanged(const QString& newTitle); - protected: void resizeEvent(QResizeEvent* event); void showEvent(QShowEvent* event); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 764bfad..a1e131a 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -77,6 +77,8 @@ #include "LocalizedStrings.h" #include "Cache.h" #include "runtime/InitializeThreading.h" +#include "PageGroup.h" +#include "QWebPageClient.h" #include <QApplication> #include <QBasicTimer> @@ -106,6 +108,9 @@ #else #include "qwebnetworkinterface.h" #endif +#if defined(Q_WS_X11) +#include <QX11Info> +#endif using namespace WebCore; @@ -137,6 +142,95 @@ QString QWEBKIT_EXPORT qt_webpage_groupName(QWebPage* page) return page->handle()->page->groupName(); } +class QWebPageWidgetClient : public QWebPageClient { +public: + QWebPageWidgetClient(QWidget* view) + : view(view) + { + Q_ASSERT(view); + } + + virtual void scroll(int dx, int dy, const QRect&); + virtual void update(const QRect& dirtyRect); + virtual void setInputMethodEnabled(bool enable); +#if QT_VERSION >= 0x040600 + virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable); +#endif + +#ifndef QT_NO_CURSOR + virtual QCursor cursor() const; + virtual void updateCursor(const QCursor& cursor); +#endif + + virtual QPalette palette() const; + virtual int screenNumber() const; + virtual QWidget* ownerWidget() const; + + virtual QObject* pluginParent() const; + + QWidget* view; +}; + +void QWebPageWidgetClient::scroll(int dx, int dy, const QRect& rectToScroll) +{ + view->scroll(qreal(dx), qreal(dy), rectToScroll); +} + +void QWebPageWidgetClient::update(const QRect & dirtyRect) +{ + view->update(dirtyRect); +} + +void QWebPageWidgetClient::setInputMethodEnabled(bool enable) +{ + view->setAttribute(Qt::WA_InputMethodEnabled, enable); +} +#if QT_VERSION >= 0x040600 +void QWebPageWidgetClient::setInputMethodHint(Qt::InputMethodHint hint, bool enable) +{ + if (enable) + view->setInputMethodHints(view->inputMethodHints() | hint); + else + view->setInputMethodHints(view->inputMethodHints() & ~hint); +} +#endif +#ifndef QT_NO_CURSOR +QCursor QWebPageWidgetClient::cursor() const +{ + return view->cursor(); +} + +void QWebPageWidgetClient::updateCursor(const QCursor& cursor) +{ + view->setCursor(cursor); +} +#endif + +QPalette QWebPageWidgetClient::palette() const +{ + return view->palette(); +} + +int QWebPageWidgetClient::screenNumber() const +{ +#if defined(Q_WS_X11) + if (view) + return view->x11Info().screen(); +#endif + + return 0; +} + +QWidget* QWebPageWidgetClient::ownerWidget() const +{ + return view; +} + +QObject* QWebPageWidgetClient::pluginParent() const +{ + return view; +} + // Lookup table mapping QWebPage::WebActions to the associated Editor commands static const char* editorCommandWebActions[] = { @@ -262,7 +356,9 @@ static inline Qt::DropAction dragOpToDropAction(unsigned actions) QWebPagePrivate::QWebPagePrivate(QWebPage *qq) : q(qq) , client(0) +#if QT_VERSION < 0x040600 , view(0) +#endif , inspectorFrontend(0) , inspector(0) , inspectorIsInternalOnly(false) @@ -302,6 +398,8 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) history.d = new QWebHistoryPrivate(page->backForwardList()); memset(actions, 0, sizeof(actions)); + + PageGroup::setShouldTrackVisitedLinks(true); } QWebPagePrivate::~QWebPagePrivate() @@ -378,7 +476,7 @@ static QWebPage::WebAction webActionForContextMenuAction(WebCore::ContextMenuAct QMenu *QWebPagePrivate::createContextMenu(const WebCore::ContextMenu *webcoreMenu, const QList<WebCore::ContextMenuItem> *items, QBitArray *visitedWebActions) { - QMenu* menu = new QMenu(view); + QMenu* menu = new QMenu(q->view()); for (int i = 0; i < items->count(); ++i) { const ContextMenuItem &item = items->at(i); switch (item.type()) { @@ -759,13 +857,13 @@ void QWebPagePrivate::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev) void QWebPagePrivate::handleSoftwareInputPanel(Qt::MouseButton button) { #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - if (view && view->testAttribute(Qt::WA_InputMethodEnabled) + if (q->view() && q->view()->testAttribute(Qt::WA_InputMethodEnabled) && button == Qt::LeftButton && qApp->autoSipEnabled()) { QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( - view->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); + q->view()->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) { QEvent event(QEvent::RequestSoftwareInputPanel); - QApplication::sendEvent(view, &event); + QApplication::sendEvent(q->view(), &event); } } @@ -909,8 +1007,8 @@ void QWebPagePrivate::keyPressEvent(QKeyEvent *ev) if (!handled) { handled = true; QFont defaultFont; - if (view) - defaultFont = view->font(); + if (q->view()) + defaultFont = q->view()->font(); QFontMetrics fm(defaultFont); if (!handleScrolling(ev, frame)) { switch (ev->key()) { @@ -1665,8 +1763,17 @@ QWebHistory *QWebPage::history() const */ void QWebPage::setView(QWidget *view) { - if (d->view != 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)); } } @@ -1678,7 +1785,11 @@ void QWebPage::setView(QWidget *view) */ QWidget *QWebPage::view() const { +#if QT_VERSION < 0x040600 return d->view; +#else + return d->view.data(); +#endif } /*! @@ -1705,7 +1816,7 @@ void QWebPage::javaScriptAlert(QWebFrame *frame, const QString& msg) { Q_UNUSED(frame) #ifndef QT_NO_MESSAGEBOX - QMessageBox::information(d->view, tr("JavaScript Alert - %1").arg(mainFrame()->url().host()), msg, QMessageBox::Ok); + QMessageBox::information(view(), tr("JavaScript Alert - %1").arg(mainFrame()->url().host()), msg, QMessageBox::Ok); #endif } @@ -1721,7 +1832,7 @@ bool QWebPage::javaScriptConfirm(QWebFrame *frame, const QString& msg) #ifdef QT_NO_MESSAGEBOX return true; #else - return QMessageBox::Yes == QMessageBox::information(d->view, tr("JavaScript Confirm - %1").arg(mainFrame()->url().host()), msg, QMessageBox::Yes, QMessageBox::No); + return QMessageBox::Yes == QMessageBox::information(view(), tr("JavaScript Confirm - %1").arg(mainFrame()->url().host()), msg, QMessageBox::Yes, QMessageBox::No); #endif } @@ -1739,7 +1850,7 @@ bool QWebPage::javaScriptPrompt(QWebFrame *frame, const QString& msg, const QStr Q_UNUSED(frame) bool ok = false; #ifndef QT_NO_INPUTDIALOG - QString x = QInputDialog::getText(d->view, tr("JavaScript Prompt - %1").arg(mainFrame()->url().host()), msg, QLineEdit::Normal, defaultValue, &ok); + QString x = QInputDialog::getText(view(), tr("JavaScript Prompt - %1").arg(mainFrame()->url().host()), msg, QLineEdit::Normal, defaultValue, &ok); if (ok && result) *result = x; #endif @@ -1764,7 +1875,7 @@ bool QWebPage::shouldInterruptJavaScript() #ifdef QT_NO_MESSAGEBOX return false; #else - return QMessageBox::Yes == QMessageBox::information(d->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); + 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); #endif } @@ -1781,7 +1892,7 @@ bool QWebPage::shouldInterruptJavaScript() */ QWebPage *QWebPage::createWindow(WebWindowType type) { - QWebView *webView = qobject_cast<QWebView *>(d->view); + QWebView *webView = qobject_cast<QWebView *>(view()); if (webView) { QWebView *newView = webView->createWindow(type); if (newView) @@ -2764,7 +2875,7 @@ 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(d->view, QString::null); + QStringList names = QFileDialog::getOpenFileNames(view(), QString::null); static_cast<ChooseMultipleFilesExtensionReturn*>(output)->fileNames = names; return true; } @@ -2846,7 +2957,7 @@ QString QWebPage::chooseFile(QWebFrame *parentFrame, const QString& suggestedFil { Q_UNUSED(parentFrame) #ifndef QT_NO_FILEDIALOG - return QFileDialog::getOpenFileName(d->view, QString::null, suggestedFile); + return QFileDialog::getOpenFileName(view(), QString::null, suggestedFile); #else return QString::null; #endif @@ -3109,8 +3220,8 @@ QString QWebPage::userAgentForUrl(const QUrl& url) const // Language QLocale locale; - if (d->view) - locale = d->view->locale(); + if (view()) + locale = view()->locale(); QString name = locale.name(); name[2] = QLatin1Char('-'); ua.append(name); @@ -3397,16 +3508,6 @@ quint64 QWebPage::bytesReceived() const */ /*! - \since 4.6 - \fn void QWebPage::networkRequestStarted(QWebFrame* frame, QNetworkRequest* request); - \preliminary - - This signal is emitted when a \a frame of the current page requests a web resource. The application - may want to associate the \a request with the \a frame that initiated it by storing the \a frame - as an attribute of the \a request. -*/ - -/*! \fn QWebPagePrivate* QWebPage::handle() const \internal */ diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h index f2bbde0..f39209c 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h @@ -347,8 +347,6 @@ Q_SIGNALS: void saveFrameStateRequested(QWebFrame* frame, QWebHistoryItem* item); void restoreFrameStateRequested(QWebFrame* frame); - void networkRequestStarted(QWebFrame* frame, QNetworkRequest* request); - protected: virtual QWebPage *createWindow(WebWindowType type); virtual QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h index b9571fa..f0f842d 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h @@ -135,7 +135,12 @@ public: #ifndef QT_NO_UNDOSTACK QUndoStack *undoStack; #endif + +#if QT_VERSION >= 0x040600 + QWeakPointer<QWidget> view; +#else QWidget* view; +#endif bool insideOpenCall; quint64 m_totalBytes; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.cpp index 623895f..758e257 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.cpp @@ -18,7 +18,7 @@ */ #include "config.h" -#include "qwebplugindatabase.h" +#include "qwebplugindatabase_p.h" #include "PluginDatabase.h" #include "PluginPackage.h" @@ -26,6 +26,7 @@ using namespace WebCore; /*! + \internal \typedef QWebPluginInfo::MimeType \since 4.6 \brief Represents a single MIME type supported by a plugin. @@ -33,6 +34,7 @@ using namespace WebCore; /*! \class QWebPluginInfo + \internal \since 4.6 \brief The QWebPluginInfo class represents a single Netscape plugin. @@ -232,6 +234,7 @@ QWebPluginInfo &QWebPluginInfo::operator=(const QWebPluginInfo& other) /*! \class QWebPluginDatabase + \internal \since 4.6 \brief The QWebPluginDatabase class provides an interface for managing Netscape plugins used by WebKit in QWebPages. diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase_p.h index b22c3de..b22c3de 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase_p.h diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp index 7c44e37..2a225c5 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp @@ -30,6 +30,16 @@ 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(); +} + /*! \class QWebSecurityOrigin \since 4.5 @@ -239,21 +249,3 @@ QStringList QWebSecurityOrigin::localSchemes() } return list; } - -/*! - \since 4.6 - \internal -*/ -void QWebSecurityOrigin::whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains) -{ - SecurityOrigin::whiteListAccessFromOrigin(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains); -} - -/*! - \since 4.6 - \internal -*/ -void QWebSecurityOrigin::resetOriginAccessWhiteLists() -{ - SecurityOrigin::resetOriginAccessWhiteLists(); -} diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.h index 94b96f0..16f8bc1 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.h @@ -40,8 +40,6 @@ public: static void addLocalScheme(const QString& scheme); static void removeLocalScheme(const QString& scheme); static QStringList localSchemes(); - static void whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains); - static void resetOriginAccessWhiteLists(); ~QWebSecurityOrigin(); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp index ffa21e4..3052056 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp @@ -22,7 +22,7 @@ #include "qwebpage.h" #include "qwebpage_p.h" -#include "qwebplugindatabase.h" +#include "qwebplugindatabase_p.h" #include "Cache.h" #include "CrossOriginPreflightResultCache.h" @@ -627,7 +627,7 @@ QIcon QWebSettings::iconForUrl(const QUrl& url) /*! Returns the plugin database object. -*/ + QWebPluginDatabase *QWebSettings::pluginDatabase() { static QWebPluginDatabase* database = 0; @@ -635,6 +635,7 @@ QWebPluginDatabase *QWebSettings::pluginDatabase() database = new QWebPluginDatabase(); return database; } +*/ /*! Sets \a graphic to be drawn when QtWebKit needs to draw an image of the diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h index e68ea53..c958ae7 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h @@ -114,7 +114,7 @@ public: static void clearIconDatabase(); static QIcon iconForUrl(const QUrl &url); - static QWebPluginDatabase *pluginDatabase(); + //static QWebPluginDatabase *pluginDatabase(); static void setWebGraphic(WebGraphic type, const QPixmap &graphic); static QPixmap webGraphic(WebGraphic type); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index cb487ce..55ce1f7 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -32,11 +32,8 @@ #include "qprinter.h" #include "qdir.h" #include "qfile.h" -#if defined(Q_WS_X11) -#include <QX11Info> -#endif -class QWebViewPrivate : public QWebPageClient { +class QWebViewPrivate { public: QWebViewPrivate(QWebView *view) : view(view) @@ -46,24 +43,6 @@ public: Q_ASSERT(view); } - virtual void scroll(int dx, int dy, const QRect&); - virtual void update(const QRect& dirtyRect); - virtual void setInputMethodEnabled(bool enable); -#if QT_VERSION >= 0x040600 - virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable); -#endif - -#ifndef QT_NO_CURSOR - virtual QCursor cursor() const; - virtual void updateCursor(const QCursor& cursor); -#endif - - virtual QPalette palette() const; - virtual int screenNumber() const; - virtual QWidget* ownerWidget() const; - - virtual QObject* pluginParent() const; - void _q_pageDestroyed(); QWebView *view; @@ -72,66 +51,6 @@ public: QPainter::RenderHints renderHints; }; -void QWebViewPrivate::scroll(int dx, int dy, const QRect& rectToScroll) -{ - view->scroll(qreal(dx), qreal(dy), rectToScroll); -} - -void QWebViewPrivate::update(const QRect & dirtyRect) -{ - view->update(dirtyRect); -} - -void QWebViewPrivate::setInputMethodEnabled(bool enable) -{ - view->setAttribute(Qt::WA_InputMethodEnabled, enable); -} -#if QT_VERSION >= 0x040600 -void QWebViewPrivate::setInputMethodHint(Qt::InputMethodHint hint, bool enable) -{ - if (enable) - view->setInputMethodHints(view->inputMethodHints() | hint); - else - view->setInputMethodHints(view->inputMethodHints() & ~hint); -} -#endif -#ifndef QT_NO_CURSOR -QCursor QWebViewPrivate::cursor() const -{ - return view->cursor(); -} - -void QWebViewPrivate::updateCursor(const QCursor& cursor) -{ - view->setCursor(cursor); -} -#endif - -QPalette QWebViewPrivate::palette() const -{ - return view->palette(); -} - -int QWebViewPrivate::screenNumber() const -{ -#if defined(Q_WS_X11) - if (view) - return view->x11Info().screen(); -#endif - - return 0; -} - -QWidget* QWebViewPrivate::ownerWidget() const -{ - return view; -} - -QObject* QWebViewPrivate::pluginParent() const -{ - return view; -} - void QWebViewPrivate::_q_pageDestroyed() { page = 0; @@ -246,7 +165,12 @@ QWebView::QWebView(QWidget *parent) QWebView::~QWebView() { if (d->page) { +#if QT_VERSION >= 0x040600 + d->page->d->view.clear(); +#else d->page->d->view = 0; +#endif + delete d->page->d->client; d->page->d->client = 0; } @@ -292,7 +216,6 @@ void QWebView::setPage(QWebPage* page) d->page = page; if (d->page) { d->page->setView(this); - d->page->d->client = d; // set the page client d->page->setPalette(palette()); // #### connect signals QWebFrame *mainFrame = d->page->mainFrame(); @@ -324,79 +247,6 @@ void QWebView::setPage(QWebPage* page) } /*! - Returns a valid URL from a user supplied \a string if one can be deducted. - In the case that is not possible, an invalid QUrl() is returned. - - \since 4.6 - - Most applications that can browse the web, allow the user to input a URL - in the form of a plain string. This string can be manually typed into - a location bar, obtained from the clipboard, or passed in via command - line arguments. - - When the string is not already a valid URL, a best guess is performed, - making various web related assumptions. - - In the case the string corresponds to a valid file path on the system, - a file:// URL is constructed, using QUrl::fromLocalFile(). - - If that is not the case, an attempt is made to turn the string into a - http:// or ftp:// URL. The latter in the case the string starts with - 'ftp'. The result is then passed through QUrl's tolerant parser, and - in the case or success, a valid QUrl is returned, or else a QUrl(). - - \section1 Examples: - - \list - \o webkit.org becomes http://webkit.org - \o ftp.webkit.org becomes ftp://ftp.webkit.org - \o localhost becomes http://localhost - \o /home/user/test.html becomes file:///home/user/test.html (if exists) - \endlist - - \section2 Tips when dealing with URLs and strings: - - \list - \o When creating a QString from a QByteArray or a char*, always use - QString::fromUtf8(). - \o Do not use QUrl(string), nor QUrl::toString() anywhere where the URL might - be used, such as in the location bar, as those functions loose data. - Instead use QUrl::fromEncoded() and QUrl::toEncoded(), respectively. - \endlist - */ -QUrl QWebView::guessUrlFromString(const QString &string) -{ - QString trimmedString = string.trimmed(); - - // Check the most common case of a valid url with scheme and host first - QUrl url = QUrl::fromEncoded(trimmedString.toUtf8(), QUrl::TolerantMode); - if (url.isValid() && !url.scheme().isEmpty() && !url.host().isEmpty()) - return url; - - // Absolute files that exists - if (QDir::isAbsolutePath(trimmedString) && QFile::exists(trimmedString)) - return QUrl::fromLocalFile(trimmedString); - - // If the string is missing the scheme or the scheme is not valid prepend a scheme - QString scheme = url.scheme(); - if (scheme.isEmpty() || scheme.contains(QLatin1Char('.')) || scheme == QLatin1String("localhost")) { - // Do not do anything for strings such as "foo", only "foo.com" - int dotIndex = trimmedString.indexOf(QLatin1Char('.')); - if (dotIndex != -1 || trimmedString.startsWith(QLatin1String("localhost"))) { - const QString hostscheme = trimmedString.left(dotIndex).toLower(); - QByteArray scheme = (hostscheme == QLatin1String("ftp")) ? "ftp" : "http"; - trimmedString = QLatin1String(scheme) + QLatin1String("://") + trimmedString; - } - url = QUrl::fromEncoded(trimmedString.toUtf8(), QUrl::TolerantMode); - } - - if (url.isValid()) - return url; - - return QUrl(); -} - -/*! Loads the specified \a url and displays it. \note The view remains the same until enough data has arrived to display the new \a url. @@ -684,24 +534,38 @@ qreal QWebView::textSizeMultiplier() const return page()->mainFrame()->textSizeMultiplier(); } -#if !defined(Q_OS_SYMBIAN) /*! \property QWebView::renderHints \since 4.6 \brief the default render hints for the view - These hints are used to initialize QPainter before painting the web page. + These hints are used to initialize QPainter before painting the Web page. QPainter::TextAntialiasing is enabled by default. + \note This property is not available on Symbian. However, the getter and + setter functions can still be used directly. + + \sa QPainter::renderHints() +*/ + +/*! + \since 4.6 + Returns the render hints used by the view to render content. + \sa QPainter::renderHints() */ -#endif QPainter::RenderHints QWebView::renderHints() const { return d->renderHints; } +/*! + \since 4.6 + Sets the render hints used by the view to the specified \a hints. + + \sa QPainter::setRenderHints() +*/ void QWebView::setRenderHints(QPainter::RenderHints hints) { if (hints == d->renderHints) @@ -711,11 +575,11 @@ void QWebView::setRenderHints(QPainter::RenderHints hints) } /*! - If \a enabled is true, the render hint \a hint is enabled; otherwise it - is disabled. - \since 4.6 - \sa renderHints + If \a enabled is true, enables the specified render \a hint; otherwise + disables it. + + \sa renderHints, QPainter::renderHints() */ void QWebView::setRenderHint(QPainter::RenderHint hint, bool enabled) { @@ -783,7 +647,7 @@ bool QWebView::event(QEvent *e) // WebCore. // FIXME: Add a QEvent::CursorUnset or similar to Qt. if (cursor().shape() == Qt::ArrowCursor) - d->resetCursor(); + d->page->d->client->resetCursor(); #endif #endif } else if (e->type() == QEvent::Leave) diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.h index 15b5836..e9c1ec8 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.h @@ -53,9 +53,8 @@ class QWEBKIT_EXPORT QWebView : public QWidget { // FIXME: temporary work around for elftran issue that it couldn't find the QPainter::staticMetaObject // symbol from Qt lib; it should be reverted after the right symbol is exported. -// remember to revert the qdoc \property comment as well. // See bug: http://qt.nokia.com/developer/task-tracker/index_html?method=entry&id=258893 -#if !defined(Q_OS_SYMBIAN) +#if defined(Q_QDOC) || !defined(Q_OS_SYMBIAN) Q_PROPERTY(QPainter::RenderHints renderHints READ renderHints WRITE setRenderHints) #endif Q_FLAGS(QPainter::RenderHints) @@ -66,8 +65,6 @@ public: QWebPage* page() const; void setPage(QWebPage* page); - static QUrl guessUrlFromString(const QString& string); - void load(const QUrl& url); #if QT_VERSION < 0x040400 && !defined(qdoc) void load(const QWebNetworkRequest& request); diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 7987613..84c5d43 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,613 @@ +2009-11-04 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] REGRESSION: Allow applications to use their own QWidget bypassing QWebView. + https://bugs.webkit.org/show_bug.cgi?id=30979 + + Decouple QWebViewPrivate from QWebPageClient, and automatically create + QWebPageWidgetClient whenever the view is QWidget based. + + * Api/qwebpage.cpp: + (QWebPageWidgetClient::QWebPageWidgetClient): + (QWebPageWidgetClient::scroll): + (QWebPageWidgetClient::update): + (QWebPageWidgetClient::setInputMethodEnabled): + (QWebPageWidgetClient::setInputMethodHint): + (QWebPageWidgetClient::cursor): + (QWebPageWidgetClient::updateCursor): + (QWebPageWidgetClient::palette): + (QWebPageWidgetClient::screenNumber): + (QWebPageWidgetClient::ownerWidget): + (QWebPageWidgetClient::pluginParent): + (QWebPage::setView): + * Api/qwebview.cpp: + (QWebView::~QWebView): + (QWebView::setPage): + (QWebView::event): + +2009-11-03 Andras Becsi <becsi.andras@stud.u-szeged.hu> + + Reviewed by Simon Hausmann. + + [Qt] Fix build of unit-test after r50454. + + * tests/qwebpage/tst_qwebpage.cpp: + +2009-11-03 Simon Hausmann <hausmann@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Make QWebPluginDatabase private API for now. + + https://bugs.webkit.org/show_bug.cgi?id=30775 + + * Api/headers.pri: + * Api/qwebplugindatabase.cpp: + * Api/qwebplugindatabase_p.h: Renamed from WebKit/qt/Api/qwebplugindatabase.h. + * Api/qwebsettings.cpp: + * Api/qwebsettings.h: + * QtLauncher/main.cpp: + (MainWindow::setupUI): + * tests/tests.pro: + +2009-11-03 Simon Hausmann <hausmann@webkit.org> + + Rubber-stamped by Tor Arne Vestbø. + + Oops, also remove the API docs of the removed networkRequestStarted() signal. + + * Api/qwebpage.cpp: + +2009-11-03 Simon Hausmann <hausmann@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Replace the QWebPage::networkRequestStarted() signal with the originatingObject + property set to the QWebFrame that belongs to the request. + + https://bugs.webkit.org/show_bug.cgi?id=29975 + + * Api/qwebpage.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction): + (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction): + (WebCore::FrameLoaderClientQt::startDownload): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::loadFinished): + (TestNetworkManager::createRequest): + (tst_QWebPage::originatingObjectInNetworkRequests): + +2009-11-02 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> + + Reviewed by Adam Barth. + + QWebView crash fix. + + The QWebView should not crash if the stop() method is called from + a function triggered by the loadProgress signal. + + A null pointer protection was added in the ProgressTracker::incrementProgress. + + New autotest was created. + + https://bugs.webkit.org/show_bug.cgi?id=29425 + + * tests/qwebview/tst_qwebview.cpp: + (WebViewCrashTest::WebViewCrashTest): + (WebViewCrashTest::loading): + (tst_QWebView::crashTests): + +2009-10-30 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Remove the QWebInspector::windowTitleChanged signal, + QEvent::WindowTitleChange can be used to achieve the same. + https://bugs.webkit.org/show_bug.cgi?id=30927 + + * Api/qwebinspector.cpp: + * Api/qwebinspector.h: + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::updateWindowTitle): + +2009-10-29 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Implement DELETE HTTP method for XmlHttpRequest + https://bugs.webkit.org/show_bug.cgi?id=30894 + + No new tests as this functionality is already tested by the + xmlhttprequest LayoutTests. As this patch depends on an unreleased + version of the dependent QtNetwork library and the tests will be + enabled later once the dependent library is released (and the + buildbot is updated). + + * Api/qwebframe.cpp: + (QWebFrame::load): + +2009-10-29 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Remove QWebView::guessUrlFromString() and replace its use + with the new QUrl::fromUserInput() if using Qt 4.6 or newer. + + * Api/qwebview.cpp: + * Api/qwebview.h: + * QGVLauncher/main.cpp: + (urlFromUserInput): + (WebPage::applyProxy): + (MainWindow::load): + * QtLauncher/main.cpp: + (urlFromUserInput): + (MainWindow::MainWindow): + (MainWindow::changeLocation): + * tests/qwebview/tst_qwebview.cpp: + +2009-10-28 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Serialize directly to the stream, and not first to an QByteArray, + that is later serialized. That is slower and also uses more bytes. + + * Api/qwebhistory.cpp: + (operator<<): + (operator>>): + +2009-10-28 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Eric Seidel. + + [Qt] WebFrame::counterValueForElementById must not be exposed + https://bugs.webkit.org/show_bug.cgi?id=30882 + + * Api/qwebframe.cpp: + (qt_drt_counterValueForElementById): + * Api/qwebframe.h: + +2009-10-27 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Darin Adler. + + Provide a way to get counter values with layoutTestContoller + https://bugs.webkit.org/show_bug.cgi?id=30555 + + * Api/qwebframe.cpp: + (QWebFrame::counterValueForElementById): + (QWebHitTestResult::frame): + * Api/qwebframe.h: + +2009-10-28 Antonio Gomes <tonikitoo@webkit.org> + + Pushing missing WebKit/qt/tests/qwebframe/resources/ dir from bug 29248. + + [Qt] [API] Make it possible to have 'invisible' loads + https://bugs.webkit.org/show_bug.cgi?id=29248 + + * tests/qwebframe/resources/image2.png: Copied from WebKit/qt/tests/qwebelement/image.png. + +2009-10-28 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Tor Arne Vestbø. + + [Qt] QWebHistory::saveState() is inconsistent with the Qt API + https://bugs.webkit.org/show_bug.cgi?id=30710 + + Make the versioning internal and enforce it in the WebCore + part. Adjust the comments, as well as remove now dead code. + + * Api/qwebhistory.cpp: + (operator<<): + (operator>>): + * Api/qwebhistory.h: + +2009-10-28 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Holger Freyther. + + [Qt] QWebHistory::saveState() is inconsistent with the Qt API + https://bugs.webkit.org/show_bug.cgi?id=30710 + + Remove the QWebHistory::saveState() and ::restoreState() as + they are inconsistent with the Qt API. + + Update unittests to reflect the change. + + * Api/qwebhistory.cpp: + (operator<<): + (operator>>): + * Api/qwebhistory.h: + * tests/qwebhistory/tst_qwebhistory.cpp: + (saveHistory): + (restoreHistory): + (tst_QWebHistory::saveAndRestore_crash_1): + (tst_QWebHistory::saveAndRestore_crash_2): + (tst_QWebHistory::saveAndRestore_crash_3): + (tst_QWebHistory::clear): + +2009-10-27 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Holger Freyther. + + Complementary fix to bug 30779. + + By mistake I used QWeakPointer's toStrongRef() method which docs + explicitly say to not be used in this situation (when the tracked + pointer is devired from QObject). Instead QWeakPointer's data() + is recommended. + + * Api/qwebpage.cpp: + (QWebPage::view): + +2009-10-27 Holger Hans Peter Freyther <zecke@selfish.org> + + Reviewed by Simon Fraser. + + Change HitTestResult methods to use (3d) transformation aware methods + https://bugs.webkit.org/show_bug.cgi?id=27347 + + The HitTestResult::boundingBox method was removed. The + RenderObject must be used directly. In contrast to the + old HitTestResult::boundingBox method this code must use + a (3d) transformation aware method to not run into an + assert in SVGRenderBase::mapLocalToContainer. + + * Api/qwebframe.cpp: + (QWebHitTestResultPrivate::QWebHitTestResultPrivate): + +2009-10-27 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Rubberstamped by Oliver Hunt. + + Change two methods to be internal for DRT use only. + + Part of [Qt] Review all new API in Qt 4.6 + https://bugs.webkit.org/show_bug.cgi?id=29843#c11 + + * Api/qwebsecurityorigin.cpp: + (qt_drt_whiteListAccessFromOrigin): + (qt_drt_resetOriginAccessWhiteLists): + (QWebSecurityOrigin::localSchemes): + * Api/qwebsecurityorigin.h: + +2009-10-27 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Make sure that initiating a rotation while rotating won't make + it end up at rotation positions that are not a multiply of + 180 degrees. + + * QGVLauncher/main.cpp: + (MainView::animatedFlip): + +2009-10-27 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Unreviewed Qt build fix. + + Update the tests as well to the new API change. + + * tests/qwebelement/tst_qwebelement.cpp: + (tst_QWebElement::clear): + +2009-10-27 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Rubberstamped by Tor Arne Vestbø. + + [Qt] QWebElement::removeChildren() should be + QWebElement::removeAllChildren() + https://bugs.webkit.org/show_bug.cgi?id=30630 + + * Api/qwebelement.cpp: + (QWebElement::removeAllChildren): + * Api/qwebelement.h: + +2009-10-27 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Antti Koivisto and Holger Freyther. + + Make QWebPagePrivate's (QWidget) view to be a QWeakPointer. + https://bugs.webkit.org/show_bug.cgi?id=30779 + + The fact that it was been set from external objects of qwebpage + and not being deleted internally can lead to dangling references. + + * Api/qgraphicswebview.cpp: + (QGraphicsWebView::~QGraphicsWebView): + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + (QWebPagePrivate::createContextMenu): + (QWebPagePrivate::handleSoftwareInputPanel): + (QWebPagePrivate::keyPressEvent): + (QWebPage::setView): + (QWebPage::view): + (QWebPage::javaScriptAlert): + (QWebPage::javaScriptConfirm): + (QWebPage::javaScriptPrompt): + (QWebPage::shouldInterruptJavaScript): + (QWebPage::createWindow): + (QWebPage::extension): + (QWebPage::chooseFile): + (QWebPage::userAgentForUrl): + * Api/qwebpage_p.h: + * Api/qwebview.cpp: + (QWebView::~QWebView): + +2009-10-26 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Unreviewed documentation fix from David Boddie (Qt Doc Team) + + Removes the check around the RenderHints property documentation + that was clearly added to synchronize the source and header files + when the #if !defined(Q_OS_SYMBIAN) guards was added to the + property. + + The documentation has also been updated to ensure that Symbian + users know that there is no actual RenderHints property on their + platform. + + * Api/qwebview.cpp: + +2009-10-26 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Unreviewed documentation fix from David Boddie (Qt Doc Team) + + Ensure that qdoc will always see the RenderHints property. + + The property was only defined in the header file if the Q_OS_SYMBIAN + symbol was not defined, resulting in the property not showing up + in the Qt documentation just because one platform doesn't support it. + + A follow up commit will improve the documentation for the property + and note that it is not supported on the Symbiam platform. + + * Api/qwebview.h: + +2009-10-26 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Reintroduce QWebElementCollection + + Revert the patch that has replaced QWebElementCollection + with QList<QWebElement>. Update the tests accordingly. + + Remove the constness of the return type of QWebElement operator[]. + + https://bugs.webkit.org/show_bug.cgi?id=30767 + + * Api/qwebelement.cpp: + (QWebElement::findAll): + (QWebElementCollectionPrivate::QWebElementCollectionPrivate): + (QWebElementCollectionPrivate::create): + (QWebElementCollection::QWebElementCollection): + (QWebElementCollection::operator=): + (QWebElementCollection::~QWebElementCollection): + (QWebElementCollection::operator+): + (QWebElementCollection::append): + (QWebElementCollection::count): + (QWebElementCollection::at): + (QWebElementCollection::toList): + * Api/qwebelement.h: + (const_iterator::begin): + (const_iterator::end): + (const_iterator::operator[]): + * Api/qwebframe.cpp: + (QWebFrame::findAllElements): + * Api/qwebframe.h: + * QtLauncher/main.cpp: + (MainWindow::selectElements): + * tests/qwebelement/tst_qwebelement.cpp: + (tst_QWebElement::simpleCollection): + (tst_QWebElement::iteration): + (tst_QWebElement::emptyCollection): + (tst_QWebElement::appendCollection): + (tst_QWebElement::nullSelect): + (tst_QWebElement::hasSetFocus): + (tst_QWebElement::render): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::inputMethods): + +2009-10-24 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Holger Freyther. + + [Qt] [Symbian] Set the capability and memory required to run QtWebKit for Symbian + https://bugs.webkit.org/show_bug.cgi?id=30476 + + Assign ReadUserData WriteUserData NetworkServices Symbian capabilities + to all QtWebkit executables. + + * QGVLauncher/QGVLauncher.pro: + * QtLauncher/QtLauncher.pro: + * tests/benchmarks/loading/tst_loading.pro: + * tests/benchmarks/painting/tst_painting.pro: + * tests/qgraphicswebview/qgraphicswebview.pro: + * tests/qwebelement/qwebelement.pro: + * tests/qwebframe/qwebframe.pro: + * tests/qwebhistory/qwebhistory.pro: + * tests/qwebhistoryinterface/qwebhistoryinterface.pro: + * tests/qwebpage/qwebpage.pro: + * tests/qwebplugindatabase/qwebplugindatabase.pro: + * tests/qwebview/qwebview.pro: + +2009-10-22 Gavin Barraclough <barraclough@apple.com> + + Reviewed by NOBODY (speculative build fix - qt is currently already broken!) + Build fix following bug #30696. + + * Api/qwebelement.cpp: + (setupScriptContext): + * Api/qwebframe.cpp: + (QWebFrame::evaluateJavaScript): + +2009-10-22 Shu Chang <Chang.Shu@nokia.com> + + Reviewed by Eric Seidel. + + [Qt] Enable track visited links in QWebPage + https://bugs.webkit.org/show_bug.cgi?id=30574 + + Test: fast/history/clicked-link-is-visited.html + + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + +2009-10-22 Girish Ramakrishnan <girish@forwardbias.in> + + Reviewed by Eric Seidel. + + [Qt] Add Print Shortcut to QtLauncher + + https://bugs.webkit.org/show_bug.cgi?id=30682 + + * QtLauncher/main.cpp: + (MainWindow::setupUI): + +2009-10-22 Antonio Gomes <tonikitoo@webkit.org> + + Rubberstamped by Tor Arne Vestbø. + + Code standarlization for QGVLauncher. + + 1) Made member initilization lists in constructors + to be per line. + 2) Made applyProxy method inline as all other methods in + WebPage class. + + * QGVLauncher/main.cpp: + (WebPage::WebPage): + (WebPage::applyProxy): + (MainView::MainView): + (MainWindow::MainWindow): + (MainWindow::init): + +2009-10-22 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Add a Y-Axis rotation to QGVLauncher. + + It uses the QStateMachine API from Qt 4.6. + + * QGVLauncher/main.cpp: + (WebView::WebView): + (WebView::setYRotation): + (WebView::yRotation): + (MainView::flip): + (MainView::animatedYFlip): + (SharedScene::SharedScene): + (SharedScene::webView): + (MainWindow::init): + (MainWindow::animatedYFlip): + (MainWindow::buildUI): + +2009-10-20 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed By Adam Barth. + + Add some actions to the menu for cursor debugging. + + GraphicsView based launcher only. + + * QGVLauncher/main.cpp: + (MainView::setWaitCursor): + (MainView::resetCursor): + (MainView::flip): + (MainWindow::setWaitCursor): + (MainWindow::resetCursor): + (MainWindow::buildUI): + +2009-10-20 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Rubberstamped by Adam Barth. + + Remove clipRenderToViewport as agreed upon in + https://bugs.webkit.org/show_bug.cgi?id=29843 + + * Api/qwebframe.cpp: + * Api/qwebframe.h: + * Api/qwebframe_p.h: + (QWebFramePrivate::QWebFramePrivate): + +2009-10-20 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Adam Barth. + + Update the tests to test the new render functionality, and take + into consideration that render() clips to the frame itself as well + as the viewport. + + QWebFrame::render() now always clips, so the old tests were bogus. + + Rendering pure contents (no scrollbars etc) without clipping can now + be accomplished using QWebFrame::documentElement()->render(...) + + * Api/qwebframe.cpp: + * Api/qwebframe.h: + * Api/qwebframe_p.h: + (QWebFramePrivate::QWebFramePrivate): + * tests/qwebframe/tst_qwebframe.cpp: + +2009-10-20 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Rubberstamped by Adam Barth. + + As we do not support rendering a QWebFrame without it being clipped + the the frame as well as the viewport, we now set the viewport size + to the size of the contents. + + Rendering pure contents (no scrollbars etc) without clipping can be + acomplished using QWebFrame::documentElement()->render(...) + + * tests/qwebelement/tst_qwebelement.cpp: + (tst_QWebElement::render): + +2009-10-20 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Add menu item to dump the plugin list to the console, + which can be handy for debugging. + + * QtLauncher/main.cpp: + (MainWindow::dumpPlugins): + (MainWindow::setupUI): + +2009-10-19 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Introduce new render method on QWebFrame, which supports specifying + which layers to render (scrollbars, contents, pan-icon). + + * Api/qwebframe.cpp: + (QWebFramePrivate::renderPrivate): + (QWebFrame::render): + * Api/qwebframe.h: + * Api/qwebframe_p.h: + +2009-10-19 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Ariya Hidayat. + + [Qt] Infinite loop (leading to crash) when setting cursor in QGraphicsWebView + https://bugs.webkit.org/show_bug.cgi?id=30549 + + Patch reimplements QGraphicsItem's itemChange method, and make + CursorChange event to be emitted after cursor has already been + set. + + QWidget::setCursor send the event just after it sets the cursor, + then patch makes both behaviors compatible. + + * Api/qgraphicswebview.cpp: + (QGraphicsWebView::itemChange): + * Api/qgraphicswebview.h: + 2009-10-19 Nate Chapin <japhet@chromium.org> Unreviewed, build fix. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 81ccbe8..f706d77 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -946,7 +946,7 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction(FramePolicyFunc #if QT_VERSION < 0x040400 QWebNetworkRequest r(request); #else - QNetworkRequest r(request.toNetworkRequest()); + QNetworkRequest r(request.toNetworkRequest(m_webFrame)); #endif QWebPage* page = m_webFrame->page(); @@ -971,7 +971,7 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFun #if QT_VERSION < 0x040400 QWebNetworkRequest r(request); #else - QNetworkRequest r(request.toNetworkRequest()); + QNetworkRequest r(request.toNetworkRequest(m_webFrame)); #endif QWebPage*page = m_webFrame->page(); @@ -1001,7 +1001,7 @@ void FrameLoaderClientQt::startDownload(const WebCore::ResourceRequest& request) if (!m_webFrame) return; - emit m_webFrame->page()->downloadRequested(request.toNetworkRequest()); + emit m_webFrame->page()->downloadRequested(request.toNetworkRequest(m_webFrame)); #endif } diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index 12f405c..7a1bfd5 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -166,7 +166,6 @@ void InspectorClientQt::updateWindowTitle() if (m_inspectedWebPage->d->inspector) { QString caption = QCoreApplication::translate("QWebPage", "Web Inspector - %2").arg(m_inspectedURL); m_inspectedWebPage->d->inspector->setWindowTitle(caption); - emit m_inspectedWebPage->d->inspector->windowTitleChanged(caption); } } diff --git a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro index 80717c2..bc5e75f 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro @@ -5,4 +5,7 @@ SOURCES += tst_loading.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0xA000E541 +symbian { + TARGET.UID3 = 0xA000E541 + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} diff --git a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro index f45d804..48c7072 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro @@ -5,4 +5,7 @@ SOURCES += tst_painting.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0xA000E542 +symbian { + TARGET.UID3 = 0xA000E542 + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro index cba6f11..57b4437 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro @@ -4,3 +4,7 @@ include(../../../../WebKit.pri) SOURCES += tst_qgraphicswebview.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian { + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro index 0a140ad..c45a9ac 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro @@ -6,4 +6,7 @@ RESOURCES += qwebelement.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0xA000E53A +symbian { + TARGET.UID3 = 0xA000E53A + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp index db2f7d7..cf83fe8 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp @@ -70,7 +70,10 @@ private slots: void attributesNS(); void classes(); void namespaceURI(); + void iteration(); void foreachManipulation(); + void emptyCollection(); + void appendCollection(); void evaluateJavaScript(); void documentElement(); void frame(); @@ -134,7 +137,7 @@ void tst_QWebElement::simpleCollection() m_mainFrame->setHtml(html); QWebElement body = m_mainFrame->documentElement(); - QList<QWebElement> list = body.findAll("p"); + QWebElementCollection list = body.findAll("p"); QCOMPARE(list.count(), 2); QCOMPARE(list.at(0).toPlainText(), QString("first para")); QCOMPARE(list.at(1).toPlainText(), QString("second para")); @@ -267,6 +270,41 @@ void tst_QWebElement::namespaceURI() } +void tst_QWebElement::iteration() +{ + QString html = "<body><p>first para</p><p>second para</p></body>"; + m_mainFrame->setHtml(html); + QWebElement body = m_mainFrame->documentElement(); + + QWebElementCollection paras = body.findAll("p"); + QList<QWebElement> referenceList = paras.toList(); + + QList<QWebElement> foreachList; + foreach(QWebElement p, paras) { + foreachList.append(p); + } + QVERIFY(foreachList.count() == 2); + QCOMPARE(foreachList.count(), referenceList.count()); + QCOMPARE(foreachList.at(0), referenceList.at(0)); + QCOMPARE(foreachList.at(1), referenceList.at(1)); + + QList<QWebElement> forLoopList; + for (int i = 0; i < paras.count(); ++i) { + forLoopList.append(paras.at(i)); + } + QVERIFY(foreachList.count() == 2); + QCOMPARE(foreachList.count(), referenceList.count()); + QCOMPARE(foreachList.at(0), referenceList.at(0)); + QCOMPARE(foreachList.at(1), referenceList.at(1)); + + for (int i = 0; i < paras.count(); ++i) { + QCOMPARE(paras.at(i), paras[i]); + } + + QCOMPARE(paras.at(0), paras.first()); + QCOMPARE(paras.at(1), paras.last()); +} + void tst_QWebElement::foreachManipulation() { QString html = "<body><p>first para</p><p>second para</p></body>"; @@ -280,6 +318,43 @@ void tst_QWebElement::foreachManipulation() QCOMPARE(body.findAll("div").count(), 4); } +void tst_QWebElement::emptyCollection() +{ + QWebElementCollection emptyCollection; + QCOMPARE(emptyCollection.count(), 0); +} + +void tst_QWebElement::appendCollection() +{ + QString html = "<body><span class='a'>aaa</span><p>first para</p><div>foo</div>" + "<span class='b'>bbb</span><p>second para</p><div>bar</div></body>"; + m_mainFrame->setHtml(html); + QWebElement body = m_mainFrame->documentElement(); + + QWebElementCollection collection = body.findAll("p"); + QCOMPARE(collection.count(), 2); + + collection.append(body.findAll("div")); + QCOMPARE(collection.count(), 4); + + collection += body.findAll("span.a"); + QCOMPARE(collection.count(), 5); + + QWebElementCollection all = collection + body.findAll("span.b"); + QCOMPARE(all.count(), 6); + QCOMPARE(collection.count(), 5); + + all += collection; + QCOMPARE(all.count(), 11); + + QCOMPARE(collection.count(), 5); + QWebElementCollection test; + test.append(collection); + QCOMPARE(test.count(), 5); + test.append(QWebElementCollection()); + QCOMPARE(test.count(), 5); +} + void tst_QWebElement::evaluateJavaScript() { QVariant result; @@ -629,7 +704,7 @@ void tst_QWebElement::clear() QCOMPARE(body.findAll("div").count(), 1); QCOMPARE(body.findAll("p").count(), 3); - body.findFirst("div").removeChildren(); + body.findFirst("div").removeAllChildren(); QCOMPARE(body.findAll("div").count(), 1); QCOMPARE(body.findAll("p").count(), 2); } @@ -773,7 +848,7 @@ void tst_QWebElement::nullSelect() { m_mainFrame->setHtml("<body><p>Test"); - QList<QWebElement> collection = m_mainFrame->findAllElements("invalid{syn(tax;;%#$f223e>>"); + QWebElementCollection collection = m_mainFrame->findAllElements("invalid{syn(tax;;%#$f223e>>"); QVERIFY(collection.count() == 0); } @@ -815,7 +890,7 @@ void tst_QWebElement::hasSetFocus() "<input type='text' id='input2'/>" \ "</body></html>"); - QList<QWebElement> inputs = m_mainFrame->documentElement().findAll("input"); + QWebElementCollection inputs = m_mainFrame->documentElement().findAll("input"); QWebElement input1 = inputs.at(0); input1.setFocus(); QVERIFY(input1.hasFocus()); @@ -851,7 +926,10 @@ void tst_QWebElement::render() waitForSignal(&page, SIGNAL(loadFinished(bool))); QCOMPARE(loadSpy.count(), 1); - QList<QWebElement> imgs = page.mainFrame()->findAllElements("img"); + QSize size = page.mainFrame()->contentsSize(); + page.setViewportSize(size); + + QWebElementCollection imgs = page.mainFrame()->findAllElements("img"); QCOMPARE(imgs.count(), 1); QImage resource(":/image.png"); @@ -882,7 +960,7 @@ void tst_QWebElement::render() // compare table rendered through QWebElement::render to whole page table rendering QRect tableRect(0, 0, 300, 300); - QList<QWebElement> tables = page.mainFrame()->findAllElements("table"); + QWebElementCollection tables = page.mainFrame()->findAllElements("table"); QCOMPARE(tables.count(), 1); QImage image3(300, 300, QImage::Format_ARGB32); @@ -893,7 +971,6 @@ void tst_QWebElement::render() QImage image4(300, 300, QImage::Format_ARGB32); QPainter painter4(&image4); - page.mainFrame()->setClipRenderToViewport(false); page.mainFrame()->render(&painter4, tableRect); painter4.end(); diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro index 4c92e91..b8734cd 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro @@ -5,6 +5,9 @@ SOURCES += tst_qwebframe.cpp RESOURCES += qwebframe.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -DEFINES += SRCDIR=\\\"$$PWD/resources\\\" +!symbian:DEFINES += SRCDIR=\\\"$$PWD/resources\\\" -symbian:TARGET.UID3 = 0xA000E53D +symbian { + TARGET.UID3 = 0xA000E53D + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/image2.png b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/image2.png Binary files differnew file mode 100644 index 0000000..8d70364 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/image2.png diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 100f272..6f07e90 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -38,6 +38,10 @@ #endif #include "../util.h" +#if defined(Q_OS_SYMBIAN) +# define SRCDIR "" +#endif + //TESTED_CLASS= //TESTED_FILES= @@ -586,6 +590,7 @@ private slots: void javaScriptWindowObjectClearedOnEvaluate(); void setHtml(); void setHtmlWithResource(); + void setHtmlWithBaseURL(); void ipv6HostEncoding(); void metaData(); void popupFocus(); @@ -2371,6 +2376,28 @@ void tst_QWebFrame::setHtmlWithResource() QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("red")); } +void tst_QWebFrame::setHtmlWithBaseURL() +{ + QString html("<html><body><p>hello world</p><img src='resources/image2.png'/></body></html>"); + + QWebPage page; + QWebFrame* frame = page.mainFrame(); + + // in few seconds, the image should be completey loaded + QSignalSpy spy(&page, SIGNAL(loadFinished(bool))); + + frame->setHtml(html, QUrl::fromLocalFile(QDir::currentPath())); + QTest::qWait(200); + QCOMPARE(spy.count(), 1); + + QCOMPARE(frame->evaluateJavaScript("document.images.length").toInt(), 1); + QCOMPARE(frame->evaluateJavaScript("document.images[0].width").toInt(), 128); + QCOMPARE(frame->evaluateJavaScript("document.images[0].height").toInt(), 128); + + // no history item has to be added. + QCOMPARE(m_view->page()->history()->count(), 0); +} + class TestNetworkManager : public QNetworkAccessManager { public: @@ -2668,26 +2695,24 @@ void tst_QWebFrame::render() QPicture picture; - // render clipping to Viewport - frame->setClipRenderToViewport(true); + QSize size = page.mainFrame()->contentsSize(); + page.setViewportSize(size); + + // render contents layer only (the iframe is smaller than the image, so it will have scrollbars) QPainter painter1(&picture); - frame->render(&painter1); + frame->render(&painter1, QWebFrame::ContentsLayer); painter1.end(); - QSize size = page.mainFrame()->contentsSize(); - page.setViewportSize(size); - QCOMPARE(size.width(), picture.boundingRect().width()); // 100px - QCOMPARE(size.height(), picture.boundingRect().height()); // 100px + QCOMPARE(size.width(), picture.boundingRect().width() + frame->scrollBarGeometry(Qt::Vertical).width()); + QCOMPARE(size.height(), picture.boundingRect().height() + frame->scrollBarGeometry(Qt::Horizontal).height()); - // render without clipping to Viewport - frame->setClipRenderToViewport(false); + // render everything, should be the size of the iframe QPainter painter2(&picture); - frame->render(&painter2); + frame->render(&painter2, QWebFrame::AllLayers); painter2.end(); - QImage resource(":/image.png"); - QCOMPARE(resource.width(), picture.boundingRect().width()); // resource width: 128px - QCOMPARE(resource.height(), picture.boundingRect().height()); // resource height: 128px + QCOMPARE(size.width(), picture.boundingRect().width()); // width: 100px + QCOMPARE(size.height(), picture.boundingRect().height()); // height: 100px } void tst_QWebFrame::scrollPosition() diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro index 8ee63cc..7445e3b 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro @@ -6,4 +6,7 @@ RESOURCES += tst_qwebhistory.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0xA000E53B +symbian { + TARGET.UID3 = 0xA000E53B + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp index 4f4d3c4..ec2d497 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp @@ -56,9 +56,6 @@ private slots: void serialize_1(); //QWebHistory countity void serialize_2(); //QWebHistory index void serialize_3(); //QWebHistoryItem - void saveAndRestore_1(); //simple checks saveState and restoreState - void saveAndRestore_2(); //bad parameters saveState and restoreState - void saveAndRestore_3(); //try use different version void saveAndRestore_crash_1(); void saveAndRestore_crash_2(); void saveAndRestore_crash_3(); @@ -294,67 +291,40 @@ void tst_QWebHistory::serialize_3() QVERIFY(load.atEnd()); } -/** Simple checks should be a bit redundant to streaming operators */ -void tst_QWebHistory::saveAndRestore_1() +static void saveHistory(QWebHistory* history, QByteArray* in) { - QAction* actionBack = page->action(QWebPage::Back); - hist->back(); - waitForLoadFinished.exec(); - QVERIFY(actionBack->isEnabled()); - QByteArray buffer(hist->saveState()); - hist->clear(); - QVERIFY(!actionBack->isEnabled()); - QVERIFY(hist->count() == 1); - hist->restoreState(buffer); - - //check only few values, do not make full test - //because most of the code is shared with streaming operators - //and these are checked before - QCOMPARE(hist->count(), histsize); - QCOMPARE(hist->currentItemIndex(), histsize - 2); - QCOMPARE(hist->itemAt(0).title(), QString("page1")); - QCOMPARE(hist->itemAt(histsize - 1).title(), QString("page") + QString::number(histsize)); - QVERIFY(actionBack->isEnabled()); + in->clear(); + QDataStream save(in, QIODevice::WriteOnly); + save << *history; } -/** Check returns value if there are bad parameters. Actually, result - * is no so importent. The test shouldn't crash :-) */ -void tst_QWebHistory::saveAndRestore_2() +static void restoreHistory(QWebHistory* history, QByteArray* out) { - QByteArray buffer; - hist->restoreState(buffer); - QVERIFY(hist->count() == 1); - QVERIFY(hist->itemAt(0).isValid()); -} - -/** Try to use bad version value */ -void tst_QWebHistory::saveAndRestore_3() -{ - QByteArray tmp = hist->saveState((QWebHistory::HistoryStateVersion)29999); - QVERIFY(hist->saveState((QWebHistory::HistoryStateVersion)29999).isEmpty()); - QVERIFY(hist->count() == histsize); - QVERIFY(hist->itemAt(3).isValid()); + QDataStream load(out, QIODevice::ReadOnly); + load >> *history; } /** The test shouldn't crash */ void tst_QWebHistory::saveAndRestore_crash_1() { - QByteArray tmp = hist->saveState(); - for (unsigned i = 0; i < 5; i++){ - hist->restoreState(tmp); - hist->saveState(); + QByteArray buffer; + saveHistory(hist, &buffer); + for (unsigned i = 0; i < 5; i++) { + restoreHistory(hist, &buffer); + saveHistory(hist, &buffer); } } /** The test shouldn't crash */ void tst_QWebHistory::saveAndRestore_crash_2() { - QByteArray tmp = hist->saveState(); + QByteArray buffer; + saveHistory(hist, &buffer); QWebPage* page2 = new QWebPage(this); QWebHistory* hist2 = page2->history(); - for (unsigned i = 0; i < 5; i++){ - hist2->restoreState(tmp); - hist2->saveState(); + for (unsigned i = 0; i < 5; i++) { + restoreHistory(hist2, &buffer); + saveHistory(hist2, &buffer); } delete page2; } @@ -362,17 +332,18 @@ void tst_QWebHistory::saveAndRestore_crash_2() /** The test shouldn't crash */ void tst_QWebHistory::saveAndRestore_crash_3() { - QByteArray tmp = hist->saveState(); + QByteArray buffer; + saveHistory(hist, &buffer); QWebPage* page2 = new QWebPage(this); QWebHistory* hist1 = hist; QWebHistory* hist2 = page2->history(); - for (unsigned i = 0; i < 5; i++){ - hist1->restoreState(tmp); - hist2->restoreState(tmp); + for (unsigned i = 0; i < 5; i++) { + restoreHistory(hist1, &buffer); + restoreHistory(hist2, &buffer); QVERIFY(hist1->count() == hist2->count()); QVERIFY(hist1->count() == histsize); hist2->back(); - tmp = hist2->saveState(); + saveHistory(hist2, &buffer); hist2->clear(); } delete page2; @@ -381,15 +352,16 @@ void tst_QWebHistory::saveAndRestore_crash_3() /** ::clear */ void tst_QWebHistory::clear() { + QByteArray buffer; + QAction* actionBack = page->action(QWebPage::Back); QVERIFY(actionBack->isEnabled()); - hist->saveState(); + saveHistory(hist, &buffer); QVERIFY(hist->count() > 1); hist->clear(); QVERIFY(hist->count() == 1); // Leave current item. QVERIFY(!actionBack->isEnabled()); - QWebPage* page2 = new QWebPage(this); QWebHistory* hist2 = page2->history(); QVERIFY(hist2->count() == 0); diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro index 53e1afe..764f806 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro @@ -5,4 +5,7 @@ SOURCES += tst_qwebhistoryinterface.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0xA000E53C +symbian { + TARGET.UID3 = 0xA000E53C + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro index 101837a..7853b28 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro @@ -5,6 +5,9 @@ SOURCES += tst_qwebpage.cpp RESOURCES += tst_qwebpage.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -DEFINES += SRCDIR=\\\"$$PWD/\\\" +!symbian:DEFINES += SRCDIR=\\\"$$PWD/\\\" -symbian:TARGET.UID3 = 0xA000E53E +symbian { + TARGET.UID3 = 0xA000E53E + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 21b3bc7..3eead92 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -37,6 +37,10 @@ #include <QPushButton> #include <QDir> +#if defined(Q_OS_SYMBIAN) +# define SRCDIR "" +#endif + // Will try to wait for the condition while allowing event processing #define QTRY_COMPARE(__expr, __expected) \ do { \ @@ -129,6 +133,8 @@ private slots: void screenshot_data(); void screenshot(); + void originatingObjectInNetworkRequests(); + private: QWebView* m_view; QWebPage* m_page; @@ -234,7 +240,6 @@ void tst_QWebPage::loadFinished() { qRegisterMetaType<QWebFrame*>("QWebFrame*"); qRegisterMetaType<QNetworkRequest*>("QNetworkRequest*"); - QSignalSpy spyNetworkRequestStarted(m_page, SIGNAL(networkRequestStarted(QWebFrame*, QNetworkRequest*))); QSignalSpy spyLoadStarted(m_view, SIGNAL(loadStarted())); QSignalSpy spyLoadFinished(m_view, SIGNAL(loadFinished(bool))); @@ -245,7 +250,6 @@ void tst_QWebPage::loadFinished() QTest::qWait(3000); - QVERIFY(spyNetworkRequestStarted.count() > 1); QVERIFY(spyLoadStarted.count() > 1); QVERIFY(spyLoadFinished.count() > 1); @@ -346,9 +350,11 @@ public: TestNetworkManager(QObject* parent) : QNetworkAccessManager(parent) {} QList<QUrl> requestedUrls; + QList<QNetworkRequest> requests; protected: virtual QNetworkReply* createRequest(Operation op, const QNetworkRequest &request, QIODevice* outgoingData) { + requests.append(request); requestedUrls.append(request.url()); return QNetworkAccessManager::createRequest(op, request, outgoingData); } @@ -1270,7 +1276,7 @@ void tst_QWebPage::inputMethods() "</body></html>"); m_view->page()->mainFrame()->setFocus(); - QList<QWebElement> inputs = m_view->page()->mainFrame()->documentElement().findAll("input"); + QWebElementCollection inputs = m_view->page()->mainFrame()->documentElement().findAll("input"); QMouseEvent evpres(QEvent::MouseButtonPress, inputs.at(0).geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier); m_view->page()->event(&evpres); @@ -1609,5 +1615,27 @@ void tst_QWebPage::screenshot() QDir::setCurrent(QApplication::applicationDirPath()); } +void tst_QWebPage::originatingObjectInNetworkRequests() +{ + TestNetworkManager* networkManager = new TestNetworkManager(m_page); + m_page->setNetworkAccessManager(networkManager); + networkManager->requests.clear(); + + m_view->setHtml(QString("data:text/html,<frameset cols=\"25%,75%\"><frame src=\"data:text/html," + "<head><meta http-equiv='refresh' content='1'></head>foo \">" + "<frame src=\"data:text/html,bar\"></frameset>"), QUrl()); + QVERIFY(::waitForSignal(m_view, SIGNAL(loadFinished(bool)))); + + QCOMPARE(networkManager->requests.count(), 2); + + QList<QWebFrame*> childFrames = m_page->mainFrame()->childFrames(); + QCOMPARE(childFrames.count(), 2); + +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + for (int i = 0; i < 2; ++i) + QVERIFY(qobject_cast<QWebFrame*>(networkManager->requests.at(i).originatingObject()) == childFrames.at(i)); +#endif +} + QTEST_MAIN(tst_QWebPage) #include "tst_qwebpage.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro index 1376ca5..569146a 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro @@ -5,4 +5,7 @@ SOURCES += tst_qwebplugindatabase.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0xA000E540 +symbian { + TARGET.UID3 = 0xA000E540 + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/frame_a.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/frame_a.html new file mode 100644 index 0000000..9ff68f1 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/frame_a.html @@ -0,0 +1,2 @@ +<a href="http://google.com" target="frame_b"><img src="" width=100 height=100 alt="Google"></a> +<a href="http://yahoo.com" target="frame_b"><img src="" width=100 height=100 alt="Yahoo"></a> diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/index.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/index.html new file mode 100644 index 0000000..c53ad09 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/index.html @@ -0,0 +1,4 @@ +<frameset cols="25%,75%"> + <frame src="frame_a.html" name="frame_a"> + <frame src="frame_b.html" name="frame_b"> +</frameset> diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro index bba7c39..735537b 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro @@ -4,6 +4,10 @@ include(../../../../WebKit.pri) SOURCES += tst_qwebview.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR +RESOURCES += tst_qwebview.qrc DEFINES += SRCDIR=\\\"$$PWD/\\\" -symbian:TARGET.UID3 = 0xA000E53F +symbian { + TARGET.UID3 = 0xA000E53F + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp index 9204223..27daf38 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp @@ -20,6 +20,7 @@ */ #include <qtest.h> +#include "../util.h" #include <qpainter.h> #include <qwebview.h> @@ -41,12 +42,12 @@ public slots: private slots: void renderHints(); - void guessUrlFromString_data(); - void guessUrlFromString(); void getWebKitVersion(); void reusePage_data(); void reusePage(); + + void crashTests(); }; // This will be called before the first test function is executed. @@ -105,68 +106,6 @@ void tst_QWebView::renderHints() QVERIFY(!(webView.renderHints() & QPainter::HighQualityAntialiasing)); } -void tst_QWebView::guessUrlFromString_data() -{ - QTest::addColumn<QString>("string"); - QTest::addColumn<QUrl>("guessUrlFromString"); - - // Null - QTest::newRow("null") << QString() << QUrl(); - - // File - QDirIterator it(QDir::homePath()); - QString fileString; - int c = 0; - while (it.hasNext()) { - it.next(); - QTest::newRow(QString("file-%1").arg(c++).toLatin1()) << it.filePath() << QUrl::fromLocalFile(it.filePath()); - } - - // basic latin1 - QTest::newRow("unicode-0") << QString::fromUtf8("å.com/") << QUrl::fromEncoded(QString::fromUtf8("http://å.com/").toUtf8(), QUrl::TolerantMode); - // unicode - QTest::newRow("unicode-1") << QString::fromUtf8("λ.com/") << QUrl::fromEncoded(QString::fromUtf8("http://λ.com/").toUtf8(), QUrl::TolerantMode); - - // no scheme - QTest::newRow("add scheme-0") << "webkit.org" << QUrl("http://webkit.org"); - QTest::newRow("add scheme-1") << "www.webkit.org" << QUrl("http://www.webkit.org"); - QTest::newRow("add scheme-2") << "ftp.webkit.org" << QUrl("ftp://ftp.webkit.org"); - QTest::newRow("add scheme-3") << "webkit" << QUrl("webkit"); - - // QUrl's tolerant parser should already handle this - QTest::newRow("not-encoded-0") << "http://webkit.org/test page.html" << QUrl("http://webkit.org/test%20page.html"); - - // Make sure the :80, i.e. port doesn't screw anything up - QUrl portUrl("http://webkit.org"); - portUrl.setPort(80); - QTest::newRow("port-0") << "webkit.org:80" << portUrl; - QTest::newRow("port-1") << "http://webkit.org:80" << portUrl; - - // mailto doesn't have a ://, but is valid - QUrl mailto("ben@meyerhome.net"); - mailto.setScheme("mailto"); - QTest::newRow("mailto") << "mailto:ben@meyerhome.net" << mailto; - - // misc - QTest::newRow("localhost-0") << "localhost" << QUrl("http://localhost"); - QTest::newRow("localhost-1") << "localhost:80" << QUrl("http://localhost:80"); - QTest::newRow("spaces-0") << " http://webkit.org/test page.html " << QUrl("http://webkit.org/test%20page.html"); - - // FYI: The scheme in the resulting url user - QUrl authUrl("user:pass@domain.com"); - QTest::newRow("misc-1") << "user:pass@domain.com" << authUrl; -} - -// public static QUrl guessUrlFromString(QString const& string) -void tst_QWebView::guessUrlFromString() -{ - QFETCH(QString, string); - QFETCH(QUrl, guessUrlFromString); - - QUrl url = QWebView::guessUrlFromString(string); - QCOMPARE(url, guessUrlFromString); -} - void tst_QWebView::getWebKitVersion() { QVERIFY(qWebKitVersion().toDouble() > 0); @@ -212,6 +151,46 @@ void tst_QWebView::reusePage() QDir::setCurrent(QApplication::applicationDirPath()); } +// Class used in crashTests +class WebViewCrashTest : public QObject { + Q_OBJECT + QWebView* m_view; +public: + bool m_executed; + + + WebViewCrashTest(QWebView* view) + : m_view(view) + , m_executed(false) + { + view->connect(view, SIGNAL(loadProgress(int)), this, SLOT(loading(int))); + } + +private slots: + void loading(int progress) + { + if (progress >= 20 && progress < 90) { + QVERIFY(!m_executed); + m_view->stop(); + m_executed = true; + } + } +}; + + +// Should not crash. +void tst_QWebView::crashTests() +{ + // Test if loading can be stopped in loadProgress handler without crash. + // Test page should have frames. + QWebView view; + WebViewCrashTest tester(&view); + QUrl url("qrc:///data/index.html"); + view.load(url); + QTRY_VERIFY(tester.m_executed); // If fail it means that the test wasn't executed. +} + + QTEST_MAIN(tst_QWebView) #include "tst_qwebview.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc new file mode 100644 index 0000000..ede34a9 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc @@ -0,0 +1,7 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>data/index.html</file> + <file>data/frame_a.html</file> +</qresource> +</RCC> + diff --git a/src/3rdparty/webkit/WebKit/qt/tests/tests.pro b/src/3rdparty/webkit/WebKit/qt/tests/tests.pro index 81cc8f3..939cd22 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/tests.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/tests.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs -SUBDIRS = qwebframe qwebpage qwebelement qgraphicswebview qwebhistoryinterface qwebplugindatabase qwebview qwebhistory +SUBDIRS = qwebframe qwebpage qwebelement qgraphicswebview qwebhistoryinterface qwebview qwebhistory greaterThan(QT_MINOR_VERSION, 4): SUBDIRS += benchmarks/painting/tst_painting.pro benchmarks/loading/tst_loading.pro |