summaryrefslogtreecommitdiffstats
path: root/Source/WebKit
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit')
-rw-r--r--Source/WebKit/CMakeLists.txt12
-rw-r--r--Source/WebKit/PlatformQt.cmake24
-rw-r--r--Source/WebKit/qt/Api/qwebsettings.cpp5
-rw-r--r--Source/WebKit/qt/Api/qwebsettings.h3
-rw-r--r--Source/WebKit/qt/README26
-rw-r--r--Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp2
-rw-r--r--Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp22
-rw-r--r--Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h6
-rw-r--r--Source/WebKit/qt/WebCoreSupport/ProgressTrackerClientQt.cpp2
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp1
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QWebFrameData.cpp2
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp32
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h3
-rw-r--r--Source/WebKit/qt/WidgetApi/qwebframe.h4
-rw-r--r--Source/WebKit/qt/WidgetApi/qwebpage.cpp12
-rw-r--r--Source/WebKit/qt/WidgetSupport/InspectorClientWebPage.cpp58
-rw-r--r--Source/WebKit/qt/WidgetSupport/InspectorClientWebPage.h7
-rw-r--r--Source/WebKit/qt/WidgetSupport/QStyleFacadeImp.cpp6
-rw-r--r--Source/WebKit/qt/tests/CMakeLists.txt2
-rw-r--r--Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp1
-rw-r--r--Source/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp6
-rw-r--r--Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp62
-rw-r--r--Source/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp8
-rw-r--r--Source/WebKit/qt/tests/qwebhistoryinterface/tst_qwebhistoryinterface.cpp7
-rw-r--r--Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp75
-rw-r--r--Source/WebKit/qt/tests/qwebsecurityorigin/tst_qwebsecurityorigin.cpp4
26 files changed, 253 insertions, 139 deletions
diff --git a/Source/WebKit/CMakeLists.txt b/Source/WebKit/CMakeLists.txt
index 82dc1e662..04117d563 100644
--- a/Source/WebKit/CMakeLists.txt
+++ b/Source/WebKit/CMakeLists.txt
@@ -70,11 +70,21 @@ if (${PORT} STREQUAL "Qt")
if (MACOS_BUILD_FRAMEWORKS)
set_target_properties(WebKit PROPERTIES
- FRAMEWORK_VERSION 5
+ FRAMEWORK_VERSION ${PROJECT_VERSION_MAJOR}
+ SOVERSION ${MACOS_COMPATIBILITY_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER org.qt-project.QtWebKit
)
endif ()
+ if (USE_LINKER_VERSION_SCRIPT)
+ set(VERSION_SCRIPT "${CMAKE_BINARY_DIR}/QtWebKit.version")
+ add_custom_command(TARGET WebKit PRE_LINK
+ COMMAND ${PERL_EXECUTABLE} ${TOOLS_DIR}/qt/generate-version-script.pl ${Qt5_VERSION} > ${VERSION_SCRIPT}
+ VERBATIM
+ )
+ set_target_properties(WebKit PROPERTIES LINK_FLAGS -Wl,--version-script,${VERSION_SCRIPT})
+ endif ()
+
if (ENABLE_WEBKIT2)
add_dependencies(WebKit WebKit2)
endif ()
diff --git a/Source/WebKit/PlatformQt.cmake b/Source/WebKit/PlatformQt.cmake
index 3792def6f..2bd6342be 100644
--- a/Source/WebKit/PlatformQt.cmake
+++ b/Source/WebKit/PlatformQt.cmake
@@ -5,7 +5,7 @@ include(ECMGeneratePriFile)
macro(generate_header _file _var _content)
file(GENERATE OUTPUT ${_file} CONTENT ${_content})
list(APPEND ${_var} ${_file})
- set_source_files_properties(${_file} PROPERTIES GENERATED TRUE)
+ set_source_files_properties(${_file} PROPERTIES GENERATED TRUE SKIP_AUTOMOC TRUE)
endmacro()
macro(generate_version_header _file _var _prefix)
@@ -13,7 +13,7 @@ macro(generate_version_header _file _var _prefix)
configure_file(VersionHeader.h.in ${_file} @ONLY)
unset(HEADER_PREFIX)
list(APPEND ${_var} ${_file})
- set_source_files_properties(${_file} PROPERTIES GENERATED TRUE)
+ set_source_files_properties(${_file} PROPERTIES GENERATED TRUE SKIP_AUTOMOC TRUE)
endmacro()
macro(append_lib_names_to_list _lib_names_list)
@@ -353,6 +353,7 @@ if (NOT SHARED_CORE)
list(APPEND WebKit_SOURCES
"${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/qrc_WebInspector.cpp"
)
+ set_property(SOURCE "${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/qrc_WebInspector.cpp" PROPERTY SKIP_AUTOMOC ON)
endif ()
endif ()
@@ -427,7 +428,7 @@ install(
COMPONENT Data
)
-set(WEBKIT_PKGCONGIG_DEPS "Qt5Core Qt5Gui Qt5Network")
+set(WEBKIT_PKGCONFIG_DEPS "Qt5Core Qt5Gui Qt5Network")
set(WEBKIT_PRI_DEPS "core gui network")
set(WEBKIT_PRI_EXTRA_LIBS "")
set(WEBKIT_PRI_RUNTIME_DEPS "core_private gui_private")
@@ -448,11 +449,11 @@ if (USE_MEDIA_FOUNDATION)
set(WEBKIT_PRI_EXTRA_LIBS "-lmfuuid -lstrmiids ${WEBKIT_PRI_EXTRA_LIBS}")
endif ()
if (USE_QT_MULTIMEDIA)
- set(WEBKIT_PKGCONGIG_DEPS "${WEBKIT_PKGCONGIG_DEPS} Qt5Multimedia")
+ set(WEBKIT_PKGCONFIG_DEPS "${WEBKIT_PKGCONFIG_DEPS} Qt5Multimedia")
set(WEBKIT_PRI_RUNTIME_DEPS "multimedia ${WEBKIT_PRI_RUNTIME_DEPS}")
endif ()
-set(WEBKITWIDGETS_PKGCONGIG_DEPS "${WEBKIT_PKGCONGIG_DEPS} Qt5Widgets Qt5WebKit")
+set(WEBKITWIDGETS_PKGCONFIG_DEPS "${WEBKIT_PKGCONFIG_DEPS} Qt5Widgets Qt5WebKit")
set(WEBKITWIDGETS_PRI_DEPS "${WEBKIT_PRI_DEPS} widgets webkit")
set(WEBKITWIDGETS_PRI_RUNTIME_DEPS "${WEBKIT_PRI_RUNTIME_DEPS} widgets_private")
@@ -465,12 +466,12 @@ if (ENABLE_PRINT_SUPPORT)
endif ()
if (USE_QT_MULTIMEDIA)
- set(WEBKITWIDGETS_PKGCONGIG_DEPS "${WEBKITWIDGETS_PKGCONGIG_DEPS} Qt5MultimediaWidgets")
+ set(WEBKITWIDGETS_PKGCONFIG_DEPS "${WEBKITWIDGETS_PKGCONFIG_DEPS} Qt5MultimediaWidgets")
set(WEBKITWIDGETS_PRI_RUNTIME_DEPS "${WEBKITWIDGETS_PRI_RUNTIME_DEPS} multimediawidgets")
endif ()
if (QT_STATIC_BUILD)
- set(WEBKITWIDGETS_PKGCONGIG_DEPS "${WEBKITWIDGETS_PKGCONGIG_DEPS} Qt5PrintSupport")
+ set(WEBKITWIDGETS_PKGCONFIG_DEPS "${WEBKITWIDGETS_PKGCONFIG_DEPS} Qt5PrintSupport")
set(WEBKITWIDGETS_PRI_DEPS "${WEBKITWIDGETS_PRI_DEPS} printsupport")
set(EXTRA_LIBS_NAMES WebCore JavaScriptCore WTF)
append_lib_names_to_list(EXTRA_LIBS_NAMES ${LIBXML2_LIBRARIES} ${SQLITE_LIBRARIES} ${ZLIB_LIBRARIES} ${JPEG_LIBRARIES} ${PNG_LIBRARIES})
@@ -494,7 +495,7 @@ if (QT_STATIC_BUILD)
endif ()
list(REMOVE_DUPLICATES EXTRA_LIBS_NAMES)
foreach (LIB_NAME ${EXTRA_LIBS_NAMES})
- set(WEBKIT_PKGCONGIG_DEPS "${WEBKIT_PKGCONGIG_DEPS} ${LIB_PREFIX}${LIB_NAME}")
+ set(WEBKIT_PKGCONFIG_DEPS "${WEBKIT_PKGCONFIG_DEPS} ${LIB_PREFIX}${LIB_NAME}")
set(WEBKIT_PRI_EXTRA_LIBS "${WEBKIT_PRI_EXTRA_LIBS} -l${LIB_PREFIX}${LIB_NAME}")
endforeach ()
endif ()
@@ -503,7 +504,8 @@ if (NOT MACOS_BUILD_FRAMEWORKS)
ecm_generate_pkgconfig_file(
BASE_NAME Qt5WebKit
DESCRIPTION "Qt WebKit module"
- DEPS "${WEBKIT_PKGCONGIG_DEPS}"
+ INCLUDE_INSTALL_DIR "${KDE_INSTALL_INCLUDEDIR}/QtWebKit"
+ DEPS "${WEBKIT_PKGCONFIG_DEPS}"
FILENAME_VAR WebKit_PKGCONFIG_FILENAME
)
set(ECM_PKGCONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/pkgconfig" CACHE PATH "The directory where pkgconfig will be installed to.")
@@ -728,6 +730,7 @@ if (NOT MACOS_BUILD_FRAMEWORKS)
ecm_generate_pkgconfig_file(
BASE_NAME Qt5WebKitWidgets
DESCRIPTION "Qt WebKitWidgets module"
+ INCLUDE_INSTALL_DIR "${KDE_INSTALL_INCLUDEDIR}/QtWebKitWidgets"
DEPS "${WEBKITWIDGETS_PKGCONFIG_DEPS}"
FILENAME_VAR WebKitWidgets_PKGCONFIG_FILENAME
)
@@ -861,7 +864,8 @@ endif ()
if (MACOS_BUILD_FRAMEWORKS)
set_target_properties(WebKitWidgets PROPERTIES
- FRAMEWORK_VERSION 5
+ FRAMEWORK_VERSION ${PROJECT_VERSION_MAJOR}
+ SOVERSION ${MACOS_COMPATIBILITY_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER org.qt-project.QtWebKitWidgets
)
endif ()
diff --git a/Source/WebKit/qt/Api/qwebsettings.cpp b/Source/WebKit/qt/Api/qwebsettings.cpp
index d552cec17..3cbb831af 100644
--- a/Source/WebKit/qt/Api/qwebsettings.cpp
+++ b/Source/WebKit/qt/Api/qwebsettings.cpp
@@ -600,6 +600,7 @@ QWebSettings::QWebSettings()
d->attributes.insert(QWebSettings::FullScreenSupportEnabled, true);
d->attributes.insert(QWebSettings::ImagesEnabled, true);
d->attributes.insert(QWebSettings::AllowRunningInsecureContent, false);
+ d->attributes.insert(QWebSettings::ErrorPageEnabled, true);
d->offlineStorageDefaultQuota = 5 * 1024 * 1024;
d->defaultTextEncoding = QLatin1String("iso-8859-1");
d->thirdPartyCookiePolicy = AlwaysAllowThirdPartyCookies;
@@ -936,10 +937,8 @@ void QWebSettings::clearMemoryCaches()
// FastMalloc has lock-free thread specific caches that can only be cleared from the thread itself.
WebCore::StorageThread::releaseFastMallocFreeMemoryInAllThreads();
-#if ENABLE(WORKERS)
WebCore::WorkerThread::releaseFastMallocFreeMemoryInAllThreads();
-#endif
- WTF::releaseFastMallocFreeMemory();
+ WTF::releaseFastMallocFreeMemory();
}
/*!
diff --git a/Source/WebKit/qt/Api/qwebsettings.h b/Source/WebKit/qt/Api/qwebsettings.h
index 0b0a1f00a..2c22fb46e 100644
--- a/Source/WebKit/qt/Api/qwebsettings.h
+++ b/Source/WebKit/qt/Api/qwebsettings.h
@@ -92,7 +92,8 @@ public:
WebSecurityEnabled,
FullScreenSupportEnabled,
ImagesEnabled,
- AllowRunningInsecureContent
+ AllowRunningInsecureContent,
+ ErrorPageEnabled
};
enum WebGraphic {
MissingImageGraphic,
diff --git a/Source/WebKit/qt/README b/Source/WebKit/qt/README
new file mode 100644
index 000000000..6b6a411ce
--- /dev/null
+++ b/Source/WebKit/qt/README
@@ -0,0 +1,26 @@
+# Qt Port of WebKit
+
+WebKit is an open source web browser engine. WebKit's HTML and JavaScript code began as a branch of the KHTML and KJS libraries from KDE. As part of KDE framework KHTML was based on Qt but during their porting efforts Apple's engineers made WebKit toolkit independent. QtWebKit is a project aiming at porting this fabulous engine back to Qt.
+
+The Qt port of WebKit currently compiles and runs on Linux, *BSD, Windows and macOS.
+
+# Building
+
+You can build and install QtWebKit with these commands:
+
+mkdir build
+cd build
+cmake -G Ninja -DPORT=Qt -DCMAKE_BUILD_TYPE=Release ..
+ninja
+sudo ninja install
+
+See https://github.com/annulen/webkit/wiki for more detailed instuctions
+
+After QtWebKit is installed, you can use it as described in
+https://github.com/annulen/webkit/wiki/Using-QtWebKit-in-your-project
+
+# Contacts
+
+* Mailing list: webkit-qt@lists.webkit.org
+* IRC: #qtwebkit on irc.freenode.net
+* Blog: http://qtwebkit.blogspot.com
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;
diff --git a/Source/WebKit/qt/WidgetApi/qwebframe.h b/Source/WebKit/qt/WidgetApi/qwebframe.h
index a3374ff13..9502618ff 100644
--- a/Source/WebKit/qt/WidgetApi/qwebframe.h
+++ b/Source/WebKit/qt/WidgetApi/qwebframe.h
@@ -59,6 +59,9 @@ namespace WebCore {
class ChromeClientQt;
class TextureMapperLayerClientQt;
}
+namespace WebKit {
+ class InspectorClientWebPage;
+}
class QWebFrameData;
class QWebHitTestResultPrivate;
class QWebFrame;
@@ -242,6 +245,7 @@ private:
friend class WebCore::FrameLoaderClientQt;
friend class WebCore::ChromeClientQt;
friend class WebCore::TextureMapperLayerClientQt;
+ friend class WebKit::InspectorClientWebPage;
QWebFramePrivate *d;
Q_PRIVATE_SLOT(d, void _q_orientationChanged())
};
diff --git a/Source/WebKit/qt/WidgetApi/qwebpage.cpp b/Source/WebKit/qt/WidgetApi/qwebpage.cpp
index f8d8c0abc..261e032fd 100644
--- a/Source/WebKit/qt/WidgetApi/qwebpage.cpp
+++ b/Source/WebKit/qt/WidgetApi/qwebpage.cpp
@@ -663,16 +663,6 @@ void QWebPagePrivate::createWebInspector(QObject** inspectorView, QWebPageAdapte
QWebPage* page = new WebKit::InspectorClientWebPage;
*inspectorView = page->view();
*inspectorPage = page->d;
-
- // FIXME: Find out what's going on with Settings
- page->settings()->setAttribute(QWebSettings::AcceleratedCompositingEnabled, false);
-
- // We treat "qrc:" scheme as local, but by default local content is not allowed to use
- // LocalStorage which is required for Inspector to work.
- // See https://bugs.webkit.org/show_bug.cgi?id=155265
- // Alternatively we can make "qrc:" scheme non-local like GTK port does:
- // https://bugs.webkit.org/show_bug.cgi?id=155497
- page->settings()->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, true);
}
#ifndef QT_NO_MENU
@@ -3219,7 +3209,7 @@ bool QWebPage::supportsExtension(Extension extension) const
if (extension == ChooseMultipleFilesExtension)
return true;
#endif
- return extension == ErrorPageExtension;
+ return extension == ErrorPageExtension && d->settings->testAttribute(QWebSettings::ErrorPageEnabled);
}
/*!
diff --git a/Source/WebKit/qt/WidgetSupport/InspectorClientWebPage.cpp b/Source/WebKit/qt/WidgetSupport/InspectorClientWebPage.cpp
index 8e5427b23..2d498c5b8 100644
--- a/Source/WebKit/qt/WidgetSupport/InspectorClientWebPage.cpp
+++ b/Source/WebKit/qt/WidgetSupport/InspectorClientWebPage.cpp
@@ -32,7 +32,14 @@
#include "config.h"
#include "InspectorClientWebPage.h"
+#include <QApplication>
+#include <QClipboard>
+#include <QContextMenuEvent>
+
+#include <qwebelement.h>
#include <qwebframe.h>
+#include <qwebframe_p.h>
+#include <qwebpage_p.h>
using namespace WebKit;
@@ -41,7 +48,21 @@ InspectorClientWebPage::InspectorClientWebPage()
QWebView* view = new QWebView;
view->setPage(this);
setParent(view);
+ settings()->setAttribute(QWebSettings::JavascriptEnabled, true);
+#if !ENABLE(DEVELOPER_MODE)
+ settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, false);
+#endif
connect(mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), SLOT(javaScriptWindowObjectCleared()));
+
+ // FIXME: Find out what's going on with Settings
+ settings()->setAttribute(QWebSettings::AcceleratedCompositingEnabled, false);
+
+ // We treat "qrc:" scheme as local, but by default local content is not allowed to use
+ // LocalStorage which is required for Inspector to work.
+ // See https://bugs.webkit.org/show_bug.cgi?id=155265
+ // Alternatively we can make "qrc:" scheme non-local like GTK port does:
+ // https://bugs.webkit.org/show_bug.cgi?id=155497
+ settings()->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, true);
}
QWebPage* InspectorClientWebPage::createWindow(QWebPage::WebWindowType)
@@ -53,6 +74,18 @@ QWebPage* InspectorClientWebPage::createWindow(QWebPage::WebWindowType)
return page;
}
+bool InspectorClientWebPage::event(QEvent* ev)
+{
+ if (ev->type() == QEvent::ContextMenu) {
+ auto* contextMenuEvent = static_cast<QContextMenuEvent*>(ev);
+
+ if (contextMenuEvent)
+ m_clickPos = contextMenuEvent->pos();
+ }
+
+ return QWebPage::event(ev);
+}
+
void InspectorClientWebPage::javaScriptWindowObjectCleared()
{
QVariant inspectorJavaScriptWindowObjects = property("_q_inspectorJavaScriptWindowObjects");
@@ -69,3 +102,28 @@ void InspectorClientWebPage::javaScriptWindowObjectCleared()
}
}
+void InspectorClientWebPage::triggerAction(WebAction action, bool checked)
+{
+ const QWebHitTestResult hitTestResult = mainFrame()->hitTestContent(m_clickPos);
+
+ if (hitTestResult.imageUrl().isValid() && hitTestResult.element().hasAttribute(QStringLiteral("data-url"))) {
+ switch (action) {
+ case OpenImageInNewWindow: {
+ auto* frame = static_cast<QWebFramePrivate*>(hitTestResult.frame()->d);
+
+ if (frame) {
+ QWebPagePrivate::openNewWindow(QUrl(hitTestResult.element().attribute(QStringLiteral("data-url"))), frame->frame);
+ return;
+ }
+ }
+
+ case CopyImageUrlToClipboard:
+ QApplication::clipboard()->setText(hitTestResult.element().attribute(QStringLiteral("data-url")));
+ return;
+ default:
+ break;
+ }
+ }
+
+ QWebPage::triggerAction(action, checked);
+}
diff --git a/Source/WebKit/qt/WidgetSupport/InspectorClientWebPage.h b/Source/WebKit/qt/WidgetSupport/InspectorClientWebPage.h
index 59cf74135..d996587cc 100644
--- a/Source/WebKit/qt/WidgetSupport/InspectorClientWebPage.h
+++ b/Source/WebKit/qt/WidgetSupport/InspectorClientWebPage.h
@@ -43,9 +43,16 @@ public:
InspectorClientWebPage();
QWebPage* createWindow(QWebPage::WebWindowType) final;
+ bool event(QEvent*) final;
public Q_SLOTS:
void javaScriptWindowObjectCleared();
+
+protected:
+ void triggerAction(WebAction, bool checked = false) final;
+
+private:
+ QPoint m_clickPos;
};
} // namespace WebKit
diff --git a/Source/WebKit/qt/WidgetSupport/QStyleFacadeImp.cpp b/Source/WebKit/qt/WidgetSupport/QStyleFacadeImp.cpp
index b35545674..53582f821 100644
--- a/Source/WebKit/qt/WidgetSupport/QStyleFacadeImp.cpp
+++ b/Source/WebKit/qt/WidgetSupport/QStyleFacadeImp.cpp
@@ -224,7 +224,7 @@ void QStyleFacadeImp::getButtonMetrics(QString *buttonFontFamily, int *buttonFon
QFont defaultButtonFont = QApplication::font(&button);
*buttonFontFamily = defaultButtonFont.family();
*buttonFontPixelSize = 0;
-#ifdef Q_OS_MAC
+#ifdef Q_OS_MACOS
button.setAttribute(Qt::WA_MacSmallSize);
QFontInfo fontInfo(defaultButtonFont);
*buttonFontPixelSize = fontInfo.pixelSize();
@@ -281,7 +281,7 @@ void QStyleFacadeImp::paintComboBox(QPainter *painter, const QStyleFacadeOption
QRect rect = opt.rect;
-#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if defined(Q_OS_MACOS) && !defined(QT_NO_STYLE_MAC)
// QMacStyle makes the combo boxes a little bit smaller to leave space for the focus rect.
// Because of it, the combo button is drawn at a point to the left of where it was expect to be and may end up
// overlapped with the text. This will force QMacStyle to draw the combo box with the expected width.
@@ -366,7 +366,7 @@ void QStyleFacadeImp::paintInnerSpinButton(QPainter* painter, const QStyleFacade
// Default to moving the buttons a little bit within the editor frame.
int inflateX = -2;
int inflateY = -2;
-#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if defined(Q_OS_MACOS) && !defined(QT_NO_STYLE_MAC)
// QMacStyle will position the aqua buttons flush to the right.
// This will move them more within the control for better style, a la
// Chromium look & feel.
diff --git a/Source/WebKit/qt/tests/CMakeLists.txt b/Source/WebKit/qt/tests/CMakeLists.txt
index 3dc6af1d5..42d636573 100644
--- a/Source/WebKit/qt/tests/CMakeLists.txt
+++ b/Source/WebKit/qt/tests/CMakeLists.txt
@@ -14,6 +14,8 @@ include_directories(SYSTEM
${Qt5Test_INCLUDE_DIRS}
)
+add_definitions(-DTESTS_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/")
+
if (ENABLE_TEST_SUPPORT)
add_definitions(-DHAVE_QTTESTSUPPORT)
endif ()
diff --git a/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp b/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
index 0fd5d0a85..8417d0ef7 100644
--- a/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
+++ b/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
@@ -190,6 +190,7 @@ void tst_QGraphicsWebView::widgetsRenderingThroughCache()
// 1. Reference without tiling.
webView->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, false);
QPixmap referencePixmap(view.size());
+ QApplication::processEvents();
widget->render(&referencePixmap);
// 2. With tiling.
diff --git a/Source/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp b/Source/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
index 32935e6a2..4ca5fe5f9 100644
--- a/Source/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
+++ b/Source/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
@@ -74,9 +74,9 @@ private Q_SLOTS:
void addElementToHead();
private:
- QWebView* m_view;
- QWebPage* m_page;
- QWebFrame* m_mainFrame;
+ QWebView* m_view { nullptr };
+ QWebPage* m_page { nullptr };
+ QWebFrame* m_mainFrame { nullptr };
};
tst_QWebElement::tst_QWebElement()
diff --git a/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
index 17bc703fc..2068eec3f 100644
--- a/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
+++ b/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
@@ -94,14 +94,15 @@ private Q_SLOTS:
void setUrlThenLoads_data();
void setUrlThenLoads();
void loadFinishedAfterNotFoundError();
+ void signalsDuringErrorHandling();
void loadInSignalHandlers_data();
void loadInSignalHandlers();
private:
- QWebView* m_view;
- QWebPage* m_page;
- QWebView* m_inputFieldsTestView;
- int m_inputFieldTestPaintCount;
+ QWebView* m_view { nullptr };
+ QWebPage* m_page { nullptr };
+ QWebView* m_inputFieldsTestView { nullptr };
+ int m_inputFieldTestPaintCount { 0 };
};
bool tst_QWebFrame::eventFilter(QObject* watched, QEvent* event)
@@ -169,12 +170,7 @@ void tst_QWebFrame::progressSignal()
::waitForSignal(m_view, SIGNAL(loadFinished(bool)));
- QVERIFY(progressSpy.size() >= 2);
-
- // WebKit defines initialProgressValue as 10%, not 0%
- QCOMPARE(progressSpy.first().first().toInt(), 10);
-
- // But we always end at 100%
+ QVERIFY(progressSpy.size() >= 1);
QCOMPARE(progressSpy.last().first().toInt(), 100);
}
@@ -345,11 +341,21 @@ void tst_QWebFrame::requestedUrlAfterSetAndLoadFailures()
const QUrl second("http://abcdef.abcdef/another_page.html");
QVERIFY(first != second);
+ page.settings()->setAttribute(QWebSettings::ErrorPageEnabled, false);
+
frame->load(second);
::waitForSignal(frame, SIGNAL(loadFinished(bool)));
QCOMPARE(frame->url(), first);
QCOMPARE(frame->requestedUrl(), second);
QVERIFY(!spy.at(1).first().toBool());
+
+ page.settings()->setAttribute(QWebSettings::ErrorPageEnabled, true);
+
+ frame->load(second);
+ ::waitForSignal(frame, SIGNAL(loadFinished(bool)));
+ QCOMPARE(frame->url(), second);
+ QCOMPARE(frame->requestedUrl(), second);
+ QVERIFY(!spy.at(2).first().toBool());
}
void tst_QWebFrame::javaScriptWindowObjectCleared_data()
@@ -467,7 +473,7 @@ void tst_QWebFrame::setHtmlWithBaseURL()
QDir::setCurrent(TESTS_SOURCE_DIR);
- QString html("<html><body><p>hello world</p><img src='resources/image2.png'/></body></html>");
+ QString html("<html><body><p>hello world</p><img src='qwebframe/resources/image.png'/></body></html>");
QWebPage page;
QWebFrame* frame = page.mainFrame();
@@ -1272,7 +1278,7 @@ void tst_QWebFrame::setUrlHistory()
QCOMPARE(spy.count(), expectedLoadFinishedCount);
QCOMPARE(frame->url(), url);
QCOMPARE(frame->requestedUrl(), url);
- QCOMPARE(m_page->history()->count(), 0);
+ QCOMPARE(m_page->history()->count(), 1);
url = QUrl("qrc:/test1.html");
frame->setUrl(url);
@@ -1281,14 +1287,14 @@ void tst_QWebFrame::setUrlHistory()
QCOMPARE(spy.count(), expectedLoadFinishedCount);
QCOMPARE(frame->url(), url);
QCOMPARE(frame->requestedUrl(), url);
- QCOMPARE(m_page->history()->count(), 1);
+ QCOMPARE(m_page->history()->count(), 2);
frame->setUrl(QUrl());
expectedLoadFinishedCount++;
QCOMPARE(spy.count(), expectedLoadFinishedCount);
QCOMPARE(frame->url(), aboutBlank);
QCOMPARE(frame->requestedUrl(), QUrl());
- QCOMPARE(m_page->history()->count(), 1);
+ QCOMPARE(m_page->history()->count(), 2);
// Loading same page as current in history, so history count doesn't change.
url = QUrl("qrc:/test1.html");
@@ -1298,7 +1304,7 @@ void tst_QWebFrame::setUrlHistory()
QCOMPARE(spy.count(), expectedLoadFinishedCount);
QCOMPARE(frame->url(), url);
QCOMPARE(frame->requestedUrl(), url);
- QCOMPARE(m_page->history()->count(), 1);
+ QCOMPARE(m_page->history()->count(), 2);
url = QUrl("qrc:/test2.html");
frame->setUrl(url);
@@ -1307,7 +1313,7 @@ void tst_QWebFrame::setUrlHistory()
QCOMPARE(spy.count(), expectedLoadFinishedCount);
QCOMPARE(frame->url(), url);
QCOMPARE(frame->requestedUrl(), url);
- QCOMPARE(m_page->history()->count(), 2);
+ QCOMPARE(m_page->history()->count(), 3);
}
void tst_QWebFrame::setUrlUsingStateObject()
@@ -1472,6 +1478,30 @@ void tst_QWebFrame::loadFinishedAfterNotFoundError()
QVERIFY(!wasLoadOk);
}
+void tst_QWebFrame::signalsDuringErrorHandling()
+{
+ QWebPage page;
+ QWebFrame* frame = page.mainFrame();
+
+ QSignalSpy loadStartedSpy(frame, &QWebFrame::loadStarted);
+ QSignalSpy loadFinishedSpy(frame, &QWebFrame::loadFinished);
+ FakeNetworkManager* networkManager = new FakeNetworkManager(&page);
+ page.setNetworkAccessManager(networkManager);
+
+ frame->setUrl(FakeReply::urlFor404ErrorWithoutContents);
+ QTRY_COMPARE(loadStartedSpy.count(), 1);
+ QTRY_COMPARE(loadFinishedSpy.count(), 1);
+ bool wasLoadOk = loadFinishedSpy.at(0).at(0).toBool();
+ QVERIFY(!wasLoadOk);
+
+ frame->load(QUrl("http://example.com"));
+ waitForSignal(frame, SIGNAL(loadFinished(bool)));
+ QCOMPARE(loadStartedSpy.count(), 2);
+ QCOMPARE(loadFinishedSpy.count(), 2);
+ wasLoadOk = loadFinishedSpy.at(1).at(0).toBool();
+ QVERIFY(wasLoadOk);
+}
+
class URLSetter : public QObject {
Q_OBJECT
diff --git a/Source/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp b/Source/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp
index 17488ebb9..8df3d26d6 100644
--- a/Source/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp
+++ b/Source/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp
@@ -70,11 +70,11 @@ private Q_SLOTS:
private:
- QWebPage* page;
- QWebFrame* frame;
- QWebHistory* hist;
+ QWebPage* page { nullptr };
+ QWebFrame* frame { nullptr };
+ QWebHistory* hist { nullptr };
QScopedPointer<SignalBarrier> loadFinishedBarrier;
- int histsize;
+ int histsize {0};
};
tst_QWebHistory::tst_QWebHistory()
diff --git a/Source/WebKit/qt/tests/qwebhistoryinterface/tst_qwebhistoryinterface.cpp b/Source/WebKit/qt/tests/qwebhistoryinterface/tst_qwebhistoryinterface.cpp
index 1612eb7b9..91d1c997f 100644
--- a/Source/WebKit/qt/tests/qwebhistoryinterface/tst_qwebhistoryinterface.cpp
+++ b/Source/WebKit/qt/tests/qwebhistoryinterface/tst_qwebhistoryinterface.cpp
@@ -42,11 +42,8 @@ private Q_SLOTS:
void visitedLinks();
private:
-
-
-private:
- QWebView* m_view;
- QWebPage* m_page;
+ QWebView* m_view { nullptr };
+ QWebPage* m_page { nullptr };
};
tst_QWebHistoryInterface::tst_QWebHistoryInterface()
diff --git a/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index e545c5c0f..db4c911e6 100644
--- a/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -173,7 +173,6 @@ private Q_SLOTS:
void errorPageExtension();
void errorPageExtensionInIFrames();
void errorPageExtensionInFrameset();
- void errorPageExtensionLoadFinished();
void userAgentApplicationName();
void userAgentNewlineStripping();
void undoActionHaveCustomText();
@@ -212,13 +211,13 @@ private Q_SLOTS:
void cssMediaTypeGlobalSetting();
void cssMediaTypePageSetting();
-#ifdef Q_OS_MAC
+#ifdef Q_OS_MACOS
void macCopyUnicodeToClipboard();
#endif
private:
- QWebView* m_view;
- QWebPage* m_page;
+ QWebView* m_view { nullptr };
+ QWebPage* m_page { nullptr };
QString tmpDirPath() const
{
static QString tmpd = QDir::tempPath() + "/tst_qwebpage-"
@@ -379,7 +378,7 @@ public:
}
private:
- bool m_allowGeolocation;
+ bool m_allowGeolocation { false };
};
// [Qt] tst_QWebPage::infiniteLoopJS() timeouts with DFG JIT
@@ -2755,35 +2754,6 @@ void tst_QWebPage::errorPageExtensionInFrameset()
m_view->setPage(0);
}
-void tst_QWebPage::errorPageExtensionLoadFinished()
-{
- ErrorPage page;
- m_view->setPage(&page);
-
- QSignalSpy spyLoadFinished(m_view, SIGNAL(loadFinished(bool)));
- QSignalSpy spyFrameLoadFinished(m_view->page()->mainFrame(), SIGNAL(loadFinished(bool)));
-
- m_view->setUrl(QUrl("data:text/html,foo"));
- QTRY_COMPARE(spyLoadFinished.count(), 1);
- QTRY_COMPARE(spyFrameLoadFinished.count(), 1);
-
- const bool loadSucceded = spyLoadFinished.at(0).at(0).toBool();
- QVERIFY(loadSucceded);
- const bool frameLoadSucceded = spyFrameLoadFinished.at(0).at(0).toBool();
- QVERIFY(frameLoadSucceded);
-
- m_view->page()->mainFrame()->setUrl(QUrl("http://non.existent/url"));
- QTRY_COMPARE(spyLoadFinished.count(), 2);
- QTRY_COMPARE(spyFrameLoadFinished.count(), 2);
-
- const bool nonExistantLoadSucceded = spyLoadFinished.at(1).at(0).toBool();
- QVERIFY(nonExistantLoadSucceded);
- const bool nonExistantFrameLoadSucceded = spyFrameLoadFinished.at(1).at(0).toBool();
- QVERIFY(nonExistantFrameLoadSucceded);
-
- m_view->setPage(0);
-}
-
class FriendlyWebPage : public QWebPage
{
public:
@@ -2926,15 +2896,13 @@ void tst_QWebPage::originatingObjectInNetworkRequests()
m_page->setNetworkAccessManager(networkManager);
networkManager->requests.clear();
- m_view->setHtml(QString("<frameset cols=\"25%,75%\"><frame src=\"data:text/html,"
- "<head><meta http-equiv='refresh' content='1'></head>foo \">"
- "<frame src=\"data:text/html,bar\"></frameset>"), QUrl());
+ m_view->setHtml(QString("<frameset cols=\"25%,75%\"><frame src=\"qrc:///frame_c.html\">"
+ "<frame src=\"qrc:///frame_b.html\"></frameset>"), QUrl());
QVERIFY(::waitForSignal(m_view, SIGNAL(loadFinished(bool))));
QCOMPARE(networkManager->requests.count(), 2);
QList<QWebFrame*> childFrames = m_page->mainFrame()->childFrames();
- QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=118660", Continue);
QCOMPARE(childFrames.count(), 2);
for (int i = 0; i < 2; ++i)
@@ -3102,15 +3070,6 @@ void tst_QWebPage::findText()
}
}
-static QString getMimeTypeForExtension(const QString &ext)
-{
- QMimeType mimeType = QMimeDatabase().mimeTypeForFile(QStringLiteral("filename.") + ext.toLower(), QMimeDatabase::MatchExtension);
- if (mimeType.isValid() && !mimeType.isDefault())
- return mimeType.name();
-
- return QString();
-}
-
void tst_QWebPage::supportedContentType()
{
QStringList contentTypes;
@@ -3118,19 +3077,14 @@ void tst_QWebPage::supportedContentType()
// Add supported non image types...
contentTypes << "text/html" << "text/xml" << "text/xsl" << "text/plain" << "text/"
<< "application/xml" << "application/xhtml+xml" << "application/vnd.wap.xhtml+xml"
- << "application/rss+xml" << "application/atom+xml" << "application/json";
+ << "application/rss+xml" << "application/atom+xml" << "application/json"
+ // Add JPEG MIME type
+ << "image/jpeg";
#if ENABLE_MHTML
contentTypes << "application/x-mimearchive";
#endif
- // Add supported image types...
- Q_FOREACH(const QByteArray& imageType, QImageWriter::supportedImageFormats()) {
- const QString mimeType = getMimeTypeForExtension(imageType);
- if (!mimeType.isEmpty())
- contentTypes << mimeType;
- }
-
// Get the mime types supported by webkit...
const QStringList supportedContentTypes = m_page->supportedContentTypes();
@@ -3194,7 +3148,7 @@ void tst_QWebPage::thirdPartyCookiePolicy()
}
#endif
-#ifdef Q_OS_MAC
+#ifdef Q_OS_MACOS
void tst_QWebPage::macCopyUnicodeToClipboard()
{
QString unicodeText = QString::fromUtf8("αβγδεζηθικλμπ");
@@ -3329,9 +3283,12 @@ void tst_QWebPage::contextMenuPopulatedOnce()
QList<QAction *> list = contextMenu->actions();
QStringList entries;
while (!list.isEmpty()) {
- QString entry = list.takeFirst()->text();
- QVERIFY(!entries.contains(entry));
- entries << entry;
+ const QAction* action = list.takeFirst();
+ if (!action->isSeparator()) {
+ QString entry = action->text();
+ QVERIFY(!entries.contains(entry));
+ entries << entry;
+ }
}
}
diff --git a/Source/WebKit/qt/tests/qwebsecurityorigin/tst_qwebsecurityorigin.cpp b/Source/WebKit/qt/tests/qwebsecurityorigin/tst_qwebsecurityorigin.cpp
index a15838274..225c42d0a 100644
--- a/Source/WebKit/qt/tests/qwebsecurityorigin/tst_qwebsecurityorigin.cpp
+++ b/Source/WebKit/qt/tests/qwebsecurityorigin/tst_qwebsecurityorigin.cpp
@@ -38,8 +38,8 @@ private slots:
void whiteList_data();
void whiteList();
private:
- QWebView* m_view;
- QWebPage* m_page;
+ QWebView* m_view { nullptr };
+ QWebPage* m_page { nullptr };
};
tst_QWebSecurityOrigin::tst_QWebSecurityOrigin()