diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-07-24 09:45:33 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-07-27 13:04:30 (GMT) |
commit | 3643028959f0b38350e57e60ba4000435b75e592 (patch) | |
tree | c129e4dee11487abd437ab8ebd993ba261e06fa6 /src/3rdparty/webkit/WebKit | |
parent | cf66c667a97c0079141eb3f2d9e997b7378ae792 (diff) | |
parent | c36139c665e61866aff4bf8572890a735167a7d0 (diff) | |
download | Qt-3643028959f0b38350e57e60ba4000435b75e592.zip Qt-3643028959f0b38350e57e60ba4000435b75e592.tar.gz Qt-3643028959f0b38350e57e60ba4000435b75e592.tar.bz2 |
Merge commit 'qt/master-stable'
Conflicts:
configure.exe
qmake/Makefile.unix
qmake/generators/makefile.cpp
src/corelib/global/qglobal.h
src/corelib/kernel/kernel.pri
src/corelib/kernel/qcoreevent.cpp
src/corelib/kernel/qsharedmemory_unix.cpp
src/gui/graphicsview/qgraphicsscene.cpp
src/gui/kernel/qaction.cpp
src/gui/kernel/qaction.h
src/gui/kernel/qaction_p.h
src/gui/kernel/qapplication.cpp
src/gui/kernel/qapplication.h
src/gui/kernel/qwidget.cpp
src/gui/kernel/qwidget.h
src/gui/kernel/qwidget_mac.mm
src/gui/painting/qgraphicssystemfactory.cpp
src/gui/styles/qwindowsstyle.cpp
src/gui/text/qfontengine_qpf.cpp
src/gui/widgets/qabstractscrollarea_p.h
src/network/access/qnetworkaccessdebugpipebackend.cpp
src/network/socket/qlocalsocket_unix.cpp
src/network/socket/qnativesocketengine_p.h
src/network/socket/qnativesocketengine_unix.cpp
src/openvg/qpaintengine_vg.cpp
tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
tests/auto/qcssparser/qcssparser.pro
tests/auto/qdir/tst_qdir.cpp
tests/auto/qfile/tst_qfile.cpp
tests/auto/qobject/tst_qobject.cpp
tests/auto/qpathclipper/qpathclipper.pro
tests/auto/qprocess/tst_qprocess.cpp
tests/auto/qsettings/tst_qsettings.cpp
tests/auto/qsharedpointer/qsharedpointer.pro
tests/auto/qsqlquerymodel/qsqlquerymodel.pro
tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro
tests/auto/qsqltablemodel/qsqltablemodel.pro
tests/auto/qsqlthread/qsqlthread.pro
tests/auto/qwidget/tst_qwidget.cpp
Diffstat (limited to 'src/3rdparty/webkit/WebKit')
24 files changed, 819 insertions, 170 deletions
diff --git a/src/3rdparty/webkit/WebKit/ChangeLog b/src/3rdparty/webkit/WebKit/ChangeLog index f07a75c..cabdf46 100644 --- a/src/3rdparty/webkit/WebKit/ChangeLog +++ b/src/3rdparty/webkit/WebKit/ChangeLog @@ -1,3 +1,42 @@ +2009-07-10 Adam Roben <aroben@apple.com> + + Sort all our Xcode projects + + Accomplished using sort-Xcode-project-file. + + Requested by Dave Kilzer. + + * WebKit.xcodeproj/project.pbxproj: + +2009-07-02 Adam Roben <aroben@apple.com> + + Fix warnings from update-webkit-localizable-strings + + Rubber-stamped by Eric Carlson. + + * English.lproj/Localizable.strings: Updated. + +2009-07-02 Adam Roben <aroben@apple.com> + + Update StringsNotToBeLocalized.txt for (not so) recent changes + + Bug 26926: StringsNotToBeLocalized.txt is out-of-date + <https://bugs.webkit.org/show_bug.cgi?id=26926> + + Reviewed by John Sullivan. + + * StringsNotToBeLocalized.txt: + +2009-07-02 Pierre d'Herbemont <pdherbemont@apple.com> + + Reviewed by Simon Fraser. + + <rdar://problem/6518119> + + Add localized strings for media controller status messages. + + * English.lproj/Localizable.strings: Localized text. + 2009-06-08 Dan Bernstein <mitz@apple.com> Rubber-stamped by Mark Rowe. diff --git a/src/3rdparty/webkit/WebKit/StringsNotToBeLocalized.txt b/src/3rdparty/webkit/WebKit/StringsNotToBeLocalized.txt index 003de11..7e593ca 100644 --- a/src/3rdparty/webkit/WebKit/StringsNotToBeLocalized.txt +++ b/src/3rdparty/webkit/WebKit/StringsNotToBeLocalized.txt @@ -402,7 +402,6 @@ "WebViewDidChangeTypingStyleNotification" "WebViewDidEndEditingNotification" "WebViewWindowClass" -"WhatsNewPanel" "Windows %d.%d" "Windows 95" "Windows 98" @@ -465,7 +464,6 @@ "com.adobe.dreamweaver-9.0" "com.alientechnology.Proteus" "com.app4mac.KidsBrowsercom.app4mac.wKiosk" -"com.apple." "com.apple.Aperture" "com.apple.AppKit" "com.apple.Automator" @@ -477,6 +475,7 @@ "com.apple.JavaAppletPlugin" "com.apple.JavaPluginCocoa" "com.apple.KeyboardUIModeDidChange" +"com.apple.Mail" "com.apple.QuickTime Plugin.plugin" "com.apple.Safari" "com.apple.WebCore" @@ -496,7 +495,9 @@ "com.barebones.textwrangler" "com.barebones.yojimbo" "com.culturedcode.xyle" +"com.e-frontier.shade10" "com.equinux.iSale4" +"com.equinux.iSale5" "com.freeverse.bumpercar" "com.growl.growlframework" "com.intrarts.PandoraMan" @@ -539,7 +540,6 @@ "https" "https:" "i" -"iLifeWelcomePanel" "icon.db" "image.pict" "image.png" @@ -690,6 +690,8 @@ WebKit/mac/WebCoreSupport/WebEditorClient.mm:"Enter" WebKit/mac/WebCoreSupport/WebEditorClient.mm:"Up" WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm:"height" WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm:"width" +WebKit/mac/WebCoreSupport/WebInspectorClient.mm:"Menlo" +WebKit/mac/WebCoreSupport/WebInspectorClient.mm:"Monaco" WebKit/mac/WebCoreSupport/WebInspectorClient.mm:"Web Inspector 2" WebKit/mac/WebCoreSupport/WebInspectorClient.mm:"inspector" WebKit/mac/WebView/WebHTMLView.mm:"'%@'" @@ -742,6 +744,7 @@ WebKit/win/ProgIDMacros.h:"WebKit." WebKit/win/WebCache.cpp:"images" WebKit/win/WebCache.cpp:"scripts" WebKit/win/WebCache.cpp:"style sheets" +WebKit/win/WebCoreSupport/WebInspectorClient.cpp:"Courier New" WebKit/win/WebCoreSupport/WebInspectorClient.cpp:"Web Inspector " WebKit/win/WebCoreSupport/WebInspectorClient.cpp:"Web Inspector" WebKit/win/WebCoreSupport/WebInspectorClient.cpp:"inspector" diff --git a/src/3rdparty/webkit/WebKit/qt/Api/headers.pri b/src/3rdparty/webkit/WebKit/qt/Api/headers.pri index e4bb618..d92eb1c 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/headers.pri +++ b/src/3rdparty/webkit/WebKit/qt/Api/headers.pri @@ -6,4 +6,6 @@ WEBKIT_API_HEADERS = $$PWD/qwebframe.h \ $$PWD/qwebhistoryinterface.h \ $$PWD/qwebdatabase.h \ $$PWD/qwebsecurityorigin.h \ - $$PWD/qwebelement.h + $$PWD/qwebelement.h \ + $$PWD/qwebpluginfactory.h \ + $$PWD/qwebhistory.h diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp index 2db9cd0..0d11381 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp @@ -34,9 +34,20 @@ using namespace WebCore; \brief The QWebDatabase class provides access to HTML 5 databases created with JavaScript. The upcoming HTML 5 standard includes support for SQL databases that web sites can create and - access on a local computer through JavaScript. QWebDatabase is the C++ interface to these databases. + access on a local computer through JavaScript. QWebDatabase is the C++ interface to these + databases. - For more information refer to the \l{http://www.w3.org/html/wg/html5/#sql}{HTML 5 Draft Standard}. + To get access to all databases defined by a security origin, use QWebSecurityOrigin::databases(). + Each database has an internal name(), as well as a user-friendly name, provided by displayName(). + + WebKit uses SQLite to create and access the local SQL databases. The location of the database + file in the local file system is returned by fileName(). You can access the database directly + through the QtSql database module. + + For each database the web site can define an expectedSize(). The current size of the database + in bytes is returned by size(). + + For more information refer to the \l{http://dev.w3.org/html5/webdatabase/}{HTML 5 Draft Standard}. \sa QWebSecurityOrigin */ @@ -127,7 +138,7 @@ QWebDatabase::QWebDatabase(QWebDatabasePrivate* priv) \endcode \note Concurrent access to a database from multiple threads or processes - is not very efficient because Sqlite is used as WebKit's database backend. + is not very efficient because SQLite is used as WebKit's database backend. */ QString QWebDatabase::fileName() const { @@ -149,8 +160,8 @@ QWebSecurityOrigin QWebDatabase::origin() const } /*! - Removes the database, \a db, from its security origin. All data stored in this database - will be destroyed. + Removes the database \a db from its security origin. All data stored in the + database \a db will be destroyed. */ void QWebDatabase::removeDatabase(const QWebDatabase &db) { @@ -160,6 +171,20 @@ void QWebDatabase::removeDatabase(const QWebDatabase &db) } /*! + \since 4.6 + + Deletes all web databases in the configured offline storage path. + + \sa QWebSettings::setOfflineStoragePath() +*/ +void QWebDatabase::removeAllDatabases() +{ +#if ENABLE(DATABASE) + DatabaseTracker::tracker().deleteAllDatabases(); +#endif +} + +/*! Destroys the web database object. The data within this database is \b not destroyed. */ QWebDatabase::~QWebDatabase() diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.h index 4e832bb..5b4f704 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.h @@ -46,6 +46,7 @@ public: QWebSecurityOrigin origin() const; static void removeDatabase(const QWebDatabase &db); + static void removeAllDatabases(); private: QWebDatabase(QWebDatabasePrivate* priv); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp index 381251d..29d380d 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp @@ -20,73 +20,71 @@ #include "config.h" #include "qwebframe.h" -#include "qwebpage.h" -#include "qwebpage_p.h" -#include "qwebframe_p.h" -#include "qwebsecurityorigin.h" -#include "qwebsecurityorigin_p.h" -#include "qwebelement.h" +#include "CallFrame.h" +#include "Document.h" #include "DocumentLoader.h" +#include "DragData.h" +#include "Element.h" #include "FocusController.h" -#include "FrameLoaderClientQt.h" #include "Frame.h" +#include "FrameLoaderClientQt.h" #include "FrameTree.h" #include "FrameView.h" +#include "GCController.h" +#include "GraphicsContext.h" +#include "HTMLMetaElement.h" +#include "HitTestResult.h" #include "IconDatabase.h" #include "InspectorController.h" +#include "JSDOMBinding.h" +#include "JSDOMWindowBase.h" +#include "JSLock.h" +#include "JSObject.h" +#include "NodeList.h" #include "Page.h" +#include "PlatformMouseEvent.h" +#include "PlatformWheelEvent.h" +#include "PrintContext.h" #include "PutPropertySlot.h" -#include "ResourceRequest.h" +#include "RenderTreeAsText.h" #include "RenderView.h" -#include "SelectionController.h" +#include "ResourceRequest.h" +#include "ScriptController.h" +#include "ScriptSourceCode.h" +#include "ScriptValue.h" #include "Scrollbar.h" -#include "PrintContext.h" +#include "SelectionController.h" #include "SubstituteData.h" - -#include "markup.h" #include "htmlediting.h" -#include "RenderTreeAsText.h" -#include "Element.h" -#include "Document.h" -#include "DragData.h" -#include "RenderView.h" -#include "GraphicsContext.h" -#include "PlatformMouseEvent.h" -#include "PlatformWheelEvent.h" -#include "GraphicsContext.h" -#include "HitTestResult.h" - -#include "CallFrame.h" -#include "JSDOMBinding.h" -#include "JSDOMWindow.h" -#include "JSLock.h" -#include "JSObject.h" +#include "markup.h" #include "qt_instance.h" #include "qt_runtime.h" +#include "qwebelement.h" +#include "qwebframe_p.h" +#include "qwebpage.h" +#include "qwebpage_p.h" +#include "qwebsecurityorigin.h" +#include "qwebsecurityorigin_p.h" #include "runtime.h" #include "runtime_object.h" #include "runtime_root.h" -#include "ScriptController.h" -#include "ScriptSourceCode.h" -#include "ScriptValue.h" - #include "wtf/HashMap.h" - +#include <QMultiMap> #include <qdebug.h> #include <qevent.h> #include <qfileinfo.h> #include <qpainter.h> -#include <QMultiMap> +#include <qprinter.h> +#include <qregion.h> + +#if QT_VERSION < 0x040400 +#include "qwebnetworkinterface.h" +#endif + #if QT_VERSION >= 0x040400 #include <qnetworkrequest.h> -#else -#include "qwebnetworkinterface.h" #endif -#include <qregion.h> -#include <qprinter.h> -#include "HTMLMetaElement.h" -#include "NodeList.h" using namespace WebCore; @@ -166,27 +164,56 @@ int QWEBKIT_EXPORT qt_drt_numberOfActiveAnimations(QWebFrame *qframe) return controller->numberOfActiveAnimations(); } -void QWebFramePrivate::init(QWebFrame *qframe, WebCore::Page *webcorePage, QWebFrameData *frameData) +void QWEBKIT_EXPORT qt_drt_clearFrameName(QWebFrame* qFrame) { - q = qframe; + Frame* frame = QWebFramePrivate::core(qFrame); + frame->tree()->clearName(); +} - allowsScrolling = frameData->allowsScrolling; - marginWidth = frameData->marginWidth; - marginHeight = frameData->marginHeight; +int QWEBKIT_EXPORT qt_drt_javaScriptObjectsCount() +{ + return JSDOMWindowBase::commonJSGlobalData()->heap.globalObjectCount(); +} + +void QWEBKIT_EXPORT qt_drt_garbageCollector_collect() +{ + gcController().garbageCollectNow(); +} +void QWEBKIT_EXPORT qt_drt_garbageCollector_collectOnAlternateThread(bool waitUntilDone) +{ + gcController().garbageCollectOnAlternateThreadForDebugging(waitUntilDone); +} + +QWebFrameData::QWebFrameData(WebCore::Page* parentPage, WebCore::Frame* parentFrame, + WebCore::HTMLFrameOwnerElement* ownerFrameElement, + const WebCore::String& frameName) + : name(frameName) + , ownerElement(ownerFrameElement) + , page(parentPage) + , allowsScrolling(true) + , marginWidth(0) + , marginHeight(0) +{ frameLoaderClient = new FrameLoaderClientQt(); - RefPtr<Frame> newFrame = Frame::create(webcorePage, frameData->ownerElement, frameLoaderClient); - frame = newFrame.get(); - frameLoaderClient->setFrame(qframe, frame); + frame = Frame::create(page, ownerElement, frameLoaderClient); // FIXME: All of the below should probably be moved over into WebCore - frame->tree()->setName(frameData->name); - if (QWebFrame* _parentFrame = parentFrame()) - QWebFramePrivate::core(_parentFrame)->tree()->appendChild(frame); + frame->tree()->setName(name); + if (parentFrame) + parentFrame->tree()->appendChild(frame); +} - // balanced by adoptRef in FrameLoaderClientQt::createFrame - if (frameData->ownerElement) - frame->ref(); +void QWebFramePrivate::init(QWebFrame *qframe, QWebFrameData *frameData) +{ + q = qframe; + + allowsScrolling = frameData->allowsScrolling; + marginWidth = frameData->marginWidth; + marginHeight = frameData->marginHeight; + frame = frameData->frame.get(); + frameLoaderClient = frameData->frameLoaderClient; + frameLoaderClient->setFrame(qframe, frame); frame->init(); } @@ -280,7 +307,7 @@ QWebFrame::QWebFrame(QWebPage *parent, QWebFrameData *frameData) , d(new QWebFramePrivate) { d->page = parent; - d->init(this, parent->d->page, frameData); + d->init(this, frameData); if (!frameData->url.isEmpty()) { WebCore::ResourceRequest request(frameData->url, frameData->referrer); @@ -293,7 +320,7 @@ QWebFrame::QWebFrame(QWebFrame *parent, QWebFrameData *frameData) , d(new QWebFramePrivate) { d->page = parent->d->page; - d->init(this, parent->d->page->d->page, frameData); + d->init(this, frameData); } QWebFrame::~QWebFrame() @@ -316,6 +343,8 @@ QWebFrame::~QWebFrame() new URL, you should add them in a slot connected to the javaScriptWindowObjectCleared() signal. + If Javascript is not enabled for this page, then this method does nothing. + The \a object will never be explicitly deleted by QtWebKit. */ void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object) @@ -338,10 +367,15 @@ void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object new URL, you should add them in a slot connected to the javaScriptWindowObjectCleared() signal. + If Javascript is not enabled for this page, then this method does nothing. + The ownership of \a object is specified using \a own. */ void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object, QScriptEngine::ValueOwnership ownership) { + if (!page()->settings()->testAttribute(QWebSettings::JavascriptEnabled)) + return; + JSC::JSLock lock(false); JSDOMWindow* window = toJSDOMWindow(d->frame); JSC::Bindings::RootObject* root = d->frame->script()->bindingRootObject(); @@ -487,6 +521,17 @@ QUrl QWebFrame::url() const } /*! + \property QWebFrame::baseUrl + \brief the base URL of the frame, can be used to resolve relative URLs + \since 4.6 +*/ + +QUrl QWebFrame::baseUrl() const +{ + return d->frame->loader()->baseURL(); +} + +/*! \property QWebFrame::icon \brief the icon associated with this frame @@ -933,6 +978,27 @@ qreal QWebFrame::zoomFactor() const } /*! + \property QWebFrame::focus + \since 4.6 + + Returns true if this frame has keyboard input focus; otherwise, returns false. +*/ +bool QWebFrame::hasFocus() const +{ + return QWebFramePrivate::kit(d->frame->page()->focusController()->focusedFrame()) == this; +} + +/*! + \since 4.6 + + Gives keyboard input focus to this frame. +*/ +void QWebFrame::setFocus() +{ + QWebFramePrivate::core(this)->page()->focusController()->setFocusedFrame(QWebFramePrivate::core(this)); +} + +/*! Returns the position of the frame relative to it's parent frame. */ QPoint QWebFrame::pos() const @@ -1229,6 +1295,25 @@ QWebFrame* QWebFramePrivate::kit(WebCore::Frame* coreFrame) */ /*! + \fn void QWebFrame::loadStarted() + \since 4.6 + + This signal is emitted when a new load of this frame is started. + + \sa loadFinished() +*/ + +/*! + \fn void QWebFrame::loadFinished(bool ok) + \since 4.6 + + This signal is emitted when a load of this frame is finished. + \a ok will indicate whether the load was successful or any error occurred. + + \sa loadStarted() +*/ + +/*! \class QWebHitTestResult \since 4.4 \brief The QWebHitTestResult class provides information about the web diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h index 3ed453e..2c5309a 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h @@ -109,9 +109,11 @@ class QWEBKIT_EXPORT QWebFrame : public QObject Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor) Q_PROPERTY(QString title READ title) Q_PROPERTY(QUrl url READ url WRITE setUrl) + Q_PROPERTY(QUrl baseUrl READ baseUrl) Q_PROPERTY(QIcon icon READ icon) Q_PROPERTY(QSize contentsSize READ contentsSize) Q_PROPERTY(QPoint scrollPosition READ scrollPosition WRITE setScrollPosition) + Q_PROPERTY(bool focus READ hasFocus) private: QWebFrame(QWebPage *parent, QWebFrameData *frameData); QWebFrame(QWebFrame *parent, QWebFrameData *frameData); @@ -140,6 +142,7 @@ public: QString title() const; void setUrl(const QUrl &url); QUrl url() const; + QUrl baseUrl() const; QIcon icon() const; QMultiMap<QString, QString> metaData() const; @@ -171,6 +174,9 @@ public: qreal zoomFactor() const; void setZoomFactor(qreal factor); + bool hasFocus() const; + void setFocus(); + QPoint pos() const; QRect geometry() const; QSize contentsSize() const; @@ -204,6 +210,9 @@ Q_SIGNALS: void contentsSizeChanged(const QSize &size); + void loadStarted(); + void loadFinished(bool ok); + private: friend class QWebPage; friend class QWebPagePrivate; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h index 0c7da90..2b5c187 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h @@ -43,9 +43,16 @@ class QWebPage; class QWebFrameData { public: + QWebFrameData(WebCore::Page*, WebCore::Frame* parentFrame = 0, + WebCore::HTMLFrameOwnerElement* = 0, + const WebCore::String& frameName = WebCore::String()); + WebCore::KURL url; WebCore::String name; WebCore::HTMLFrameOwnerElement* ownerElement; + WebCore::Page* page; + RefPtr<WebCore::Frame> frame; + WebCore::FrameLoaderClientQt* frameLoaderClient; WebCore::String referrer; bool allowsScrolling; @@ -67,8 +74,7 @@ public: , marginWidth(-1) , marginHeight(-1) {} - void init(QWebFrame *qframe, WebCore::Page *page, - QWebFrameData *frameData); + void init(QWebFrame* qframe, QWebFrameData* frameData); inline QWebFrame *parentFrame() { return qobject_cast<QWebFrame*>(q->parent()); } diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 5899a1b..3c2151b 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -325,11 +325,7 @@ bool QWebPagePrivate::acceptNavigationRequest(QWebFrame *frame, const QNetworkRe void QWebPagePrivate::createMainFrame() { if (!mainFrame) { - QWebFrameData frameData; - frameData.ownerElement = 0; - frameData.allowsScrolling = true; - frameData.marginWidth = 0; - frameData.marginHeight = 0; + QWebFrameData frameData(page); mainFrame = new QWebFrame(q, &frameData); emit q->frameCreated(mainFrame); @@ -420,23 +416,6 @@ QMenu *QWebPagePrivate::createContextMenu(const WebCore::ContextMenu *webcoreMen } #endif // QT_NO_CONTEXTMENU -QWebFrame *QWebPagePrivate::frameAt(const QPoint &pos) const -{ - QWebFrame *frame = mainFrame; - -redo: - QList<QWebFrame*> children = frame->childFrames(); - for (int i = 0; i < children.size(); ++i) { - if (children.at(i)->geometry().contains(pos)) { - frame = children.at(i); - goto redo; - } - } - if (frame->geometry().contains(pos)) - return frame; - return 0; -} - void QWebPagePrivate::_q_webActionTriggered(bool checked) { QAction *a = qobject_cast<QAction *>(q->sender()); @@ -844,7 +823,7 @@ void QWebPagePrivate::focusInEvent(QFocusEvent *ev) Frame *frame = focusController->focusedFrame(); focusController->setActive(true); if (frame) { - frame->selection()->setFocused(true); + focusController->setFocused(true); } else { focusController->setFocusedFrame(QWebFramePrivate::core(mainFrame)); } @@ -857,10 +836,7 @@ void QWebPagePrivate::focusOutEvent(QFocusEvent *ev) // focusInEvent() we can re-activate the frame. FocusController *focusController = page->focusController(); focusController->setActive(false); - Frame *frame = focusController->focusedFrame(); - if (frame) { - frame->selection()->setFocused(false); - } + focusController->setFocused(false); } void QWebPagePrivate::dragEnterEvent(QDragEnterEvent *ev) @@ -1337,6 +1313,23 @@ QWebFrame *QWebPage::currentFrame() const return static_cast<WebCore::FrameLoaderClientQt *>(d->page->focusController()->focusedOrMainFrame()->loader()->client())->webFrame(); } + +/*! + \since 4.6 + + Returns the frame at the given point \a pos. + + \sa mainFrame(), currentFrame() +*/ +QWebFrame* QWebPage::frameAt(const QPoint& pos) const +{ + QWebFrame* webFrame = mainFrame(); + if (!webFrame->geometry().contains(pos)) + return 0; + QWebHitTestResult hitTestResult = webFrame->hitTestContent(pos); + return hitTestResult.frame(); +} + /*! Returns a pointer to the view's history of navigated web pages. */ @@ -1430,6 +1423,28 @@ bool QWebPage::javaScriptPrompt(QWebFrame *frame, const QString& msg, const QStr } /*! + \fn bool QWebPage::shouldInterruptJavaScript() + \since 4.6 + This function is called when a JavaScript program is running for a long period of time. + + If the user wanted to stop the JavaScript the implementation should return true; otherwise false. + + The default implementation executes the query using QMessageBox::information with QMessageBox::Yes and QMessageBox::No buttons. + + \warning Because of binary compatibility constraints, this function is not virtual. If you want to + provide your own implementation in a QWebPage subclass, reimplement the shouldInterruptJavaScript() + slot in your subclass instead. QtWebKit will dynamically detect the slot and call it. +*/ +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); +#endif +} + +/*! This function is called whenever WebKit wants to create a new window of the given \a type, for example when a JavaScript program requests to open a document in a new window. @@ -2193,9 +2208,9 @@ bool QWebPage::swallowContextMenuEvent(QContextMenuEvent *event) { d->page->contextMenuController()->clearContextMenu(); - if (QWebFrame* webFrame = d->frameAt(event->pos())) { + if (QWebFrame* webFrame = frameAt(event->pos())) { Frame* frame = QWebFramePrivate::core(webFrame); - if (Scrollbar* scrollbar = frame->view()->scrollbarUnderPoint(PlatformMouseEvent(event, 1).pos())) { + if (Scrollbar* scrollbar = frame->view()->scrollbarAtPoint(PlatformMouseEvent(event, 1).pos())) { return scrollbar->contextMenu(PlatformMouseEvent(event, 1)); } } diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h index 86822d2..517a77c 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h @@ -193,6 +193,7 @@ public: QWebFrame *mainFrame() const; QWebFrame *currentFrame() const; + QWebFrame* frameAt(const QPoint& pos) const; QWebHistory *history() const; QWebSettings *settings() const; @@ -287,6 +288,9 @@ public: inline QWebPagePrivate* handle() const { return d; } +public Q_SLOTS: + bool shouldInterruptJavaScript(); + Q_SIGNALS: void loadStarted(); void loadProgress(int progress); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h index 984bec1..3a3a674 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h @@ -75,9 +75,6 @@ public: #ifndef QT_NO_CONTEXTMENU QMenu *createContextMenu(const WebCore::ContextMenu *webcoreMenu, const QList<WebCore::ContextMenuItem> *items, QBitArray *visitedWebActions); #endif - - QWebFrame *frameAt(const QPoint &pos) const; - void _q_onLoadProgressChanged(int); void _q_webActionTriggered(bool checked); #ifndef NDEBUG diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp index da9278c..d2eaf10 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp @@ -36,10 +36,9 @@ using namespace WebCore; \brief The QWebSecurityOrigin class defines a security boundary for web sites. QWebSecurityOrigin provides access to the security domains defined by web sites. - An origin consists of a host name, a scheme, and a port number. Web sites with the same - security origin can access each other's resources for client-side scripting or databases. - - ### diagram + An origin consists of a host name, a scheme, and a port number. Web sites + with the same security origin can access each other's resources for client-side + scripting or databases. For example the site \c{http://www.example.com/my/page.html} is allowed to share the same database as \c{http://www.example.com/my/overview.html}, or access each other's @@ -47,7 +46,13 @@ using namespace WebCore; \c{http://www.malicious.com/evil.html} from accessing \c{http://www.example.com/}'s resources, because they are of a different security origin. - QWebSecurity also provides access to all databases defined within a security origin. + Call QWebFrame::securityOrigin() to get the QWebSecurityOrigin for a frame in a + web page, and use host(), scheme() and port() to identify the security origin. + + Use databases() to access the databases defined within a security origin. The + disk usage of the origin's databases can be limited with setDatabaseQuota(). + databaseQuota() and databaseUsage() report the current limit as well as the + current usage. For more information refer to the \l{http://en.wikipedia.org/wiki/Same_origin_policy}{"Same origin policy" Wikipedia Article}. diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index c634a7f..34da644 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -270,19 +270,24 @@ void QWebView::setPage(QWebPage *page) '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(). - Examples - - webkit.org becomes http://webkit.org - - ftp.webkit.org becomes ftp://ftp.webkit.org - - localhost becomes http://localhost - - /home/user/test.html becomes file:///home/user/test.html (if exists) - - Tips when dealing with URLs and strings - - When creating a QString from a QByteArray or a char*, always use - QString::fromUtf8(). - - 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. + \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) { diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index dffa5e5..02aab77 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,341 @@ +2009-07-13 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Ariya Hidayat. + + Fix qdoc warnings for QWebPage::shouldInterruptJavaScript() and mention + how to re-implement it. + + * Api/qwebpage.cpp: + +2009-07-13 Simon Hausmann <hausmann@webkit.org> + + Reviewed by Ariya Hidayat. + + Fix crash with plugins when the plugin stream is cancelled. + + Similar to r26667 handle the case where didReceiveResponse on the + plugin view results in failure to set up the stream and + setMainDocumentError being called instead. This will set the + m_pluginView back to 0 and we need check for it before calling + didReceiveData. + + This was triggered by consecutive execution of + LayoutTests/plugins/return-error-from-new-stream-callback-in-full-frame-plugin.html + followed by LayoutTests/scrollbars/scrollbar-crash-on-refresh.html + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::committedLoad): + +2009-07-13 Simon Hausmann <hausmann@webkit.org> + + Reviewed by Ariya Hidayat. + + Added QWebDatabase::removeAllDatabases, as a way to delete all + databases from the offline storage path. + + Used by the Qt DRT. + + * Api/qwebdatabase.cpp: + (QWebDatabase::removeAllDatabases): + * Api/qwebdatabase.h: + +2009-07-13 Simon Hausmann <hausmann@webkit.org> + + Reviewed by Ariya Hidayat. + + Added loadStarted() and loadFinished() signals to QWebFrame, + to allow load tracking of individual frames, as opposed to + QWebPage's loadStarted/loadFinished signals that are emitted + whenever _any_ child frame loads/finishes. + + * Api/qwebframe.cpp: Document new signals. + * Api/qwebframe.h: Add new signals. + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::setFrame): Connect new signals. + +2009-07-13 Simon Hausmann <hausmann@webkit.org> + + Reviewed by Ariya Hidayat. + + Add hooks for the GCController JavaScript interface needed by the + Qt DRT. + + Fixed sort order of includes in qwebframe.cpp. + + * Api/qwebframe.cpp: + (qt_drt_javaScriptObjectsCount): + (qt_drt_garbageCollector_collect): + (qt_drt_garbageCollector_collectOnAlternateThread): + +2009-07-13 Simon Hausmann <hausmann@webkit.org> + + Reviewed by Ariya Hidayat. + + Add hooks for the GCController JavaScript interface needed by the + Qt DRT. + + Fixed sort order of includes in qwebframe.cpp. + + * Api/qwebframe.cpp: + (qt_drt_javaScriptObjectsCount): + (qt_drt_garbageCollector_collect): + (qt_drt_garbageCollector_collectOnAlternateThread): + +2009-07-12 Brent Fulgham <bfulgham@gmail.com> + + Speculative build fix after http://trac.webkit.org/changeset/45786. + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::addMessageToConsole): + * WebCoreSupport/ChromeClientQt.h: + +2009-07-10 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Holger Freyther. + + https://bugs.webkit.org/show_bug.cgi?id=27136 + + Fix a bug where webkit hangs when executing infinite JavaScript loop. + + * Api/qwebpage.cpp: + (QWebPage::shouldInterruptJavaScript): + * Api/qwebpage.h: + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::shouldInterruptJavaScript): + * tests/qwebpage/tst_qwebpage.cpp: + (JSTestPage::JSTestPage): + (JSTestPage::shouldInterruptJavaScript): + (tst_QWebPage::infiniteLoopJS): + +2009-07-10 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Holger Freyther. + + https://bugs.webkit.org/show_bug.cgi?id=27108 + + Fix crash when in frame tree of a new frame before the new frame + has been installed in the frame tree, similar to r35088. + + After calling Frame::init() the frame it may have been removed from the + frame tree again through JavaScript. Detect this by checking the page() + afterwards. + + To make this check safe the Frame::init() code was moved into + QWebFrameData's constructor, where a RefPtr holds a reference to the frame. + After the check back in FrameLoaderClientQt we would hold the single + reference left and after release() the frame, its frame loader, its + client as well as the QWebFrame should have disappeared then. + + * Api/qwebframe.cpp: + (QWebFramePrivate::init): Only call Frame::init here, the rest is + done in QWebFrameData's constructor. + (QWebFrame::QWebFrame): + * Api/qwebframe_p.h: Adjust declaration. + (QWebFrameData::QWebFrameData): Create the Frame here. + * Api/qwebpage.cpp: + (QWebPagePrivate::createMainFrame): Adjust and simplify + to new QWebFrame constructor. + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::createFrame): Adjust to + new QWebFrame construction using QWebFrameData and add the + check like in r35088. + +2009-07-09 Beth Dakin <bdakin@apple.com> + + Reviewed by Dave Hyatt. + + Make Widget RefCounted to fix: + + <rdar://problem/7038831> REGRESSION (TOT): In Mail, a crash occurs + at WebCore::Widget::afterMouseDown() after clicking To Do's close + box + <rdar://problem/6978804> WER #16: Repro Access Violation in + WebCore::PluginView::bindingInstance (1310178023) + -and- + <rdar://problem/6991251> WER #13: Crash in WebKit! + WebCore::PluginView::performRequest+203 (1311461169) + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::createPlugin): + (WebCore::FrameLoaderClientQt::createJavaAppletWidget): + * WebCoreSupport/FrameLoaderClientQt.h: + +2009-07-08 Pradeepto Bhattacharya <pradeepto@kde.org> + + Reviewed by Ariya Hidayat. + + Build fix. + + * WebCoreSupport/FrameLoaderClientQt.h: Removed the slot slotCallPolicyFunction(). + +2009-07-08 Simon Hausmann <hausmann@webkit.org> + + Reviewed by Tor Arne Vestbø. + + https://bugs.webkit.org/show_bug.cgi?id=27080 + + Fix DRT instability issues with fast/loader/submit-form-while-parsing-2.html + + When the form is submitted we call the policy function in the frame + loader delayed with a queued connection. That queued connection + sometimes interferes with the javascript timeout set in the testcase. + + Eliminate the entire delayed policy function mechanism and instead always + call back directly, like in the other ports. In most other places we called + the slot directly anyway. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::FrameLoaderClientQt): Remove m_policyFunction. + (WebCore::FrameLoaderClientQt::callPolicyFunction): Call the policy function directly instead + of emitting the queued signal. + (WebCore::FrameLoaderClientQt::cancelPolicyCheck): Call callPolicyFunction directly. + (WebCore::FrameLoaderClientQt::dispatchWillSubmitForm): Ditto. + (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForMIMEType): Ditto. + (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction): Ditto. + (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction): Ditto. + * WebCoreSupport/FrameLoaderClientQt.h: Remove m_policyFunction as well as the associated + signal. + +2009-07-07 Simon Hausmann <hausmann@webkit.org> + + Reviewed by Holger Freyther. + + Add Qt DRT hook for clearing the frame name. + + * Api/qwebframe.cpp: + (qt_drt_clearFrameName): + +2009-07-05 Simon Hausmann <hausmann@webkit.org> + + Reviewed by Holger Freyther. + + Fix two qdoc warnings. + + Added missing \property for QWebFrame::hasFocus and added \a + tag for pos of QWebPage::frameAt. + + * Api/qwebframe.cpp: + * Api/qwebpage.cpp: + +2009-07-04 Holger Hans Peter Freyther <zecke@selfish.org> + + Reviewed by Simon Hausmann. + + Use the recently introduced FocusController::setFocused + + Use the recently introduced FocusController::setFocused + in the Qt platform. The SelectionController will be updated + from within the FocusController now. + + * Api/qwebpage.cpp: + (QWebPagePrivate::focusInEvent): + (QWebPagePrivate::focusOutEvent): + +2009-07-02 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Ariya Hidayat. + + Improve documentation of QWebFrame::setFocus and hasFocus() + Added missing Q_PROPERTY for QWebFrame::hasFocus. + + * Api/qwebframe.cpp: Clarify the docs. + * Api/qwebframe.h: add Q_PROPERTY(focus). + +2009-07-02 Joe Ligman <joseph.ligman@nokia.com> + + Reviewed by Simon Hausmann. + + Bug 26855: [Qt] New methods for QWebFrame to check and set focus. + + Added new public methods QWebFrame::hasFocus() and QWebFrame::setFocus() + Added auto test. + + * Api/qwebframe.cpp: + (QWebFrame::hasFocus): + (QWebFrame::setFocus): + * Api/qwebframe.h: + * tests/qwebframe/tst_qwebframe.cpp: + +2009-07-01 Robert Hogan <robert@roberthogan.net> + + Reviewed by NOBODY. + + Fix Qt segfault when javascript disabled. + If clients call addToJavaScriptWindowObject even though JavascriptEnabled is false + webkit will segfault on the assert: + ASSERTION FAILED: _rootObject + (../../../WebCore/bridge/runtime.cpp:52 + JSC::Bindings::Instance::Instance(WTF::PassRefPtr<JSC::Bindings::RootObject>)) + Fix is to ensure JavaScript is enabled when client calls addToJavaScriptWindowObject. + + https://bugs.webkit.org/show_bug.cgi?id=26906 + + * Api/qwebframe.cpp: + (QWebFrame::addToJavaScriptWindowObject): + +2009-07-01 Jakub Wieczorek <faw217@gmail.com> + + Reviewed by Simon Hausmann. + + [Qt] Move some API headers from WebCore.pro to headers.pri so that they + get installed when running make install from the build directory. + + * Api/headers.pri: + +2009-07-01 Balazs Kelemen <kelemen.balazs.3@stud.u-szeged.hu> + + Reviewed by Simon Hausmann. + + Fixed robotized QtLauncher to work when there is no index.html in the user's home. + + * QtLauncher/main.cpp: + (main): + +2009-06-30 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Adam Roben. + + Renamed scrollbarUnderPoint to scrollbarAtPoint to follow conventions. + + * Api/qwebpage.cpp: + (QWebPage::swallowContextMenuEvent): + +2009-06-30 Joe Ligman <joseph.ligman@nokia.com> + + Reviewed by Adam Treat. + + Bug 26422: [Qt] QWebPagePrivate::frameAt calculates wrong frame + + Added a public method QWebPage::frameAt + Removed QWebPagePrivate::frameAt, which calcuated the wrong frame + Modified QWebPage::swallowContextMenuEvent to use the new frameAt method + New test case for frameAt added to tst_qwebpage.cpp + + * Api/qwebpage.cpp: + (QWebPage::frameAt): + (QWebPage::swallowContextMenuEvent): + * Api/qwebpage.h: + * Api/qwebpage_p.h: + * tests/qwebpage/frametest/iframe.html: Added. + * tests/qwebpage/frametest/iframe2.html: Added. + * tests/qwebpage/frametest/iframe3.html: Added. + * tests/qwebpage/tst_qwebpage.cpp: + (frameAtHelper): + (tst_QWebPage::frameAt): + * tests/qwebpage/tst_qwebpage.qrc: + +2009-06-30 Jakub Wieczorek <faw217@gmail.com> + + Reviewed by Simon Hausmann. + + Add QWebFrame::baseUrl() function that exposes the base URL of a frame. + Autotests included. + + * Api/qwebframe.cpp: + (QWebFrame::baseUrl): + * Api/qwebframe.h: + * tests/qwebframe/tst_qwebframe.cpp: + 2009-06-29 Simon Hausmann <simon.hausmann@nokia.com> Fix the Qt build, add missing isSpeaking() implementation to diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index d001035..c169a9f 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -228,7 +228,7 @@ void ChromeClientQt::setResizable(bool) notImplemented(); } -void ChromeClientQt::addMessageToConsole(MessageSource, MessageLevel, const String& message, +void ChromeClientQt::addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned int lineNumber, const String& sourceID) { QString x = message; @@ -288,8 +288,9 @@ void ChromeClientQt::setStatusbarText(const String& msg) bool ChromeClientQt::shouldInterruptJavaScript() { - notImplemented(); - return false; + bool shouldInterrupt = false; + QMetaObject::invokeMethod(m_webPage, "shouldInterruptJavaScript", Qt::DirectConnection, Q_RETURN_ARG(bool, shouldInterrupt)); + return shouldInterrupt; } bool ChromeClientQt::tabsToLinks() const diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h index 9f2c1b5..67663fb 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h @@ -83,7 +83,7 @@ namespace WebCore { virtual void setResizable(bool); - virtual void addMessageToConsole(MessageSource, MessageLevel, const String& message, + virtual void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned int lineNumber, const String& sourceID); virtual bool canRunBeforeUnloadConfirmPanel(); diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index c6c4b9e..8e6ffed 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -144,10 +144,8 @@ FrameLoaderClientQt::FrameLoaderClientQt() , m_pluginView(0) , m_hasSentResponseToPlugin(false) , m_firstData(false) - , m_policyFunction(0) , m_loadSucceeded(false) { - connect(this, SIGNAL(sigCallPolicyFunction(int)), this, SLOT(slotCallPolicyFunction(int)), Qt::QueuedConnection); } @@ -166,10 +164,14 @@ void FrameLoaderClientQt::setFrame(QWebFrame* webFrame, Frame* frame) connect(this, SIGNAL(loadStarted()), m_webFrame->page(), SIGNAL(loadStarted())); + connect(this, SIGNAL(loadStarted()), + m_webFrame, SIGNAL(loadStarted())); connect(this, SIGNAL(loadProgress(int)), m_webFrame->page(), SIGNAL(loadProgress(int))); connect(this, SIGNAL(loadFinished(bool)), m_webFrame->page(), SIGNAL(loadFinished(bool))); + connect(this, SIGNAL(loadFinished(bool)), + m_webFrame, SIGNAL(loadFinished(bool))); connect(this, SIGNAL(titleChanged(const QString&)), m_webFrame, SIGNAL(titleChanged(const QString&))); } @@ -181,20 +183,7 @@ QWebFrame* FrameLoaderClientQt::webFrame() const void FrameLoaderClientQt::callPolicyFunction(FramePolicyFunction function, PolicyAction action) { - ASSERT(!m_policyFunction); - ASSERT(function); - - m_policyFunction = function; - emit sigCallPolicyFunction(action); -} - -void FrameLoaderClientQt::slotCallPolicyFunction(int action) -{ - if (!m_frame || !m_policyFunction) - return; - FramePolicyFunction function = m_policyFunction; - m_policyFunction = 0; - (m_frame->loader()->*function)(WebCore::PolicyAction(action)); + (m_frame->loader()->*function)(action); } bool FrameLoaderClientQt::hasWebView() const @@ -415,7 +404,6 @@ void FrameLoaderClientQt::dispatchShow() void FrameLoaderClientQt::cancelPolicyCheck() { // qDebug() << "FrameLoaderClientQt::cancelPolicyCheck"; - m_policyFunction = 0; } @@ -423,7 +411,6 @@ void FrameLoaderClientQt::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState>) { notImplemented(); - Q_ASSERT(!m_policyFunction); // FIXME: This is surely too simple callPolicyFunction(function, PolicyUse); } @@ -692,6 +679,11 @@ void FrameLoaderClientQt::committedLoad(WebCore::DocumentLoader* loader, const c if (m_pluginView) { if (!m_hasSentResponseToPlugin) { m_pluginView->didReceiveResponse(loader->response()); + // didReceiveResponse sets up a new stream to the plug-in. on a full-page plug-in, a failure in + // setting up this stream can cause the main document load to be cancelled, setting m_pluginView + // to null + if (!m_pluginView) + return; m_hasSentResponseToPlugin = true; } m_pluginView->didReceiveData(data, length); @@ -887,19 +879,15 @@ WebCore::Frame* FrameLoaderClientQt::dispatchCreatePage() void FrameLoaderClientQt::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const WebCore::String& MIMEType, const WebCore::ResourceRequest&) { // we need to call directly here - Q_ASSERT(!m_policyFunction); - m_policyFunction = function; if (canShowMIMEType(MIMEType)) - slotCallPolicyFunction(PolicyUse); + callPolicyFunction(function, PolicyUse); else - slotCallPolicyFunction(PolicyDownload); + callPolicyFunction(function, PolicyDownload); } void FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState>, const WebCore::String&) { - Q_ASSERT(!m_policyFunction); Q_ASSERT(m_webFrame); - m_policyFunction = function; #if QT_VERSION < 0x040400 QWebNetworkRequest r(request); #else @@ -916,17 +904,15 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction(FramePolicyFunc m_frame->loader()->activeDocumentLoader()->setLastCheckedRequest(emptyRequest); } - slotCallPolicyFunction(PolicyIgnore); + callPolicyFunction(function, PolicyIgnore); return; } - slotCallPolicyFunction(PolicyUse); + callPolicyFunction(function, PolicyUse); } void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState>) { - Q_ASSERT(!m_policyFunction); Q_ASSERT(m_webFrame); - m_policyFunction = function; #if QT_VERSION < 0x040400 QWebNetworkRequest r(request); #else @@ -943,10 +929,10 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFun m_frame->loader()->activeDocumentLoader()->setLastCheckedRequest(emptyRequest); } - slotCallPolicyFunction(PolicyIgnore); + callPolicyFunction(function, PolicyIgnore); return; } - slotCallPolicyFunction(PolicyUse); + callPolicyFunction(function, PolicyUse); } void FrameLoaderClientQt::dispatchUnableToImplementPolicy(const WebCore::ResourceError&) @@ -971,32 +957,35 @@ PassRefPtr<Frame> FrameLoaderClientQt::createFrame(const KURL& url, const String if (!m_webFrame) return 0; - QWebFrameData frameData; + QWebFrameData frameData(m_frame->page(), m_frame, ownerElement, name); frameData.url = url; - frameData.name = name; - frameData.ownerElement = ownerElement; frameData.referrer = referrer; frameData.allowsScrolling = allowsScrolling; frameData.marginWidth = marginWidth; frameData.marginHeight = marginHeight; - QWebFrame* webFrame = new QWebFrame(m_webFrame, &frameData); - emit m_webFrame->page()->frameCreated(webFrame); + QPointer<QWebFrame> webFrame = new QWebFrame(m_webFrame, &frameData); + // The creation of the frame may have run arbitrary JavaScript that removed it from the page already. + if (!webFrame->d->frame->page()) { + frameData.frame.release(); + ASSERT(webFrame.isNull()); + return 0; + } - RefPtr<Frame> childFrame = adoptRef(webFrame->d->frame); + emit m_webFrame->page()->frameCreated(webFrame); // ### set override encoding if we have one FrameLoadType loadType = m_frame->loader()->loadType(); FrameLoadType childLoadType = FrameLoadTypeRedirectWithLockedBackForwardList; - childFrame->loader()->loadURLIntoChildFrame(frameData.url, frameData.referrer, childFrame.get()); + frameData.frame->loader()->loadURLIntoChildFrame(frameData.url, frameData.referrer, frameData.frame.get()); // The frame's onload handler may have removed it from the document. - if (!childFrame->tree()->parent()) + if (!frameData.frame->tree()->parent()) return 0; - return childFrame.release(); + return frameData.frame.release(); } ObjectContentType FrameLoaderClientQt::objectContentType(const KURL& url, const String& _mimeType) @@ -1085,7 +1074,7 @@ public: } }; -Widget* FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames, +PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually) { // qDebug()<<"------ Creating plugin in FrameLoaderClientQt::createPlugin for "<<url.prettyURL() << mimeType; @@ -1149,7 +1138,7 @@ Widget* FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, HTMLPlugInE QWidget* view = m_webFrame->page()->view(); if (view) widget->setParent(view); - QtPluginWidget* w = new QtPluginWidget(); + RefPtr<QtPluginWidget> w = adoptRef(new QtPluginWidget()); w->setPlatformWidget(widget); // Make sure it's invisible until properly placed into the layout w->setFrameRect(IntRect(0, 0, 0, 0)); @@ -1158,7 +1147,7 @@ Widget* FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, HTMLPlugInE // FIXME: make things work for widgetless plugins as well delete object; } else { // NPAPI Plugins - PluginView* pluginView = PluginView::create(m_frame, pluginSize, element, url, + RefPtr<PluginView> pluginView = PluginView::create(m_frame, pluginSize, element, url, paramNames, paramValues, mimeType, loadManually); return pluginView; } @@ -1173,7 +1162,7 @@ void FrameLoaderClientQt::redirectDataToPlugin(Widget* pluginWidget) m_hasSentResponseToPlugin = false; } -Widget* FrameLoaderClientQt::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, +PassRefPtr<Widget> FrameLoaderClientQt::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues) { notImplemented(); diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index 4d2dcbc..754d8bc 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -59,10 +59,7 @@ namespace WebCore { friend class ::QWebFrame; void callPolicyFunction(FramePolicyFunction function, PolicyAction action); - private slots: - void slotCallPolicyFunction(int); signals: - void sigCallPolicyFunction(int); void loadStarted(); void loadProgress(int d); void loadFinished(bool); @@ -188,10 +185,10 @@ namespace WebCore { virtual PassRefPtr<Frame> createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) ; - virtual Widget* createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool); + virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool); virtual void redirectDataToPlugin(Widget* pluginWidget); - virtual Widget* createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues); + virtual PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues); virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType); virtual String overrideMediaType() const; @@ -209,7 +206,6 @@ namespace WebCore { QWebFrame *m_webFrame; ResourceResponse m_response; bool m_firstData; - FramePolicyFunction m_policyFunction; // Plugin view to redirect data to WebCore::PluginView* m_pluginView; 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 cc4d313..c0e72be 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -582,6 +582,10 @@ private slots: void jsByteArray(); void ownership(); void nullValue(); + void baseUrl_data(); + void baseUrl(); + void hasSetFocus(); + private: QString evalJS(const QString&s) { // Convert an undefined return variant to the string "undefined" @@ -2413,5 +2417,61 @@ void tst_QWebFrame::nullValue() QVERIFY(v.isNull()); } +void tst_QWebFrame::baseUrl_data() +{ + QTest::addColumn<QString>("html"); + QTest::addColumn<QUrl>("loadUrl"); + QTest::addColumn<QUrl>("url"); + QTest::addColumn<QUrl>("baseUrl"); + + QTest::newRow("null") << QString() << QUrl() + << QUrl("about:blank") << QUrl("about:blank"); + + QTest::newRow("foo") << QString() << QUrl("http://foobar.baz/") + << QUrl("http://foobar.baz/") << QUrl("http://foobar.baz/"); + + QString html = "<html>" + "<head>" + "<base href=\"http://foobaz.bar/\" />" + "</head>" + "</html>"; + QTest::newRow("customBaseUrl") << html << QUrl("http://foobar.baz/") + << QUrl("http://foobar.baz/") << QUrl("http://foobaz.bar/"); +} + +void tst_QWebFrame::baseUrl() +{ + QFETCH(QString, html); + QFETCH(QUrl, loadUrl); + QFETCH(QUrl, url); + QFETCH(QUrl, baseUrl); + + m_page->mainFrame()->setHtml(html, loadUrl); + QCOMPARE(m_page->mainFrame()->url(), url); + QCOMPARE(m_page->mainFrame()->baseUrl(), baseUrl); +} + +void tst_QWebFrame::hasSetFocus() +{ + QSignalSpy loadSpy(m_page, SIGNAL(loadFinished(bool))); + QUrl url = QUrl("qrc:///frametest/iframe.html"); + m_page->mainFrame()->load(url); + + ::waitForSignal(m_page, SIGNAL(loadFinished(bool))); + + m_page->mainFrame()->setFocus(); + QVERIFY(m_page->mainFrame()->hasFocus()); + + QList<QWebFrame*> children = m_page->mainFrame()->childFrames(); + for (int i = 0; i < children.size(); ++i) { + children.at(i)->setFocus(); + QVERIFY(children.at(i)->hasFocus()); + QVERIFY(!m_page->mainFrame()->hasFocus()); + } + + m_page->mainFrame()->setFocus(); + QVERIFY(m_page->mainFrame()->hasFocus()); +} + QTEST_MAIN(tst_QWebFrame) #include "tst_qwebframe.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe.html new file mode 100644 index 0000000..f17027c --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe.html @@ -0,0 +1,6 @@ +<html> +<body> +<p>top</p> +<iframe src="iframe2.html" width="80%" height="30%"/> +</body> +</html> diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe2.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe2.html new file mode 100644 index 0000000..5017435 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe2.html @@ -0,0 +1,7 @@ +<html> +<body> +<p>another iframe</p> +<iframe src="iframe3.html" width="80%" height="30%"></iframe> +</body> +</html> + diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe3.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe3.html new file mode 100644 index 0000000..ed6ac5b --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe3.html @@ -0,0 +1,5 @@ +<html> +<body> +<p>inner</p> +</body> +</html> 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 1d6a48e..6c3b296 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -92,6 +92,7 @@ private slots: void cleanupTestCase(); void acceptNavigationRequest(); + void infiniteLoopJS(); void loadFinished(); void acceptNavigationRequestWithNewWindow(); void userStyleSheet(); @@ -106,7 +107,7 @@ private slots: void textSelection(); void textEditing(); void backActionUpdate(); - + void frameAt(); void requestCache(); private: @@ -192,6 +193,26 @@ void tst_QWebPage::acceptNavigationRequest() m_view->setPage(0); } +class JSTestPage : public QWebPage +{ +Q_OBJECT +public: + JSTestPage(QObject* parent = 0) + : QWebPage(parent) {} + +public slots: + bool shouldInterruptJavaScript() { + return true; + } +}; + +void tst_QWebPage::infiniteLoopJS() +{ + JSTestPage* newPage = new JSTestPage(m_view); + m_view->setPage(newPage); + m_view->setHtml(QString("<html><bodytest</body></html>"), QUrl()); + m_view->page()->mainFrame()->evaluateJavaScript("var run = true;var a = 1;while(run){a++;}"); +} void tst_QWebPage::loadFinished() { @@ -1116,5 +1137,32 @@ void tst_QWebPage::backActionUpdate() QVERIFY(action->isEnabled()); } +void frameAtHelper(QWebPage* webPage, QWebFrame* webFrame, QPoint framePosition) +{ + if (!webFrame) + return; + + framePosition += QPoint(webFrame->pos()); + QList<QWebFrame*> children = webFrame->childFrames(); + for (int i = 0; i < children.size(); ++i) { + if (children.at(i)->childFrames().size() > 0) + frameAtHelper(webPage, children.at(i), framePosition); + + QRect frameRect(children.at(i)->pos() + framePosition, children.at(i)->geometry().size()); + QVERIFY(children.at(i) == webPage->frameAt(frameRect.topLeft())); + } +} + +void tst_QWebPage::frameAt() +{ + QWebView webView; + QWebPage* webPage = webView.page(); + QSignalSpy loadSpy(webPage, SIGNAL(loadFinished(bool))); + QUrl url = QUrl("qrc:///frametest/iframe.html"); + webPage->mainFrame()->load(url); + QTRY_COMPARE(loadSpy.count(), 1); + frameAtHelper(webPage, webPage->mainFrame(), webPage->mainFrame()->pos()); +} + QTEST_MAIN(tst_QWebPage) #include "tst_qwebpage.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc index 38c5232..3085ce2 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc @@ -2,6 +2,9 @@ <qresource> <file>frametest/index.html</file> <file>frametest/frame_a.html</file> + <file>frametest/iframe.html</file> + <file>frametest/iframe2.html</file> + <file>frametest/iframe3.html</file> </qresource> </RCC> |