diff options
Diffstat (limited to 'Source/WebKit/qt/WebCoreSupport')
8 files changed, 49 insertions, 21 deletions
diff --git a/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp index f7316f717..b91c306f4 100644 --- a/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp @@ -469,7 +469,7 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event) if (kevent->altKey()) shouldInsertText = true; } else { -#ifndef Q_OS_MAC +#ifndef Q_OS_MACOS // We need to exclude checking for Alt because it is just a different Shift if (!kevent->altKey()) #endif diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index b3209a572..9634e6d51 100644 --- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -213,6 +213,8 @@ FrameLoaderClientQt::FrameLoaderClientQt() , m_pluginView(0) , m_hasSentResponseToPlugin(false) , m_isOriginatingLoad(false) + , m_isDisplayingErrorPage(false) + , m_shouldSuppressLoadStarted(false) { } @@ -1089,6 +1091,9 @@ bool FrameLoaderClientQt::callErrorPageExtension(const WebCore::ResourceError& e if (!page->errorPageExtension(&option, &output)) return false; + m_isDisplayingErrorPage = true; + m_shouldSuppressLoadStarted = true; + URL baseUrl(output.baseUrl); URL failingUrl(option.url); @@ -1098,6 +1103,9 @@ bool FrameLoaderClientQt::callErrorPageExtension(const WebCore::ResourceError& e // FIXME: visibility? WebCore::SubstituteData substituteData(buffer, failingUrl, response, SubstituteData::SessionHistoryVisibility::Hidden); m_frame->loader().load(WebCore::FrameLoadRequest(m_frame, request, ShouldOpenExternalURLsPolicy::ShouldNotAllow /*FIXME*/, substituteData)); + + m_shouldSuppressLoadStarted = false; + return true; } @@ -1107,8 +1115,7 @@ void FrameLoaderClientQt::dispatchDidFailProvisionalLoad(const WebCore::Resource printf("%s - didFailProvisionalLoadWithError\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame))); if (!error.isNull() && !error.isCancellation()) { - if (callErrorPageExtension(error)) - return; + callErrorPageExtension(error); } if (m_webFrame) @@ -1121,8 +1128,7 @@ void FrameLoaderClientQt::dispatchDidFailLoad(const WebCore::ResourceError& erro printf("%s - didFailLoadWithError\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame))); if (!error.isNull() && !error.isCancellation()) { - if (callErrorPageExtension(error)) - return; + callErrorPageExtension(error); } if (m_webFrame) @@ -1534,11 +1540,19 @@ QWebFrameAdapter* FrameLoaderClientQt::webFrame() const void FrameLoaderClientQt::emitLoadStarted() { + if (m_shouldSuppressLoadStarted) + return; + + m_isDisplayingErrorPage = false; + m_webFrame->emitLoadStarted(m_isOriginatingLoad); } void FrameLoaderClientQt::emitLoadFinished(bool ok) { + if (ok && m_isDisplayingErrorPage) + return; + // Signal handlers can lead to a new load, that will use the member again. const bool wasOriginatingLoad = m_isOriginatingLoad; m_isOriginatingLoad = false; diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index a20364f76..8bfc1d46e 100644 --- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -32,9 +32,7 @@ #include "FormState.h" #include "FrameLoaderClient.h" -#include "HTMLFormElement.h" #include "ResourceResponse.h" -#include "SharedBuffer.h" #include "URL.h" #include <QUrl> #include <qobject.h> @@ -254,6 +252,10 @@ private: URL m_lastRequestedUrl; bool m_isOriginatingLoad; + + // QTFIXME: consider introducing some sort of flags for storing state + bool m_isDisplayingErrorPage; + bool m_shouldSuppressLoadStarted; }; } diff --git a/Source/WebKit/qt/WebCoreSupport/ProgressTrackerClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/ProgressTrackerClientQt.cpp index 7cf620bd4..4e7f61d63 100644 --- a/Source/WebKit/qt/WebCoreSupport/ProgressTrackerClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/ProgressTrackerClientQt.cpp @@ -26,9 +26,11 @@ #include "config.h" #include "ProgressTrackerClientQt.h" +#include "Document.h" #include "EventHandler.h" #include "Frame.h" #include "FrameLoaderClientQt.h" +#include "HTMLFormElement.h" #include "ProgressTracker.h" #include "QWebFrameAdapter.h" #include "QWebPageAdapter.h" diff --git a/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp index df28e9f21..841d0544a 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp +++ b/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp @@ -31,6 +31,7 @@ #include "FrameLoaderClientQt.h" #include "FrameView.h" #include "HTMLCollection.h" +#include "HTMLFormElement.h" #include "HTMLMetaElement.h" #include "HTTPParsers.h" #include "HitTestResult.h" diff --git a/Source/WebKit/qt/WebCoreSupport/QWebFrameData.cpp b/Source/WebKit/qt/WebCoreSupport/QWebFrameData.cpp index d09ad3a35..f3f1534e0 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebFrameData.cpp +++ b/Source/WebKit/qt/WebCoreSupport/QWebFrameData.cpp @@ -21,6 +21,8 @@ #include "config.h" #include "QWebFrameData.h" +#include "Document.h" +#include "HTMLFormElement.h" #include "FrameLoaderClientQt.h" #include "MainFrame.h" #include "Page.h" diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp index 00dc0c488..b3b49f5d6 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp +++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp @@ -192,22 +192,13 @@ static WebCore::FrameLoadRequest frameLoadRequest(const QUrl &url, WebCore::Fram ); } -static void openNewWindow(const QUrl& url, Frame* frame) +// FIXME: Find a better place +static UserContentController& userContentProvider() { - if (Page* oldPage = frame->page()) { - WindowFeatures features; - NavigationAction action; - FrameLoadRequest request = frameLoadRequest(url, frame); - if (Page* newPage = oldPage->chrome().createWindow(frame, request, features, action)) { - newPage->mainFrame().loader().loadFrameRequest(request, /*event*/ 0, /*FormState*/ 0); - newPage->chrome().show(); - } - } + static NeverDestroyed<Ref<UserContentController>> s_userContentProvider(UserContentController::create()); + return s_userContentProvider.get(); } -// FIXME: Find a better place -Ref<UserContentController> s_userContentProvider = UserContentController::create(); - QWebPageAdapter::QWebPageAdapter() : settings(0) , page(0) @@ -242,7 +233,7 @@ void QWebPageAdapter::initializeWebCorePage() pageConfiguration.databaseProvider = &WebDatabaseProvider::singleton(); pageConfiguration.storageNamespaceProvider = WebStorageNamespaceProvider::create( QWebSettings::globalSettings()->localStoragePath()); - pageConfiguration.userContentController = &s_userContentProvider.get(); + pageConfiguration.userContentController = &userContentProvider(); pageConfiguration.visitedLinkStore = &VisitedLinkStoreQt::singleton(); page = new Page(pageConfiguration); @@ -1586,3 +1577,16 @@ bool QWebPageAdapter::swallowContextMenuEvent(QContextMenuEvent *event, QWebFram return !menu; } + +void QWebPageAdapter::openNewWindow(const QUrl& url, Frame* frame) +{ + if (Page* oldPage = frame->page()) { + WindowFeatures features; + NavigationAction action; + FrameLoadRequest request = frameLoadRequest(url, frame); + if (Page* newPage = oldPage->chrome().createWindow(frame, request, features, action)) { + newPage->mainFrame().loader().loadFrameRequest(request, /*event*/ 0, /*FormState*/ 0); + newPage->chrome().show(); + } + } +} diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h index 1b7199a9c..e9c93958d 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h +++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h @@ -49,6 +49,7 @@ class ChromeClientQt; class DeviceOrientationClient; class DeviceMotionClient; class GeolocationClientQt; +class Frame; class Page; class UndoStep; struct ViewportArguments; @@ -395,6 +396,8 @@ public: const QWebElement& fullScreenElement() const; void setFullScreenElement(const QWebElement&); + static void openNewWindow(const QUrl&, WebCore::Frame*); + QWebSettings *settings; WebCore::Page *page; |