diff options
author | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2009-11-03 16:12:30 (GMT) |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2009-11-03 16:21:02 (GMT) |
commit | 33eefe549f4570a79d2531bad82698f7109ab687 (patch) | |
tree | 63a7c385e9f9bbcbe450bb47ddaf1740dc912aca /src/3rdparty/webkit/WebKit/qt | |
parent | 4c1ac09381a259e96a1774a5c931c55e8393813f (diff) | |
download | Qt-33eefe549f4570a79d2531bad82698f7109ab687.zip Qt-33eefe549f4570a79d2531bad82698f7109ab687.tar.gz Qt-33eefe549f4570a79d2531bad82698f7109ab687.tar.bz2 |
Updated WebKit from /home/jturcott/dev/webkit/ to qtwebkit-4.6-snapshot-20091003 ( 8f810287200d21aded375664cc0a6ac0476dbdea )
Changes in WebKit/qt since the last update:
++ b/WebKit/qt/ChangeLog
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:
Diffstat (limited to 'src/3rdparty/webkit/WebKit/qt')
32 files changed, 1371 insertions, 569 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp index 0cb4204..50a0986 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp @@ -164,101 +164,17 @@ void QGraphicsWebViewPrivate::_q_setStatusBarMessage(const QString& s) /*! \class QGraphicsWebView - \brief The QGraphicsWebView class allows Web content to be added to a GraphicsView. + \brief The QGraphicsWebView class allows web content to be added to a GraphicsView. \since 4.6 - An instance of this class renders Web content from a URL or supplied as data, using - features of the QtWebKit module. + A WebGraphicsItem renders web content based on a URL or set data. - If the width and height of the item is not set, they will dynamically adjust to - a size appropriate for the content. This width may be large (e.g., 980 pixels or - more) for typical online Web pages. - - \section1 Browser Features - - Many of the functions, signals and properties provided by QWebView are also available - for this item, making it simple to adapt existing code to use QGraphicsWebView instead - of QWebView. - - The item uses a QWebPage object to perform the rendering of Web content, and this can - be obtained with the page() function, enabling the document itself to be accessed and - modified. - - As with QWebView, the item records the browsing history using a QWebHistory object, - accessible using the history() function. The QWebSettings object that defines the - configuration of the browser can be obtained with the settings() function, enabling - features like plugin support to be customized for each item. - - \sa QWebView, QGraphicsTextItem -*/ - -/*! - \fn void QGraphicsWebView::titleChanged(const QString &title) - - This signal is emitted whenever the \a title of the main frame changes. - - \sa title() + If the width and height of the item is not set, they will + dynamically adjust to a size appropriate for the content. + This width may be large (eg. 980) for typical online web pages. */ /*! - \fn void QGraphicsWebView::urlChanged(const QUrl &url) - - This signal is emitted when the \a url of the view changes. - - \sa url(), load() -*/ - -/*! - \fn void QGraphicsWebView::statusChanged() - - This signal is emitted when the status bar text is changed by the page. -*/ - -/*! - \fn void QGraphicsWebView::iconChanged() - - This signal is emitted whenever the icon of the page is loaded or changes. - - In order for icons to be loaded, you will need to set an icon database path - using QWebSettings::setIconDatabasePath(). - - \sa icon(), QWebSettings::setIconDatabasePath() -*/ - -/*! - \fn void QGraphicsWebView::loadStarted() - - This signal is emitted when a new load of the page is started. - - \sa progressChanged(), loadFinished() -*/ - -/*! - \fn void QGraphicsWebView::loadFinished(bool ok) - - This signal is emitted when a load of the page is finished. - \a ok will indicate whether the load was successful or any error occurred. - - \sa loadStarted() -*/ - -/*! - \fn void QGraphicsWebView::progressChanged(qreal progress) - - This signal is emitted every time an element in the web page - completes loading and the overall loading progress advances. - - This signal tracks the progress of all child frames. - - The current value is provided by \a progress and scales from 0.0 to 1.0, - which is the default range of QProgressBar. - - \sa loadStarted(), loadFinished() -*/ - - - -/*! Constructs an empty QGraphicsWebView with parent \a parent. \sa load() @@ -275,12 +191,16 @@ QGraphicsWebView::QGraphicsWebView(QGraphicsItem* parent) } /*! - Destroys the item. + Destroys the web graphicsitem. */ 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 +250,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..606dae4 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"; @@ -946,44 +991,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 +1152,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 +1302,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 +1440,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 +1449,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 +1697,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/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 764bfad..0b122b4 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -77,6 +77,7 @@ #include "LocalizedStrings.h" #include "Cache.h" #include "runtime/InitializeThreading.h" +#include "PageGroup.h" #include <QApplication> #include <QBasicTimer> @@ -262,7 +263,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 +305,8 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) history.d = new QWebHistoryPrivate(page->backForwardList()); memset(actions, 0, sizeof(actions)); + + PageGroup::setShouldTrackVisitedLinks(true); } QWebPagePrivate::~QWebPagePrivate() @@ -378,7 +383,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 +764,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 +914,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,7 +1670,7 @@ QWebHistory *QWebPage::history() const */ void QWebPage::setView(QWidget *view) { - if (d->view != view) { + if (this->view() != view) { d->view = view; setViewportSize(view ? view->size() : QSize(0, 0)); } @@ -1678,7 +1683,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 +1714,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 +1730,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 +1748,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 +1773,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 +1790,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) @@ -2652,17 +2661,6 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) as a result of the user clicking on a "file upload" button in a HTML form where multiple file selection is allowed. - \omitvalue ErrorPageExtension (introduced in Qt 4.6) -*/ - -/*! - \enum QWebPage::ErrorDomain - \since 4.6 - \internal - - \value QtNetwork - \value Http - \value WebKit */ /*! @@ -2713,12 +2711,6 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) */ /*! - \fn QWebPage::ErrorPageExtensionReturn::ErrorPageExtensionReturn() - - Constructs a new error page object. -*/ - -/*! \class QWebPage::ChooseMultipleFilesExtensionOption \since 4.5 \brief The ChooseMultipleFilesExtensionOption class describes the option @@ -2764,7 +2756,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 +2838,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 +3101,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); 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/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/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index cb487ce..48de8c6 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -151,7 +151,7 @@ void QWebViewPrivate::_q_pageDestroyed() It can be used in various applications to display web content live from the Internet. - The image below shows QWebView previewed in \QD with a Nokia website. + The image below shows QWebView previewed in \QD with the Trolltech website. \image qwebview-url.png @@ -246,7 +246,11 @@ 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 d->page->d->client = 0; } @@ -324,79 +328,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 +615,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 +656,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) { @@ -1110,7 +1055,7 @@ void QWebView::changeEvent(QEvent *e) /*! \fn void QWebView::statusBarMessage(const QString& text) - This signal is emitted when the status bar \a text is changed by the page. + This signal is emitted when the statusbar \a text is changed by the page. */ /*! 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..b19a1d0 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,484 @@ +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/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..0e540e5 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro @@ -7,4 +7,7 @@ QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR 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..7cc62b0 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -586,6 +586,7 @@ private slots: void javaScriptWindowObjectClearedOnEvaluate(); void setHtml(); void setHtmlWithResource(); + void setHtmlWithBaseURL(); void ipv6HostEncoding(); void metaData(); void popupFocus(); @@ -2371,6 +2372,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 +2691,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..6b28efd 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro @@ -7,4 +7,7 @@ QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR 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..0cf85ee 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -1270,7 +1270,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); 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/qwebview.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro index bba7c39..e67bb7a 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro @@ -6,4 +6,7 @@ QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR 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..fda979e 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp @@ -41,8 +41,6 @@ public slots: private slots: void renderHints(); - void guessUrlFromString_data(); - void guessUrlFromString(); void getWebKitVersion(); void reusePage_data(); @@ -105,68 +103,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); |