From 9f657356f897d8bf4c92965a8bc1af82107e2379 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 26 Jul 2010 16:31:43 +0200 Subject: Updated WebKit to 0be9ff9f2b1ec2b748885ac15299bc1c65aca590 Integrated changes: || || Spatial navigation: do not consider outline for focusable element boundaries || || || [Qt] Clamp color stops passed to QGradient to 1.0 || || || [Qt] [Regression] QWebView::setHtml() executes script body twice || || || Loading HTML with a JS alert() when the DocumentLoader has been set to not defer data load results in ASSERT || --- src/3rdparty/webkit/.tag | 2 +- src/3rdparty/webkit/JavaScriptCore/ChangeLog | 14 +++++ .../webkit/JavaScriptCore/runtime/TimeoutChecker.h | 1 + src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 64 ++++++++++++++++++++++ .../webkit/WebCore/loader/MainResourceLoader.cpp | 4 ++ .../webkit/WebCore/page/SpatialNavigation.cpp | 11 +--- .../WebCore/platform/graphics/qt/GradientQt.cpp | 2 +- src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp | 4 ++ src/3rdparty/webkit/WebKit/qt/ChangeLog | 48 ++++++++++++++++ .../qt/WebCoreSupport/FrameLoaderClientQt.cpp | 12 +++- .../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h | 2 + .../WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 28 ++++++++++ 13 files changed, 182 insertions(+), 12 deletions(-) diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index 79165f6..3cb818d 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -669858f9bbd4913fd16c642090375c81acbfdb04 +0be9ff9f2b1ec2b748885ac15299bc1c65aca590 diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index 8fa3a72..ea680ac 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,17 @@ +2009-10-30 Tor Arne Vestbø + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Use the default timeout interval for JS as the HTML tokenizer delay for setHtml() + + This ensures that long-running JavaScript (for example due to a modal alert() dialog), + will not trigger a deferred load after only 500ms (the default tokenizer delay) while + still giving a reasonable timeout (10 seconds) to prevent deadlock. + + https://bugs.webkit.org/show_bug.cgi?id=29381 + + * runtime/TimeoutChecker.h: Add getter for the timeout interval + 2010-05-18 Anders Carlsson Reviewed by Sam Weinig. diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.h b/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.h index 7bfa6d0..5925641 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.h @@ -40,6 +40,7 @@ namespace JSC { TimeoutChecker(); void setTimeoutInterval(unsigned timeoutInterval) { m_timeoutInterval = timeoutInterval; } + unsigned timeoutInterval() const { return m_timeoutInterval; } unsigned ticksUntilNextCheck() { return m_ticksUntilNextCheck; } diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index e492154..f12f6b5 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from and has the sha1 checksum - 669858f9bbd4913fd16c642090375c81acbfdb04 + 0be9ff9f2b1ec2b748885ac15299bc1c65aca590 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 1f7ca09..f7f2803 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,67 @@ +2010-07-01 Andreas Kling + + Reviewed by Tor Arne Vestbø. + + [Qt] Clamp color stops passed to QGradient to 1.0 + [https://bugs.webkit.org/show_bug.cgi?id=41484 + + Fixes an issue where color stops would be silently dropped from radial gradients. + + * platform/graphics/qt/GradientQt.cpp: + (WebCore::Gradient::platformGradient): + +2010-07-07 Tor Arne Vestbø + + Reviewed by Darin Adler. + + Prevent assertion/duplicate loads for non-deferred subtitute-data loads + + https://bugs.webkit.org/show_bug.cgi?id=30879 + + MainResourceLoader uses the member m_initialRequest to store requests for future + deferred loads. When doing the actual load in handleDataLoadNow(), we therefore + have to clear this request so that subsequent entries into the loader will not + start yet another load. + + This can happen as a result of a PageGroupLoadDeferrer going out of scope when + returning from Chrome::runJavaScriptAlert(), which calls setDeferredLoading(false), + but only in the case of using both substitute-data and non-deferred main resource + load together. That's why two new DRT functions were added: + + * queueLoadHTMLString() + * setDeferMainResourceLoad() + + The change adds DRT hooks for Mac, Win and Qt for these two functions. For Mac + and Win the hook uses new SPI in WebDataSource. For Qt a new static member was + added to the FrameLoaderClientQt and accessed though DumpRenderTreeSupportQt. + + Test: fast/loader/non-deferred-substitute-load.html + + * loader/MainResourceLoader.cpp: + (WebCore::MainResourceLoader::handleDataLoadNow): + +2010-07-16 Antonio Gomes + + Reviewed by Simon Fraser. + + Spatial navigation: do not consider outline for focusable element boundaries + https://bugs.webkit.org/show_bug.cgi?id=42474 + + Test: fast/events/spatial-navigation/snav-zero-margin-content.html + + Currently in WebCore::renderRectRelativeToRootDocument function, we are calling + RenderObject::absoluteClippedOverflowRect to obtain the rect boundary of a given + renderer/element. This method deals with outline, which is out of elements boundary. + It makes spatial navigation to fail on common sites like google.gom: "Web, Images, Map, etc" + are inaccessible. + + Patch replaces RenderObject::absoluteClippedOverflowRect by Node::getRect, + which returns only the absolute bounding box rect of the Element. + + * page/SpatialNavigation.cpp: + (WebCore::renderRectRelativeToRootDocument): + (WebCore::checkNegativeCoordsForNode): + 2010-07-21 Kristian Amlie Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/WebCore/loader/MainResourceLoader.cpp b/src/3rdparty/webkit/WebCore/loader/MainResourceLoader.cpp index 28587e2..54c5c34 100644 --- a/src/3rdparty/webkit/WebCore/loader/MainResourceLoader.cpp +++ b/src/3rdparty/webkit/WebCore/loader/MainResourceLoader.cpp @@ -464,6 +464,10 @@ void MainResourceLoader::handleDataLoadNow(MainResourceLoaderTimer*) KURL url = m_substituteData.responseURL(); if (url.isEmpty()) url = m_initialRequest.url(); + + // Clear the initial request here so that subsequent entries into the + // loader will not think there's still a deferred load left to do. + m_initialRequest = ResourceRequest(); ResourceResponse response(url, m_substituteData.mimeType(), m_substituteData.content()->size(), m_substituteData.textEncoding(), ""); didReceiveResponse(response); diff --git a/src/3rdparty/webkit/WebCore/page/SpatialNavigation.cpp b/src/3rdparty/webkit/WebCore/page/SpatialNavigation.cpp index a80626f..fdacebb 100644 --- a/src/3rdparty/webkit/WebCore/page/SpatialNavigation.cpp +++ b/src/3rdparty/webkit/WebCore/page/SpatialNavigation.cpp @@ -102,14 +102,9 @@ void distanceDataForNode(FocusDirection direction, Node* start, FocusCandidate& // FIXME: This function does not behave correctly with transformed frames. static IntRect renderRectRelativeToRootDocument(RenderObject* render) { - ASSERT(render); + ASSERT(render && render->node()); - IntRect rect(render->absoluteClippedOverflowRect()); - - if (rect.isEmpty()) { - Element* e = static_cast(render->node()); - rect = e->getRect(); - } + IntRect rect = render->node()->getRect(); // In cases when the |render|'s associated node is in a scrollable inner // document, we only consider its scrollOffset if it is not offscreen. @@ -516,7 +511,7 @@ static bool checkNegativeCoordsForNode(Node* node, const IntRect& curRect) { ASSERT(node || node->renderer()); - if (curRect.x() > 0 && curRect.y() > 0) + if (curRect.x() >= 0 && curRect.y() >= 0) return true; bool canBeScrolled = false; diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GradientQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GradientQt.cpp index 8b9e2d7..1ec3203 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GradientQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GradientQt.cpp @@ -65,7 +65,7 @@ QGradient* Gradient::platformGradient() lastStop = stopIterator->stop; if (m_radial && m_r0) lastStop = m_r0 / m_r1 + lastStop * (1.0f - m_r0 / m_r1); - m_gradient->setColorAt(lastStop, stopColor); + m_gradient->setColorAt(qMin(lastStop, qreal(1.0f)), stopColor); // Keep the lastStop as orginal value, since the following stopColor depend it lastStop = stopIterator->stop; ++stopIterator; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp index cc7b11c..4fe784f 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp @@ -959,6 +959,10 @@ void QWebFrame::load(const QNetworkRequest &req, The \a html is loaded immediately; external objects are loaded asynchronously. + If a script in the \a html runs longer than the default script timeout (currently 10 seconds), + for example due to being blocked by a modal JavaScript alert dialog, this method will return + as soon as possible after the timeout and any subsequent \a html will be loaded asynchronously. + When using this method WebKit assumes that external resources such as JavaScript programs or style sheets are encoded in UTF-8 unless otherwise specified. For example, the encoding of an external script can be specified through the charset attribute of the HTML script tag. It is also possible diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 1075b24..b2bff0c 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,51 @@ +2009-10-30 Tor Arne Vestbø + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Use the default timeout interval for JS as the HTML tokenizer delay for setHtml() + + This ensures that long-running JavaScript (for example due to a modal alert() dialog), + will not trigger a deferred load after only 500ms (the default tokenizer delay) while + still giving a reasonable timeout (10 seconds) to prevent deadlock. + + https://bugs.webkit.org/show_bug.cgi?id=29381 + + * Api/qwebframe.cpp: Document the behaviour + * WebCoreSupport/FrameLoaderClientQt.cpp: set the custom tokenizer delay for substitute loads + * tests/qwebframe/tst_qwebframe.cpp: Add test + +2010-07-07 Tor Arne Vestbø + + Reviewed by Darin Adler. + + Prevent assertion/duplicate loads for non-deferred subtitute-data loads + + https://bugs.webkit.org/show_bug.cgi?id=30879 + + MainResourceLoader uses the member m_initialRequest to store requests for future + deferred loads. When doing the actual load in handleDataLoadNow(), we therefore + have to clear this request so that subsequent entries into the loader will not + start yet another load. + + This can happen as a result of a PageGroupLoadDeferrer going out of scope when + returning from Chrome::runJavaScriptAlert(), which calls setDeferredLoading(false), + but only in the case of using both substitute-data and non-deferred main resource + load together. That's why two new DRT functions were added: + + * queueLoadHTMLString() + * setDeferMainResourceLoad() + + The change adds DRT hooks for Mac, Win and Qt for these two functions. For Mac + and Win the hook uses new SPI in WebDataSource. For Qt a new static member was + added to the FrameLoaderClientQt and accessed though DumpRenderTreeSupportQt. + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::setDeferMainResourceDataLoad): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::createDocumentLoader): + * WebCoreSupport/FrameLoaderClientQt.h: + 2010-07-23 David Boddie Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 686bfcc..713fa39 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -38,6 +38,7 @@ #include "FrameTree.h" #include "FrameView.h" #include "DocumentLoader.h" +#include "JSDOMWindowBase.h" #include "MIMETypeRegistry.h" #include "ResourceResponse.h" #include "Page.h" @@ -141,6 +142,8 @@ static QString drtDescriptionSuitableForTestResult(const WebCore::ResourceRespon namespace WebCore { +bool FrameLoaderClientQt::deferMainResourceDataLoad = true; + FrameLoaderClientQt::FrameLoaderClientQt() : m_frame(0) , m_webFrame(0) @@ -812,8 +815,15 @@ bool FrameLoaderClientQt::shouldFallBack(const WebCore::ResourceError&) WTF::PassRefPtr FrameLoaderClientQt::createDocumentLoader(const WebCore::ResourceRequest& request, const SubstituteData& substituteData) { RefPtr loader = DocumentLoader::create(request, substituteData); - if (substituteData.isValid()) + if (!deferMainResourceDataLoad || substituteData.isValid()) { loader->setDeferMainResourceDataLoad(false); + // Use the default timeout interval for JS as the HTML tokenizer delay. This ensures + // that long-running JavaScript will still allow setHtml() to be synchronous, while + // still giving a reasonable timeout to prevent deadlock. + double delay = JSDOMWindowBase::commonJSGlobalData()->timeoutChecker.timeoutInterval() / 1000.0f; + m_frame->page()->setCustomHTMLTokenizerTimeDelay(delay); + } else + m_frame->page()->setCustomHTMLTokenizerTimeDelay(-1); return loader.release(); } diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index adeb31c..515cf9a 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -211,6 +211,8 @@ namespace WebCore { QString chooseFile(const QString& oldFile); + static bool deferMainResourceDataLoad; + private: Frame *m_frame; QWebFrame *m_webFrame; 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 76fdba3..e584f97 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -598,6 +598,7 @@ private slots: void setHtml(); void setHtmlWithResource(); void setHtmlWithBaseURL(); + void setHtmlWithJSAlert(); void ipv6HostEncoding(); void metaData(); #if !defined(Q_WS_MAEMO_5) @@ -2485,6 +2486,33 @@ void tst_QWebFrame::setHtmlWithBaseURL() QCOMPARE(m_view->page()->history()->count(), 0); } +class MyPage : public QWebPage +{ +public: + MyPage() : QWebPage(), alerts(0) {} + int alerts; + +protected: + virtual void javaScriptAlert(QWebFrame*, const QString& msg) + { + alerts++; + QCOMPARE(msg, QString("foo")); + // Should not be enough to trigger deferred loading, since we've upped the HTML + // tokenizer delay in the Qt frameloader. See HTMLTokenizer::continueProcessing() + QTest::qWait(1000); + } +}; + +void tst_QWebFrame::setHtmlWithJSAlert() +{ + QString html("

hello world

"); + MyPage page; + m_view->setPage(&page); + page.mainFrame()->setHtml(html); + QCOMPARE(page.alerts, 1); + QCOMPARE(m_view->page()->mainFrame()->toHtml(), html); +} + class TestNetworkManager : public QNetworkAccessManager { public: -- cgit v0.12