From 72cfbd7664f21fcc0e62b869a6b01bf73eb5e7da Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Sat, 20 Jan 2018 16:23:23 +0300 Subject: Import WebKit commit 025cd3fc8d29620535309aa3e2ab7075aad36044 Change-Id: I39d60de0f241abc52c0c4eb174eba7882d576f24 Reviewed-by: Konstantin Tokarev --- Source/WebCore/page/Performance.cpp | 2 +- Source/WebCore/rendering/style/NinePieceImage.cpp | 2 ++ Source/WebKit/CMakeLists.txt | 12 +++++++- Source/WebKit/PlatformQt.cmake | 3 +- Source/cmake/FindICU.cmake | 4 +-- Source/cmake/OptionsQt.cmake | 35 ++++++++++++++++++++++- Tools/qmake/projects/run_cmake.pro | 2 ++ 7 files changed, 54 insertions(+), 6 deletions(-) diff --git a/Source/WebCore/page/Performance.cpp b/Source/WebCore/page/Performance.cpp index 1c491da5d..aa18fe063 100644 --- a/Source/WebCore/page/Performance.cpp +++ b/Source/WebCore/page/Performance.cpp @@ -233,7 +233,7 @@ void Performance::webkitClearMeasures(const String& measureName) double Performance::now() const { double nowSeconds = monotonicallyIncreasingTime() - m_referenceTime; - const double resolutionSeconds = 0.0001; + const double resolutionSeconds = 0.001; return 1000.0 * floor(nowSeconds / resolutionSeconds) * resolutionSeconds; } diff --git a/Source/WebCore/rendering/style/NinePieceImage.cpp b/Source/WebCore/rendering/style/NinePieceImage.cpp index b4c33f4f0..3c32a8a59 100644 --- a/Source/WebCore/rendering/style/NinePieceImage.cpp +++ b/Source/WebCore/rendering/style/NinePieceImage.cpp @@ -25,6 +25,7 @@ #include "NinePieceImage.h" #include "GraphicsContext.h" +#include "ImageQualityController.h" #include "LengthFunctions.h" #include "RenderStyle.h" #include @@ -209,6 +210,7 @@ void NinePieceImage::paint(GraphicsContext& graphicsContext, RenderElement* rend if (!image) return; + InterpolationQualityMaintainer interpolationMaintainer(graphicsContext, ImageQualityController::interpolationQualityFromStyle(style)); for (ImagePiece piece = MinPiece; piece < MaxPiece; ++piece) { if ((piece == MiddlePiece && !fill()) || isEmptyPieceRect(piece, destinationRects, sourceRects)) continue; 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..6fe440be8 100644 --- a/Source/WebKit/PlatformQt.cmake +++ b/Source/WebKit/PlatformQt.cmake @@ -861,7 +861,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/cmake/FindICU.cmake b/Source/cmake/FindICU.cmake index c0de36338..4e93286f3 100644 --- a/Source/cmake/FindICU.cmake +++ b/Source/cmake/FindICU.cmake @@ -24,7 +24,7 @@ mark_as_advanced(ICU_INCLUDE_DIR) # Look for the library. find_library( ICU_LIBRARY - NAMES sicuuc icuuc cygicuuc cygicuuc32 + NAMES icuuc cygicuuc cygicuuc32 HINTS ${PC_ICU_LIBRARY_DIRS} ${PC_ICU_LIBDIR} DOC "Libraries to link against for the common parts of ICU") @@ -49,7 +49,7 @@ if (ICU_INCLUDE_DIR AND ICU_LIBRARY) pkg_check_modules(PC_ICU_I18N icu-i18n) find_library( ICU_I18N_LIBRARY - NAMES sicui18n sicuin icui18n icuin cygicuin cygicuin32 + NAMES icui18n icuin cygicuin cygicuin32 HINTS ${PC_ICU_I18N_LIBRARY_DIRS} ${PC_ICU_I18N_LIBDIR} DOC "Libraries to link against for ICU internationalization") diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake index 559b2ab8b..003fdca41 100644 --- a/Source/cmake/OptionsQt.cmake +++ b/Source/cmake/OptionsQt.cmake @@ -1,3 +1,4 @@ +include(CheckCXXSourceCompiles) include(FeatureSummary) include(ECMEnableSanitizers) include(ECMPackageConfigHelpers) @@ -53,6 +54,30 @@ macro(CONVERT_PRL_LIBS_TO_CMAKE _qt_component) endif () endmacro() +macro(CHECK_QT5_PRIVATE_INCLUDE_DIRS _qt_component _header) + set(INCLUDE_TEST_SOURCE + " + #include <${_header}> + int main() { return 0; } + " + ) + set(CMAKE_REQUIRED_INCLUDES ${Qt5${_qt_component}_PRIVATE_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES Qt5::${_qt_component}) + + # Avoid check_include_file_cxx() because it performs linking but doesn't support CMAKE_REQUIRED_LIBRARIES (doh!) + check_cxx_source_compiles("${INCLUDE_TEST_SOURCE}" Qt5${_qt_component}_PRIVATE_HEADER_FOUND) + + unset(INCLUDE_TEST_SOURCE) + unset(CMAKE_REQUIRED_INCLUDES) + unset(CMAKE_REQUIRED_LIBRARIES) + + if (NOT Qt5${_qt_component}_PRIVATE_HEADER_FOUND) + message(FATAL_ERROR "Header ${_header} is not found. Please make sure that: + 1. Private headers of Qt5${_qt_component} are installed + 2. Qt5${_qt_component}_PRIVATE_INCLUDE_DIRS is correctly defined in Qt5${_qt_component}Config.cmake") + endif () +endmacro() + macro(QT_ADD_EXTRA_WEBKIT_TARGET_EXPORT target) if (QT_STATIC_BUILD OR SHARED_CORE) install(TARGETS ${target} EXPORT WebKitTargets @@ -131,11 +156,13 @@ endif () WEBKIT_OPTION_BEGIN() if (APPLE) + set(MACOS_COMPATIBILITY_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}" CACHE STRING "Compatibility version that macOS dylibs should have") + option(MACOS_FORCE_SYSTEM_XML_LIBRARIES "Use system installation of libxml2 and libxslt on macOS" ON) option(MACOS_USE_SYSTEM_ICU "Use system installation of ICU on macOS" ON) option(USE_UNIX_DOMAIN_SOCKETS "Use Unix domain sockets instead of native IPC code on macOS" OFF) option(USE_APPSTORE_COMPLIANT_CODE "Avoid using private macOS APIs which are not allowed on App Store (experimental)" OFF) - set(MACOS_BUILD_FRAMEWORKS ON) # TODO: Make it an option + option(MACOS_BUILD_FRAMEWORKS "Build QtWebKit as framework bundles" ON) if (USE_APPSTORE_COMPLIANT_CODE) set(MACOS_USE_SYSTEM_ICU OFF) @@ -581,6 +608,12 @@ if (ENABLE_QT_WEBCHANNEL) endif () find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS ${QT_REQUIRED_COMPONENTS}) + +CHECK_QT5_PRIVATE_INCLUDE_DIRS(Gui private/qhexstring_p.h) +if (ENABLE_WEBKIT2) + CHECK_QT5_PRIVATE_INCLUDE_DIRS(Quick private/qsgrendernode_p.h) +endif () + if (QT_STATIC_BUILD) foreach (qt_module ${QT_REQUIRED_COMPONENTS}) CONVERT_PRL_LIBS_TO_CMAKE(${qt_module}) diff --git a/Tools/qmake/projects/run_cmake.pro b/Tools/qmake/projects/run_cmake.pro index f63fcd658..b9d0f08a2 100644 --- a/Tools/qmake/projects/run_cmake.pro +++ b/Tools/qmake/projects/run_cmake.pro @@ -83,6 +83,8 @@ build_pass|!debug_and_release { debug_and_release:build_all:CONFIG(debug, debug|release) { CMAKE_CONFIG += CMAKE_INSTALL_PREFIX=\"$$[QT_INSTALL_PREFIX]/debug\" } + + !qt_framework: CMAKE_CONFIG += MACOS_BUILD_FRAMEWORKS=OFF } !isEmpty(use_ninja): cmake_args += "-G Ninja" -- cgit v1.2.1 From c49326e942d7cc21f78fe187020dce73befdd935 Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Tue, 4 Jun 2019 22:44:55 +0300 Subject: Import WebKit commit 5ccca3a720f7c2251c4ac8b28f25bd73524081f0 Change-Id: Idfb37cd43929536d4c67d1fa5d8cb598e9c0ad7e Reviewed-by: Konstantin Tokarev --- Source/CMakeLists.txt | 2 +- Source/JavaScriptCore/bytecode/Opcode.cpp | 16 ++++++- Source/JavaScriptCore/bytecode/Opcode.h | 13 ----- Source/JavaScriptCore/parser/Parser.cpp | 16 +++---- Source/JavaScriptCore/parser/Parser.h | 3 ++ Source/JavaScriptCore/shell/PlatformQt.cmake | 2 +- Source/WTF/wtf/CMakeLists.txt | 9 ---- Source/WTF/wtf/HashTable.h | 2 +- Source/WTF/wtf/OSRandomSource.cpp | 5 +- Source/WTF/wtf/Platform.h | 5 +- Source/WTF/wtf/PlatformQt.cmake | 21 ++++++-- Source/WTF/wtf/StringPrintStream.cpp | 34 ++++++++----- Source/WTF/wtf/StringPrintStream.h | 1 + Source/WTF/wtf/Vector.h | 8 ++-- Source/WTF/wtf/WorkQueue.cpp | 2 +- Source/WTF/wtf/spi/darwin/CommonCryptoSPI.h | 41 ---------------- Source/WebCore/CMakeLists.txt | 9 +++- Source/WebCore/PlatformQt.cmake | 5 ++ Source/WebCore/Resources/nullPlugin@2x.png | Bin 7181 -> 3898 bytes .../WebCore/Resources/textAreaResizeCorner@2x.png | Bin 2907 -> 167 bytes Source/WebCore/bindings/js/JSImageConstructor.cpp | 2 +- Source/WebCore/crypto/CommonCryptoUtilities.h | 6 +-- Source/WebCore/dom/Document.cpp | 3 ++ Source/WebCore/dom/SlotAssignment.h | 1 + Source/WebCore/page/qt/EventHandlerQt.cpp | 2 +- Source/WebCore/platform/FileSystem.h | 4 +- Source/WebCore/platform/HashTools.h | 6 +-- Source/WebCore/platform/Length.h | 8 ++-- .../platform/network/qt/QNetworkReplyHandler.cpp | 7 ++- Source/WebCore/platform/qt/FileSystemQt.cpp | 2 +- Source/WebCore/platform/qt/PasteboardQt.cpp | 2 +- Source/WebCore/platform/qt/RenderThemeQStyle.cpp | 8 ++-- Source/WebCore/platform/qt/RenderThemeQStyle.h | 2 +- Source/WebKit/PlatformQt.cmake | 21 ++++---- Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp | 2 +- .../WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp | 8 +++- Source/WebKit/qt/WidgetSupport/QStyleFacadeImp.cpp | 6 +-- Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 4 +- Source/WebKit2/Shared/qt/ChildProcessMainQt.cpp | 2 +- Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp | 15 +++--- .../WebKit2/UIProcess/API/qt/qquickwebview_p_p.h | 2 +- .../WebKit2/UIProcess/API/qt/qwebpreferences.cpp | 36 ++++++++++++++ .../WebKit2/UIProcess/API/qt/qwebpreferences_p.h | 10 ++++ .../WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h | 4 +- .../WebKit2/UIProcess/Launcher/ProcessLauncher.cpp | 3 +- .../UIProcess/Launcher/qt/ProcessLauncherQt.cpp | 12 ++--- Source/WebKit2/UIProcess/WebPageProxy.cpp | 2 +- Source/WebKit2/UIProcess/qt/QtPageClient.cpp | 3 +- Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp | 4 +- Source/WebKit2/WebProcess/qt/WebProcessQt.cpp | 6 +-- Source/bmalloc/bmalloc/BPlatform.h | 3 +- Source/cmake/FindWOFF2Dec.cmake | 53 +++++++++++++++++++++ Source/cmake/OptionsQt.cmake | 9 ++++ Source/cmake/OptionsWin.cmake | 3 ++ Source/cmake/WebKitCommon.cmake | 3 ++ Source/cmake/WebKitMacros.cmake | 4 ++ Source/qtwebkit.qdocconf | 2 + Tools/QtTestBrowser/launcherwindow.cpp | 35 +++++++++++++- Tools/QtTestBrowser/launcherwindow.h | 4 ++ Tools/QtTestBrowser/mainwindow.cpp | 2 + Tools/TestWebKitAPI/PlatformQt.cmake | 2 +- 61 files changed, 335 insertions(+), 172 deletions(-) delete mode 100644 Source/WTF/wtf/spi/darwin/CommonCryptoSPI.h create mode 100644 Source/cmake/FindWOFF2Dec.cmake diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 9d9483ecc..a473dbf14 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -19,7 +19,7 @@ if (ENABLE_API_TESTS) add_subdirectory(ThirdParty/gtest) endif () -if (USE_WOFF2) +if (USE_WOFF2 AND NOT WOFF2DEC_FOUND) add_subdirectory(ThirdParty/brotli) add_subdirectory(ThirdParty/woff2) endif () diff --git a/Source/JavaScriptCore/bytecode/Opcode.cpp b/Source/JavaScriptCore/bytecode/Opcode.cpp index 0d16dfc2f..25e857d76 100644 --- a/Source/JavaScriptCore/bytecode/Opcode.cpp +++ b/Source/JavaScriptCore/bytecode/Opcode.cpp @@ -49,6 +49,18 @@ const char* const opcodeNames[] = { #if ENABLE(OPCODE_STATS) +inline const char* padOpcodeName(OpcodeID op, unsigned width) +{ + auto padding = " "; + auto paddingLength = strlen(padding); + auto opcodeNameLength = strlen(opcodeNames[op]); + if (opcodeNameLength >= width) + return ""; + if (paddingLength + opcodeNameLength < width) + return padding; + return &padding[paddingLength + opcodeNameLength - width]; +} + long long OpcodeStats::opcodeCounts[numOpcodeIDs]; long long OpcodeStats::opcodePairCounts[numOpcodeIDs][numOpcodeIDs]; int OpcodeStats::lastOpcode = -1; @@ -80,9 +92,9 @@ static int compareOpcodeIndices(const void* left, const void* right) static int compareOpcodePairIndices(const void* left, const void* right) { - std::pair leftPair = *(pair*) left; + std::pair leftPair = *(std::pair*) left; long long leftValue = OpcodeStats::opcodePairCounts[leftPair.first][leftPair.second]; - std::pair rightPair = *(pair*) right; + std::pair rightPair = *(std::pair*) right; long long rightValue = OpcodeStats::opcodePairCounts[rightPair.first][rightPair.second]; if (leftValue < rightValue) diff --git a/Source/JavaScriptCore/bytecode/Opcode.h b/Source/JavaScriptCore/bytecode/Opcode.h index ee667c84f..21665c5f7 100644 --- a/Source/JavaScriptCore/bytecode/Opcode.h +++ b/Source/JavaScriptCore/bytecode/Opcode.h @@ -85,21 +85,8 @@ typedef void* Opcode; typedef OpcodeID Opcode; #endif -#define PADDING_STRING " " -#define PADDING_STRING_LENGTH static_cast(strlen(PADDING_STRING)) - extern const char* const opcodeNames[]; -inline const char* padOpcodeName(OpcodeID op, unsigned width) -{ - unsigned pad = width - strlen(opcodeNames[op]); - pad = std::min(pad, PADDING_STRING_LENGTH); - return PADDING_STRING + PADDING_STRING_LENGTH - pad; -} - -#undef PADDING_STRING_LENGTH -#undef PADDING_STRING - #if ENABLE(OPCODE_STATS) struct OpcodeStats { diff --git a/Source/JavaScriptCore/parser/Parser.cpp b/Source/JavaScriptCore/parser/Parser.cpp index c66b74282..f4751616f 100644 --- a/Source/JavaScriptCore/parser/Parser.cpp +++ b/Source/JavaScriptCore/parser/Parser.cpp @@ -90,7 +90,7 @@ void Parser::logError(bool) return; StringPrintStream stream; printUnexpectedTokenText(stream); - setErrorMessage(stream.toString()); + setErrorMessage(stream.toStringWithLatin1Fallback()); } template template @@ -104,7 +104,7 @@ void Parser::logError(bool shouldPrintToken, const A& value1) stream.print(". "); } stream.print(value1, "."); - setErrorMessage(stream.toString()); + setErrorMessage(stream.toStringWithLatin1Fallback()); } template template @@ -118,7 +118,7 @@ void Parser::logError(bool shouldPrintToken, const A& value1, const B stream.print(". "); } stream.print(value1, value2, "."); - setErrorMessage(stream.toString()); + setErrorMessage(stream.toStringWithLatin1Fallback()); } template template @@ -132,7 +132,7 @@ void Parser::logError(bool shouldPrintToken, const A& value1, const B stream.print(". "); } stream.print(value1, value2, value3, "."); - setErrorMessage(stream.toString()); + setErrorMessage(stream.toStringWithLatin1Fallback()); } template template @@ -146,7 +146,7 @@ void Parser::logError(bool shouldPrintToken, const A& value1, const B stream.print(". "); } stream.print(value1, value2, value3, value4, "."); - setErrorMessage(stream.toString()); + setErrorMessage(stream.toStringWithLatin1Fallback()); } template template @@ -160,7 +160,7 @@ void Parser::logError(bool shouldPrintToken, const A& value1, const B stream.print(". "); } stream.print(value1, value2, value3, value4, value5, "."); - setErrorMessage(stream.toString()); + setErrorMessage(stream.toStringWithLatin1Fallback()); } template template @@ -174,7 +174,7 @@ void Parser::logError(bool shouldPrintToken, const A& value1, const B stream.print(". "); } stream.print(value1, value2, value3, value4, value5, value6, "."); - setErrorMessage(stream.toString()); + setErrorMessage(stream.toStringWithLatin1Fallback()); } template template @@ -188,7 +188,7 @@ void Parser::logError(bool shouldPrintToken, const A& value1, const B stream.print(". "); } stream.print(value1, value2, value3, value4, value5, value6, value7, "."); - setErrorMessage(stream.toString()); + setErrorMessage(stream.toStringWithLatin1Fallback()); } template diff --git a/Source/JavaScriptCore/parser/Parser.h b/Source/JavaScriptCore/parser/Parser.h index 02a726a56..bce94ba25 100644 --- a/Source/JavaScriptCore/parser/Parser.h +++ b/Source/JavaScriptCore/parser/Parser.h @@ -1114,7 +1114,10 @@ private: void setErrorMessage(const String& message) { + ASSERT_WITH_MESSAGE(!message.isEmpty(), "Attempted to set the empty string as an error message. Likely caused by invalid UTF8 used when creating the message."); m_errorMessage = message; + if (m_errorMessage.isEmpty()) + m_errorMessage = ASCIILiteral("Unparseable script"); } NEVER_INLINE void logError(bool); diff --git a/Source/JavaScriptCore/shell/PlatformQt.cmake b/Source/JavaScriptCore/shell/PlatformQt.cmake index 55640eb3a..8d4b260c1 100644 --- a/Source/JavaScriptCore/shell/PlatformQt.cmake +++ b/Source/JavaScriptCore/shell/PlatformQt.cmake @@ -1,5 +1,5 @@ if (QT_STATIC_BUILD) list(APPEND JSC_LIBRARIES - ${DEPEND_STATIC_LIBS} + ${STATIC_LIB_DEPENDENCIES} ) endif () diff --git a/Source/WTF/wtf/CMakeLists.txt b/Source/WTF/wtf/CMakeLists.txt index 09b848c7a..297589b90 100644 --- a/Source/WTF/wtf/CMakeLists.txt +++ b/Source/WTF/wtf/CMakeLists.txt @@ -241,15 +241,6 @@ set(WTF_LIBRARIES ${CMAKE_DL_LIBS} ) -if (CMAKE_SYSTEM_NAME MATCHES "Darwin") - list(APPEND WTF_HEADERS - spi/darwin/CommonCryptoSPI.h - ) - list(APPEND WTF_INCLUDE_DIRECTORIES - "${WTF_DIR}/wtf/spi/darwin" - ) -endif () - if (NOT USE_SYSTEM_MALLOC) list(APPEND WTF_LIBRARIES bmalloc) endif () diff --git a/Source/WTF/wtf/HashTable.h b/Source/WTF/wtf/HashTable.h index 712022d71..f95167f23 100644 --- a/Source/WTF/wtf/HashTable.h +++ b/Source/WTF/wtf/HashTable.h @@ -845,7 +845,7 @@ namespace WTF { // This initializes the bucket without copying the empty value. // That makes it possible to use this with types that don't support copying. // The memset to 0 looks like a slow operation but is optimized by the compilers. - memset(&bucket, 0, sizeof(bucket)); + memset(static_cast(std::addressof(bucket)), 0, sizeof(bucket)); } }; diff --git a/Source/WTF/wtf/OSRandomSource.cpp b/Source/WTF/wtf/OSRandomSource.cpp index 378795dc7..529acf714 100644 --- a/Source/WTF/wtf/OSRandomSource.cpp +++ b/Source/WTF/wtf/OSRandomSource.cpp @@ -41,7 +41,8 @@ #endif #if OS(DARWIN) -#include "CommonCryptoSPI.h" +#include +#include #endif namespace WTF { @@ -61,7 +62,7 @@ NEVER_INLINE NO_RETURN_DUE_TO_CRASH static void crashUnableToReadFromURandom() void cryptographicallyRandomValuesFromOS(unsigned char* buffer, size_t length) { #if OS(DARWIN) - RELEASE_ASSERT(!CCRandomCopyBytes(kCCRandomDefault, buffer, length)); + RELEASE_ASSERT(!CCRandomGenerateBytes(buffer, length)); #elif OS(UNIX) int fd = open("/dev/urandom", O_RDONLY, 0); if (fd < 0) diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h index 191f3090c..5717f3ea1 100644 --- a/Source/WTF/wtf/Platform.h +++ b/Source/WTF/wtf/Platform.h @@ -238,7 +238,8 @@ || defined(__ARM_ARCH_7S__) #define WTF_ARM_ARCH_VERSION 7 -#elif defined(__ARM_ARCH_8__) +#elif defined(__ARM_ARCH_8__) \ + || defined(__ARM_ARCH_8A__) #define WTF_ARM_ARCH_VERSION 8 /* MSVC sets _M_ARM */ @@ -1027,7 +1028,7 @@ #define USE_VIDEOTOOLBOX 1 #endif -#if PLATFORM(COCOA) || PLATFORM(GTK) || (PLATFORM(WIN) && !USE(WINGDI)) +#if PLATFORM(COCOA) || PLATFORM(GTK) || PLATFORM(QT) || (PLATFORM(WIN) && !USE(WINGDI)) #define USE_REQUEST_ANIMATION_FRAME_TIMER 1 #endif diff --git a/Source/WTF/wtf/PlatformQt.cmake b/Source/WTF/wtf/PlatformQt.cmake index 684119455..b7f4149f2 100644 --- a/Source/WTF/wtf/PlatformQt.cmake +++ b/Source/WTF/wtf/PlatformQt.cmake @@ -27,7 +27,13 @@ if (QT_STATIC_BUILD) ) endif () -if (UNIX AND NOT APPLE) +if (USE_MACH_PORTS) + list(APPEND WTF_SOURCES + cocoa/WorkQueueCocoa.cpp + ) +endif () + +if (USE_UNIX_DOMAIN_SOCKETS) list(APPEND WTF_SOURCES UniStdExtras.cpp @@ -66,8 +72,6 @@ endif () if (APPLE) list(APPEND WTF_SOURCES - cocoa/WorkQueueCocoa.cpp - text/cf/AtomicStringImplCF.cpp text/cf/StringCF.cpp text/cf/StringImplCF.cpp @@ -77,3 +81,14 @@ if (APPLE) ${COREFOUNDATION_LIBRARY} ) endif () + +if (UNIX AND NOT APPLE) + check_function_exists(clock_gettime CLOCK_GETTIME_EXISTS) + if (NOT CLOCK_GETTIME_EXISTS) + set(CMAKE_REQUIRED_LIBRARIES rt) + check_function_exists(clock_gettime CLOCK_GETTIME_REQUIRES_LIBRT) + if (CLOCK_GETTIME_REQUIRES_LIBRT) + list(APPEND WTF_LIBRARIES rt) + endif () + endif () +endif () diff --git a/Source/WTF/wtf/StringPrintStream.cpp b/Source/WTF/wtf/StringPrintStream.cpp index 0fd6e4760..6a8881c5b 100644 --- a/Source/WTF/wtf/StringPrintStream.cpp +++ b/Source/WTF/wtf/StringPrintStream.cpp @@ -20,7 +20,7 @@ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" @@ -52,32 +52,34 @@ void StringPrintStream::vprintf(const char* format, va_list argList) { ASSERT_WITH_SECURITY_IMPLICATION(m_next < m_size); ASSERT(!m_buffer[m_next]); - + va_list firstPassArgList; va_copy(firstPassArgList, argList); - + int numberOfBytesNotIncludingTerminatorThatWouldHaveBeenWritten = vsnprintf(m_buffer + m_next, m_size - m_next, format, firstPassArgList); - + + va_end(firstPassArgList); + int numberOfBytesThatWouldHaveBeenWritten = numberOfBytesNotIncludingTerminatorThatWouldHaveBeenWritten + 1; - + if (m_next + numberOfBytesThatWouldHaveBeenWritten <= m_size) { m_next += numberOfBytesNotIncludingTerminatorThatWouldHaveBeenWritten; return; // This means that vsnprintf() succeeded. } - + increaseSize(m_next + numberOfBytesThatWouldHaveBeenWritten); - + int numberOfBytesNotIncludingTerminatorThatWereWritten = vsnprintf(m_buffer + m_next, m_size - m_next, format, argList); - + int numberOfBytesThatWereWritten = numberOfBytesNotIncludingTerminatorThatWereWritten + 1; - + ASSERT_UNUSED(numberOfBytesThatWereWritten, m_next + numberOfBytesThatWereWritten <= m_size); - + m_next += numberOfBytesNotIncludingTerminatorThatWereWritten; - + ASSERT_WITH_SECURITY_IMPLICATION(m_next < m_size); ASSERT(!m_buffer[m_next]); } @@ -100,14 +102,20 @@ String StringPrintStream::toString() return String::fromUTF8(m_buffer, m_next); } +String StringPrintStream::toStringWithLatin1Fallback() +{ + ASSERT(m_next == strlen(m_buffer)); + return String::fromUTF8WithLatin1Fallback(m_buffer, m_next); +} + void StringPrintStream::increaseSize(size_t newSize) { ASSERT_WITH_SECURITY_IMPLICATION(newSize > m_size); ASSERT(newSize > sizeof(m_inlineBuffer)); - + // Use exponential resizing to reduce thrashing. m_size = newSize << 1; - + // Use fastMalloc instead of fastRealloc because we know that for the sizes we're using, // fastRealloc will just do malloc+free anyway. Also, this simplifies the code since // we can't realloc the inline buffer. diff --git a/Source/WTF/wtf/StringPrintStream.h b/Source/WTF/wtf/StringPrintStream.h index 18eecb208..c526b8aa1 100644 --- a/Source/WTF/wtf/StringPrintStream.h +++ b/Source/WTF/wtf/StringPrintStream.h @@ -43,6 +43,7 @@ public: WTF_EXPORT_PRIVATE CString toCString(); WTF_EXPORT_PRIVATE String toString(); + WTF_EXPORT_PRIVATE String toStringWithLatin1Fallback(); WTF_EXPORT_PRIVATE void reset(); private: diff --git a/Source/WTF/wtf/Vector.h b/Source/WTF/wtf/Vector.h index 18268b6ef..d9a25ac6f 100644 --- a/Source/WTF/wtf/Vector.h +++ b/Source/WTF/wtf/Vector.h @@ -85,7 +85,7 @@ struct VectorInitializer { static void initialize(T* begin, T* end) { - memset(begin, 0, reinterpret_cast(end) - reinterpret_cast(begin)); + memset(static_cast(begin), 0, reinterpret_cast(end) - reinterpret_cast(begin)); } }; @@ -125,11 +125,11 @@ struct VectorMover { static void move(const T* src, const T* srcEnd, T* dst) { - memcpy(dst, src, reinterpret_cast(srcEnd) - reinterpret_cast(src)); + memcpy(static_cast(dst), static_cast(const_cast(src)), reinterpret_cast(srcEnd) - reinterpret_cast(src)); } static void moveOverlapping(const T* src, const T* srcEnd, T* dst) { - memmove(dst, src, reinterpret_cast(srcEnd) - reinterpret_cast(src)); + memmove(static_cast(dst), static_cast(const_cast(src)), reinterpret_cast(srcEnd) - reinterpret_cast(src)); } }; @@ -155,7 +155,7 @@ struct VectorCopier { static void uninitializedCopy(const T* src, const T* srcEnd, T* dst) { - memcpy(dst, src, reinterpret_cast(srcEnd) - reinterpret_cast(src)); + memcpy(static_cast(dst), static_cast(const_cast(src)), reinterpret_cast(srcEnd) - reinterpret_cast(src)); } template static void uninitializedCopy(const T* src, const T* srcEnd, U* dst) diff --git a/Source/WTF/wtf/WorkQueue.cpp b/Source/WTF/wtf/WorkQueue.cpp index e26ae3bf2..3624d3902 100644 --- a/Source/WTF/wtf/WorkQueue.cpp +++ b/Source/WTF/wtf/WorkQueue.cpp @@ -52,7 +52,7 @@ WorkQueue::~WorkQueue() platformInvalidate(); } -#if !PLATFORM(COCOA) && !(PLATFORM(QT) && OS(DARWIN)) +#if !PLATFORM(COCOA) && !(PLATFORM(QT) && USE(MACH_PORTS)) void WorkQueue::concurrentApply(size_t iterations, const std::function& function) { if (!iterations) diff --git a/Source/WTF/wtf/spi/darwin/CommonCryptoSPI.h b/Source/WTF/wtf/spi/darwin/CommonCryptoSPI.h deleted file mode 100644 index 325cbe81b..000000000 --- a/Source/WTF/wtf/spi/darwin/CommonCryptoSPI.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2015 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CommonCryptoSPI_h -#define CommonCryptoSPI_h - -#if OS(DARWIN) - -#if USE(APPLE_INTERNAL_SDK) -#include -#endif - -typedef struct __CCRandom* CCRandomRef; -extern const CCRandomRef kCCRandomDefault; -extern "C" int CCRandomCopyBytes(CCRandomRef rnd, void *bytes, size_t count); - -#endif // OS(DARWIN) - -#endif /* CommonCryptoSPI_h */ diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt index e9fc4e54e..56b32563a 100644 --- a/Source/WebCore/CMakeLists.txt +++ b/Source/WebCore/CMakeLists.txt @@ -3354,8 +3354,13 @@ if (ENABLE_USER_MESSAGE_HANDLERS) endif () if (USE_WOFF2) - list(APPEND WebCore_INCLUDE_DIRECTORIES "${THIRDPARTY_DIR}/woff2/include") - list(APPEND WebCore_LIBRARIES woff2) + if (WOFF2DEC_FOUND) + list(APPEND WebCore_INCLUDE_DIRECTORIES "${WOFF2DEC_INCLUDE_DIRS}") + list(APPEND WebCore_LIBRARIES "${WOFF2DEC_LIBRARIES}") + else () + list(APPEND WebCore_INCLUDE_DIRECTORIES "${THIRDPARTY_DIR}/woff2/include") + list(APPEND WebCore_LIBRARIES woff2) + endif () endif () set(WebCoreTestSupport_INCLUDE_DIRECTORIES diff --git a/Source/WebCore/PlatformQt.cmake b/Source/WebCore/PlatformQt.cmake index 49c76a8de..8414d21e5 100644 --- a/Source/WebCore/PlatformQt.cmake +++ b/Source/WebCore/PlatformQt.cmake @@ -446,6 +446,11 @@ endif () # From PlatformWin.cmake if (WIN32) + # Eliminate C2139 errors + if (MSVC) + add_compile_options(/D_ENABLE_EXTENDED_ALIGNED_STORAGE) + endif () + if (${JavaScriptCore_LIBRARY_TYPE} MATCHES STATIC) add_definitions(-DSTATICALLY_LINKED_WITH_WTF -DSTATICALLY_LINKED_WITH_JavaScriptCore) endif () diff --git a/Source/WebCore/Resources/nullPlugin@2x.png b/Source/WebCore/Resources/nullPlugin@2x.png index ccc40188a..0c76ff343 100644 Binary files a/Source/WebCore/Resources/nullPlugin@2x.png and b/Source/WebCore/Resources/nullPlugin@2x.png differ diff --git a/Source/WebCore/Resources/textAreaResizeCorner@2x.png b/Source/WebCore/Resources/textAreaResizeCorner@2x.png index 7d26fbc42..dc6242d0e 100644 Binary files a/Source/WebCore/Resources/textAreaResizeCorner@2x.png and b/Source/WebCore/Resources/textAreaResizeCorner@2x.png differ diff --git a/Source/WebCore/bindings/js/JSImageConstructor.cpp b/Source/WebCore/bindings/js/JSImageConstructor.cpp index 923690600..de553f5fa 100644 --- a/Source/WebCore/bindings/js/JSImageConstructor.cpp +++ b/Source/WebCore/bindings/js/JSImageConstructor.cpp @@ -44,7 +44,7 @@ template<> JSValue JSImageConstructor::prototypeForStructure(VM& vm, const JSDOM return JSHTMLElement::getConstructor(vm, &globalObject); } -template<> EncodedJSValue JSImageConstructor::construct(ExecState* state) +template<> EncodedJSValue JSC_HOST_CALL JSImageConstructor::construct(ExecState* state) { JSImageConstructor* jsConstructor = jsCast(state->callee()); Document* document = jsConstructor->document(); diff --git a/Source/WebCore/crypto/CommonCryptoUtilities.h b/Source/WebCore/crypto/CommonCryptoUtilities.h index 61d82c873..32419ecc4 100644 --- a/Source/WebCore/crypto/CommonCryptoUtilities.h +++ b/Source/WebCore/crypto/CommonCryptoUtilities.h @@ -30,11 +30,11 @@ #include "CryptoAlgorithmIdentifier.h" #include +#include #include #if USE(APPLE_INTERNAL_SDK) #include -#include #endif #ifndef _CC_RSACRYPTOR_H_ @@ -67,10 +67,6 @@ enum { typedef struct _CCBigNumRef *CCBigNumRef; -typedef struct __CCRandom *CCRandomRef; -extern const CCRandomRef kCCRandomDefault; -extern "C" int CCRandomCopyBytes(CCRandomRef rnd, void *bytes, size_t count); - typedef struct _CCRSACryptor *CCRSACryptorRef; extern "C" CCCryptorStatus CCRSACryptorEncrypt(CCRSACryptorRef publicKey, CCAsymmetricPadding padding, const void *plainText, size_t plainTextLen, void *cipherText, size_t *cipherTextLen, const void *tagData, size_t tagDataLen, CCDigestAlgorithm digestType); extern "C" CCCryptorStatus CCRSACryptorDecrypt(CCRSACryptorRef privateKey, CCAsymmetricPadding padding, const void *cipherText, size_t cipherTextLen, void *plainText, size_t *plainTextLen, const void *tagData, size_t tagDataLen, CCDigestAlgorithm digestType); diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index 2598b0f1e..1bca2d0a6 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -5315,6 +5315,9 @@ void Document::initDNSPrefetch() void Document::parseDNSPrefetchControlHeader(const String& dnsPrefetchControl) { + if (!settings()->dnsPrefetchingEnabled()) + return; + if (equalLettersIgnoringASCIICase(dnsPrefetchControl, "on") && !m_haveExplicitlyDisabledDNSPrefetch) { m_isDNSPrefetchEnabled = true; return; diff --git a/Source/WebCore/dom/SlotAssignment.h b/Source/WebCore/dom/SlotAssignment.h index 0fcd4dfa6..9b9ebe429 100644 --- a/Source/WebCore/dom/SlotAssignment.h +++ b/Source/WebCore/dom/SlotAssignment.h @@ -28,6 +28,7 @@ #if ENABLE(SHADOW_DOM) || ENABLE(DETAILS_ELEMENT) +#include #include #include #include diff --git a/Source/WebCore/page/qt/EventHandlerQt.cpp b/Source/WebCore/page/qt/EventHandlerQt.cpp index b717b1f54..6aed3f43f 100644 --- a/Source/WebCore/page/qt/EventHandlerQt.cpp +++ b/Source/WebCore/page/qt/EventHandlerQt.cpp @@ -54,7 +54,7 @@ namespace WebCore { #if ENABLE(DRAG_SUPPORT) -#if defined(Q_OS_OSX) +#if defined(Q_OS_MACOS) const double EventHandler::TextDragDelay = 0.15; #else const double EventHandler::TextDragDelay = 0.0; diff --git a/Source/WebCore/platform/FileSystem.h b/Source/WebCore/platform/FileSystem.h index 2c46e4da0..4ee276da4 100644 --- a/Source/WebCore/platform/FileSystem.h +++ b/Source/WebCore/platform/FileSystem.h @@ -49,7 +49,7 @@ #endif #endif -#if USE(CF) || (PLATFORM(QT) && defined(Q_OS_MAC)) +#if USE(CF) || (PLATFORM(QT) && defined(Q_OS_MACOS)) typedef struct __CFBundle* CFBundleRef; typedef const struct __CFData* CFDataRef; #endif @@ -75,7 +75,7 @@ typedef HMODULE PlatformModule; #elif PLATFORM(EFL) typedef Eina_Module* PlatformModule; #elif PLATFORM(QT) -#if defined(Q_OS_MAC) +#if defined(Q_OS_MACOS) typedef CFBundleRef PlatformModule; #elif !defined(QT_NO_LIBRARY) typedef QLibrary* PlatformModule; diff --git a/Source/WebCore/platform/HashTools.h b/Source/WebCore/platform/HashTools.h index 3badbdee1..a943eb49a 100644 --- a/Source/WebCore/platform/HashTools.h +++ b/Source/WebCore/platform/HashTools.h @@ -37,9 +37,9 @@ struct Value { int id; }; -const NamedColor* findColor(register const char* str, register unsigned int len); -const Property* findProperty(register const char* str, register unsigned int len); -const Value* findValue(register const char* str, register unsigned int len); +const NamedColor* findColor(const char* str, unsigned len); +const Property* findProperty(const char* str, unsigned len); +const Value* findValue(const char* str, unsigned len); } // namespace WebCore diff --git a/Source/WebCore/platform/Length.h b/Source/WebCore/platform/Length.h index 75ccf775e..b5697ce13 100644 --- a/Source/WebCore/platform/Length.h +++ b/Source/WebCore/platform/Length.h @@ -170,12 +170,12 @@ inline Length::Length(const Length& other) if (other.isCalculated()) other.ref(); - memcpy(this, &other, sizeof(Length)); + memcpy(static_cast(this), static_cast(const_cast(&other)), sizeof(Length)); } inline Length::Length(Length&& other) { - memcpy(this, &other, sizeof(Length)); + memcpy(static_cast(this), static_cast(&other), sizeof(Length)); other.m_type = Auto; } @@ -189,7 +189,7 @@ inline Length& Length::operator=(const Length& other) if (isCalculated()) deref(); - memcpy(this, &other, sizeof(Length)); + memcpy(static_cast(this), static_cast(const_cast(&other)), sizeof(Length)); return *this; } @@ -201,7 +201,7 @@ inline Length& Length::operator=(Length&& other) if (isCalculated()) deref(); - memcpy(this, &other, sizeof(Length)); + memcpy(static_cast(this), static_cast(&other), sizeof(Length)); other.m_type = Auto; return *this; } diff --git a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp index 1b60c5131..631adf37d 100644 --- a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp +++ b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp @@ -488,12 +488,15 @@ QNetworkReply* QNetworkReplyHandler::release() static bool shouldIgnoreHttpError(QNetworkReply* reply, bool receivedData) { + int httpStatusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + // Don't ignore error if we haven't received HTTP status code + if (httpStatusCode == 0) + return false; + // An HEAD XmlHTTPRequest shouldn't be marked as failure for HTTP errors. if (reply->operation() == QNetworkAccessManager::HeadOperation) return true; - int httpStatusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); - if (httpStatusCode == 401 || httpStatusCode == 407) return true; diff --git a/Source/WebCore/platform/qt/FileSystemQt.cpp b/Source/WebCore/platform/qt/FileSystemQt.cpp index 167ff8354..7f62d0e1f 100644 --- a/Source/WebCore/platform/qt/FileSystemQt.cpp +++ b/Source/WebCore/platform/qt/FileSystemQt.cpp @@ -257,7 +257,7 @@ int writeToFile(PlatformFileHandle handle, const char* data, int length) bool unloadModule(PlatformModule module) { -#if defined(Q_OS_MAC) +#if defined(Q_OS_MACOS) CFRelease(module); return true; diff --git a/Source/WebCore/platform/qt/PasteboardQt.cpp b/Source/WebCore/platform/qt/PasteboardQt.cpp index 2bc766782..2b4a2220c 100644 --- a/Source/WebCore/platform/qt/PasteboardQt.cpp +++ b/Source/WebCore/platform/qt/PasteboardQt.cpp @@ -131,7 +131,7 @@ void Pasteboard::writeSelection(Range& selectedRange, bool canSmartCopyOrDelete, m_writableData->setText(text); QString markup = createMarkup(selectedRange, 0, AnnotateForInterchange, false, ResolveNonLocalURLs); -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS markup.prepend(QLatin1String("")); markup.append(QLatin1String("")); m_writableData->setData(QLatin1String("text/html"), markup.toUtf8()); diff --git a/Source/WebCore/platform/qt/RenderThemeQStyle.cpp b/Source/WebCore/platform/qt/RenderThemeQStyle.cpp index 706570399..8c6bbba03 100644 --- a/Source/WebCore/platform/qt/RenderThemeQStyle.cpp +++ b/Source/WebCore/platform/qt/RenderThemeQStyle.cpp @@ -130,7 +130,7 @@ RenderThemeQStyle::RenderThemeQStyle(Page* page) { int buttonPixelSize = 0; m_qStyle->getButtonMetrics(&m_buttonFontFamily, &buttonPixelSize); -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS m_buttonFontPixelSize = buttonPixelSize; #endif } @@ -288,7 +288,7 @@ void RenderThemeQStyle::adjustButtonStyle(StyleResolver& styleResolver, RenderSt // Ditch the border. style.resetBorder(); -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS if (style.appearance() == PushButtonPart) { // The Mac ports ignore the specified height for elements // unless a border and/or background CSS property is also specified. @@ -299,7 +299,7 @@ void RenderThemeQStyle::adjustButtonStyle(StyleResolver& styleResolver, RenderSt FontCascadeDescription fontDescription = style.fontDescription(); fontDescription.setIsAbsoluteSize(true); -#ifdef Q_OS_MAC // Use fixed font size and family on Mac (like Safari does) +#ifdef Q_OS_MACOS // Use fixed font size and family on Mac (like Safari does) fontDescription.setSpecifiedSize(m_buttonFontPixelSize); fontDescription.setComputedSize(m_buttonFontPixelSize); #else @@ -601,7 +601,7 @@ ControlPart RenderThemeQStyle::initializeCommonQStyleOptions(QStyleFacadeOption option.state &= ~(QStyleFacade::State_HasFocus | QStyleFacade::State_MouseOver); option.state |= QStyleFacade::State_Enabled; -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS // to render controls in correct positions we also should set the State_Active flag option.state |= QStyleFacade::State_Active; #endif diff --git a/Source/WebCore/platform/qt/RenderThemeQStyle.h b/Source/WebCore/platform/qt/RenderThemeQStyle.h index 665eee005..463404b7d 100644 --- a/Source/WebCore/platform/qt/RenderThemeQStyle.h +++ b/Source/WebCore/platform/qt/RenderThemeQStyle.h @@ -110,7 +110,7 @@ private: QRect indicatorRect(QStyleFacade::ButtonType part, const QRect& originalRect) const; -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS int m_buttonFontPixelSize; #endif diff --git a/Source/WebKit/PlatformQt.cmake b/Source/WebKit/PlatformQt.cmake index 6fe440be8..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 ) 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/QWebPageAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp index 00dc0c488..1c14fcd07 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp +++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp @@ -206,7 +206,11 @@ static void openNewWindow(const QUrl& url, Frame* frame) } // FIXME: Find a better place -Ref s_userContentProvider = UserContentController::create(); +static UserContentController& userContentProvider() +{ + static NeverDestroyed> s_userContentProvider(UserContentController::create()); + return s_userContentProvider.get(); +} QWebPageAdapter::QWebPageAdapter() : settings(0) @@ -242,7 +246,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); 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/qwebpage/tst_qwebpage.cpp b/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index e545c5c0f..73427cb4b 100644 --- a/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -212,7 +212,7 @@ private Q_SLOTS: void cssMediaTypeGlobalSetting(); void cssMediaTypePageSetting(); -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS void macCopyUnicodeToClipboard(); #endif @@ -3194,7 +3194,7 @@ void tst_QWebPage::thirdPartyCookiePolicy() } #endif -#ifdef Q_OS_MAC +#ifdef Q_OS_MACOS void tst_QWebPage::macCopyUnicodeToClipboard() { QString unicodeText = QString::fromUtf8("αβγδεζηθικλμπ"); diff --git a/Source/WebKit2/Shared/qt/ChildProcessMainQt.cpp b/Source/WebKit2/Shared/qt/ChildProcessMainQt.cpp index 2db152766..85dc2a5ca 100644 --- a/Source/WebKit2/Shared/qt/ChildProcessMainQt.cpp +++ b/Source/WebKit2/Shared/qt/ChildProcessMainQt.cpp @@ -45,7 +45,7 @@ bool ChildProcessMainBase::parseCommandLine(int argc, char** argv) if (argc < 2) return false; -#if OS(DARWIN) +#if USE(MACH_PORTS) QByteArray serviceName(argv[1]); // Get the server port. diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp index b894d7338..7e4b37012 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp @@ -385,8 +385,10 @@ void QQuickWebViewPrivate::initialize(WKPageConfigurationRef configurationRef) loadClient.didChangeProgress = didChangeProgress; loadClient.didFinishProgress = didFinishProgress; loadClient.didChangeBackForwardList = didChangeBackForwardList; + // FIXME: These three functions should not be part of this client. loadClient.processDidBecomeUnresponsive = processDidBecomeUnresponsive; loadClient.processDidBecomeResponsive = processDidBecomeResponsive; + loadClient.processDidCrash = processDidCrash; WKPageSetPageLoaderClient(webPage.get(), &loadClient.base); } @@ -605,20 +607,21 @@ void QQuickWebViewPrivate::didRenderFrame() } } -void QQuickWebViewPrivate::processDidCrash() +void QQuickWebViewPrivate::processDidCrash(WKPageRef, const void* clientInfo) { - Q_Q(QQuickWebView); + QQuickWebViewPrivate* d = toQQuickWebViewPrivate(clientInfo); + QQuickWebView* q = d->q_ptr; - QUrl url(URL(WebCore::ParsedURLString, webPageProxy->urlAtProcessExit())); + QUrl url(URL(WebCore::ParsedURLString, d->webPageProxy->urlAtProcessExit())); qWarning("WARNING: The web process experienced a crash on '%s'.", qPrintable(url.toString(QUrl::RemoveUserInfo))); - pageEventHandler->resetGestureRecognizers(); + d->pageEventHandler->resetGestureRecognizers(); // Check if loading was ongoing, when process crashed. - if (m_loadProgress > 0 && m_loadProgress < 100) { + if (d->m_loadProgress > 0 && d->m_loadProgress < 100) { QWebLoadRequest loadRequest(url, QQuickWebView::LoadFailedStatus, QStringLiteral("The web process crashed."), QQuickWebView::InternalErrorDomain, 0); - loadProgressDidChange(100); + d->loadProgressDidChange(100); emit q->loadingChanged(&loadRequest); } diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h index cca489582..dba68e792 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h @@ -128,7 +128,6 @@ public: // PageClient. WebCore::IntSize viewSize() const; virtual void pageDidRequestScroll(const QPoint& pos) { } - void processDidCrash(); void didRelaunchProcess(); std::unique_ptr createDrawingAreaProxy(); void handleDownloadRequest(WebKit::DownloadProxy*); @@ -176,6 +175,7 @@ protected: static void didChangeBackForwardList(WKPageRef, WKBackForwardListItemRef, WKArrayRef, const void *clientInfo); static void processDidBecomeUnresponsive(WKPageRef, const void* clientInfo); static void processDidBecomeResponsive(WKPageRef, const void* clientInfo); + static void processDidCrash(WKPageRef, const void* clientInfo); QQuickWebViewPrivate(QQuickWebView* viewport); RefPtr webPageProxy; diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp b/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp index c781a97ca..82a3db952 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp @@ -83,6 +83,10 @@ bool QWebPreferencesPrivate::testAttribute(QWebPreferencesPrivate::WebAttribute return WKPreferencesGetUniversalAccessFromFileURLsAllowed(preferencesRef); case FileAccessFromFileURLsAllowed: return WKPreferencesGetFileAccessFromFileURLsAllowed(preferencesRef); + case LogsPageMessagesToSystemConsoleEnabled: + return WKPreferencesGetLogsPageMessagesToSystemConsoleEnabled(preferencesRef); + case WebSecurityEnabled: + return WKPreferencesGetWebSecurityEnabled(preferencesRef); default: ASSERT_NOT_REACHED(); return false; @@ -156,6 +160,12 @@ void QWebPreferencesPrivate::setAttribute(QWebPreferencesPrivate::WebAttribute a case FileAccessFromFileURLsAllowed: WKPreferencesSetFileAccessFromFileURLsAllowed(preferencesRef, enable); break; + case LogsPageMessagesToSystemConsoleEnabled: + WKPreferencesSetLogsPageMessagesToSystemConsoleEnabled(preferencesRef, enable); + break; + case WebSecurityEnabled: + WKPreferencesSetWebSecurityEnabled(preferencesRef, enable); + break; default: ASSERT_NOT_REACHED(); } @@ -631,6 +641,32 @@ void QWebPreferences::setLinksIncludedInFocusChain(bool enable) emit linksIncludedInFocusChainChanged(); } +bool QWebPreferences::logsPageMessagesToSystemConsoleEnabled() const +{ + return d->testAttribute(QWebPreferencesPrivate::LogsPageMessagesToSystemConsoleEnabled); +} + +void QWebPreferences::setLogsPageMessagesToSystemConsoleEnabled(bool enable) +{ + if (logsPageMessagesToSystemConsoleEnabled() == enable) + return; + d->setAttribute(QWebPreferencesPrivate::LogsPageMessagesToSystemConsoleEnabled, enable); + emit logsPageMessagesToSystemConsoleEnabledChanged(); +} + +bool QWebPreferences::webSecurityEnabled() const +{ + return d->testAttribute(QWebPreferencesPrivate::WebSecurityEnabled); +} + +void QWebPreferences::setWebSecurityEnabled(bool enable) +{ + if (webSecurityEnabled() == enable) + return; + d->setAttribute(QWebPreferencesPrivate::WebSecurityEnabled, enable); + emit webSecurityEnabledChanged(); +} + QWebPreferencesPrivate* QWebPreferencesPrivate::get(QWebPreferences* preferences) { return preferences->d; diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p.h b/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p.h index 08c4df2d8..702146c38 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p.h @@ -51,6 +51,8 @@ public: Q_PROPERTY(bool fileAccessFromFileURLsAllowed READ fileAccessFromFileURLsAllowed WRITE setFileAccessFromFileURLsAllowed NOTIFY fileAccessFromFileURLsAllowedChanged FINAL) Q_PROPERTY(bool spatialNavigationEnabled READ spatialNavigationEnabled WRITE setSpatialNavigationEnabled NOTIFY spatialNavigationEnabledChanged FINAL) Q_PROPERTY(bool linksIncludedInFocusChain READ linksIncludedInFocusChain WRITE setLinksIncludedInFocusChain NOTIFY linksIncludedInFocusChainChanged FINAL) + Q_PROPERTY(bool logsPageMessagesToSystemConsoleEnabled READ logsPageMessagesToSystemConsoleEnabled WRITE setLogsPageMessagesToSystemConsoleEnabled NOTIFY logsPageMessagesToSystemConsoleEnabledChanged FINAL) + Q_PROPERTY(bool webSecurityEnabled READ webSecurityEnabled WRITE setWebSecurityEnabled NOTIFY webSecurityEnabledChanged FINAL) Q_PROPERTY(QString standardFontFamily READ standardFontFamily WRITE setStandardFontFamily NOTIFY standardFontFamilyChanged FINAL) Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily WRITE setFixedFontFamily NOTIFY fixedFontFamilyChanged FINAL) @@ -123,6 +125,12 @@ public: bool linksIncludedInFocusChain() const; void setLinksIncludedInFocusChain(bool enable); + bool logsPageMessagesToSystemConsoleEnabled() const; + void setLogsPageMessagesToSystemConsoleEnabled(bool); + + bool webSecurityEnabled() const; + void setWebSecurityEnabled(bool); + QString standardFontFamily() const; void setStandardFontFamily(const QString& family); @@ -171,6 +179,8 @@ Q_SIGNALS: void linksIncludedInFocusChainChanged(); void universalAccessFromFileURLsAllowedChanged(); void fileAccessFromFileURLsAllowedChanged(); + void logsPageMessagesToSystemConsoleEnabledChanged(); + void webSecurityEnabledChanged(); void standardFontFamilyChanged(); void fixedFontFamilyChanged(); diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h b/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h index 2b4c804ff..a5395c3c8 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h @@ -44,7 +44,9 @@ public: UniversalAccessFromFileURLsAllowed, FileAccessFromFileURLsAllowed, SpatialNavigationEnabled, - LinksIncludedInFocusChain + LinksIncludedInFocusChain, + LogsPageMessagesToSystemConsoleEnabled, + WebSecurityEnabled }; enum FontFamily { diff --git a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp index e62e18d03..f5b66cd5f 100644 --- a/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp +++ b/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp @@ -58,8 +58,7 @@ void ProcessLauncher::didFinishLaunchingProcess(PlatformProcessIdentifier proces if (!m_client) { // FIXME: Make Identifier a move-only object and release port rights/connections in the destructor. -#if OS(DARWIN) && !PLATFORM(GTK) - // FIXME: Should really be something like USE(MACH) +#if USE(MACH_PORTS) if (identifier.port) mach_port_mod_refs(mach_task_self(), identifier.port, MACH_PORT_RIGHT_RECEIVE, -1); #endif diff --git a/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp b/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp index 51a3ffbba..694a759e6 100644 --- a/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp +++ b/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp @@ -62,7 +62,7 @@ #include #endif -#if OS(DARWIN) +#if USE(MACH_PORTS) #include #include @@ -70,7 +70,7 @@ extern "C" kern_return_t bootstrap_register2(mach_port_t, name_t, mach_port_t, u #endif // for QNX we need SOCK_DGRAM, see https://bugs.webkit.org/show_bug.cgi?id=95553 -#if defined(SOCK_SEQPACKET) && !defined(Q_OS_MACX) && !OS(QNX) +#if defined(SOCK_SEQPACKET) && !defined(Q_OS_MACOS) && !OS(QNX) #define SOCKET_TYPE SOCK_SEQPACKET #else #define SOCKET_TYPE SOCK_DGRAM @@ -101,7 +101,7 @@ void QtWebProcess::setupChildProcess() #endif prctl(PR_SET_PDEATHSIG, SIGKILL); #endif -#if defined(Q_OS_MACX) +#if defined(Q_OS_MACOS) qputenv("QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM", QByteArray("1")); #endif } @@ -126,7 +126,7 @@ void ProcessLauncher::launchProcess() #if ENABLE(DATABASE_PROCESS) } else if (m_launchOptions.processType == ProcessType::Database) { commandLine = QLatin1String("%1 \"%2\" %3 %4"); - QByteArray processPrefix = qgetenv("QT_WEBKIT2_DP_CMD_PREFIX"); + QByteArray processPrefix = qgetenv("QT_WEBKIT2_SP_CMD_PREFIX"); commandLine = commandLine.arg(QLatin1String(processPrefix.constData())).arg(QString(executablePathOfDatabaseProcess())); #endif } else { @@ -134,7 +134,7 @@ void ProcessLauncher::launchProcess() ASSERT_NOT_REACHED(); } -#if OS(DARWIN) +#if USE(MACH_PORTS) // Create the listening port. mach_port_t connector; mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &connector); @@ -216,7 +216,7 @@ void ProcessLauncher::launchProcess() if (!webProcessOrSUIDHelper->waitForStarted()) { qDebug() << "Failed to start" << commandLine; ASSERT_NOT_REACHED(); -#if OS(DARWIN) +#if USE(MACH_PORTS) mach_port_deallocate(mach_task_self(), connector); mach_port_mod_refs(mach_task_self(), connector, MACH_PORT_RIGHT_RECEIVE, -1); #endif diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp index 5f6a16f70..d0ff9bca5 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.cpp +++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp @@ -6287,7 +6287,7 @@ void WebPageProxy::setURLSchemeHandlerForScheme(Ref&& handl WebURLSchemeHandler* WebPageProxy::urlSchemeHandlerForScheme(const String& scheme) { - return m_urlSchemeHandlersByScheme.get(scheme); + return scheme.isNull() ? nullptr : m_urlSchemeHandlersByScheme.get(scheme); } void WebPageProxy::startURLSchemeHandlerTask(uint64_t handlerIdentifier, uint64_t resourceIdentifier, const WebCore::ResourceRequest& request) diff --git a/Source/WebKit2/UIProcess/qt/QtPageClient.cpp b/Source/WebKit2/UIProcess/qt/QtPageClient.cpp index 53faa7647..fd410ffdd 100644 --- a/Source/WebKit2/UIProcess/qt/QtPageClient.cpp +++ b/Source/WebKit2/UIProcess/qt/QtPageClient.cpp @@ -90,7 +90,8 @@ void QtPageClient::pageDidRequestScroll(const IntPoint& pos) void QtPageClient::processDidExit() { - QQuickWebViewPrivate::get(m_webView)->processDidCrash(); + // TODO: Do we need this signal? + // QQuickWebViewPrivate::get(m_webView)->processDidExit(); } void QtPageClient::didRelaunchProcess() diff --git a/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp b/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp index 2d0d7df10..ec271b5bd 100644 --- a/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp +++ b/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp @@ -45,7 +45,7 @@ #endif #endif -#if OS(DARWIN) && !USE(UNIX_DOMAIN_SOCKETS) +#if USE(MACH_PORTS) #include extern "C" kern_return_t bootstrap_look_up2(mach_port_t, const name_t, mach_port_t*, pid_t, uint64_t); @@ -139,7 +139,7 @@ Q_DECL_EXPORT int WebProcessMainQt(QGuiApplication* app) return 1; } -#if OS(DARWIN) +#if USE(MACH_PORTS) QString serviceName = app->arguments().value(1); // Get the server port. diff --git a/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp b/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp index d4864af5b..e687966db 100644 --- a/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp +++ b/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp @@ -39,7 +39,7 @@ #include #include -#if defined(Q_OS_MACX) +#if defined(Q_OS_MACOS) #include #include #include @@ -99,7 +99,7 @@ void WebProcess::platformClearResourceCaches(ResourceCachesToClear) { } -#if defined(Q_OS_MACX) +#if defined(Q_OS_MACOS) static void parentProcessDiedCallback(void*) { QCoreApplication::quit(); @@ -134,7 +134,7 @@ void WebProcess::platformInitializeWebProcess(WebProcessCreationParameters&& par } #endif -#if defined(Q_OS_MACX) +#if defined(Q_OS_MACOS) pid_t ppid = getppid(); dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_source_t source = dispatch_source_create(DISPATCH_SOURCE_TYPE_PROC, ppid, DISPATCH_PROC_EXIT, queue); diff --git a/Source/bmalloc/bmalloc/BPlatform.h b/Source/bmalloc/bmalloc/BPlatform.h index 8d768db63..400143a63 100644 --- a/Source/bmalloc/bmalloc/BPlatform.h +++ b/Source/bmalloc/bmalloc/BPlatform.h @@ -120,7 +120,8 @@ || defined(__ARM_ARCH_7S__) #define BARM_ARCH_VERSION 7 -#elif defined(__ARM_ARCH_8__) +#elif defined(__ARM_ARCH_8__) \ +|| defined(__ARM_ARCH_8A__) #define BARM_ARCH_VERSION 8 /* MSVC sets _M_ARM */ diff --git a/Source/cmake/FindWOFF2Dec.cmake b/Source/cmake/FindWOFF2Dec.cmake new file mode 100644 index 000000000..4927eeeb7 --- /dev/null +++ b/Source/cmake/FindWOFF2Dec.cmake @@ -0,0 +1,53 @@ +# - Try to find WOFF2Dec. +# Once done, this will define +# +# WOFF2DEC_FOUND - system has WOFF2Dec. +# WOFF2DEC_INCLUDE_DIRS - the WOFF2Dec include directories +# WOFF2DEC_LIBRARIES - link these to use WOFF2Dec. +# +# Copyright (C) 2017 Igalia S.L. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS +# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +find_package(PkgConfig) +pkg_check_modules(PC_WOFF2DEC libwoff2dec) + +find_path(WOFF2DEC_INCLUDE_DIRS + NAMES woff2/decode.h + HINTS ${PC_WOFF2DEC_INCLUDEDIR} +) + +find_library(WOFF2DEC_LIBRARIES + NAMES woff2dec + HINTS ${PC_WOFF2DEC_LIBDIR} +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WOFF2Dec + REQUIRED_VARS WOFF2DEC_INCLUDE_DIRS WOFF2DEC_LIBRARIES + FOUND_VAR WOFF2DEC_FOUND + VERSION_VAR PC_WOFF2DEC_VERSION) + +mark_as_advanced( + WOFF2DEC_INCLUDE_DIRS + WOFF2DEC_LIBRARIES +) diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake index 003fdca41..ff207fe77 100644 --- a/Source/cmake/OptionsQt.cmake +++ b/Source/cmake/OptionsQt.cmake @@ -793,6 +793,15 @@ if (USE_LIBHYPHEN) endif () endif () +if (USE_WOFF2) + find_package(WOFF2Dec 1.0.1) + if (WOFF2DEC_FOUND) + message(STATUS "Using system WOFF2Dec library.") + else () + message(STATUS "WOFF2Dec not found, using the bundled library.") + endif () +endif () + # From OptionsGTK.cmake if (CMAKE_MAJOR_VERSION LESS 3) # Before CMake 3 it was necessary to use a build script instead of using cmake --build directly diff --git a/Source/cmake/OptionsWin.cmake b/Source/cmake/OptionsWin.cmake index be36d92d3..a568258d9 100644 --- a/Source/cmake/OptionsWin.cmake +++ b/Source/cmake/OptionsWin.cmake @@ -128,6 +128,9 @@ if (MSVC) /wd6255 /wd6387 ) + # Eliminate C2139 errors + add_compile_options(/D_ENABLE_EXTENDED_ALIGNED_STORAGE) + # Create pdb files for debugging purposes, also for Release builds add_compile_options(/Zi /GS) diff --git a/Source/cmake/WebKitCommon.cmake b/Source/cmake/WebKitCommon.cmake index 1f7b4ccdf..de4ac8f65 100644 --- a/Source/cmake/WebKitCommon.cmake +++ b/Source/cmake/WebKitCommon.cmake @@ -41,6 +41,9 @@ if (NOT HAS_RUN_WEBKIT_COMMON) # Helper macros and feature defines # ----------------------------------------------------------------------------- + # To prevent multiple inclusion, most modules should be included once here. + include(CheckFunctionExists) + include(WebKitMacros) include(WebKitFS) include(WebKitHelpers) diff --git a/Source/cmake/WebKitMacros.cmake b/Source/cmake/WebKitMacros.cmake index 07e31432a..d58c73eb4 100644 --- a/Source/cmake/WebKitMacros.cmake +++ b/Source/cmake/WebKitMacros.cmake @@ -373,6 +373,10 @@ macro(GENERATE_WEBKIT2_MESSAGE_SOURCES _output_source _input_files) WORKING_DIRECTORY ${WEBKIT2_DIR} VERBATIM) + if (${PORT} STREQUAL "Qt") + set_property(SOURCE ${DERIVED_SOURCES_WEBKIT2_DIR}/${_name}MessageReceiver.cpp PROPERTY SKIP_AUTOMOC ON) + endif () + list(APPEND ${_output_source} ${DERIVED_SOURCES_WEBKIT2_DIR}/${_name}MessageReceiver.cpp) endforeach () endmacro() diff --git a/Source/qtwebkit.qdocconf b/Source/qtwebkit.qdocconf index 5142b0776..8e4edbd75 100644 --- a/Source/qtwebkit.qdocconf +++ b/Source/qtwebkit.qdocconf @@ -35,3 +35,5 @@ exampledirs = WebKit/qt/docs imagedirs = WebKit/qt/docs depends += qtcore qtwidgets qtgui qtscript qtdoc qtprintsupport qtxml qtwebkitexamples qtquickcontrols + +tagfile = qtwebkit.tags diff --git a/Tools/QtTestBrowser/launcherwindow.cpp b/Tools/QtTestBrowser/launcherwindow.cpp index 716a6e3e8..6e221840d 100644 --- a/Tools/QtTestBrowser/launcherwindow.cpp +++ b/Tools/QtTestBrowser/launcherwindow.cpp @@ -222,6 +222,7 @@ void LauncherWindow::applyPrefs() settings->setAttribute(QWebSettings::TiledBackingStoreEnabled, m_windowOptions.useTiledBackingStore); settings->setAttribute(QWebSettings::FrameFlatteningEnabled, m_windowOptions.useFrameFlattening); settings->setAttribute(QWebSettings::WebGLEnabled, m_windowOptions.useWebGL); + settings->setAttribute(QWebSettings::MediaEnabled, m_windowOptions.useMedia); m_windowOptions.useWebAudio = settings->testAttribute(QWebSettings::WebAudioEnabled); m_windowOptions.useMediaSource = settings->testAttribute(QWebSettings::MediaSourceEnabled); @@ -326,6 +327,15 @@ void LauncherWindow::createChrome() toggleWebGL->setEnabled(false); #endif + QAction* toggleMedia = toolsMenu->addAction("Toggle Media", this, SLOT(toggleMedia(bool))); + toggleMedia->setCheckable(true); +#if ENABLE(VIDEO) + toggleMedia->setChecked(settings->testAttribute(QWebSettings::MediaEnabled)); +#else + toggleMedia->setChecked(false); + toggleMedia->setEnabled(false); +#endif + QAction* toggleWebAudio = toolsMenu->addAction("Toggle WebAudio", this, SLOT(toggleWebAudio(bool))); toggleWebAudio->setCheckable(true); #if ENABLE(WEB_AUDIO) @@ -336,7 +346,7 @@ void LauncherWindow::createChrome() QAction* toggleMediaSource = toolsMenu->addAction("Toggle MediaSource", this, SLOT(toggleMediaSource(bool))); toggleMediaSource->setCheckable(true); - toggleWebGL->setChecked(settings->testAttribute(QWebSettings::MediaSourceEnabled)); + toggleMediaSource->setChecked(settings->testAttribute(QWebSettings::MediaSourceEnabled)); #if !ENABLE(MEDIA_SOURCE) toggleMediaSource->setEnabled(false); #endif @@ -948,6 +958,12 @@ void LauncherWindow::toggleWebGL(bool toggle) page()->settings()->setAttribute(QWebSettings::WebGLEnabled, toggle); } +void LauncherWindow::toggleMedia(bool toggle) +{ + m_windowOptions.useMedia = toggle; + page()->settings()->setAttribute(QWebSettings::MediaEnabled, toggle); +} + void LauncherWindow::toggleWebAudio(bool toggle) { m_windowOptions.useWebAudio = toggle; @@ -1142,6 +1158,23 @@ void LauncherWindow::showUserAgentDialog() delete dialog; } +void LauncherWindow::showSSLErrorConfirmation(QNetworkReply* reply, const QList& errors) +{ + QString errorStrings = "
    "; + for (const QSslError& error : errors) + errorStrings += "
  • " + error.errorString() + "
  • "; + errorStrings += "
"; + + QMessageBox sslWarningBox; + sslWarningBox.setText("SSL handshake problem"); + sslWarningBox.setInformativeText(errorStrings); + sslWarningBox.setStandardButtons(QMessageBox::Abort | QMessageBox::Ignore); + sslWarningBox.setDefaultButton(QMessageBox::Abort); + sslWarningBox.setIcon(QMessageBox::Warning); + if (sslWarningBox.exec() == QMessageBox::Ignore) + reply->ignoreSslErrors(); +} + void LauncherWindow::loadURLListFromFile() { QString selectedFile; diff --git a/Tools/QtTestBrowser/launcherwindow.h b/Tools/QtTestBrowser/launcherwindow.h index e475a8022..8a8baeeda 100644 --- a/Tools/QtTestBrowser/launcherwindow.h +++ b/Tools/QtTestBrowser/launcherwindow.h @@ -72,6 +72,7 @@ public: bool useCompositing { false }; bool useTiledBackingStore { false }; bool useWebGL { false }; + bool useMedia { true }; bool useWebAudio { false }; bool useMediaSource { false }; bool useFrameFlattening { false }; @@ -134,6 +135,7 @@ protected Q_SLOTS: void toggleTiledBackingStore(bool toggle); void toggleResizesToContents(bool toggle); void toggleWebGL(bool toggle); + void toggleMedia(bool toggle); void toggleWebAudio(bool toggle); void toggleMediaSource(bool toggle); void toggleSpatialNavigation(bool enable); @@ -170,6 +172,8 @@ protected Q_SLOTS: void clearSelection(); void showFPS(bool enable); void showUserAgentDialog(); + void showSSLErrorConfirmation(QNetworkReply*, const QList&); + void printURL(const QUrl&); #if !defined(QT_NO_FILEDIALOG) && !defined(QT_NO_MESSAGEBOX) diff --git a/Tools/QtTestBrowser/mainwindow.cpp b/Tools/QtTestBrowser/mainwindow.cpp index d342147ac..e22193a96 100644 --- a/Tools/QtTestBrowser/mainwindow.cpp +++ b/Tools/QtTestBrowser/mainwindow.cpp @@ -43,6 +43,7 @@ #include #endif #include +#include MainWindow::MainWindow() : m_page(new WebPage(this)) @@ -85,6 +86,7 @@ void MainWindow::buildUI() connect(page()->mainFrame(), SIGNAL(loadStarted()), this, SLOT(onLoadStarted())); connect(page()->mainFrame(), SIGNAL(iconChanged()), this, SLOT(onIconChanged())); connect(page()->mainFrame(), SIGNAL(titleChanged(QString)), this, SLOT(onTitleChanged(QString))); + connect(page()->networkAccessManager(), SIGNAL(sslErrors(QNetworkReply*, const QList&)), this, SLOT(onSSLErrors(QNetworkReply*, const QList&))); connect(page(), SIGNAL(windowCloseRequested()), this, SLOT(close())); #ifndef QT_NO_SHORTCUT diff --git a/Tools/TestWebKitAPI/PlatformQt.cmake b/Tools/TestWebKitAPI/PlatformQt.cmake index c054c661b..81d98bcb5 100644 --- a/Tools/TestWebKitAPI/PlatformQt.cmake +++ b/Tools/TestWebKitAPI/PlatformQt.cmake @@ -35,7 +35,7 @@ set(test_webcore_LIBRARIES WebCore gtest ${Qt5Gui_LIBRARIES} - ${DEPEND_STATIC_LIBS} + ${STATIC_LIB_DEPENDENCIES} ) add_executable(TestWebCore -- cgit v1.2.1 From 154b95c308911b04f11a991b5ac792269f89ab7d Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Wed, 5 Jun 2019 18:33:47 +0300 Subject: Temporarily skip MinGW build Change-Id: I58095beac3783f5ea0a295b5a4ca77214288ba69 Reviewed-by: Konstantin Tokarev --- Tools/qmake/mkspecs/features/functions.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/qmake/mkspecs/features/functions.prf b/Tools/qmake/mkspecs/features/functions.prf index e3f42cec4..213e482d1 100644 --- a/Tools/qmake/mkspecs/features/functions.prf +++ b/Tools/qmake/mkspecs/features/functions.prf @@ -82,7 +82,7 @@ defineTest(isPlatformSupported) { } } } else { - isGCCVersionSupported() + skipBuild("MinGW build skipped.") } } else: macos { # We require macOS 10.10 (darwin version 14.0.0) or newer -- cgit v1.2.1 From ac794c7928225108f27bbad161682c74756da8fb Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Fri, 7 Jun 2019 01:39:41 +0300 Subject: Stop using bundled libjpeg from qtbase [*] Its usage is too fragile, updates on QtBase side often break compilation, also maintaining compatibility with different Qt versions becomes harder [*] Mismatch between vendor and version of libjpeg bundled with QtBase is the often sources of troubles for Windows and macOS users trying to build QtWebKit from sources against precompiled Qt SDK. This patch makes libjpeg optional dependency when CMake option USE_LIBJPEG is set to off. In qmake wrapper detection of bunled libjpeg in QtGui configuration disables use of libjpeg automatically. When WebKit JPEG decoder is disabled, JPEG images are handled by QImageReader, losing support for progressive rendering and possibly some other features. Note that libpng is still mandatory, because it doesn't expose issues described above. Change-Id: Ibf270f2f9e3230b27f4c63390918dd7e78ffee2b Reviewed-by: Konstantin Tokarev --- Source/WebCore/PlatformQt.cmake | 6 ++++++ .../platform/image-decoders/ImageDecoder.cpp | 4 ++++ Source/cmake/OptionsQt.cmake | 23 +++++++--------------- Tools/qmake/projects/qtjpeg/qtjpeg.pro | 14 ------------- Tools/qmake/projects/run_cmake.pro | 12 +++-------- WebKit.pro | 3 --- 6 files changed, 20 insertions(+), 42 deletions(-) delete mode 100644 Tools/qmake/projects/qtjpeg/qtjpeg.pro diff --git a/Source/WebCore/PlatformQt.cmake b/Source/WebCore/PlatformQt.cmake index 8414d21e5..cd2e79d5d 100644 --- a/Source/WebCore/PlatformQt.cmake +++ b/Source/WebCore/PlatformQt.cmake @@ -2,6 +2,12 @@ include(platform/ImageDecoders.cmake) include(platform/Linux.cmake) include(platform/TextureMapper.cmake) +if (NOT USE_LIBJPEG) + list(REMOVE_ITEM WebCore_SOURCES + platform/image-decoders/jpeg/JPEGImageDecoder.cpp + ) +endif () + if (JPEG_DEFINITIONS) add_definitions(${JPEG_DEFINITIONS}) endif () diff --git a/Source/WebCore/platform/image-decoders/ImageDecoder.cpp b/Source/WebCore/platform/image-decoders/ImageDecoder.cpp index 46366823f..0273dd3c2 100644 --- a/Source/WebCore/platform/image-decoders/ImageDecoder.cpp +++ b/Source/WebCore/platform/image-decoders/ImageDecoder.cpp @@ -28,7 +28,9 @@ #if PLATFORM(QT) #include "ImageDecoderQt.h" #endif +#if !PLATFORM(QT) || USE(LIBJPEG) #include "JPEGImageDecoder.h" +#endif #include "PNGImageDecoder.h" #include "SharedBuffer.h" #if USE(WEBP) @@ -115,8 +117,10 @@ ImageDecoder* ImageDecoder::create(const SharedBuffer& data, ImageSource::AlphaO if (matchesICOSignature(contents) || matchesCURSignature(contents)) return new ICOImageDecoder(alphaOption, gammaAndColorProfileOption); +#if !PLATFORM(QT) || USE(LIBJPEG) if (matchesJPEGSignature(contents)) return new JPEGImageDecoder(alphaOption, gammaAndColorProfileOption); +#endif #if USE(WEBP) if (matchesWebPSignature(contents)) diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake index ff207fe77..ac1065d92 100644 --- a/Source/cmake/OptionsQt.cmake +++ b/Source/cmake/OptionsQt.cmake @@ -259,6 +259,7 @@ option(USE_STATIC_RUNTIME "Use static runtime (MSVC only)" OFF) # Private options specific to the Qt port. Changing these options is # completely unsupported. They are intended for use only by WebKit developers. WEBKIT_OPTION_DEFINE(ENABLE_TOUCH_ADJUSTMENT "Whether to use touch adjustment" PRIVATE ON) +WEBKIT_OPTION_DEFINE(USE_LIBJPEG "Support JPEG format directly. If it is disabled, QImageReader will be used with possible degradation of user experience" PUBLIC ON) # Public options shared with other WebKit ports. There must be strong reason @@ -439,23 +440,13 @@ endif () find_package(Threads REQUIRED) -if (NOT QT_BUNDLED_JPEG) - find_package(JPEG REQUIRED) +if (USE_LIBJPEG) + find_package(JPEG) + if (NOT JPEG_FOUND) + message(FATAL_ERROR "libjpeg not found. Please make sure that CMake can find its header files and libraries, or build with -DUSE_LIBJPEG=OFF with possible degradation of user experience") + endif () else () - set(JPEG_FOUND 1) - # As of Qt 5.10, libjpeg-turbo shipped as a part of Qt requires using a few macro definitions - # WARNING: Keep in sync with libjpeg.pri - # FIXME: Change Qt so we can avoid this - include(CheckTypeSize) - check_type_size(size_t _SIZEOF_SIZE_T) - set(JPEG_DEFINITIONS - -DC_ARITH_CODING_SUPPORTED=1 - -DD_ARITH_CODING_SUPPORTED=1 - -DBITS_IN_JSAMPLE=8 - -DJPEG_LIB_VERSION=80 - -DSIZEOF_SIZE_T=${_SIZEOF_SIZE_T} - ) - unset(_SIZEOF_SIZE_T) + message(WARNING "USE_LIBJPEG is disabled, will attempt using QImageReader to decode JPEG with possible degradation of user experience") endif () if (NOT QT_BUNDLED_PNG) diff --git a/Tools/qmake/projects/qtjpeg/qtjpeg.pro b/Tools/qmake/projects/qtjpeg/qtjpeg.pro deleted file mode 100644 index 33aa665d3..000000000 --- a/Tools/qmake/projects/qtjpeg/qtjpeg.pro +++ /dev/null @@ -1,14 +0,0 @@ -load(functions) - -TARGET = qtjpeg - -CONFIG += \ - static \ - hide_symbols \ - exceptions_off rtti_off warn_off - -load(qt_helper_lib) - -DESTDIR = $$ROOT_BUILD_DIR/lib - -include($$QTBASE_DIR/src/3rdparty/libjpeg.pri) diff --git a/Tools/qmake/projects/run_cmake.pro b/Tools/qmake/projects/run_cmake.pro index b9d0f08a2..ff6d1d562 100644 --- a/Tools/qmake/projects/run_cmake.pro +++ b/Tools/qmake/projects/run_cmake.pro @@ -35,15 +35,9 @@ build_pass|!debug_and_release { static_runtime: CMAKE_CONFIG += USE_STATIC_RUNTIME=ON QT_FOR_CONFIG += gui-private - !qtConfig(system-jpeg):exists($$QTBASE_DIR) { - CMAKE_CONFIG += \ - QT_BUNDLED_JPEG=1 \ - JPEG_LIBRARIES=$$staticLibPath(qtjpeg) - - exists($$QTBASE_DIR/src/3rdparty/libjpeg/src/jpeglib.h): \ - CMAKE_CONFIG += JPEG_INCLUDE_DIR=$$QTBASE_DIR/src/3rdparty/libjpeg/src - else: \ - CMAKE_CONFIG += JPEG_INCLUDE_DIR=$$QTBASE_DIR/src/3rdparty/libjpeg + !qtConfig(system-jpeg):qtConfig(jpeg) { + # Use QImageReader for JPEG + CMAKE_CONFIG += USE_LIBJPEG=OFF } !qtConfig(system-png):qtConfig(png):exists($$QTBASE_DIR) { diff --git a/WebKit.pro b/WebKit.pro index ca3b009aa..09debf182 100644 --- a/WebKit.pro +++ b/WebKit.pro @@ -9,9 +9,6 @@ isPlatformSupported() { !qtConfig(system-png):qtConfig(png):exists($$QTBASE_DIR): \ SUBDIRS += $$PROJECTS_DIR/qtpng - !qtConfig(system-jpeg):exists($$QTBASE_DIR): \ - SUBDIRS += $$PROJECTS_DIR/qtjpeg - SUBDIRS += \ $$PROJECTS_DIR/generate_cmake_toolchain_file.pro \ $$PROJECTS_DIR/generate_forwarding_pris.pro \ -- cgit v1.2.1 From 3dc7d3b44fa620814acd553c1a82f020183951b3 Mon Sep 17 00:00:00 2001 From: Alexey Proskuryakov Date: Fri, 19 Jan 2018 18:09:23 +0000 Subject: Update XPCSPI.h https://bugs.webkit.org/show_bug.cgi?id=181827 rdar://problem/36393031 Reviewed by Daniel Bates. * wtf/spi/darwin/XPCSPI.h: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@227212 268f45cc-cd09-0410-ab3c-d52691b4dbfc Change-Id: I808f2a26d9d7f108675617553439fbba2cd504e2 Reviewed-by: Konstantin Tokarev --- Source/WTF/wtf/spi/darwin/XPCSPI.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Source/WTF/wtf/spi/darwin/XPCSPI.h b/Source/WTF/wtf/spi/darwin/XPCSPI.h index e30315ab5..2820b9d04 100644 --- a/Source/WTF/wtf/spi/darwin/XPCSPI.h +++ b/Source/WTF/wtf/spi/darwin/XPCSPI.h @@ -56,11 +56,15 @@ typedef void* xpc_connection_t; typedef const struct _xpc_type_s* xpc_type_t; +#if PLATFORM(IOS) && __has_attribute(noescape) +#define XPC_NOESCAPE __attribute__((__noescape__)) +#endif + #if COMPILER_SUPPORTS(BLOCKS) typedef bool (^xpc_array_applier_t)(size_t index, xpc_object_t); typedef bool (^xpc_dictionary_applier_t)(const char *key, xpc_object_t value); typedef void (^xpc_handler_t)(xpc_object_t); -#endif +#endif // COMPILER_SUPPORTS(BLOCKS) typedef void (*xpc_connection_handler_t)(xpc_connection_t connection); @@ -79,6 +83,10 @@ typedef void (*xpc_connection_handler_t)(xpc_connection_t connection); #include #endif +#if !defined(XPC_NOESCAPE) +#define XPC_NOESCAPE +#endif + EXTERN_C const struct _xpc_dictionary_s _xpc_error_connection_invalid; EXTERN_C const struct _xpc_dictionary_s _xpc_error_termination_imminent; @@ -90,8 +98,8 @@ EXTERN_C const struct _xpc_type_s _xpc_type_string; EXTERN_C xpc_object_t xpc_array_create(const xpc_object_t*, size_t count); #if COMPILER_SUPPORTS(BLOCKS) -EXTERN_C bool xpc_array_apply(xpc_object_t, xpc_array_applier_t); -EXTERN_C bool xpc_dictionary_apply(xpc_object_t xdict, xpc_dictionary_applier_t applier); +EXTERN_C bool xpc_array_apply(xpc_object_t, XPC_NOESCAPE xpc_array_applier_t); +EXTERN_C bool xpc_dictionary_apply(xpc_object_t xdict, XPC_NOESCAPE xpc_dictionary_applier_t applier); #endif EXTERN_C size_t xpc_array_get_count(xpc_object_t); EXTERN_C const char* xpc_array_get_string(xpc_object_t, size_t index); -- cgit v1.2.1 From cd2fc453baf21084d0fb9f5f6b203f3aac3fa2ba Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Mon, 10 Jun 2019 10:48:24 +0300 Subject: Import WebKit commit eb64318ce61c3d6c6bd2c52ee1df69820a19802c Change-Id: I73331bc707a68785c44548f5d607c0e62f68e701 Reviewed-by: Konstantin Tokarev --- README | 15 ++++++++++++ .../WebCore/platform/network/NetworkingContext.h | 4 ---- .../platform/network/qt/QNetworkReplyHandler.cpp | 5 +++- .../platform/network/qt/ResourceRequestQt.cpp | 28 +++++++++++----------- Source/WebKit/qt/README | 15 ++++++++++++ Tools/qt/manifest.txt | 3 ++- 6 files changed, 50 insertions(+), 20 deletions(-) create mode 100644 README create mode 100644 Source/WebKit/qt/README diff --git a/README b/README new file mode 100644 index 000000000..8a2bc8c5b --- /dev/null +++ b/README @@ -0,0 +1,15 @@ +# 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 + +See instructions at https://github.com/annulen/webkit/wiki + +# Contacts + +* Mailing list: webkit-qt@lists.webkit.org +* IRC: #qtwebkit on irc.freenode.net +* Blog: http://qtwebkit.blogspot.com diff --git a/Source/WebCore/platform/network/NetworkingContext.h b/Source/WebCore/platform/network/NetworkingContext.h index 3de432e42..582bca647 100644 --- a/Source/WebCore/platform/network/NetworkingContext.h +++ b/Source/WebCore/platform/network/NetworkingContext.h @@ -28,10 +28,6 @@ #include #endif -#if PLATFORM(QT) -#include -#endif - #if PLATFORM(COCOA) OBJC_CLASS NSOperationQueue; #endif diff --git a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp index 631adf37d..0ce68838e 100644 --- a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp +++ b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp @@ -609,6 +609,7 @@ void QNetworkReplyHandler::sendResponseIfNeeded() response.setHTTPHeaderField(String(pair.first.constData(), pair.first.size()), String(pair.second.constData(), pair.second.size())); } + // Note: Qt sets RedirectionTargetAttribute only for 3xx responses, so Location header in 201 responce won't affect this code QUrl redirection = m_replyWrapper->reply()->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl(); if (redirection.isValid()) { redirect(response, redirection); @@ -651,8 +652,10 @@ void QNetworkReplyHandler::redirect(ResourceResponse& response, const QUrl& redi ASSERT(!m_queue.deferSignals()); QUrl currentUrl = m_replyWrapper->reply()->url(); + + // RFC7231 section 7.1.2 QUrl newUrl = currentUrl.resolved(redirection); - if (currentUrl.hasFragment()) + if (!newUrl.hasFragment() && currentUrl.hasFragment()) newUrl.setFragment(currentUrl.fragment()); ResourceHandleClient* client = m_resourceHandle->client(); diff --git a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp index c54a8115b..694e2a764 100644 --- a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp +++ b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp @@ -27,16 +27,20 @@ #include #include -// HTTP/2 is implemented since Qt 5.8, but QTBUG-64359 makes it unusable in browser -#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 4) +// HTTP/2 is implemented since Qt 5.8, but various QtNetwork bugs make it unusable in browser with Qt < 5.10.1 +// We also don't enable HTTP/2 for unencrypted connections because of possible compatibility issues; it can be +// enabled manually by user application via custom QNAM subclass +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 1) +#include #define USE_HTTP2 1 -#endif -// HTTP2AllowedAttribute enforces HTTP/2 instead of negotiating, see QTBUG-61397 -#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) -#define HTTP2_IS_BUGGY_WITHOUT_HTTPS 1 -#else -#define HTTP2_IS_BUGGY_WITHOUT_HTTPS 0 +// Don't enable HTTP/2 when ALPN support status is unknown +// Before QTBUG-65903 is implemented there is no better way than to check OpenSSL version +static bool alpnIsSupported() +{ + return QSslSocket::sslLibraryVersionNumber() > 0x10002000L && + QSslSocket::sslLibraryVersionString().startsWith(QLatin1String("OpenSSL")); +} #endif namespace WebCore { @@ -74,15 +78,11 @@ QNetworkRequest ResourceRequest::toNetworkRequest(NetworkingContext *context) co request.setOriginatingObject(context ? context->originatingObject() : 0); #if USE(HTTP2) -#if HTTP2_IS_BUGGY_WITHOUT_HTTPS - if (originalUrl.protocolIs("https")) -#endif - { + static const bool NegotiateHttp2ForHttps = alpnIsSupported(); + if (originalUrl.protocolIs("https") && NegotiateHttp2ForHttps) request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true); - } #endif // USE(HTTP2) - const HTTPHeaderMap &headers = httpHeaderFields(); for (HTTPHeaderMap::const_iterator it = headers.begin(), end = headers.end(); it != end; ++it) { diff --git a/Source/WebKit/qt/README b/Source/WebKit/qt/README new file mode 100644 index 000000000..8a2bc8c5b --- /dev/null +++ b/Source/WebKit/qt/README @@ -0,0 +1,15 @@ +# 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 + +See instructions at https://github.com/annulen/webkit/wiki + +# Contacts + +* Mailing list: webkit-qt@lists.webkit.org +* IRC: #qtwebkit on irc.freenode.net +* Blog: http://qtwebkit.blogspot.com diff --git a/Tools/qt/manifest.txt b/Tools/qt/manifest.txt index 6fe3e9546..39414cc5f 100644 --- a/Tools/qt/manifest.txt +++ b/Tools/qt/manifest.txt @@ -99,8 +99,9 @@ file Source/WebKit/win/Plugins # Version file Source/WebKit/mac/Configurations/Version.xcconfig -# Move LICENSE.LGPLv21 to the root +# Move LICENSE.LGPLv21 and README to the root file Source/WebKit/qt/LICENSE.LGPLv21 LICENSE.LGPLv21 +file Source/WebKit/qt/README README directory Source/WebInspectorUI/UserInterface/Images exclude Source/WebInspectorUI/UserInterface/Images/.* -- cgit v1.2.1 From eb6c5179e8650f66b304a656409a1e5e5efec956 Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Wed, 26 Jun 2019 19:22:59 +0300 Subject: Import WebKit commit d6bf9b7a5a72ec63236f3f2d0eabc20913309793 Change-Id: I15a655045d43ea5f2cfe1158016db6426ded0224 Reviewed-by: Konstantin Tokarev --- README | 13 +- Source/WTF/wtf/text/WTFString.cpp | 16 --- Source/WebCore/platform/Cursor.cpp | 12 +- Source/WebCore/platform/Cursor.h | 6 +- .../platform/graphics/qt/MediaPlayerPrivateQt.cpp | 2 +- Source/WebCore/platform/qt/CursorQt.cpp | 83 ++++++------ Source/WebKit/qt/README | 13 +- .../qt/WebCoreSupport/FrameLoaderClientQt.cpp | 22 +++- .../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h | 4 + Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 25 ++++ .../webkit/LegacyMessageReceiver-expected.cpp | 6 +- .../Scripts/webkit/LegacyMessages-expected.h | 25 ++-- .../Scripts/webkit/MessageReceiver-expected.cpp | 4 +- .../webkit/MessageReceiverSuperclass-expected.cpp | 2 +- Source/WebKit2/Scripts/webkit/Messages-expected.h | 25 ++-- .../Scripts/webkit/MessagesSuperclass-expected.h | 5 +- Source/WebKit2/Scripts/webkit/messages.py | 71 ++++++----- Source/WebKit2/Scripts/webkit/messages_unittest.py | 142 +++++++++++++-------- Source/WebKit2/Scripts/webkit/model.py | 3 +- Source/WebKit2/Scripts/webkit/parser.py | 3 +- Source/qtwebkit.qdocconf | 2 +- Tools/QtTestBrowser/launcherwindow.cpp | 4 +- Tools/QtTestBrowser/mainwindow.cpp | 1 - 23 files changed, 297 insertions(+), 192 deletions(-) diff --git a/README b/README index 8a2bc8c5b..6b6a411ce 100644 --- a/README +++ b/README @@ -6,7 +6,18 @@ The Qt port of WebKit currently compiles and runs on Linux, *BSD, Windows and ma # Building -See instructions at https://github.com/annulen/webkit/wiki +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 diff --git a/Source/WTF/wtf/text/WTFString.cpp b/Source/WTF/wtf/text/WTFString.cpp index 958fd2069..ce376e23a 100644 --- a/Source/WTF/wtf/text/WTFString.cpp +++ b/Source/WTF/wtf/text/WTFString.cpp @@ -460,21 +460,6 @@ Vector String::charactersWithNullTermination() const String String::format(const char *format, ...) { -#if PLATFORM(QT) - // Use QString::vsprintf to avoid the locale dependent formatting of vsnprintf. - // https://bugs.webkit.org/show_bug.cgi?id=18994 - va_list args; - va_start(args, format); - - QString buffer; - buffer.vsprintf(format, args); - - va_end(args); - - QByteArray ba = buffer.toUtf8(); - return StringImpl::create(reinterpret_cast(ba.constData()), ba.length()); - -#else va_list args; va_start(args, format); @@ -503,7 +488,6 @@ String String::format(const char *format, ...) va_end(args); return StringImpl::create(reinterpret_cast(buffer.data()), len); -#endif } String String::number(int number) diff --git a/Source/WebCore/platform/Cursor.cpp b/Source/WebCore/platform/Cursor.cpp index 60a619acd..014efa5f5 100644 --- a/Source/WebCore/platform/Cursor.cpp +++ b/Source/WebCore/platform/Cursor.cpp @@ -154,7 +154,7 @@ Cursor::Cursor(Image* image, const IntPoint& hotSpot) #if ENABLE(MOUSE_CURSOR_SCALE) , m_imageScaleFactor(1) #endif - , m_platformCursor(0) + , m_platformCursor(nullptr) { } @@ -174,11 +174,17 @@ Cursor::Cursor(Type type) #if ENABLE(MOUSE_CURSOR_SCALE) , m_imageScaleFactor(1) #endif - , m_platformCursor(0) + , m_platformCursor(nullptr) { } -#if !PLATFORM(COCOA) +#if PLATFORM(QT) +PlatformCursor Cursor::platformCursor() const +{ + ensurePlatformCursor(); + return m_platformCursor.get(); +} +#elif !PLATFORM(COCOA) PlatformCursor Cursor::platformCursor() const { diff --git a/Source/WebCore/platform/Cursor.h b/Source/WebCore/platform/Cursor.h index d06ad7d47..86d714903 100644 --- a/Source/WebCore/platform/Cursor.h +++ b/Source/WebCore/platform/Cursor.h @@ -140,7 +140,7 @@ namespace WebCore { #if ENABLE(MOUSE_CURSOR_SCALE) , m_imageScaleFactor(1) #endif - , m_platformCursor(0) + , m_platformCursor(nullptr) #endif // !PLATFORM(IOS) { } @@ -181,7 +181,9 @@ namespace WebCore { float m_imageScaleFactor; #endif -#if !USE(APPKIT) +#if PLATFORM(QT) + mutable std::unique_ptr m_platformCursor; +#elif !USE(APPKIT) mutable PlatformCursor m_platformCursor; #else mutable RetainPtr m_platformCursor; diff --git a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp index 9091fdc72..cef4750ed 100644 --- a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp +++ b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp @@ -80,7 +80,7 @@ MediaPlayer::SupportsType MediaPlayerPrivateQt::supportsType(const MediaEngineSu if (parameters.isMediaStream || parameters.isMediaSource) return MediaPlayer::IsNotSupported; - if (!parameters.type.startsWith("audio/") && !parameters.type.startsWith("video/")) + if (!parameters.type.startsWithIgnoringASCIICase("audio/") && !parameters.type.startsWithIgnoringASCIICase("video/")) return MediaPlayer::IsNotSupported; // Parse and trim codecs. diff --git a/Source/WebCore/platform/qt/CursorQt.cpp b/Source/WebCore/platform/qt/CursorQt.cpp index ffec6715a..4a62cec82 100644 --- a/Source/WebCore/platform/qt/CursorQt.cpp +++ b/Source/WebCore/platform/qt/CursorQt.cpp @@ -49,17 +49,12 @@ Cursor::Cursor(const Cursor& other) , m_image(other.m_image) , m_hotSpot(other.m_hotSpot) #ifndef QT_NO_CURSOR - , m_platformCursor(other.m_platformCursor ? new QCursor(*other.m_platformCursor) : 0) + , m_platformCursor(other.m_platformCursor ? std::make_unique(*other.m_platformCursor) : nullptr) #endif { } -Cursor::~Cursor() -{ -#ifndef QT_NO_CURSOR - delete m_platformCursor; -#endif -} +Cursor::~Cursor() = default; Cursor& Cursor::operator=(const Cursor& other) { @@ -67,18 +62,18 @@ Cursor& Cursor::operator=(const Cursor& other) m_image = other.m_image; m_hotSpot = other.m_hotSpot; #ifndef QT_NO_CURSOR - m_platformCursor = other.m_platformCursor ? new QCursor(*other.m_platformCursor) : 0; + m_platformCursor = other.m_platformCursor ? std::make_unique(*other.m_platformCursor) : nullptr; #endif return *this; } #ifndef QT_NO_CURSOR -static QCursor* createCustomCursor(Image* image, const IntPoint& hotSpot) +static std::unique_ptr createCustomCursor(Image* image, const IntPoint& hotSpot) { if (!image->nativeImageForCurrentFrame()) - return 0; + return nullptr; IntPoint effectiveHotSpot = determineHotSpot(image, hotSpot); - return new QCursor(*(image->nativeImageForCurrentFrame()), effectiveHotSpot.x(), effectiveHotSpot.y()); + return std::make_unique(*(image->nativeImageForCurrentFrame()), effectiveHotSpot.x(), effectiveHotSpot.y()); } #endif @@ -90,117 +85,117 @@ void Cursor::ensurePlatformCursor() const switch (m_type) { case Pointer: - m_platformCursor = new QCursor(Qt::ArrowCursor); + m_platformCursor = std::make_unique(Qt::ArrowCursor); break; case Cross: - m_platformCursor = new QCursor(Qt::CrossCursor); + m_platformCursor = std::make_unique(Qt::CrossCursor); break; case Hand: - m_platformCursor = new QCursor(Qt::PointingHandCursor); + m_platformCursor = std::make_unique(Qt::PointingHandCursor); break; case IBeam: - m_platformCursor = new QCursor(Qt::IBeamCursor); + m_platformCursor = std::make_unique(Qt::IBeamCursor); break; case Wait: - m_platformCursor = new QCursor(Qt::WaitCursor); + m_platformCursor = std::make_unique(Qt::WaitCursor); break; case Help: - m_platformCursor = new QCursor(Qt::WhatsThisCursor); + m_platformCursor = std::make_unique(Qt::WhatsThisCursor); break; case EastResize: case EastPanning: - m_platformCursor = new QCursor(Qt::SizeHorCursor); + m_platformCursor = std::make_unique(Qt::SizeHorCursor); break; case NorthResize: case NorthPanning: - m_platformCursor = new QCursor(Qt::SizeVerCursor); + m_platformCursor = std::make_unique(Qt::SizeVerCursor); break; case NorthEastResize: case NorthEastPanning: - m_platformCursor = new QCursor(Qt::SizeBDiagCursor); + m_platformCursor = std::make_unique(Qt::SizeBDiagCursor); break; case NorthWestResize: case NorthWestPanning: - m_platformCursor = new QCursor(Qt::SizeFDiagCursor); + m_platformCursor = std::make_unique(Qt::SizeFDiagCursor); break; case SouthResize: case SouthPanning: - m_platformCursor = new QCursor(Qt::SizeVerCursor); + m_platformCursor = std::make_unique(Qt::SizeVerCursor); break; case SouthEastResize: case SouthEastPanning: - m_platformCursor = new QCursor(Qt::SizeFDiagCursor); + m_platformCursor = std::make_unique(Qt::SizeFDiagCursor); break; case SouthWestResize: case SouthWestPanning: - m_platformCursor = new QCursor(Qt::SizeBDiagCursor); + m_platformCursor = std::make_unique(Qt::SizeBDiagCursor); break; case WestResize: case WestPanning: - m_platformCursor = new QCursor(Qt::SizeHorCursor); + m_platformCursor = std::make_unique(Qt::SizeHorCursor); break; case NorthSouthResize: - m_platformCursor = new QCursor(Qt::SizeVerCursor); + m_platformCursor = std::make_unique(Qt::SizeVerCursor); break; case EastWestResize: - m_platformCursor = new QCursor(Qt::SizeHorCursor); + m_platformCursor = std::make_unique(Qt::SizeHorCursor); break; case NorthEastSouthWestResize: - m_platformCursor = new QCursor(Qt::SizeBDiagCursor); + m_platformCursor = std::make_unique(Qt::SizeBDiagCursor); break; case NorthWestSouthEastResize: - m_platformCursor = new QCursor(Qt::SizeFDiagCursor); + m_platformCursor = std::make_unique(Qt::SizeFDiagCursor); break; case ColumnResize: - m_platformCursor = new QCursor(Qt::SplitHCursor); + m_platformCursor = std::make_unique(Qt::SplitHCursor); break; case RowResize: - m_platformCursor = new QCursor(Qt::SplitVCursor); + m_platformCursor = std::make_unique(Qt::SplitVCursor); break; case MiddlePanning: case Move: - m_platformCursor = new QCursor(Qt::SizeAllCursor); + m_platformCursor = std::make_unique(Qt::SizeAllCursor); break; case None: - m_platformCursor = new QCursor(Qt::BlankCursor); + m_platformCursor = std::make_unique(Qt::BlankCursor); break; case NoDrop: case NotAllowed: - m_platformCursor = new QCursor(Qt::ForbiddenCursor); + m_platformCursor = std::make_unique(Qt::ForbiddenCursor); break; case Grab: case Grabbing: notImplemented(); - m_platformCursor = new QCursor(Qt::ArrowCursor); + m_platformCursor = std::make_unique(Qt::ArrowCursor); break; case VerticalText: - m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/verticalTextCursor.png")), 7, 7); + m_platformCursor = std::make_unique(QPixmap(QStringLiteral(":/webkit/resources/verticalTextCursor.png")), 7, 7); break; case Cell: - m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/cellCursor.png")), 7, 7); + m_platformCursor = std::make_unique(QPixmap(QStringLiteral(":/webkit/resources/cellCursor.png")), 7, 7); break; case ContextMenu: - m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/contextMenuCursor.png")), 3, 2); + m_platformCursor = std::make_unique(QPixmap(QStringLiteral(":/webkit/resources/contextMenuCursor.png")), 3, 2); break; case Alias: - m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/aliasCursor.png")), 11, 3); + m_platformCursor = std::make_unique(QPixmap(QStringLiteral(":/webkit/resources/aliasCursor.png")), 11, 3); break; case Progress: - m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/progressCursor.png")), 3, 2); + m_platformCursor = std::make_unique(QPixmap(QStringLiteral(":/webkit/resources/progressCursor.png")), 3, 2); break; case Copy: - m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/copyCursor.png")), 3, 2); + m_platformCursor = std::make_unique(QPixmap(QStringLiteral(":/webkit/resources/copyCursor.png")), 3, 2); break; case ZoomIn: - m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/zoomInCursor.png")), 7, 7); + m_platformCursor = std::make_unique(QPixmap(QStringLiteral(":/webkit/resources/zoomInCursor.png")), 7, 7); break; case ZoomOut: - m_platformCursor = new QCursor(QPixmap(QStringLiteral(":/webkit/resources/zoomOutCursor.png")), 7, 7); + m_platformCursor = std::make_unique(QPixmap(QStringLiteral(":/webkit/resources/zoomOutCursor.png")), 7, 7); break; case Custom: m_platformCursor = createCustomCursor(m_image.get(), m_hotSpot); if (!m_platformCursor) - m_platformCursor = new QCursor(Qt::ArrowCursor); + m_platformCursor = std::make_unique(Qt::ArrowCursor); break; default: ASSERT_NOT_REACHED(); diff --git a/Source/WebKit/qt/README b/Source/WebKit/qt/README index 8a2bc8c5b..6b6a411ce 100644 --- a/Source/WebKit/qt/README +++ b/Source/WebKit/qt/README @@ -6,7 +6,18 @@ The Qt port of WebKit currently compiles and runs on Linux, *BSD, Windows and ma # Building -See instructions at https://github.com/annulen/webkit/wiki +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 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..8465db721 100644 --- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -254,6 +254,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/tests/qwebframe/tst_qwebframe.cpp b/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 17bc703fc..ab15c6315 100644 --- a/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -94,6 +94,7 @@ private Q_SLOTS: void setUrlThenLoads_data(); void setUrlThenLoads(); void loadFinishedAfterNotFoundError(); + void signalsDuringErrorHandling(); void loadInSignalHandlers_data(); void loadInSignalHandlers(); @@ -1472,6 +1473,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/WebKit2/Scripts/webkit/LegacyMessageReceiver-expected.cpp b/Source/WebKit2/Scripts/webkit/LegacyMessageReceiver-expected.cpp index 240fc7374..040c722ef 100644 --- a/Source/WebKit2/Scripts/webkit/LegacyMessageReceiver-expected.cpp +++ b/Source/WebKit2/Scripts/webkit/LegacyMessageReceiver-expected.cpp @@ -104,7 +104,7 @@ bool TestMultipleAttributes::DelayedReply::send() namespace WebKit { -void WebPage::didReceiveWebPageMessage(IPC::Connection*, IPC::MessageDecoder& decoder) +void WebPage::didReceiveWebPageMessage(IPC::Connection& connection, IPC::MessageDecoder& decoder) { if (decoder.messageName() == Messages::WebPage::LoadURL::name()) { IPC::handleMessage(decoder, this, &WebPage::loadURL); @@ -184,11 +184,12 @@ void WebPage::didReceiveWebPageMessage(IPC::Connection*, IPC::MessageDecoder& de return; } #endif + UNUSED_PARAM(connection); UNUSED_PARAM(decoder); ASSERT_NOT_REACHED(); } -void WebPage::didReceiveSyncWebPageMessage(IPC::Connection* connection, IPC::MessageDecoder& decoder, std::unique_ptr& replyEncoder) +void WebPage::didReceiveSyncWebPageMessage(IPC::Connection& connection, IPC::MessageDecoder& decoder, std::unique_ptr& replyEncoder) { if (decoder.messageName() == Messages::WebPage::CreatePlugin::name()) { IPC::handleMessage(decoder, *replyEncoder, this, &WebPage::createPlugin); @@ -216,6 +217,7 @@ void WebPage::didReceiveSyncWebPageMessage(IPC::Connection* connection, IPC::Mes return; } #endif + UNUSED_PARAM(connection); UNUSED_PARAM(decoder); UNUSED_PARAM(replyEncoder); ASSERT_NOT_REACHED(); diff --git a/Source/WebKit2/Scripts/webkit/LegacyMessages-expected.h b/Source/WebKit2/Scripts/webkit/LegacyMessages-expected.h index 6397c1043..50e1ca41f 100644 --- a/Source/WebKit2/Scripts/webkit/LegacyMessages-expected.h +++ b/Source/WebKit2/Scripts/webkit/LegacyMessages-expected.h @@ -27,13 +27,27 @@ #if (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND)) +#include "ArgumentCoders.h" #include "Arguments.h" #include "Connection.h" +#if ENABLE(DEPRECATED_FEATURE) || ENABLE(EXPERIMENTAL_FEATURE) +#include "DummyType.h" +#endif +#if PLATFORM(MAC) +#include "MachPort.h" +#endif #include "MessageEncoder.h" #include "Plugin.h" #include "StringReference.h" +#include "WebCoreArgumentCoders.h" +#if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION && SOME_OTHER_MESSAGE_CONDITION)) || (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION || SOME_OTHER_MESSAGE_CONDITION)) +#include "WebEvent.h" +#endif +#include "WebPreferencesStore.h" #include +#if PLATFORM(MAC) #include +#endif #include #include #include @@ -43,17 +57,6 @@ namespace IPC { class Connection; - class DummyType; - class MachPort; -} - -namespace WTF { - class String; -} - -namespace WebKit { - struct WebPreferencesStore; - class WebTouchEvent; } namespace Messages { diff --git a/Source/WebKit2/Scripts/webkit/MessageReceiver-expected.cpp b/Source/WebKit2/Scripts/webkit/MessageReceiver-expected.cpp index 8d5e13dea..877e5129c 100644 --- a/Source/WebKit2/Scripts/webkit/MessageReceiver-expected.cpp +++ b/Source/WebKit2/Scripts/webkit/MessageReceiver-expected.cpp @@ -104,7 +104,7 @@ bool TestMultipleAttributes::DelayedReply::send() namespace WebKit { -void WebPage::didReceiveMessage(IPC::Connection* connection, IPC::MessageDecoder& decoder) +void WebPage::didReceiveMessage(IPC::Connection& connection, IPC::MessageDecoder& decoder) { if (decoder.messageName() == Messages::WebPage::LoadURL::name()) { IPC::handleMessage(decoder, this, &WebPage::loadURL); @@ -189,7 +189,7 @@ void WebPage::didReceiveMessage(IPC::Connection* connection, IPC::MessageDecoder ASSERT_NOT_REACHED(); } -void WebPage::didReceiveSyncMessage(IPC::Connection* connection, IPC::MessageDecoder& decoder, std::unique_ptr& replyEncoder) +void WebPage::didReceiveSyncMessage(IPC::Connection& connection, IPC::MessageDecoder& decoder, std::unique_ptr& replyEncoder) { if (decoder.messageName() == Messages::WebPage::CreatePlugin::name()) { IPC::handleMessage(decoder, *replyEncoder, this, &WebPage::createPlugin); diff --git a/Source/WebKit2/Scripts/webkit/MessageReceiverSuperclass-expected.cpp b/Source/WebKit2/Scripts/webkit/MessageReceiverSuperclass-expected.cpp index c6889781f..b498e9d9a 100644 --- a/Source/WebKit2/Scripts/webkit/MessageReceiverSuperclass-expected.cpp +++ b/Source/WebKit2/Scripts/webkit/MessageReceiverSuperclass-expected.cpp @@ -34,7 +34,7 @@ namespace WebKit { -void WebPage::didReceiveMessage(IPC::Connection* connection, IPC::MessageDecoder& decoder) +void WebPage::didReceiveMessage(IPC::Connection& connection, IPC::MessageDecoder& decoder) { if (decoder.messageName() == Messages::WebPage::LoadURL::name()) { IPC::handleMessage(decoder, this, &WebPage::loadURL); diff --git a/Source/WebKit2/Scripts/webkit/Messages-expected.h b/Source/WebKit2/Scripts/webkit/Messages-expected.h index 6397c1043..50e1ca41f 100644 --- a/Source/WebKit2/Scripts/webkit/Messages-expected.h +++ b/Source/WebKit2/Scripts/webkit/Messages-expected.h @@ -27,13 +27,27 @@ #if (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND)) +#include "ArgumentCoders.h" #include "Arguments.h" #include "Connection.h" +#if ENABLE(DEPRECATED_FEATURE) || ENABLE(EXPERIMENTAL_FEATURE) +#include "DummyType.h" +#endif +#if PLATFORM(MAC) +#include "MachPort.h" +#endif #include "MessageEncoder.h" #include "Plugin.h" #include "StringReference.h" +#include "WebCoreArgumentCoders.h" +#if (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION && SOME_OTHER_MESSAGE_CONDITION)) || (ENABLE(TOUCH_EVENTS) && (NESTED_MESSAGE_CONDITION || SOME_OTHER_MESSAGE_CONDITION)) +#include "WebEvent.h" +#endif +#include "WebPreferencesStore.h" #include +#if PLATFORM(MAC) #include +#endif #include #include #include @@ -43,17 +57,6 @@ namespace IPC { class Connection; - class DummyType; - class MachPort; -} - -namespace WTF { - class String; -} - -namespace WebKit { - struct WebPreferencesStore; - class WebTouchEvent; } namespace Messages { diff --git a/Source/WebKit2/Scripts/webkit/MessagesSuperclass-expected.h b/Source/WebKit2/Scripts/webkit/MessagesSuperclass-expected.h index 9b353a040..89167b6b3 100644 --- a/Source/WebKit2/Scripts/webkit/MessagesSuperclass-expected.h +++ b/Source/WebKit2/Scripts/webkit/MessagesSuperclass-expected.h @@ -25,13 +25,12 @@ #ifndef WebPageMessages_h #define WebPageMessages_h +#include "ArgumentCoders.h" #include "Arguments.h" #include "MessageEncoder.h" #include "StringReference.h" +#include -namespace WTF { - class String; -} namespace Messages { namespace WebPage { diff --git a/Source/WebKit2/Scripts/webkit/messages.py b/Source/WebKit2/Scripts/webkit/messages.py index b71df91b6..4b786fe62 100644 --- a/Source/WebKit2/Scripts/webkit/messages.py +++ b/Source/WebKit2/Scripts/webkit/messages.py @@ -1,4 +1,4 @@ -# Copyright (C) 2010, 2011 Apple Inc. All rights reserved. +# Copyright (C) 2010-2017 Apple Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -23,6 +23,7 @@ import collections import re import sys + from webkit import parser WANTS_CONNECTION_ATTRIBUTE = 'WantsConnection' @@ -168,11 +169,11 @@ def forward_declarations_for_namespace(namespace, kind_and_types): def forward_declarations_and_headers(receiver): types_by_namespace = collections.defaultdict(set) - headers = set([ - '"Arguments.h"', - '"MessageEncoder.h"', - '"StringReference.h"', - ]) + header_conditions = { + '"Arguments.h"' : [], + '"MessageEncoder.h"' : [], + '"StringReference.h"': [] + } non_template_wtf_types = frozenset([ 'String', @@ -180,38 +181,47 @@ def forward_declarations_and_headers(receiver): for message in receiver.messages: if message.reply_parameters != None and message.has_attribute(DELAYED_ATTRIBUTE): - headers.add('') + header_conditions[''] = [] types_by_namespace['IPC'].update([('class', 'Connection')]) + type_conditions = {} for parameter in receiver.iterparameters(): - kind = parameter.kind - type = parameter.type + if not parameter.type in type_conditions: + type_conditions[parameter.type] = [] - if type.find('<') != -1: - # Don't forward declare class templates. - headers.update(headers_for_type(type)) - continue + if not parameter.condition in type_conditions[parameter.type]: + type_conditions[parameter.type].append(parameter.condition) - split = type.split('::') + for parameter in receiver.iterparameters(): + type = parameter.type + conditions = type_conditions[type] - # Handle WTF types even if the WTF:: prefix is not given - if split[0] in non_template_wtf_types: - split.insert(0, 'WTF') + argument_encoder_headers = argument_coder_headers_for_type(type) + if argument_encoder_headers: + for header in argument_encoder_headers: + if header not in header_conditions: + header_conditions[header] = [] + header_conditions[header].extend(conditions) - if len(split) == 2: - namespace = split[0] - inner_type = split[1] - types_by_namespace[namespace].add((kind, inner_type)) - elif len(split) > 2: - # We probably have a nested struct, which means we can't forward declare it. - # Include its header instead. - headers.update(headers_for_type(type)) + type_headers = headers_for_type(type) + for header in type_headers: + if header not in header_conditions: + header_conditions[header] = [] + header_conditions[header].extend(conditions) forward_declarations = '\n'.join([forward_declarations_for_namespace(namespace, types) for (namespace, types) in sorted(types_by_namespace.items())]) - headers = ['#include %s\n' % header for header in sorted(headers)] + headers = [] + for header in sorted(header_conditions): + if header_conditions[header] and not None in header_conditions[header]: + headers.append('#if %s\n' % ' || '.join(set(header_conditions[header]))) + headers += ['#include %s\n' % header] + headers.append('#endif\n') + else: + headers += ['#include %s\n' % header] return (forward_declarations, headers) + def generate_messages_header(file): receiver = parser.parse(file) header_guard = messages_header_filename(receiver).replace('.', '_') @@ -302,7 +312,7 @@ def class_template_headers(template_string): match = re.match('(?P.+?)<(?P.+)>', template_string) if not match: - return {'header_infos':[], 'types':[template_string]} + return {'header_infos': [], 'types': [template_string]} template_name = match.groupdict()['template_name'] if template_name not in class_template_types: @@ -315,10 +325,10 @@ def class_template_headers(template_string): for parameter in parser.split_parameters_string(match.groupdict()['parameter_string']): parameter_header_infos_and_types = class_template_headers(parameter) - header_infos += parameter_header_infos_and_types['header_infos']; + header_infos += parameter_header_infos_and_types['header_infos'] types += parameter_header_infos_and_types['types'] - return {'header_infos':header_infos, 'types':types} + return {'header_infos': header_infos, 'types': types} def argument_coder_headers_for_type(type): @@ -346,6 +356,7 @@ def argument_coder_headers_for_type(type): return headers + def headers_for_type(type): header_infos_and_types = class_template_headers(type) @@ -402,6 +413,7 @@ def headers_for_type(type): return headers + def generate_message_handler(file): receiver = parser.parse(file) header_conditions = { @@ -452,7 +464,6 @@ def generate_message_handler(file): header_conditions[header] = [] header_conditions[header].append(message.condition) - result = [] result.append(_license_header) diff --git a/Source/WebKit2/Scripts/webkit/messages_unittest.py b/Source/WebKit2/Scripts/webkit/messages_unittest.py index e12dfd41e..164199fc2 100644 --- a/Source/WebKit2/Scripts/webkit/messages_unittest.py +++ b/Source/WebKit2/Scripts/webkit/messages_unittest.py @@ -1,4 +1,4 @@ -# Copyright (C) 2010 Apple Inc. All rights reserved. +# Copyright (C) 2010-2017 Apple Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -21,44 +21,33 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import os +import re +import sys import unittest from StringIO import StringIO -import messages -import parser - -print os.getcwd() +sys.path.append(os.path.dirname(os.path.dirname(__file__))) +from webkit import messages +from webkit import parser script_directory = os.path.dirname(os.path.realpath(__file__)) -with open(os.path.join(script_directory, 'test-messages.in')) as file: - _messages_file_contents = file.read() - -with open(os.path.join(script_directory, 'test-legacy-messages.in')) as file: - _legacy_messages_file_contents = file.read() - -with open(os.path.join(script_directory, 'test-superclass-messages.in')) as file: - _superclass_messages_file_contents = file.read() - - -with open(os.path.join(script_directory, 'Messages-expected.h')) as file: - _expected_receiver_header = file.read() +with open(os.path.join(script_directory, 'test-messages.in')) as in_file: + _messages_file_contents = in_file.read() -with open(os.path.join(script_directory, 'LegacyMessages-expected.h')) as file: - _expected_legacy_receiver_header = file.read() +with open(os.path.join(script_directory, 'test-legacy-messages.in')) as in_file: + _legacy_messages_file_contents = in_file.read() -with open(os.path.join(script_directory, 'MessagesSuperclass-expected.h')) as file: - _expected_superclass_receiver_header = file.read() - +with open(os.path.join(script_directory, 'test-superclass-messages.in')) as in_file: + _superclass_messages_file_contents = in_file.read() -with open(os.path.join(script_directory, 'MessageReceiver-expected.cpp')) as file: - _expected_receiver_implementation = file.read() +_expected_receiver_header_file_name = 'Messages-expected.h' +_expected_legacy_receiver_header_file_name = 'LegacyMessages-expected.h' +_expected_superclass_receiver_header_file_name = 'MessagesSuperclass-expected.h' -with open(os.path.join(script_directory, 'LegacyMessageReceiver-expected.cpp')) as file: - _expected_legacy_receiver_implementation = file.read() - -with open(os.path.join(script_directory, 'MessageReceiverSuperclass-expected.cpp')) as file: - _expected_superclass_receiver_implementation = file.read() +_expected_receiver_implementation_file_name = 'MessageReceiver-expected.cpp' +_expected_legacy_receiver_implementation_file_name = 'LegacyMessageReceiver-expected.cpp' +_expected_superclass_receiver_implementation_file_name = 'MessageReceiverSuperclass-expected.cpp' _expected_results = { 'name': 'WebPage', @@ -243,7 +232,7 @@ _expected_results = { _expected_superclass_results = { 'name': 'WebPage', - 'superclass' : 'WebPageBase', + 'superclass': 'WebPageBase', 'conditions': None, 'messages': ( { @@ -278,7 +267,7 @@ class ParsingTest(MessagesTest): self.assertTrue(parameter.has_attribute(attribute)) else: self.assertEquals(parameter.attributes, frozenset()) - if message.reply_parameters != None: + if message.reply_parameters is not None: for index, parameter in enumerate(message.reply_parameters): self.assertEquals(parameter.type, expected_message['reply_parameters'][index][0]) self.assertEquals(parameter.name, expected_message['reply_parameters'][index][1]) @@ -307,40 +296,50 @@ class ParsingTest(MessagesTest): self.check_message(message, _expected_superclass_results['messages'][index]) - class GeneratedFileContentsTest(unittest.TestCase): - def assertGeneratedFileContentsEqual(self, first, second): - first_list = first.split('\n') - second_list = second.split('\n') + def assertGeneratedFileContentsEqual(self, actual_file_contents, expected_file_name): + if reset_results: + with open(os.path.join(script_directory, expected_file_name), mode='w') as out_file: + out_file.write(actual_file_contents) + return - for index, first_line in enumerate(first_list): - self.assertEquals(first_line, second_list[index]) + with open(os.path.join(script_directory, expected_file_name), mode='r') as in_file: + expected_file_contents = in_file.read() + actual_line_list = actual_file_contents.splitlines(False) + expected_line_list = expected_file_contents.splitlines(False) - self.assertEquals(len(first_list), len(second_list)) + for index, actual_line in enumerate(actual_line_list): + self.assertEquals(actual_line, expected_line_list[index]) + self.assertEquals(len(actual_line_list), len(expected_line_list)) -class HeaderTest(GeneratedFileContentsTest): - def test_header(self): - file_contents = messages.generate_messages_header(StringIO(_messages_file_contents)) - self.assertGeneratedFileContentsEqual(file_contents, _expected_receiver_header) + def assertHeaderEqual(self, input_messages_file_contents, expected_file_name): + actual_file_contents = messages.generate_messages_header(StringIO(input_messages_file_contents)) + self.assertGeneratedFileContentsEqual(actual_file_contents, expected_file_name) - legacy_file_contents = messages.generate_messages_header(StringIO(_legacy_messages_file_contents)) - self.assertGeneratedFileContentsEqual(legacy_file_contents, _expected_legacy_receiver_header) + def assertImplementationEqual(self, input_messages_file_contents, expected_file_name): + actual_file_contents = messages.generate_message_handler(StringIO(input_messages_file_contents)) + self.assertGeneratedFileContentsEqual(actual_file_contents, expected_file_name) - superclass_file_contents = messages.generate_messages_header(StringIO(_superclass_messages_file_contents)) - self.assertGeneratedFileContentsEqual(superclass_file_contents, _expected_superclass_receiver_header) +class HeaderTest(GeneratedFileContentsTest): + def test_receiver_headers(self): + self.assertHeaderEqual(_messages_file_contents, + _expected_receiver_header_file_name) + self.assertHeaderEqual(_legacy_messages_file_contents, + _expected_legacy_receiver_header_file_name) + self.assertHeaderEqual(_superclass_messages_file_contents, + _expected_superclass_receiver_header_file_name) -class ReceiverImplementationTest(GeneratedFileContentsTest): - def test_receiver_implementation(self): - file_contents = messages.generate_message_handler(StringIO(_messages_file_contents)) - self.assertGeneratedFileContentsEqual(file_contents, _expected_receiver_implementation) - - legacy_file_contents = messages.generate_message_handler(StringIO(_legacy_messages_file_contents)) - self.assertGeneratedFileContentsEqual(legacy_file_contents, _expected_legacy_receiver_implementation) - superclass_file_contents = messages.generate_message_handler(StringIO(_superclass_messages_file_contents)) - self.assertGeneratedFileContentsEqual(superclass_file_contents, _expected_superclass_receiver_implementation) +class ReceiverImplementationTest(GeneratedFileContentsTest): + def test_receiver_implementations(self): + self.assertImplementationEqual(_messages_file_contents, + _expected_receiver_implementation_file_name) + self.assertImplementationEqual(_legacy_messages_file_contents, + _expected_legacy_receiver_implementation_file_name) + self.assertImplementationEqual(_superclass_messages_file_contents, + _expected_superclass_receiver_implementation_file_name) class UnsupportedPrecompilerDirectiveTest(unittest.TestCase): @@ -353,5 +352,38 @@ class UnsupportedPrecompilerDirectiveTest(unittest.TestCase): messages.generate_message_handler(StringIO("asd\n#elif bla\nfoo")) +def add_reset_results_to_unittest_help(): + script_name = os.path.basename(__file__) + reset_results_help = ''' +Custom Options: + -r, --reset-results Reset expected results for {0} +'''.format(script_name) + + options_regex = re.compile('^Usage:') + lines = unittest.TestProgram.USAGE.splitlines(True) + index = 0 + for index, line in enumerate(lines): + if options_regex.match(line) and index + 1 < len(lines): + lines.insert(index + 1, reset_results_help) + break + + if index == (len(lines) - 1): + lines.append(reset_results_help) + + unittest.TestProgram.USAGE = ''.join(lines) + + +def parse_sys_argv(): + global reset_results + for index, arg in enumerate(sys.argv[1:]): + if arg in ('-r', '--r', '--reset', '--reset-results') or '--reset-results'.startswith(arg): + reset_results = True + del sys.argv[index + 1] + break + + if __name__ == '__main__': + reset_results = False + add_reset_results_to_unittest_help() + parse_sys_argv() unittest.main() diff --git a/Source/WebKit2/Scripts/webkit/model.py b/Source/WebKit2/Scripts/webkit/model.py index ebf75ccd4..d0830440d 100644 --- a/Source/WebKit2/Scripts/webkit/model.py +++ b/Source/WebKit2/Scripts/webkit/model.py @@ -1,4 +1,4 @@ -# Copyright (C) 2010, 2011 Apple Inc. All rights reserved. +# Copyright (C) 2010-2017 Apple Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -38,6 +38,7 @@ class MessageReceiver(object): def has_attribute(self, attribute): return attribute in self.attributes + class Message(object): def __init__(self, name, parameters, reply_parameters, attributes, condition): self.name = name diff --git a/Source/WebKit2/Scripts/webkit/parser.py b/Source/WebKit2/Scripts/webkit/parser.py index 69a81dfef..306139468 100644 --- a/Source/WebKit2/Scripts/webkit/parser.py +++ b/Source/WebKit2/Scripts/webkit/parser.py @@ -1,4 +1,4 @@ -# Copyright (C) 2010, 2011 Apple Inc. All rights reserved. +# Copyright (C) 2010-2017 Apple Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -121,6 +121,7 @@ def split_parameters_string(parameters_string): parameters.append(current_parameter_string) return parameters + def parse_parameters_string(parameters_string): parameters = [] diff --git a/Source/qtwebkit.qdocconf b/Source/qtwebkit.qdocconf index 8e4edbd75..0d963a7fb 100644 --- a/Source/qtwebkit.qdocconf +++ b/Source/qtwebkit.qdocconf @@ -30,7 +30,7 @@ qhp.QtWebKit.subprojects.qmltypes.selectors = qmlclass qhp.QtWebKit.subprojects.qmltypes.sortPages = true headerdirs = WebKit/qt/Api WebKit/qt/WidgetApi WebKit2/UIProcess/API/qt -sourcedirs = WebKit/qt/Api WebKit/qt/WidgetApi WebKit/qt/docs Source/JavaScriptCore/qt/api WebKit2/UIProcess/API/qt +sourcedirs = WebKit/qt/Api WebKit/qt/WidgetApi WebKit/qt/docs WebKit2/UIProcess/API/qt exampledirs = WebKit/qt/docs imagedirs = WebKit/qt/docs diff --git a/Tools/QtTestBrowser/launcherwindow.cpp b/Tools/QtTestBrowser/launcherwindow.cpp index 6e221840d..6e9d388e9 100644 --- a/Tools/QtTestBrowser/launcherwindow.cpp +++ b/Tools/QtTestBrowser/launcherwindow.cpp @@ -106,6 +106,8 @@ LauncherWindow::LauncherWindow(WindowOptions* data, QGraphicsScene* sharedScene) createChrome(); #if !defined(QT_NO_FILEDIALOG) && !defined(QT_NO_MESSAGEBOX) connect(page(), SIGNAL(downloadRequested(const QNetworkRequest&)), this, SLOT(downloadRequest(const QNetworkRequest&))); + connect(page()->networkAccessManager(), SIGNAL(sslErrors(QNetworkReply*, const QList&)), + this, SLOT(showSSLErrorConfirmation(QNetworkReply*, const QList&))); #endif } @@ -1166,7 +1168,7 @@ void LauncherWindow::showSSLErrorConfirmation(QNetworkReply* reply, const QList< errorStrings += ""; QMessageBox sslWarningBox; - sslWarningBox.setText("SSL handshake problem"); + sslWarningBox.setText("TLS handshake problem"); sslWarningBox.setInformativeText(errorStrings); sslWarningBox.setStandardButtons(QMessageBox::Abort | QMessageBox::Ignore); sslWarningBox.setDefaultButton(QMessageBox::Abort); diff --git a/Tools/QtTestBrowser/mainwindow.cpp b/Tools/QtTestBrowser/mainwindow.cpp index e22193a96..573bc77c9 100644 --- a/Tools/QtTestBrowser/mainwindow.cpp +++ b/Tools/QtTestBrowser/mainwindow.cpp @@ -86,7 +86,6 @@ void MainWindow::buildUI() connect(page()->mainFrame(), SIGNAL(loadStarted()), this, SLOT(onLoadStarted())); connect(page()->mainFrame(), SIGNAL(iconChanged()), this, SLOT(onIconChanged())); connect(page()->mainFrame(), SIGNAL(titleChanged(QString)), this, SLOT(onTitleChanged(QString))); - connect(page()->networkAccessManager(), SIGNAL(sslErrors(QNetworkReply*, const QList&)), this, SLOT(onSSLErrors(QNetworkReply*, const QList&))); connect(page(), SIGNAL(windowCloseRequested()), this, SLOT(close())); #ifndef QT_NO_SHORTCUT -- cgit v1.2.1 From b38ffac98772e2c544c212872a2664078a363cfd Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Wed, 17 Jul 2019 12:42:40 +0300 Subject: Import WebKit commit ef70f6610af2160e0de030b81819c4b62dce7d12 Change-Id: I1644a08d8d19841cb66762af42a766fc4d1518ef Reviewed-by: Konstantin Tokarev --- .../graphics/qt/FontCustomPlatformDataQt.cpp | 2 +- .../win/MediaPlayerPrivateMediaFoundation.cpp | 16 +- .../win/MediaPlayerPrivateMediaFoundation.h | 2 - .../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h | 2 - .../qt/WebCoreSupport/ProgressTrackerClientQt.cpp | 2 + .../WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp | 1 + Source/WebKit/qt/WebCoreSupport/QWebFrameData.cpp | 2 + Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 7 +- Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 9 +- Source/WebKit2/PlatformQt.cmake | 3 + .../UIProcess/qt/ColorChooserContextObject.h | 57 ++++ Source/WebKit2/UIProcess/qt/DialogContextObjects.h | 287 +++++++++++++++++++++ .../UIProcess/qt/ItemSelectorContextObject.cpp | 181 +++++++++++++ .../UIProcess/qt/ItemSelectorContextObject.h | 119 +++++++++ Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp | 262 +------------------ Source/WebKit2/UIProcess/qt/WebColorPickerQt.cpp | 29 +-- .../WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp | 227 +--------------- Source/cmake/OptionsQt.cmake | 1 + Tools/qt/make-release.pl | 69 +++++ 19 files changed, 740 insertions(+), 538 deletions(-) create mode 100644 Source/WebKit2/UIProcess/qt/ColorChooserContextObject.h create mode 100644 Source/WebKit2/UIProcess/qt/DialogContextObjects.h create mode 100644 Source/WebKit2/UIProcess/qt/ItemSelectorContextObject.cpp create mode 100644 Source/WebKit2/UIProcess/qt/ItemSelectorContextObject.h create mode 100755 Tools/qt/make-release.pl diff --git a/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp b/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp index 908d881f1..2c8571ace 100644 --- a/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp +++ b/Source/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp @@ -41,7 +41,7 @@ std::unique_ptr createFontCustomPlatformData(SharedBuffe const QByteArray fontData(buffer.data(), buffer.size()); // Pixel size doesn't matter at this point, it is set in FontCustomPlatformData::fontPlatformData. - QRawFont rawFont(fontData, /*pixelSize = */0, QFont::PreferDefaultHinting); + QRawFont rawFont(fontData, /*pixelSize = */0, QFont::PreferVerticalHinting); if (!rawFont.isValid()) return 0; diff --git a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp index 98f2ec964..a56a47a3e 100644 --- a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp +++ b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp @@ -193,15 +193,6 @@ void MediaPlayerPrivateMediaFoundation::cancelLoad() notImplemented(); } -void MediaPlayerPrivateMediaFoundation::prepareToPlay() -{ - // We call startSession() to start buffering video data. - // When we have received enough data, we pause, so that we don't actually start the playback. - ASSERT(m_paused); - ASSERT(!m_preparingToPlay); - m_preparingToPlay = startSession(); -} - void MediaPlayerPrivateMediaFoundation::play() { m_paused = !startSession(); @@ -937,7 +928,11 @@ void MediaPlayerPrivateMediaFoundation::onTopologySet() } // It is expected that we start buffering data from the network now. - prepareToPlay(); + // We call startSession() to start buffering video data. + // When we have received enough data, we pause, so that we don't actually start the playback. + ASSERT(m_paused); + ASSERT(!m_preparingToPlay); + m_preparingToPlay = startSession(); } void MediaPlayerPrivateMediaFoundation::onBufferingStarted() @@ -2920,6 +2915,7 @@ HRESULT MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSample(IMFS D3DSURFACE_DESC desc; if (SUCCEEDED(surface->GetDesc(&desc))) format = desc.Format; + m_memSurface.clear(); hr = m_device->CreateOffscreenPlainSurface(width, height, format, D3DPOOL_SYSTEMMEM, &m_memSurface, nullptr); m_width = width; m_height = height; diff --git a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h index 0fe07fa13..d945c20d0 100644 --- a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h +++ b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h @@ -60,8 +60,6 @@ public: void load(const String& url) override; void cancelLoad() override; - void prepareToPlay() override; - void play() override; void pause() override; diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index 8465db721..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 #include 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/tests/qwebframe/tst_qwebframe.cpp b/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index ab15c6315..a4056f996 100644 --- a/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -170,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); } diff --git a/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 73427cb4b..760a242af 100644 --- a/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -3329,9 +3329,12 @@ void tst_QWebPage::contextMenuPopulatedOnce() QList 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/WebKit2/PlatformQt.cmake b/Source/WebKit2/PlatformQt.cmake index 5883096eb..a033f1cf1 100644 --- a/Source/WebKit2/PlatformQt.cmake +++ b/Source/WebKit2/PlatformQt.cmake @@ -156,6 +156,9 @@ list(APPEND WebKit2_SOURCES UIProcess/gstreamer/WebPageProxyGStreamer.cpp UIProcess/qt/BackingStoreQt.cpp + UIProcess/qt/ColorChooserContextObject.h + UIProcess/qt/DialogContextObjects.h + UIProcess/qt/ItemSelectorContextObject.cpp UIProcess/qt/PageViewportControllerClientQt.cpp UIProcess/qt/QrcSchemeHandler.cpp UIProcess/qt/QtDialogRunner.cpp diff --git a/Source/WebKit2/UIProcess/qt/ColorChooserContextObject.h b/Source/WebKit2/UIProcess/qt/ColorChooserContextObject.h new file mode 100644 index 000000000..0af685b61 --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/ColorChooserContextObject.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#pragma once + +#include +#include +#include + +namespace WebKit { + +class ColorChooserContextObject : public QObject { + Q_OBJECT + Q_PROPERTY(QColor currentColor READ currentColor CONSTANT FINAL) + Q_PROPERTY(QRectF elementRect READ elementRect CONSTANT FINAL) + +public: + ColorChooserContextObject(const QColor& color, const QRectF& rect) + : m_currentColor(color) + , m_rect(rect) + { + } + + QColor currentColor() const { return m_currentColor; } + QRectF elementRect() const { return m_rect; } + + Q_INVOKABLE void accept(const QColor& color) { emit accepted(color); } + Q_INVOKABLE void reject() { emit rejected(); } + +Q_SIGNALS: + void accepted(const QColor&); + void rejected(); + +private: + QColor m_currentColor; + QRectF m_rect; +}; + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/DialogContextObjects.h b/Source/WebKit2/UIProcess/qt/DialogContextObjects.h new file mode 100644 index 000000000..c6257125e --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/DialogContextObjects.h @@ -0,0 +1,287 @@ +/* + * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#pragma once + +#include "QtDialogRunner.h" +#include "WKRetainPtr.h" +#include "WKStringQt.h" +#include "qtwebsecurityorigin_p.h" + +namespace WebKit { + +// All dialogs need a way to support the state of the +// dialog being done/finished/dismissed. This is handled +// in the dialog base context. +class DialogContextBase : public QObject { + Q_OBJECT + +public: + DialogContextBase() + : QObject() + , m_dismissed(false) + { + } + +public Q_SLOTS: + // Allows clients to call dismiss() directly, while also + // being able to hook up signals to automatically also + // dismiss the dialog since it's a slot. + + void dismiss() + { + m_dismissed = true; + emit dismissed(); + } + +Q_SIGNALS: + void dismissed(); + +private: + // We store the dismissed state so that run() can check to see if a + // dialog has already been dismissed before spinning an event loop. + bool m_dismissed; + friend void QtDialogRunner::run(); +}; + +class DialogContextObject : public DialogContextBase { + Q_OBJECT + Q_PROPERTY(QString message READ message CONSTANT) + Q_PROPERTY(QString defaultValue READ defaultValue CONSTANT) + +public: + DialogContextObject(const QString& message, const QString& defaultValue = QString()) + : DialogContextBase() + , m_message(message) + , m_defaultValue(defaultValue) + { + connect(this, SIGNAL(accepted(QString)), SLOT(dismiss())); + connect(this, SIGNAL(rejected()), SLOT(dismiss())); + } + QString message() const { return m_message; } + QString defaultValue() const { return m_defaultValue; } + +public Q_SLOTS: + void accept(const QString& result = QString()) { emit accepted(result); } + void reject() { emit rejected(); } + +Q_SIGNALS: + void accepted(const QString& result); + void rejected(); + +private: + QString m_message; + QString m_defaultValue; +}; + +class BaseAuthenticationContextObject : public DialogContextBase { + Q_OBJECT + Q_PROPERTY(QString hostname READ hostname CONSTANT) + Q_PROPERTY(QString prefilledUsername READ prefilledUsername CONSTANT) + +public: + BaseAuthenticationContextObject(const QString& hostname, const QString& prefilledUsername) + : DialogContextBase() + , m_hostname(hostname) + , m_prefilledUsername(prefilledUsername) + { + connect(this, SIGNAL(accepted(QString, QString)), SLOT(dismiss())); + connect(this, SIGNAL(rejected()), SLOT(dismiss())); + } + + QString hostname() const { return m_hostname; } + QString prefilledUsername() const { return m_prefilledUsername; } + +public Q_SLOTS: + void accept(const QString& username, const QString& password) { emit accepted(username, password); } + void reject() { emit rejected(); } + +Q_SIGNALS: + void accepted(const QString& username, const QString& password); + void rejected(); + +private: + QString m_hostname; + QString m_prefilledUsername; +}; + +class HttpAuthenticationDialogContextObject : public BaseAuthenticationContextObject { + Q_OBJECT + Q_PROPERTY(QString realm READ realm CONSTANT) + +public: + HttpAuthenticationDialogContextObject(const QString& hostname, const QString& realm, const QString& prefilledUsername) + : BaseAuthenticationContextObject(hostname, prefilledUsername) + , m_realm(realm) + { + } + + QString realm() const { return m_realm; } + +private: + QString m_realm; +}; + +class ProxyAuthenticationDialogContextObject : public BaseAuthenticationContextObject { + Q_OBJECT + Q_PROPERTY(quint16 port READ port CONSTANT) + +public: + ProxyAuthenticationDialogContextObject(const QString& hostname, quint16 port, const QString& prefilledUsername) + : BaseAuthenticationContextObject(hostname, prefilledUsername) + , m_port(port) + { + } + + quint16 port() const { return m_port; } + +private: + quint16 m_port; +}; + +class CertificateVerificationDialogContextObject : public DialogContextBase { + Q_OBJECT + Q_PROPERTY(QString hostname READ hostname CONSTANT) + +public: + CertificateVerificationDialogContextObject(const QString& hostname) + : DialogContextBase() + , m_hostname(hostname) + { + connect(this, SIGNAL(accepted()), SLOT(dismiss())); + connect(this, SIGNAL(rejected()), SLOT(dismiss())); + } + + QString hostname() const { return m_hostname; } + +public Q_SLOTS: + void accept() { emit accepted(); } + void reject() { emit rejected(); } + +Q_SIGNALS: + void accepted(); + void rejected(); + +private: + QString m_hostname; +}; + +class FilePickerContextObject : public DialogContextBase { + Q_OBJECT + Q_PROPERTY(QStringList fileList READ fileList CONSTANT) + Q_PROPERTY(bool allowMultipleFiles READ allowMultipleFiles CONSTANT) + +public: + FilePickerContextObject(const QStringList& selectedFiles, bool allowMultiple) + : DialogContextBase() + , m_allowMultiple(allowMultiple) + , m_fileList(selectedFiles) + { + connect(this, SIGNAL(fileSelected(QStringList)), SLOT(dismiss())); + connect(this, SIGNAL(rejected()), SLOT(dismiss())); + } + + QStringList fileList() const { return m_fileList; } + bool allowMultipleFiles() const { return m_allowMultiple;} + +public Q_SLOTS: + void reject() { emit rejected();} + void accept(const QVariant& path) + { + QStringList filesPath = path.toStringList(); + + if (filesPath.isEmpty()) { + emit rejected(); + return; + } + + // For single file upload, send only the first element if there are more than one file paths + if (!m_allowMultiple && filesPath.count() > 1) + filesPath = QStringList(filesPath.at(0)); + emit fileSelected(filesPath); + } + +Q_SIGNALS: + void rejected(); + void fileSelected(const QStringList&); + +private: + bool m_allowMultiple; + QStringList m_fileList; +}; + +class DatabaseQuotaDialogContextObject : public DialogContextBase { + Q_OBJECT + Q_PROPERTY(QString databaseName READ databaseName CONSTANT) + Q_PROPERTY(QString displayName READ displayName CONSTANT) + Q_PROPERTY(quint64 currentQuota READ currentQuota CONSTANT) + Q_PROPERTY(quint64 currentOriginUsage READ currentOriginUsage CONSTANT) + Q_PROPERTY(quint64 currentDatabaseUsage READ currentDatabaseUsage CONSTANT) + Q_PROPERTY(quint64 expectedUsage READ expectedUsage CONSTANT) + Q_PROPERTY(QtWebSecurityOrigin* origin READ securityOrigin CONSTANT) + +public: + DatabaseQuotaDialogContextObject(const QString& databaseName, const QString& displayName, WKSecurityOriginRef securityOrigin, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage) + : DialogContextBase() + , m_databaseName(databaseName) + , m_displayName(displayName) + , m_currentQuota(currentQuota) + , m_currentOriginUsage(currentOriginUsage) + , m_currentDatabaseUsage(currentDatabaseUsage) + , m_expectedUsage(expectedUsage) + { + WKRetainPtr scheme = adoptWK(WKSecurityOriginCopyProtocol(securityOrigin)); + WKRetainPtr host = adoptWK(WKSecurityOriginCopyHost(securityOrigin)); + + m_securityOrigin.setScheme(WKStringCopyQString(scheme.get())); + m_securityOrigin.setHost(WKStringCopyQString(host.get())); + m_securityOrigin.setPort(static_cast(WKSecurityOriginGetPort(securityOrigin))); + + connect(this, SIGNAL(accepted(quint64)), SLOT(dismiss())); + connect(this, SIGNAL(rejected()), SLOT(dismiss())); + } + + QString databaseName() const { return m_databaseName; } + QString displayName() const { return m_displayName; } + quint64 currentQuota() const { return m_currentQuota; } + quint64 currentOriginUsage() const { return m_currentOriginUsage; } + quint64 currentDatabaseUsage() const { return m_currentDatabaseUsage; } + quint64 expectedUsage() const { return m_expectedUsage; } + QtWebSecurityOrigin* securityOrigin() { return &m_securityOrigin; } + +public Q_SLOTS: + void accept(quint64 size) { emit accepted(size); } + void reject() { emit rejected(); } + +Q_SIGNALS: + void accepted(quint64 size); + void rejected(); + +private: + QString m_databaseName; + QString m_displayName; + quint64 m_currentQuota; + quint64 m_currentOriginUsage; + quint64 m_currentDatabaseUsage; + quint64 m_expectedUsage; + QtWebSecurityOrigin m_securityOrigin; +}; + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/ItemSelectorContextObject.cpp b/Source/WebKit2/UIProcess/qt/ItemSelectorContextObject.cpp new file mode 100644 index 000000000..a78fe4964 --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/ItemSelectorContextObject.cpp @@ -0,0 +1,181 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ItemSelectorContextObject.h" + +#include "PlatformPopupMenuData.h" +#include "WebPopupItem.h" +#include "WebPopupMenuProxyQt.h" +#include "qquickwebview_p.h" +#include "qquickwebview_p_p.h" +#include +#include +#include + +using namespace WebCore; + +namespace WebKit { + +ItemSelectorContextObject::ItemSelectorContextObject(const QRectF& elementRect, const Vector& webPopupItems, bool multiple) + : m_elementRect(elementRect) + , m_items(webPopupItems, multiple) +{ + connect(&m_items, SIGNAL(indexUpdated()), SLOT(onIndexUpdate())); +} + +void ItemSelectorContextObject::onIndexUpdate() +{ + // Send the update for multi-select list. + if (m_items.multiple()) + emit acceptedWithOriginalIndex(m_items.selectedOriginalIndex()); +} + + +void ItemSelectorContextObject::accept(int index) +{ + // If the index is not valid for multi-select lists, just hide the pop up as the selected indices have + // already been sent. + if ((index == -1) && m_items.multiple()) + emit done(); + else { + if (index != -1) + m_items.toggleItem(index); + emit acceptedWithOriginalIndex(m_items.selectedOriginalIndex()); + } +} + +static QHash createRoleNamesHash() +{ + QHash roles; + roles[Qt::DisplayRole] = "text"; + roles[Qt::ToolTipRole] = "tooltip"; + roles[PopupMenuItemModel::GroupRole] = "group"; + roles[PopupMenuItemModel::EnabledRole] = "enabled"; + roles[PopupMenuItemModel::SelectedRole] = "selected"; + roles[PopupMenuItemModel::IsSeparatorRole] = "isSeparator"; + return roles; +} + +PopupMenuItemModel::PopupMenuItemModel(const Vector& webPopupItems, bool multiple) + : m_selectedModelIndex(-1) + , m_allowMultiples(multiple) +{ + buildItems(webPopupItems); +} + +QHash PopupMenuItemModel::roleNames() const +{ + static QHash roles = createRoleNamesHash(); + return roles; +} + +QVariant PopupMenuItemModel::data(const QModelIndex& index, int role) const +{ + if (!index.isValid() || index.row() < 0 || index.row() >= m_items.size()) + return QVariant(); + + const Item& item = m_items[index.row()]; + if (item.isSeparator) { + if (role == IsSeparatorRole) + return true; + return QVariant(); + } + + switch (role) { + case Qt::DisplayRole: + return item.text; + case Qt::ToolTipRole: + return item.toolTip; + case GroupRole: + return item.group; + case EnabledRole: + return item.enabled; + case SelectedRole: + return item.selected; + case IsSeparatorRole: + return false; + } + + return QVariant(); +} + +void PopupMenuItemModel::select(int index) +{ + toggleItem(index); + emit indexUpdated(); +} + +void PopupMenuItemModel::toggleItem(int index) +{ + int oldIndex = m_selectedModelIndex; + if (index < 0 || index >= m_items.size()) + return; + Item& item = m_items[index]; + if (!item.enabled) + return; + + m_selectedModelIndex = index; + if (m_allowMultiples) + item.selected = !item.selected; + else { + if (index == oldIndex) + return; + item.selected = true; + if (oldIndex != -1) { + Item& oldItem = m_items[oldIndex]; + oldItem.selected = false; + emit dataChanged(this->index(oldIndex), this->index(oldIndex)); + } + } + + emit dataChanged(this->index(index), this->index(index)); +} + +int PopupMenuItemModel::selectedOriginalIndex() const +{ + if (m_selectedModelIndex == -1) + return -1; + return m_items[m_selectedModelIndex].originalIndex; +} + +void PopupMenuItemModel::buildItems(const Vector& webPopupItems) +{ + QString currentGroup; + m_items.reserveInitialCapacity(webPopupItems.size()); + for (int i = 0; i < webPopupItems.size(); i++) { + const WebPopupItem& webPopupItem = webPopupItems[i]; + if (webPopupItem.m_isLabel) { + currentGroup = webPopupItem.m_text; + continue; + } + if (webPopupItem.m_isSelected && !m_allowMultiples) + m_selectedModelIndex = m_items.size(); + m_items.append(Item(webPopupItem, currentGroup, i)); + } +} + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/ItemSelectorContextObject.h b/Source/WebKit2/UIProcess/qt/ItemSelectorContextObject.h new file mode 100644 index 000000000..ad63893d6 --- /dev/null +++ b/Source/WebKit2/UIProcess/qt/ItemSelectorContextObject.h @@ -0,0 +1,119 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "WebPopupItem.h" +#include +#include +#include + +namespace WebKit { + +class PopupMenuItemModel final : public QAbstractListModel { + Q_OBJECT + +public: + enum Roles { + GroupRole = Qt::UserRole, + EnabledRole = Qt::UserRole + 1, + SelectedRole = Qt::UserRole + 2, + IsSeparatorRole = Qt::UserRole + 3 + }; + + PopupMenuItemModel(const Vector&, bool multiple); + int rowCount(const QModelIndex& parent = QModelIndex()) const final { return m_items.size(); } + QVariant data(const QModelIndex&, int role = Qt::DisplayRole) const final; + QHash roleNames() const final; + + Q_INVOKABLE void select(int); + + int selectedOriginalIndex() const; + bool multiple() const { return m_allowMultiples; } + void toggleItem(int); + +Q_SIGNALS: + void indexUpdated(); + +private: + struct Item { + Item(const WebPopupItem& webPopupItem, const QString& group, int originalIndex) + : text(webPopupItem.m_text) + , toolTip(webPopupItem.m_toolTip) + , group(group) + , originalIndex(originalIndex) + , enabled(webPopupItem.m_isEnabled) + , selected(webPopupItem.m_isSelected) + , isSeparator(webPopupItem.m_type == WebPopupItem::Separator) + { } + + QString text; + QString toolTip; + QString group; + // Keep track of originalIndex because we don't add the label (group) items to our vector. + int originalIndex; + bool enabled; + bool selected; + bool isSeparator; + }; + + void buildItems(const Vector& webPopupItems); + + Vector m_items; + int m_selectedModelIndex; + bool m_allowMultiples; +}; + +class ItemSelectorContextObject : public QObject { + Q_OBJECT + Q_PROPERTY(QRectF elementRect READ elementRect CONSTANT FINAL) + Q_PROPERTY(QObject* items READ items CONSTANT FINAL) + Q_PROPERTY(bool allowMultiSelect READ allowMultiSelect CONSTANT FINAL) + +public: + ItemSelectorContextObject(const QRectF& elementRect, const Vector&, bool multiple); + + QRectF elementRect() const { return m_elementRect; } + PopupMenuItemModel* items() { return &m_items; } + bool allowMultiSelect() { return m_items.multiple(); } + + Q_INVOKABLE void accept(int index = -1); + Q_INVOKABLE void reject() { emit done(); } + Q_INVOKABLE void dismiss() { emit done(); } + +Q_SIGNALS: + void acceptedWithOriginalIndex(int); + void done(); + +private Q_SLOTS: + void onIndexUpdate(); + +private: + QRectF m_elementRect; + PopupMenuItemModel m_items; +}; + +} // namespace WebKit diff --git a/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp b/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp index 5043a170f..2cd5828a8 100644 --- a/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp +++ b/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp @@ -21,8 +21,7 @@ #include "config.h" #include "QtDialogRunner.h" -#include "WKRetainPtr.h" -#include "WKStringQt.h" +#include "DialogContextObjects.h" #include "qquickwebview_p_p.h" #include "qwebpermissionrequest_p.h" #include @@ -43,263 +42,6 @@ QtDialogRunner::~QtDialogRunner() { } -// All dialogs need a way to support the state of the -// dialog being done/finished/dismissed. This is handled -// in the dialog base context. -class DialogContextBase : public QObject { - Q_OBJECT - -public: - DialogContextBase() - : QObject() - , m_dismissed(false) - { - } - -public Q_SLOTS: - // Allows clients to call dismiss() directly, while also - // being able to hook up signals to automatically also - // dismiss the dialog since it's a slot. - - void dismiss() - { - m_dismissed = true; - emit dismissed(); - } - -Q_SIGNALS: - void dismissed(); - -private: - // We store the dismissed state so that run() can check to see if a - // dialog has already been dismissed before spinning an event loop. - bool m_dismissed; - friend void QtDialogRunner::run(); -}; - -class DialogContextObject : public DialogContextBase { - Q_OBJECT - Q_PROPERTY(QString message READ message CONSTANT) - Q_PROPERTY(QString defaultValue READ defaultValue CONSTANT) - -public: - DialogContextObject(const QString& message, const QString& defaultValue = QString()) - : DialogContextBase() - , m_message(message) - , m_defaultValue(defaultValue) - { - connect(this, SIGNAL(accepted(QString)), SLOT(dismiss())); - connect(this, SIGNAL(rejected()), SLOT(dismiss())); - } - QString message() const { return m_message; } - QString defaultValue() const { return m_defaultValue; } - -public Q_SLOTS: - void accept(const QString& result = QString()) { emit accepted(result); } - void reject() { emit rejected(); } - -Q_SIGNALS: - void accepted(const QString& result); - void rejected(); - -private: - QString m_message; - QString m_defaultValue; -}; - -class BaseAuthenticationContextObject : public DialogContextBase { - Q_OBJECT - Q_PROPERTY(QString hostname READ hostname CONSTANT) - Q_PROPERTY(QString prefilledUsername READ prefilledUsername CONSTANT) - -public: - BaseAuthenticationContextObject(const QString& hostname, const QString& prefilledUsername) - : DialogContextBase() - , m_hostname(hostname) - , m_prefilledUsername(prefilledUsername) - { - connect(this, SIGNAL(accepted(QString, QString)), SLOT(dismiss())); - connect(this, SIGNAL(rejected()), SLOT(dismiss())); - } - - QString hostname() const { return m_hostname; } - QString prefilledUsername() const { return m_prefilledUsername; } - -public Q_SLOTS: - void accept(const QString& username, const QString& password) { emit accepted(username, password); } - void reject() { emit rejected(); } - -Q_SIGNALS: - void accepted(const QString& username, const QString& password); - void rejected(); - -private: - QString m_hostname; - QString m_prefilledUsername; -}; - -class HttpAuthenticationDialogContextObject : public BaseAuthenticationContextObject { - Q_OBJECT - Q_PROPERTY(QString realm READ realm CONSTANT) - -public: - HttpAuthenticationDialogContextObject(const QString& hostname, const QString& realm, const QString& prefilledUsername) - : BaseAuthenticationContextObject(hostname, prefilledUsername) - , m_realm(realm) - { - } - - QString realm() const { return m_realm; } - -private: - QString m_realm; -}; - -class ProxyAuthenticationDialogContextObject : public BaseAuthenticationContextObject { - Q_OBJECT - Q_PROPERTY(quint16 port READ port CONSTANT) - -public: - ProxyAuthenticationDialogContextObject(const QString& hostname, quint16 port, const QString& prefilledUsername) - : BaseAuthenticationContextObject(hostname, prefilledUsername) - , m_port(port) - { - } - - quint16 port() const { return m_port; } - -private: - quint16 m_port; -}; - -class CertificateVerificationDialogContextObject : public DialogContextBase { - Q_OBJECT - Q_PROPERTY(QString hostname READ hostname CONSTANT) - -public: - CertificateVerificationDialogContextObject(const QString& hostname) - : DialogContextBase() - , m_hostname(hostname) - { - connect(this, SIGNAL(accepted()), SLOT(dismiss())); - connect(this, SIGNAL(rejected()), SLOT(dismiss())); - } - - QString hostname() const { return m_hostname; } - -public Q_SLOTS: - void accept() { emit accepted(); } - void reject() { emit rejected(); } - -Q_SIGNALS: - void accepted(); - void rejected(); - -private: - QString m_hostname; -}; - -class FilePickerContextObject : public DialogContextBase { - Q_OBJECT - Q_PROPERTY(QStringList fileList READ fileList CONSTANT) - Q_PROPERTY(bool allowMultipleFiles READ allowMultipleFiles CONSTANT) - -public: - FilePickerContextObject(const QStringList& selectedFiles, bool allowMultiple) - : DialogContextBase() - , m_allowMultiple(allowMultiple) - , m_fileList(selectedFiles) - { - connect(this, SIGNAL(fileSelected(QStringList)), SLOT(dismiss())); - connect(this, SIGNAL(rejected()), SLOT(dismiss())); - } - - QStringList fileList() const { return m_fileList; } - bool allowMultipleFiles() const { return m_allowMultiple;} - -public Q_SLOTS: - void reject() { emit rejected();} - void accept(const QVariant& path) - { - QStringList filesPath = path.toStringList(); - - if (filesPath.isEmpty()) { - emit rejected(); - return; - } - - // For single file upload, send only the first element if there are more than one file paths - if (!m_allowMultiple && filesPath.count() > 1) - filesPath = QStringList(filesPath.at(0)); - emit fileSelected(filesPath); - } - -Q_SIGNALS: - void rejected(); - void fileSelected(const QStringList&); - -private: - bool m_allowMultiple; - QStringList m_fileList; -}; - -class DatabaseQuotaDialogContextObject : public DialogContextBase { - Q_OBJECT - Q_PROPERTY(QString databaseName READ databaseName CONSTANT) - Q_PROPERTY(QString displayName READ displayName CONSTANT) - Q_PROPERTY(quint64 currentQuota READ currentQuota CONSTANT) - Q_PROPERTY(quint64 currentOriginUsage READ currentOriginUsage CONSTANT) - Q_PROPERTY(quint64 currentDatabaseUsage READ currentDatabaseUsage CONSTANT) - Q_PROPERTY(quint64 expectedUsage READ expectedUsage CONSTANT) - Q_PROPERTY(QtWebSecurityOrigin* origin READ securityOrigin CONSTANT) - -public: - DatabaseQuotaDialogContextObject(const QString& databaseName, const QString& displayName, WKSecurityOriginRef securityOrigin, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage) - : DialogContextBase() - , m_databaseName(databaseName) - , m_displayName(displayName) - , m_currentQuota(currentQuota) - , m_currentOriginUsage(currentOriginUsage) - , m_currentDatabaseUsage(currentDatabaseUsage) - , m_expectedUsage(expectedUsage) - { - WKRetainPtr scheme = adoptWK(WKSecurityOriginCopyProtocol(securityOrigin)); - WKRetainPtr host = adoptWK(WKSecurityOriginCopyHost(securityOrigin)); - - m_securityOrigin.setScheme(WKStringCopyQString(scheme.get())); - m_securityOrigin.setHost(WKStringCopyQString(host.get())); - m_securityOrigin.setPort(static_cast(WKSecurityOriginGetPort(securityOrigin))); - - connect(this, SIGNAL(accepted(quint64)), SLOT(dismiss())); - connect(this, SIGNAL(rejected()), SLOT(dismiss())); - } - - QString databaseName() const { return m_databaseName; } - QString displayName() const { return m_displayName; } - quint64 currentQuota() const { return m_currentQuota; } - quint64 currentOriginUsage() const { return m_currentOriginUsage; } - quint64 currentDatabaseUsage() const { return m_currentDatabaseUsage; } - quint64 expectedUsage() const { return m_expectedUsage; } - QtWebSecurityOrigin* securityOrigin() { return &m_securityOrigin; } - -public Q_SLOTS: - void accept(quint64 size) { emit accepted(size); } - void reject() { emit rejected(); } - -Q_SIGNALS: - void accepted(quint64 size); - void rejected(); - -private: - QString m_databaseName; - QString m_displayName; - quint64 m_currentQuota; - quint64 m_currentOriginUsage; - quint64 m_currentDatabaseUsage; - quint64 m_expectedUsage; - QtWebSecurityOrigin m_securityOrigin; -}; - void QtDialogRunner::run() { DialogContextBase* context = static_cast(m_dialogContext->contextObject()); @@ -476,5 +218,5 @@ void QtDialogRunner::onDatabaseQuotaAccepted(quint64 quota) } // namespace WebKit -#include "QtDialogRunner.moc" +#include "moc_DialogContextObjects.cpp" #include "moc_QtDialogRunner.cpp" diff --git a/Source/WebKit2/UIProcess/qt/WebColorPickerQt.cpp b/Source/WebKit2/UIProcess/qt/WebColorPickerQt.cpp index 031c32d9e..c37099654 100644 --- a/Source/WebKit2/UIProcess/qt/WebColorPickerQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebColorPickerQt.cpp @@ -22,6 +22,7 @@ #include "config.h" #include "WebColorPickerQt.h" +#include "ColorChooserContextObject.h" #include "qquickwebview_p.h" #include "qquickwebview_p_p.h" #include @@ -31,33 +32,6 @@ using namespace WebCore; namespace WebKit { -class ColorChooserContextObject : public QObject { - Q_OBJECT - Q_PROPERTY(QColor currentColor READ currentColor CONSTANT FINAL) - Q_PROPERTY(QRectF elementRect READ elementRect CONSTANT FINAL) - -public: - ColorChooserContextObject(const QColor& color, const QRectF& rect) - : m_currentColor(color) - , m_rect(rect) - { - } - - QColor currentColor() const { return m_currentColor; } - QRectF elementRect() const { return m_rect; } - - Q_INVOKABLE void accept(const QColor& color) { emit accepted(color); } - Q_INVOKABLE void reject() { emit rejected(); } - -Q_SIGNALS: - void accepted(const QColor&); - void rejected(); - -private: - QColor m_currentColor; - QRectF m_rect; -}; - WebColorPickerQt::WebColorPickerQt(WebColorPicker::Client* client, QQuickWebView* webView, const Color& initialColor, const IntRect& elementRect) : WebColorPicker(client) , m_webView(webView) @@ -149,5 +123,4 @@ void WebColorPickerQt::endPicker() } // namespace WebKit -#include "WebColorPickerQt.moc" #include "moc_WebColorPickerQt.cpp" diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp index 249de62ec..066e273a9 100644 --- a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp @@ -27,6 +27,7 @@ #include "config.h" #include "WebPopupMenuProxyQt.h" +#include "ItemSelectorContextObject.h" #include "PlatformPopupMenuData.h" #include "WebPopupItem.h" #include "qquickwebview_p.h" @@ -39,229 +40,6 @@ using namespace WebCore; namespace WebKit { -static QHash createRoleNamesHash(); - -class PopupMenuItemModel final : public QAbstractListModel { - Q_OBJECT - -public: - enum Roles { - GroupRole = Qt::UserRole, - EnabledRole = Qt::UserRole + 1, - SelectedRole = Qt::UserRole + 2, - IsSeparatorRole = Qt::UserRole + 3 - }; - - PopupMenuItemModel(const Vector&, bool multiple); - int rowCount(const QModelIndex& parent = QModelIndex()) const final { return m_items.size(); } - QVariant data(const QModelIndex&, int role = Qt::DisplayRole) const final; - QHash roleNames() const final; - - Q_INVOKABLE void select(int); - - int selectedOriginalIndex() const; - bool multiple() const { return m_allowMultiples; } - void toggleItem(int); - -Q_SIGNALS: - void indexUpdated(); - -private: - struct Item { - Item(const WebPopupItem& webPopupItem, const QString& group, int originalIndex) - : text(webPopupItem.m_text) - , toolTip(webPopupItem.m_toolTip) - , group(group) - , originalIndex(originalIndex) - , enabled(webPopupItem.m_isEnabled) - , selected(webPopupItem.m_isSelected) - , isSeparator(webPopupItem.m_type == WebPopupItem::Separator) - { } - - QString text; - QString toolTip; - QString group; - // Keep track of originalIndex because we don't add the label (group) items to our vector. - int originalIndex; - bool enabled; - bool selected; - bool isSeparator; - }; - - void buildItems(const Vector& webPopupItems); - - Vector m_items; - int m_selectedModelIndex; - bool m_allowMultiples; -}; - -class ItemSelectorContextObject : public QObject { - Q_OBJECT - Q_PROPERTY(QRectF elementRect READ elementRect CONSTANT FINAL) - Q_PROPERTY(QObject* items READ items CONSTANT FINAL) - Q_PROPERTY(bool allowMultiSelect READ allowMultiSelect CONSTANT FINAL) - -public: - ItemSelectorContextObject(const QRectF& elementRect, const Vector&, bool multiple); - - QRectF elementRect() const { return m_elementRect; } - PopupMenuItemModel* items() { return &m_items; } - bool allowMultiSelect() { return m_items.multiple(); } - - Q_INVOKABLE void accept(int index = -1); - Q_INVOKABLE void reject() { emit done(); } - Q_INVOKABLE void dismiss() { emit done(); } - -Q_SIGNALS: - void acceptedWithOriginalIndex(int); - void done(); - -private Q_SLOTS: - void onIndexUpdate(); - -private: - QRectF m_elementRect; - PopupMenuItemModel m_items; -}; - -ItemSelectorContextObject::ItemSelectorContextObject(const QRectF& elementRect, const Vector& webPopupItems, bool multiple) - : m_elementRect(elementRect) - , m_items(webPopupItems, multiple) -{ - connect(&m_items, SIGNAL(indexUpdated()), SLOT(onIndexUpdate())); -} - -void ItemSelectorContextObject::onIndexUpdate() -{ - // Send the update for multi-select list. - if (m_items.multiple()) - emit acceptedWithOriginalIndex(m_items.selectedOriginalIndex()); -} - - -void ItemSelectorContextObject::accept(int index) -{ - // If the index is not valid for multi-select lists, just hide the pop up as the selected indices have - // already been sent. - if ((index == -1) && m_items.multiple()) - emit done(); - else { - if (index != -1) - m_items.toggleItem(index); - emit acceptedWithOriginalIndex(m_items.selectedOriginalIndex()); - } -} - -static QHash createRoleNamesHash() -{ - QHash roles; - roles[Qt::DisplayRole] = "text"; - roles[Qt::ToolTipRole] = "tooltip"; - roles[PopupMenuItemModel::GroupRole] = "group"; - roles[PopupMenuItemModel::EnabledRole] = "enabled"; - roles[PopupMenuItemModel::SelectedRole] = "selected"; - roles[PopupMenuItemModel::IsSeparatorRole] = "isSeparator"; - return roles; -} - -PopupMenuItemModel::PopupMenuItemModel(const Vector& webPopupItems, bool multiple) - : m_selectedModelIndex(-1) - , m_allowMultiples(multiple) -{ - buildItems(webPopupItems); -} - -QHash PopupMenuItemModel::roleNames() const -{ - static QHash roles = createRoleNamesHash(); - return roles; -} - -QVariant PopupMenuItemModel::data(const QModelIndex& index, int role) const -{ - if (!index.isValid() || index.row() < 0 || index.row() >= m_items.size()) - return QVariant(); - - const Item& item = m_items[index.row()]; - if (item.isSeparator) { - if (role == IsSeparatorRole) - return true; - return QVariant(); - } - - switch (role) { - case Qt::DisplayRole: - return item.text; - case Qt::ToolTipRole: - return item.toolTip; - case GroupRole: - return item.group; - case EnabledRole: - return item.enabled; - case SelectedRole: - return item.selected; - case IsSeparatorRole: - return false; - } - - return QVariant(); -} - -void PopupMenuItemModel::select(int index) -{ - toggleItem(index); - emit indexUpdated(); -} - -void PopupMenuItemModel::toggleItem(int index) -{ - int oldIndex = m_selectedModelIndex; - if (index < 0 || index >= m_items.size()) - return; - Item& item = m_items[index]; - if (!item.enabled) - return; - - m_selectedModelIndex = index; - if (m_allowMultiples) - item.selected = !item.selected; - else { - if (index == oldIndex) - return; - item.selected = true; - if (oldIndex != -1) { - Item& oldItem = m_items[oldIndex]; - oldItem.selected = false; - emit dataChanged(this->index(oldIndex), this->index(oldIndex)); - } - } - - emit dataChanged(this->index(index), this->index(index)); -} - -int PopupMenuItemModel::selectedOriginalIndex() const -{ - if (m_selectedModelIndex == -1) - return -1; - return m_items[m_selectedModelIndex].originalIndex; -} - -void PopupMenuItemModel::buildItems(const Vector& webPopupItems) -{ - QString currentGroup; - m_items.reserveInitialCapacity(webPopupItems.size()); - for (int i = 0; i < webPopupItems.size(); i++) { - const WebPopupItem& webPopupItem = webPopupItems[i]; - if (webPopupItem.m_isLabel) { - currentGroup = webPopupItem.m_text; - continue; - } - if (webPopupItem.m_isSelected && !m_allowMultiples) - m_selectedModelIndex = m_items.size(); - m_items.append(Item(webPopupItem, currentGroup, i)); - } -} - WebPopupMenuProxyQt::WebPopupMenuProxyQt(WebPopupMenuProxy::Client& client, QQuickWebView* webView) : WebPopupMenuProxy(client) , m_webView(webView) @@ -348,8 +126,5 @@ void WebPopupMenuProxyQt::createContext(QQmlComponent* component, QObject* conte } // namespace WebKit -// Since we define QObjects in WebPopupMenuProxyQt.cpp, this will trigger moc to run on .cpp. -#include "WebPopupMenuProxyQt.moc" - // And we can't compile the moc for WebPopupMenuProxyQt.h by itself, since it doesn't include "config.h" #include "moc_WebPopupMenuProxyQt.cpp" diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake index ac1065d92..2756a928c 100644 --- a/Source/cmake/OptionsQt.cmake +++ b/Source/cmake/OptionsQt.cmake @@ -295,6 +295,7 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(USE_SYSTEM_MALLOC PUBLIC OFF) # we need a value different from the default defined in WebKitFeatures.cmake. # Changing these options is completely unsupported. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_3D_TRANSFORMS PRIVATE ON) +WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_COMPOSITING PRIVATE ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_IMAGE_SET PRIVATE ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_REGIONS PRIVATE ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_SHAPES PRIVATE ON) diff --git a/Tools/qt/make-release.pl b/Tools/qt/make-release.pl new file mode 100755 index 000000000..facc3124f --- /dev/null +++ b/Tools/qt/make-release.pl @@ -0,0 +1,69 @@ +#!/usr/bin/env perl +# Copyright (C) 2019 Konstantin Tokarev +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +# THE POSSIBILITY OF SUCH DAMAGE. + +use Cwd; +use File::Basename; +use strict; +use warnings; + +sub usage { + my $msg = shift || ""; + die $msg . "Usage: cd snapshot/repo/path; $0 "; +} + +scalar @ARGV == 1 || usage(); + +my $version = shift; + +-f "ChangeLog" && die "This script must be run in snapshots repository"; +-d ".git" || usage(); + +`LC_ALL=C LANG=C git status` =~ "nothing to commit, working tree clean" or die "Snapshots working tree is dirty"; + +my $snapshotTag = "v$version"; +my $originalTag = "qtwebkit-$version"; + +`git tag -l $snapshotTag` && print "Found $snapshotTag\n" || die "Tag $snapshotTag is not found"; +`git tag -l $originalTag` && print "Found $originalTag\n" || die "Tag $originalTag is not found"; + +my $originalTagHash = `git log -1 --format=format:"%H" $originalTag`; +chomp $originalTagHash; + +open (my $gitShow, "-|", "git show -s --format=%B $snapshotTag") or die "Failed to run git show: $!"; +while (<$gitShow>) { + if (/^Import WebKit commit ([0-9a-f]+)$/) { + print "Snaphot imported tag = $1\n"; + unless ($1 eq $originalTagHash) { + die "Imported tag '$snapshotTag' does not point to '$originalTag' ('$originalTagHash')"; + } + last; + } +} + +# Now we are ok, let's finally make tarball +my $cmd = "git archive --prefix=$originalTag/ $snapshotTag | xz -9 > $originalTag.tar.xz"; +print "$cmd\n"; +system($cmd) == 0 or die "git archive failed: $!"; + +# TODO: Upload to GitHub? -- cgit v1.2.1 From 688ec88511dedc1de04b4438c26ef071c55de4e8 Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Tue, 6 Aug 2019 19:40:03 +0300 Subject: Import QtWebKit commit 58390740ab21cbf3ad8d7b51972c9b24fdf58a9c Change-Id: Ia730b2ca3e5c8c1556fed3301cdf2da7cfbd802f Reviewed-by: Konstantin Tokarev --- Source/WebCore/platform/graphics/qt/GradientQt.cpp | 6 +++ Source/WebCore/platform/network/qt/CookieJarQt.cpp | 2 +- .../platform/network/qt/QNetworkReplyHandler.cpp | 13 +---- Source/WebKit/qt/Api/qwebsettings.cpp | 5 +- Source/WebKit/qt/Api/qwebsettings.h | 3 +- Source/WebKit/qt/WidgetApi/qwebpage.cpp | 2 +- Source/WebKit/qt/tests/CMakeLists.txt | 2 + .../qgraphicswebview/tst_qgraphicswebview.cpp | 1 + .../qt/tests/qwebelement/tst_qwebelement.cpp | 6 +-- Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 30 +++++++---- .../qt/tests/qwebhistory/tst_qwebhistory.cpp | 8 +-- .../tst_qwebhistoryinterface.cpp | 7 +-- Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 62 +++------------------- .../qwebsecurityorigin/tst_qwebsecurityorigin.cpp | 4 +- Tools/Scripts/webkitperl/FeatureList.pm | 2 +- Tools/qmake/mkspecs/features/functions.prf | 2 +- Tools/qt/jhbuild-qt-5.4.modules | 1 + Tools/qt/jhbuild.modules | 61 ++++----------------- .../qt/patches/fontconfig-2.11.1-no-bitmaps.patch | 10 ---- Tools/qt/patches/openwebrtc-no-gtk-doc.patch | 60 --------------------- Tools/qt/patches/qtbase-5.4-fix-QTBUG-77231.patch | 50 +++++++++++++++++ Tools/qt/update-wip-qtwebkit-refs | 47 ++++++++++++++++ 22 files changed, 166 insertions(+), 218 deletions(-) delete mode 100644 Tools/qt/patches/fontconfig-2.11.1-no-bitmaps.patch delete mode 100644 Tools/qt/patches/openwebrtc-no-gtk-doc.patch create mode 100644 Tools/qt/patches/qtbase-5.4-fix-QTBUG-77231.patch create mode 100755 Tools/qt/update-wip-qtwebkit-refs diff --git a/Source/WebCore/platform/graphics/qt/GradientQt.cpp b/Source/WebCore/platform/graphics/qt/GradientQt.cpp index 3412cfadd..2c3dec5ba 100644 --- a/Source/WebCore/platform/graphics/qt/GradientQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GradientQt.cpp @@ -66,6 +66,10 @@ QGradient* Gradient::platformGradient() qreal lastStop(0.0); const qreal lastStopDiff = 0.0000001; while (stopIterator != m_stops.end()) { + // Drop gradient stops after 1.0 to avoid overwriting color at 1.0 + if (lastStop >= 1) + break; + stopColor.setRgbF(stopIterator->red, stopIterator->green, stopIterator->blue, stopIterator->alpha); if (qFuzzyCompare(lastStop, qreal(stopIterator->stop))) lastStop = stopIterator->stop + lastStopDiff; @@ -78,6 +82,8 @@ QGradient* Gradient::platformGradient() lastStop += innerRadius / outerRadius; } + // Clamp stop position to 1.0, otherwise QGradient will ignore it + // https://bugs.webkit.org/show_bug.cgi?id=41484 qreal stopPosition = qMin(lastStop, qreal(1.0f)); if (m_radial && reversed) diff --git a/Source/WebCore/platform/network/qt/CookieJarQt.cpp b/Source/WebCore/platform/network/qt/CookieJarQt.cpp index d1cf87fdd..0e05e677b 100644 --- a/Source/WebCore/platform/network/qt/CookieJarQt.cpp +++ b/Source/WebCore/platform/network/qt/CookieJarQt.cpp @@ -123,7 +123,7 @@ String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const bool cookiesEnabled(const NetworkStorageSession& session, const URL& /*firstParty*/, const URL& /*url*/) { - return true; + return session.context() ? session.context()->networkAccessManager()->cookieJar() : SharedCookieJarQt::shared(); } bool getRawCookies(const NetworkStorageSession& session, const URL& /*firstParty*/, const URL& /*url*/, Vector& rawCookies) diff --git a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp index 0ce68838e..48432d974 100644 --- a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp +++ b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp @@ -588,19 +588,10 @@ void QNetworkReplyHandler::sendResponseIfNeeded() m_replyWrapper->reply()->header(QNetworkRequest::ContentLengthHeader).toLongLong(), m_replyWrapper->encoding()); - if (url.isLocalFile()) { - if (client->usesAsyncCallbacks()) { - setLoadingDeferred(true); - client->didReceiveResponseAsync(m_resourceHandle, response); - } else - client->didReceiveResponse(m_resourceHandle, response); - return; - } - - // The status code is equal to 0 for protocols not in the HTTP family. - int statusCode = m_replyWrapper->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); if (url.protocolIsInHTTPFamily()) { + // The status code is equal to 0 for protocols not in the HTTP family. + int statusCode = m_replyWrapper->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); response.setHTTPStatusCode(statusCode); response.setHTTPStatusText(m_replyWrapper->reply()->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray().constData()); 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/WidgetApi/qwebpage.cpp b/Source/WebKit/qt/WidgetApi/qwebpage.cpp index f8d8c0abc..b27ac1357 100644 --- a/Source/WebKit/qt/WidgetApi/qwebpage.cpp +++ b/Source/WebKit/qt/WidgetApi/qwebpage.cpp @@ -3219,7 +3219,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/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 a4056f996..2068eec3f 100644 --- a/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -99,10 +99,10 @@ private Q_SLOTS: 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) @@ -341,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() @@ -463,7 +473,7 @@ void tst_QWebFrame::setHtmlWithBaseURL() QDir::setCurrent(TESTS_SOURCE_DIR); - QString html("

hello world

"); + QString html("

hello world

"); QWebPage page; QWebFrame* frame = page.mainFrame(); @@ -1268,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); @@ -1277,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"); @@ -1294,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); @@ -1303,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() 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 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 760a242af..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(); @@ -217,8 +216,8 @@ private Q_SLOTS: #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("foo \">" - ""), QUrl()); + m_view->setHtml(QString("" + ""), QUrl()); QVERIFY(::waitForSignal(m_view, SIGNAL(loadFinished(bool)))); QCOMPARE(networkManager->requests.count(), 2); QList 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(); 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() diff --git a/Tools/Scripts/webkitperl/FeatureList.pm b/Tools/Scripts/webkitperl/FeatureList.pm index 067779122..919c85875 100644 --- a/Tools/Scripts/webkitperl/FeatureList.pm +++ b/Tools/Scripts/webkitperl/FeatureList.pm @@ -233,7 +233,7 @@ my @features = ( define => "ENABLE_CSS_REGIONS", default => 1, value => \$cssRegionsSupport }, { option => "css-compositing", desc => "Toggle CSS Compositing support", - define => "ENABLE_CSS_COMPOSITING", default => isAppleWebKit(), value => \$cssCompositingSupport }, + define => "ENABLE_CSS_COMPOSITING", default => (isAppleWebKit() || isQt()), value => \$cssCompositingSupport }, { option => "custom-elements", desc => "Toggle custom elements support", define => "ENABLE_CUSTOM_ELEMENTS", default => (isAppleMacWebKit() || isIOSWebKit()), value => \$customElementsSupport }, diff --git a/Tools/qmake/mkspecs/features/functions.prf b/Tools/qmake/mkspecs/features/functions.prf index 213e482d1..e3f42cec4 100644 --- a/Tools/qmake/mkspecs/features/functions.prf +++ b/Tools/qmake/mkspecs/features/functions.prf @@ -82,7 +82,7 @@ defineTest(isPlatformSupported) { } } } else { - skipBuild("MinGW build skipped.") + isGCCVersionSupported() } } else: macos { # We require macOS 10.10 (darwin version 14.0.0) or newer diff --git a/Tools/qt/jhbuild-qt-5.4.modules b/Tools/qt/jhbuild-qt-5.4.modules index 194335129..0bffc61a0 100644 --- a/Tools/qt/jhbuild-qt-5.4.modules +++ b/Tools/qt/jhbuild-qt-5.4.modules @@ -69,6 +69,7 @@ + diff --git a/Tools/qt/jhbuild.modules b/Tools/qt/jhbuild.modules index b3e0c5101..2c8ba1384 100644 --- a/Tools/qt/jhbuild.modules +++ b/Tools/qt/jhbuild.modules @@ -17,7 +17,6 @@ - @@ -75,7 +74,8 @@ - + @@ -107,22 +107,21 @@ - + + + + - - - + hash="sha256:668293fcc4b3c59765cdee5cee05941091c0879edcc24dfec5455ef83912e45c"/> - @@ -221,46 +220,6 @@ md5sum="361638fa45466c5050bcde6bfe10fa46"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tools/qt/patches/fontconfig-2.11.1-no-bitmaps.patch b/Tools/qt/patches/fontconfig-2.11.1-no-bitmaps.patch deleted file mode 100644 index 03babba2d..000000000 --- a/Tools/qt/patches/fontconfig-2.11.1-no-bitmaps.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- conf.d/Makefile.in.old 2016-06-23 19:00:01.309774583 +0300 -+++ conf.d/Makefile.in 2016-06-23 19:00:23.542159140 +0300 -@@ -341,6 +341,7 @@ - 65-fonts-persian.conf \ - 65-nonlatin.conf \ - 69-unifont.conf \ -+ 70-no-bitmaps.conf \ - 80-delicious.conf \ - 90-synthetic.conf - diff --git a/Tools/qt/patches/openwebrtc-no-gtk-doc.patch b/Tools/qt/patches/openwebrtc-no-gtk-doc.patch deleted file mode 100644 index fb665e7d2..000000000 --- a/Tools/qt/patches/openwebrtc-no-gtk-doc.patch +++ /dev/null @@ -1,60 +0,0 @@ -diff --git a/autogen.sh b/autogen.sh -index 2c45ea9..878cf05 100755 ---- a/autogen.sh -+++ b/autogen.sh -@@ -6,27 +6,42 @@ - srcdir=`dirname $0` - (test -d $srcdir/m4) || mkdir $srcdir/m4 - --pushd $srcdir > /dev/null --gtkdocize && \ --autoreconf --verbose --force --install --make || { -- echo 'autogen.sh failed'; -- exit 1; --} -- --popd > /dev/null -- --while test "x$@" != "x" ; do --optarg=`expr "x$@" : 'x[^=]*=\(.*\)'` --case "$@" in -+for ag_option in $@ -+do -+case $ag_option in - --noconfigure) - NOCONFIGURE=defined - AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --noconfigure" - echo "+ configure run disabled" -- shift -+ ;; -+ --disable-gtk-doc) -+ enable_gtk_doc=no -+ echo "+ gtk-doc disabled" - ;; - esac - done - -+pushd $srcdir > /dev/null -+ -+if test x$enable_gtk_doc = xno; then -+ if test -f gtk-doc.make; then :; else -+ echo "EXTRA_DIST = missing-gtk-doc" > gtk-doc.make -+ fi -+ echo "WARNING: You have disabled gtk-doc." -+ echo " As a result, you will not be able to generate the API" -+ echo " documentation and 'make dist' will not work." -+ echo -+else -+ gtkdocize || exit $? -+fi -+ -+autoreconf --verbose --force --install --make || { -+ echo 'autogen.sh failed'; -+ exit 1; -+} -+ -+popd > /dev/null -+ - for arg do CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $arg"; done - if test ! -z "$CONFIGURE_EXT_OPT" - then diff --git a/Tools/qt/patches/qtbase-5.4-fix-QTBUG-77231.patch b/Tools/qt/patches/qtbase-5.4-fix-QTBUG-77231.patch new file mode 100644 index 000000000..6858e585c --- /dev/null +++ b/Tools/qt/patches/qtbase-5.4-fix-QTBUG-77231.patch @@ -0,0 +1,50 @@ +--- a/src/gui/painting/qdrawhelper.cpp 2014-12-05 19:24:36.000000000 +0300 ++++ b/src/gui/painting/qdrawhelper.cpp 2019-08-03 15:31:42.034910641 +0300 +@@ -3506,8 +3506,10 @@ + } + + /* +- if Sca.Da + Dca.Sa >= Sa.Da ++ if Sca.Da + Dca.Sa > Sa.Da + Dca' = Sa.Da + Sca.(1 - Da) + Dca.(1 - Sa) ++ else if Sca == Sa ++ Dca' = Dca.Sa + Sca.(1 - Da) + Dca.(1 - Sa) + otherwise + Dca' = Dca.Sa/(1-Sca/Sa) + Sca.(1 - Da) + Dca.(1 - Sa) + */ +@@ -3518,8 +3520,10 @@ + const int src_da = src * da; + + const int temp = src * (255 - da) + dst * (255 - sa); +- if (src_da + dst_sa >= sa_da) ++ if (src_da + dst_sa > sa_da) + return qt_div_255(sa_da + temp); ++ else if (src == sa || sa == 0) ++ return qt_div_255(temp); + else + return qt_div_255(255 * dst_sa / (255 - 255 * src / sa) + temp); + } +@@ -3589,8 +3593,10 @@ + } + + /* +- if Sca.Da + Dca.Sa <= Sa.Da ++ if Sca.Da + Dca.Sa < Sa.Da + Dca' = Sca.(1 - Da) + Dca.(1 - Sa) ++ else if Sca == 0 ++ Dca' = Dca.Sa + Sca.(1 - Da) + Dca.(1 - Sa) + otherwise + Dca' = Sa.(Sca.Da + Dca.Sa - Sa.Da)/Sca + Sca.(1 - Da) + Dca.(1 - Sa) + */ +@@ -3602,8 +3608,10 @@ + + const int temp = src * (255 - da) + dst * (255 - sa); + +- if (src == 0 || src_da + dst_sa <= sa_da) ++ if (src_da + dst_sa < sa_da) + return qt_div_255(temp); ++ else if (src == 0) ++ return qt_div_255(dst_sa + temp); + return qt_div_255(sa * (src_da + dst_sa - sa_da) / src + temp); + } + diff --git a/Tools/qt/update-wip-qtwebkit-refs b/Tools/qt/update-wip-qtwebkit-refs new file mode 100755 index 000000000..b37f31ddd --- /dev/null +++ b/Tools/qt/update-wip-qtwebkit-refs @@ -0,0 +1,47 @@ +#!/usr/bin/env perl +# Copyright (C) 2019 Konstantin Tokarev +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +# THE POSSIBILITY OF SUCH DAMAGE. + +use strict; +use warnings; + +sub usage { print "Usage: $0 \n"; exit(1); } + +my ($remote, $commit) = @ARGV; +defined $remote or usage(); +defined $commit or usage(); + +print "Remote '$remote': ", `git remote get-url $remote`, "\n"; +$? == 0 or die "git exited with code $?"; + +print `git --no-pager log --color -n1 --decorate=full $commit`; +$? == 0 or die "git exited with code $?"; + +print "\nDo you really want to switch wip/qtwebkit/5.212 to this commit? [y/N]"; +my $answer = ; +chomp $answer; +lc $answer eq "y" or die "Got '$answer', exiting"; + +print "git push -f $remote $commit:refs/heads/wip/qtwebkit/5.212 && git push -f $remote $commit:refs/staging/wip/qtwebkit/5.212\n"; +`git push -f $remote $commit:refs/heads/wip/qtwebkit/5.212 && git push -f $remote $commit:refs/staging/wip/qtwebkit/5.212`; +$? == 0 or die "git exited with code $?"; -- cgit v1.2.1 From 92021cd04e8d217f9d523c091fbcdeb6d55282a8 Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Wed, 7 Aug 2019 14:23:50 +0300 Subject: Do not allow Conan to modify CMAKE_MODULE_PATH Change-Id: I750002d7e5f26e424f425e3de318ee3231dc654f Reviewed-by: Konstantin Tokarev --- Source/cmake/OptionsQt.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake index 2756a928c..35bbc70cc 100644 --- a/Source/cmake/OptionsQt.cmake +++ b/Source/cmake/OptionsQt.cmake @@ -14,7 +14,10 @@ set(PROJECT_VERSION_STRING "${PROJECT_VERSION}") set(QT_CONAN_DIR "" CACHE PATH "Directory containing conanbuildinfo.cmake and conanfile.txt") if (QT_CONAN_DIR) include("${QT_CONAN_DIR}/conanbuildinfo.cmake") + set(_BACKUP_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) conan_basic_setup() + set(CMAKE_MODULE_PATH ${_BACKUP_CMAKE_MODULE_PATH}) + unset(_BACKUP_CMAKE_MODULE_PATH) install(CODE " set(_conan_imports_dest \${CMAKE_INSTALL_PREFIX}) -- cgit v1.2.1 From 7e91d6dbd38dce4fcab9616dbf30ddc806723a8c Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Tue, 13 Aug 2019 15:43:26 +0300 Subject: Add workaround for broken libxslt include path in Conan package Addition of include/libxslt to include path causes conflict of header file names. Change-Id: Ia08553511cfb017bc32933fa7c296760a410d080 Reviewed-by: Konstantin Tokarev --- Source/cmake/OptionsQt.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake index 35bbc70cc..31f89ea82 100644 --- a/Source/cmake/OptionsQt.cmake +++ b/Source/cmake/OptionsQt.cmake @@ -14,6 +14,12 @@ set(PROJECT_VERSION_STRING "${PROJECT_VERSION}") set(QT_CONAN_DIR "" CACHE PATH "Directory containing conanbuildinfo.cmake and conanfile.txt") if (QT_CONAN_DIR) include("${QT_CONAN_DIR}/conanbuildinfo.cmake") + + # Remove this workaround when libxslt package is fixed + string(REPLACE "include/libxslt" "include" replace_CONAN_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS}) + set(CONAN_INCLUDE_DIRS ${replace_CONAN_INCLUDE_DIRS}) + + # Remove this workaround when libxml2 package is fixed set(_BACKUP_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) conan_basic_setup() set(CMAKE_MODULE_PATH ${_BACKUP_CMAKE_MODULE_PATH}) -- cgit v1.2.1 From 6bdfdd20faa222d902cfd244590bfab8776ee34a Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Tue, 13 Aug 2019 20:24:10 +0300 Subject: Don't use -fdebug-types-section on macOS It causes error with macOS 10.14 and is probably useless on older versions. Change-Id: Ibea62e531ed23015f6a20ecd119bac7e1f1e8067 Reviewed-by: Konstantin Tokarev --- Source/PlatformQt.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/PlatformQt.cmake b/Source/PlatformQt.cmake index 7f0a54272..61648331b 100644 --- a/Source/PlatformQt.cmake +++ b/Source/PlatformQt.cmake @@ -33,8 +33,12 @@ if (USE_MINIMAL_DEBUG_INFO AND CMAKE_BUILD_TYPE STREQUAL "Debug") target_compile_options(gtest PRIVATE -g0 -O1) endif () - target_compile_options(WebKit PRIVATE -g1 -O1 -fdebug-types-section) - target_compile_options(WebKit2 PRIVATE -g1 -O1 -fdebug-types-section) + target_compile_options(WebKit PRIVATE -g1 -O1) + target_compile_options(WebKit2 PRIVATE -g1 -O1) + if (NOT APPLE) + target_compile_options(WebKit PRIVATE -fdebug-types-section) + target_compile_options(WebKit2 PRIVATE -fdebug-types-section) + endif () endif () if (USE_MINIMAL_DEBUG_INFO_MSVC AND MSVC AND CMAKE_BUILD_TYPE STREQUAL "Debug") -- cgit v1.2.1 From 0b3aa2c8d05a54a0837cb5a49fd03aa4a34957f0 Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Wed, 14 Aug 2019 12:56:41 +0300 Subject: Import QtWebKit commit 423e60d5ea622069917a51229a090eae955072dc Change-Id: I05f8e1d4bcd815cc1c3ccda241aa94e608a8221e Reviewed-by: Konstantin Tokarev --- Source/WebCore/PlatformQt.cmake | 1 + .../platform/graphics/qt/FontPlatformDataQt.cpp | 4 ++- .../platform/network/qt/QNetworkReplyHandler.cpp | 35 ++++++++++++++++++++++ .../WebCore/platform/network/qt/ResourceRequest.h | 13 ++++++++ .../platform/network/qt/ResourceRequestQt.cpp | 23 +++++++------- Source/cmake/OptionsQt.cmake | 3 ++ Tools/Scripts/build-webkit | 8 ++--- Tools/Scripts/webkitdirs.pm | 7 +++++ Tools/qt/make-snapshot.pl | 2 +- 9 files changed, 77 insertions(+), 19 deletions(-) diff --git a/Source/WebCore/PlatformQt.cmake b/Source/WebCore/PlatformQt.cmake index cd2e79d5d..99c625dc3 100644 --- a/Source/WebCore/PlatformQt.cmake +++ b/Source/WebCore/PlatformQt.cmake @@ -283,6 +283,7 @@ list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES ${Qt5Gui_INCLUDE_DIRS} ${Qt5Gui_PRIVATE_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS} + ${Qt5Network_PRIVATE_INCLUDE_DIRS} ${Qt5Sensors_INCLUDE_DIRS} ${SQLITE_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS} diff --git a/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp b/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp index 2ed4a98c3..8727bccab 100644 --- a/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp +++ b/Source/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp @@ -105,7 +105,9 @@ FontPlatformData::FontPlatformData(const FontDescription& description, const Ato font.setLetterSpacing(QFont::AbsoluteSpacing, letterSpacing); if (!FontCascade::shouldUseSmoothing()) - font.setStyleStrategy(QFont::NoAntialias); + font.setStyleStrategy(static_cast(QFont::NoAntialias | QFont::ForceOutline)); + else + font.setStyleStrategy(QFont::ForceOutline); m_data->bold = font.bold(); // WebKit allows font size zero but QFont does not. We will return diff --git a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp index 48432d974..0da45fbc7 100644 --- a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp +++ b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp @@ -41,6 +41,29 @@ #include +#if USE(HTTP2) + +#include +#include + +// Redefine private bits which are not currenly exported from QtNetwork + +QT_BEGIN_NAMESPACE + +namespace Http2 { +const char *http2ParametersPropertyName = "QT_HTTP2_PARAMETERS_PROPERTY"; + +ProtocolParameters::ProtocolParameters() +{ + settingsFrameData[Settings::INITIAL_WINDOW_SIZE_ID] = qtDefaultStreamReceiveWindowSize; + settingsFrameData[Settings::ENABLE_PUSH_ID] = 0; +} +} + +QT_END_NAMESPACE + +#endif // USE(HTTP2) + static const int gMaxRedirections = 10; namespace WebCore { @@ -774,6 +797,18 @@ QNetworkReply* QNetworkReplyHandler::sendNetworkRequest(QNetworkAccessManager* m if (!manager) return 0; +#if USE(HTTP2) + static const bool alpnIsSupported = ResourceRequest::alpnIsSupported(); + if (alpnIsSupported && !manager->property(Http2::http2ParametersPropertyName).isValid()) { + Http2::ProtocolParameters params; + // QTBUG-77308 + params.maxSessionReceiveWindowSize = Http2::maxSessionReceiveWindowSize / 2; + // Enable HTTP/2 push + params.settingsFrameData[Http2::Settings::ENABLE_PUSH_ID] = 1; + manager->setProperty(Http2::http2ParametersPropertyName, QVariant::fromValue(params)); + } +#endif + const QUrl url = m_request.url(); // Post requests on files and data don't really make sense, but for diff --git a/Source/WebCore/platform/network/qt/ResourceRequest.h b/Source/WebCore/platform/network/qt/ResourceRequest.h index e74d9024c..1154d56a0 100644 --- a/Source/WebCore/platform/network/qt/ResourceRequest.h +++ b/Source/WebCore/platform/network/qt/ResourceRequest.h @@ -29,6 +29,13 @@ #include "ResourceRequestBase.h" +// HTTP/2 is implemented since Qt 5.8, but various QtNetwork bugs make it unusable in browser with Qt < 5.10.1 +// We also don't enable HTTP/2 for unencrypted connections because of possible compatibility issues; it can be +// enabled manually by user application via custom QNAM subclass +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 1) +#define USE_HTTP2 1 +#endif + QT_BEGIN_NAMESPACE class QNetworkRequest; QT_END_NAMESPACE @@ -63,6 +70,12 @@ class NetworkingContext; QNetworkRequest toNetworkRequest(NetworkingContext* = 0) const; +#if USE(HTTP2) + // Don't enable HTTP/2 when ALPN support status is unknown + static bool alpnIsSupported(); +#endif + + private: friend class ResourceRequestBase; diff --git a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp index 694e2a764..2cf2e7750 100644 --- a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp +++ b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp @@ -27,20 +27,8 @@ #include #include -// HTTP/2 is implemented since Qt 5.8, but various QtNetwork bugs make it unusable in browser with Qt < 5.10.1 -// We also don't enable HTTP/2 for unencrypted connections because of possible compatibility issues; it can be -// enabled manually by user application via custom QNAM subclass -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 1) +#if USE(HTTP2) #include -#define USE_HTTP2 1 - -// Don't enable HTTP/2 when ALPN support status is unknown -// Before QTBUG-65903 is implemented there is no better way than to check OpenSSL version -static bool alpnIsSupported() -{ - return QSslSocket::sslLibraryVersionNumber() > 0x10002000L && - QSslSocket::sslLibraryVersionString().startsWith(QLatin1String("OpenSSL")); -} #endif namespace WebCore { @@ -70,6 +58,15 @@ static inline QByteArray stringToByteArray(const String& string) return QString(string).toLatin1(); } +#if USE(HTTP2) +bool ResourceRequest::alpnIsSupported() +{ + // Before QTBUG-65903 is implemented there is no better way than to check OpenSSL version + return QSslSocket::sslLibraryVersionNumber() > 0x10002000L && + QSslSocket::sslLibraryVersionString().startsWith(QLatin1String("OpenSSL")); +} +#endif + QNetworkRequest ResourceRequest::toNetworkRequest(NetworkingContext *context) const { QNetworkRequest request; diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake index 31f89ea82..b190f2151 100644 --- a/Source/cmake/OptionsQt.cmake +++ b/Source/cmake/OptionsQt.cmake @@ -611,6 +611,9 @@ endif () find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS ${QT_REQUIRED_COMPONENTS}) CHECK_QT5_PRIVATE_INCLUDE_DIRS(Gui private/qhexstring_p.h) +if (Qt5_VERSION VERSION_GREATER 5.10.1) + CHECK_QT5_PRIVATE_INCLUDE_DIRS(Network private/http2protocol_p.h) +endif () if (ENABLE_WEBKIT2) CHECK_QT5_PRIVATE_INCLUDE_DIRS(Quick private/qsgrendernode_p.h) endif () diff --git a/Tools/Scripts/build-webkit b/Tools/Scripts/build-webkit index b8a4bd1e2..fbaee1c0d 100755 --- a/Tools/Scripts/build-webkit +++ b/Tools/Scripts/build-webkit @@ -240,10 +240,6 @@ if (isInspectorFrontend()) { } if (isCMakeBuild() && (!isAnyWindows() || isQt())) { - if ($shouldInstall) { - $makeArgs .= ($makeArgs ? " " : "") . "install"; - } - # Visual Studio generator doesn't support -j switch if (canUseNinja() || !isAnyWindows()) { # By default we build using all of the available CPUs. @@ -258,6 +254,10 @@ if (isCMakeBuild() && (!isAnyWindows() || isQt())) { removeCMakeCache(@featureArgs); buildCMakeProjectOrExit($clean, $prefixPath, $makeArgs, (cmakeBasedPortArguments(), @featureArgs), $cmakeArgs); + + if ($shouldInstall) { + installCMakeProjectOrExit(); + } } my $baseProductDir = baseProductDir(); diff --git a/Tools/Scripts/webkitdirs.pm b/Tools/Scripts/webkitdirs.pm index 84b18c7b6..afe4af015 100755 --- a/Tools/Scripts/webkitdirs.pm +++ b/Tools/Scripts/webkitdirs.pm @@ -2145,6 +2145,13 @@ sub buildCMakeProjectOrExit($$$@) return 0; } +sub installCMakeProjectOrExit +{ + my $returnCode = exitStatus(system(qw(cmake -P cmake_install.cmake))); + exit($returnCode) if $returnCode; + return 0; +} + sub cmakeBasedPortArguments() { return (); diff --git a/Tools/qt/make-snapshot.pl b/Tools/qt/make-snapshot.pl index 2c2af1a9f..8b189059c 100755 --- a/Tools/qt/make-snapshot.pl +++ b/Tools/qt/make-snapshot.pl @@ -53,7 +53,7 @@ my @commands = ( "tar -xf $src_repo/snapshot.tar --strip-components=1", "git add -A", "rm $src_repo/snapshot.tar", - "git commit -m 'Import WebKit commit $commit'" + "git commit -m 'Import QtWebKit commit $commit'" ); my $cmd = join " && ", @commands; -- cgit v1.2.1 From 7b4671c9fcfb4a49f46cf9db20373a5a230bc35b Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Wed, 14 Aug 2019 04:55:53 +0300 Subject: Use libjpeg from Conan on Windows when Qt uses bundled copy Change-Id: Ibf64e9b2c834ff613b60444676a0b70d47dde319 Reviewed-by: Konstantin Tokarev --- Tools/qmake/projects/run_cmake.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/qmake/projects/run_cmake.pro b/Tools/qmake/projects/run_cmake.pro index ff6d1d562..5cdd40a77 100644 --- a/Tools/qmake/projects/run_cmake.pro +++ b/Tools/qmake/projects/run_cmake.pro @@ -35,7 +35,7 @@ build_pass|!debug_and_release { static_runtime: CMAKE_CONFIG += USE_STATIC_RUNTIME=ON QT_FOR_CONFIG += gui-private - !qtConfig(system-jpeg):qtConfig(jpeg) { + !win32:!qtConfig(system-jpeg):qtConfig(jpeg) { # Use QImageReader for JPEG CMAKE_CONFIG += USE_LIBJPEG=OFF } -- cgit v1.2.1 From 33a5322d0126b0fcf90026b6bf26092fd78b072e Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Wed, 28 Aug 2019 01:11:34 +0300 Subject: [cmake] Fix finding static libraries of libjpeg-turbo with CMake < 3.10 Change-Id: I83f02ab897f2bbc922664387dc58835d53737f6e Reviewed-by: Konstantin Tokarev --- Source/cmake/OptionsQt.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake index b190f2151..ed7f4d52f 100644 --- a/Source/cmake/OptionsQt.cmake +++ b/Source/cmake/OptionsQt.cmake @@ -451,6 +451,8 @@ endif () find_package(Threads REQUIRED) if (USE_LIBJPEG) + # Additional names of libjpeg to search (fixed in CMake 3.12.0) + set(JPEG_NAMES jpeg-static libjpeg-static) find_package(JPEG) if (NOT JPEG_FOUND) message(FATAL_ERROR "libjpeg not found. Please make sure that CMake can find its header files and libraries, or build with -DUSE_LIBJPEG=OFF with possible degradation of user experience") -- cgit v1.2.1 From 6fb62e5afd575a380322955a0a0144e4a6f8f86d Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Mon, 2 Sep 2019 04:14:09 +0300 Subject: Import QtWebKit commit 1c054b639030b02ff98964cc915beaa45b18e6ce Change-Id: Ieac288ef14217f25da44d69e1d191c47290182c3 Reviewed-by: Konstantin Tokarev --- Source/WebCore/platform/Cursor.cpp | 8 ++- Source/WebCore/platform/Cursor.h | 5 +- .../platform/graphics/qt/GraphicsContextQt.cpp | 5 ++ Source/WebCore/platform/qt/CursorQt.cpp | 76 +++++++++++----------- .../Views/ScopeRadioButtonNavigationItem.css | 5 ++ Source/WebKit/qt/WidgetApi/qwebpage.cpp | 10 --- .../qt/WidgetSupport/InspectorClientWebPage.cpp | 14 ++++ Tools/QtTestBrowser/webpage.cpp | 21 ------ Tools/QtTestBrowser/webpage.h | 2 - 9 files changed, 73 insertions(+), 73 deletions(-) diff --git a/Source/WebCore/platform/Cursor.cpp b/Source/WebCore/platform/Cursor.cpp index 014efa5f5..722181bc1 100644 --- a/Source/WebCore/platform/Cursor.cpp +++ b/Source/WebCore/platform/Cursor.cpp @@ -154,7 +154,9 @@ Cursor::Cursor(Image* image, const IntPoint& hotSpot) #if ENABLE(MOUSE_CURSOR_SCALE) , m_imageScaleFactor(1) #endif +#if !PLATFORM(QT) , m_platformCursor(nullptr) +#endif { } @@ -164,7 +166,9 @@ Cursor::Cursor(Image* image, const IntPoint& hotSpot, float scale) , m_image(image) , m_hotSpot(determineHotSpot(image, hotSpot)) , m_imageScaleFactor(scale) +#if !PLATFORM(QT) , m_platformCursor(0) +#endif { } #endif @@ -174,7 +178,9 @@ Cursor::Cursor(Type type) #if ENABLE(MOUSE_CURSOR_SCALE) , m_imageScaleFactor(1) #endif +#if !PLATFORM(QT) , m_platformCursor(nullptr) +#endif { } @@ -182,7 +188,7 @@ Cursor::Cursor(Type type) PlatformCursor Cursor::platformCursor() const { ensurePlatformCursor(); - return m_platformCursor.get(); + return m_platformCursor ? &m_platformCursor.value() : nullptr; } #elif !PLATFORM(COCOA) diff --git a/Source/WebCore/platform/Cursor.h b/Source/WebCore/platform/Cursor.h index 86d714903..a81783e5f 100644 --- a/Source/WebCore/platform/Cursor.h +++ b/Source/WebCore/platform/Cursor.h @@ -42,6 +42,7 @@ typedef HICON HCURSOR; #include "GRefPtrGtk.h" #elif PLATFORM(QT) #include +#include #endif #if USE(APPKIT) @@ -140,7 +141,9 @@ namespace WebCore { #if ENABLE(MOUSE_CURSOR_SCALE) , m_imageScaleFactor(1) #endif +#if !PLATFORM(QT) , m_platformCursor(nullptr) +#endif #endif // !PLATFORM(IOS) { } @@ -182,7 +185,7 @@ namespace WebCore { #endif #if PLATFORM(QT) - mutable std::unique_ptr m_platformCursor; + mutable Optional m_platformCursor; #elif !USE(APPKIT) mutable PlatformCursor m_platformCursor; #else diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index 1e041050e..6bf343087 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -151,6 +151,11 @@ static inline QPainter::CompositionMode toQtCompositionMode(BlendMode op) return QPainter::CompositionMode_Difference; case BlendModeExclusion: return QPainter::CompositionMode_Exclusion; + case BlendModePlusLighter: + return QPainter::CompositionMode_Plus; + case BlendModePlusDarker: + // there is no exact match, but this is the closest + return QPainter::CompositionMode_Darken; case BlendModeHue: case BlendModeSaturation: case BlendModeColor: diff --git a/Source/WebCore/platform/qt/CursorQt.cpp b/Source/WebCore/platform/qt/CursorQt.cpp index 4a62cec82..6f27b671c 100644 --- a/Source/WebCore/platform/qt/CursorQt.cpp +++ b/Source/WebCore/platform/qt/CursorQt.cpp @@ -49,7 +49,7 @@ Cursor::Cursor(const Cursor& other) , m_image(other.m_image) , m_hotSpot(other.m_hotSpot) #ifndef QT_NO_CURSOR - , m_platformCursor(other.m_platformCursor ? std::make_unique(*other.m_platformCursor) : nullptr) + , m_platformCursor(other.m_platformCursor) #endif { } @@ -62,18 +62,18 @@ Cursor& Cursor::operator=(const Cursor& other) m_image = other.m_image; m_hotSpot = other.m_hotSpot; #ifndef QT_NO_CURSOR - m_platformCursor = other.m_platformCursor ? std::make_unique(*other.m_platformCursor) : nullptr; + m_platformCursor = other.m_platformCursor; #endif return *this; } #ifndef QT_NO_CURSOR -static std::unique_ptr createCustomCursor(Image* image, const IntPoint& hotSpot) +static Optional createCustomCursor(Image* image, const IntPoint& hotSpot) { if (!image->nativeImageForCurrentFrame()) - return nullptr; + return Nullopt; IntPoint effectiveHotSpot = determineHotSpot(image, hotSpot); - return std::make_unique(*(image->nativeImageForCurrentFrame()), effectiveHotSpot.x(), effectiveHotSpot.y()); + return QCursor(*(image->nativeImageForCurrentFrame()), effectiveHotSpot.x(), effectiveHotSpot.y()); } #endif @@ -85,117 +85,117 @@ void Cursor::ensurePlatformCursor() const switch (m_type) { case Pointer: - m_platformCursor = std::make_unique(Qt::ArrowCursor); + m_platformCursor = QCursor(Qt::ArrowCursor); break; case Cross: - m_platformCursor = std::make_unique(Qt::CrossCursor); + m_platformCursor = QCursor(Qt::CrossCursor); break; case Hand: - m_platformCursor = std::make_unique(Qt::PointingHandCursor); + m_platformCursor = QCursor(Qt::PointingHandCursor); break; case IBeam: - m_platformCursor = std::make_unique(Qt::IBeamCursor); + m_platformCursor = QCursor(Qt::IBeamCursor); break; case Wait: - m_platformCursor = std::make_unique(Qt::WaitCursor); + m_platformCursor = QCursor(Qt::WaitCursor); break; case Help: - m_platformCursor = std::make_unique(Qt::WhatsThisCursor); + m_platformCursor = QCursor(Qt::WhatsThisCursor); break; case EastResize: case EastPanning: - m_platformCursor = std::make_unique(Qt::SizeHorCursor); + m_platformCursor = QCursor(Qt::SizeHorCursor); break; case NorthResize: case NorthPanning: - m_platformCursor = std::make_unique(Qt::SizeVerCursor); + m_platformCursor = QCursor(Qt::SizeVerCursor); break; case NorthEastResize: case NorthEastPanning: - m_platformCursor = std::make_unique(Qt::SizeBDiagCursor); + m_platformCursor = QCursor(Qt::SizeBDiagCursor); break; case NorthWestResize: case NorthWestPanning: - m_platformCursor = std::make_unique(Qt::SizeFDiagCursor); + m_platformCursor = QCursor(Qt::SizeFDiagCursor); break; case SouthResize: case SouthPanning: - m_platformCursor = std::make_unique(Qt::SizeVerCursor); + m_platformCursor = QCursor(Qt::SizeVerCursor); break; case SouthEastResize: case SouthEastPanning: - m_platformCursor = std::make_unique(Qt::SizeFDiagCursor); + m_platformCursor = QCursor(Qt::SizeFDiagCursor); break; case SouthWestResize: case SouthWestPanning: - m_platformCursor = std::make_unique(Qt::SizeBDiagCursor); + m_platformCursor = QCursor(Qt::SizeBDiagCursor); break; case WestResize: case WestPanning: - m_platformCursor = std::make_unique(Qt::SizeHorCursor); + m_platformCursor = QCursor(Qt::SizeHorCursor); break; case NorthSouthResize: - m_platformCursor = std::make_unique(Qt::SizeVerCursor); + m_platformCursor = QCursor(Qt::SizeVerCursor); break; case EastWestResize: - m_platformCursor = std::make_unique(Qt::SizeHorCursor); + m_platformCursor = QCursor(Qt::SizeHorCursor); break; case NorthEastSouthWestResize: - m_platformCursor = std::make_unique(Qt::SizeBDiagCursor); + m_platformCursor = QCursor(Qt::SizeBDiagCursor); break; case NorthWestSouthEastResize: - m_platformCursor = std::make_unique(Qt::SizeFDiagCursor); + m_platformCursor = QCursor(Qt::SizeFDiagCursor); break; case ColumnResize: - m_platformCursor = std::make_unique(Qt::SplitHCursor); + m_platformCursor = QCursor(Qt::SplitHCursor); break; case RowResize: - m_platformCursor = std::make_unique(Qt::SplitVCursor); + m_platformCursor = QCursor(Qt::SplitVCursor); break; case MiddlePanning: case Move: - m_platformCursor = std::make_unique(Qt::SizeAllCursor); + m_platformCursor = QCursor(Qt::SizeAllCursor); break; case None: - m_platformCursor = std::make_unique(Qt::BlankCursor); + m_platformCursor = QCursor(Qt::BlankCursor); break; case NoDrop: case NotAllowed: - m_platformCursor = std::make_unique(Qt::ForbiddenCursor); + m_platformCursor = QCursor(Qt::ForbiddenCursor); break; case Grab: case Grabbing: notImplemented(); - m_platformCursor = std::make_unique(Qt::ArrowCursor); + m_platformCursor = QCursor(Qt::ArrowCursor); break; case VerticalText: - m_platformCursor = std::make_unique(QPixmap(QStringLiteral(":/webkit/resources/verticalTextCursor.png")), 7, 7); + m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/verticalTextCursor.png")), 7, 7); break; case Cell: - m_platformCursor = std::make_unique(QPixmap(QStringLiteral(":/webkit/resources/cellCursor.png")), 7, 7); + m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/cellCursor.png")), 7, 7); break; case ContextMenu: - m_platformCursor = std::make_unique(QPixmap(QStringLiteral(":/webkit/resources/contextMenuCursor.png")), 3, 2); + m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/contextMenuCursor.png")), 3, 2); break; case Alias: - m_platformCursor = std::make_unique(QPixmap(QStringLiteral(":/webkit/resources/aliasCursor.png")), 11, 3); + m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/aliasCursor.png")), 11, 3); break; case Progress: - m_platformCursor = std::make_unique(QPixmap(QStringLiteral(":/webkit/resources/progressCursor.png")), 3, 2); + m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/progressCursor.png")), 3, 2); break; case Copy: - m_platformCursor = std::make_unique(QPixmap(QStringLiteral(":/webkit/resources/copyCursor.png")), 3, 2); + m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/copyCursor.png")), 3, 2); break; case ZoomIn: - m_platformCursor = std::make_unique(QPixmap(QStringLiteral(":/webkit/resources/zoomInCursor.png")), 7, 7); + m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/zoomInCursor.png")), 7, 7); break; case ZoomOut: - m_platformCursor = std::make_unique(QPixmap(QStringLiteral(":/webkit/resources/zoomOutCursor.png")), 7, 7); + m_platformCursor = QCursor(QPixmap(QStringLiteral(":/webkit/resources/zoomOutCursor.png")), 7, 7); break; case Custom: m_platformCursor = createCustomCursor(m_image.get(), m_hotSpot); if (!m_platformCursor) - m_platformCursor = std::make_unique(Qt::ArrowCursor); + m_platformCursor = QCursor(Qt::ArrowCursor); break; default: ASSERT_NOT_REACHED(); diff --git a/Source/WebInspectorUI/UserInterface/Views/ScopeRadioButtonNavigationItem.css b/Source/WebInspectorUI/UserInterface/Views/ScopeRadioButtonNavigationItem.css index b8103cb08..8c42ce8f2 100644 --- a/Source/WebInspectorUI/UserInterface/Views/ScopeRadioButtonNavigationItem.css +++ b/Source/WebInspectorUI/UserInterface/Views/ScopeRadioButtonNavigationItem.css @@ -40,6 +40,11 @@ outline: none; } +.scope-radio-button-navigation-item > .scope-radio-button-item-select option { + background: Window; + color: WindowText; +} + /* Positions the "Style" text almost exactly over the radio-button-item */ .scope-radio-button-navigation-item > .scope-radio-button-item-select:focus { top: -3px; diff --git a/Source/WebKit/qt/WidgetApi/qwebpage.cpp b/Source/WebKit/qt/WidgetApi/qwebpage.cpp index b27ac1357..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 diff --git a/Source/WebKit/qt/WidgetSupport/InspectorClientWebPage.cpp b/Source/WebKit/qt/WidgetSupport/InspectorClientWebPage.cpp index 8e5427b23..9b2ba7dfd 100644 --- a/Source/WebKit/qt/WidgetSupport/InspectorClientWebPage.cpp +++ b/Source/WebKit/qt/WidgetSupport/InspectorClientWebPage.cpp @@ -41,7 +41,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) diff --git a/Tools/QtTestBrowser/webpage.cpp b/Tools/QtTestBrowser/webpage.cpp index a0efed1d8..6188e4ca2 100644 --- a/Tools/QtTestBrowser/webpage.cpp +++ b/Tools/QtTestBrowser/webpage.cpp @@ -80,27 +80,6 @@ void WebPage::applyProxy() } } -bool WebPage::supportsExtension(QWebPage::Extension extension) const -{ - if (extension == ChooseMultipleFilesExtension || extension == QWebPage::ErrorPageExtension) - return true; - return false; -} - -bool WebPage::extension(Extension extension, const ExtensionOption* option, ExtensionReturn* output) -{ - if (extension == ChooseMultipleFilesExtension) - return QWebPage::extension(extension, option, output); - - const QWebPage::ErrorPageExtensionOption* info = static_cast(option); - QWebPage::ErrorPageExtensionReturn* errorPage = static_cast(output); - - errorPage->content = QString("Failed loading page%1") - .arg(info->errorString).toUtf8(); - - return true; -} - bool WebPage::acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest& request, NavigationType type) { QObject* view = parent(); diff --git a/Tools/QtTestBrowser/webpage.h b/Tools/QtTestBrowser/webpage.h index 0238354aa..77a19c14f 100644 --- a/Tools/QtTestBrowser/webpage.h +++ b/Tools/QtTestBrowser/webpage.h @@ -46,8 +46,6 @@ public: QWebPage* createWindow(QWebPage::WebWindowType) override; QObject* createPlugin(const QString&, const QUrl&, const QStringList&, const QStringList&) override; - bool supportsExtension(QWebPage::Extension) const override; - bool extension(Extension, const ExtensionOption*, ExtensionReturn*) override; bool acceptNavigationRequest(QWebFrame*, const QNetworkRequest&, NavigationType) override; -- cgit v1.2.1 From 2c94535e5c4dc6ad22bc2f34f76f5a5da6cf652e Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Thu, 5 Sep 2019 00:35:09 +0300 Subject: [cmake] Fix suffix of MinGW import libraries QMake doesn't treat import libraries as a separate product kind, while CMake by default uses different ".dll.a" suffix for them. Change-Id: Icc77b6b1fa050d29781211ed961ba005e0b689e9 Reviewed-by: Konstantin Tokarev --- Source/cmake/OptionsQt.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake index ed7f4d52f..d582ead76 100644 --- a/Source/cmake/OptionsQt.cmake +++ b/Source/cmake/OptionsQt.cmake @@ -153,6 +153,7 @@ if (COMPILER_IS_GCC_OR_CLANG) add_definitions(-DQT_NO_DYNAMIC_CAST) endif () +# Align build product names with QMake conventions if (WIN32) if (${CMAKE_BUILD_TYPE} MATCHES "Debug") set(CMAKE_DEBUG_POSTFIX d) @@ -160,6 +161,8 @@ if (WIN32) set(CMAKE_SHARED_LIBRARY_PREFIX "") set(CMAKE_SHARED_MODULE_PREFIX "") + # QMake doesn't treat import libraries as a separate product kind + set(CMAKE_IMPORT_LIBRARY_SUFFIX "${CMAKE_STATIC_LIBRARY_SUFFIX}") endif () WEBKIT_OPTION_BEGIN() -- cgit v1.2.1 From 34c2a6ebc0d579f08c18ce4e895fd3a9fadf7370 Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Thu, 5 Sep 2019 03:35:35 +0300 Subject: Import QtWebKit commit 55ed4f703de7bfbb0f554cd05dccff4c6db1bba3 Change-Id: I5063dd830f1cedda84e1ae66b0e659ffe7efa22c Reviewed-by: Konstantin Tokarev --- Source/WebInspectorUI/UserInterface/Main.html | 2 +- .../Views/ImageResourceContentView.js | 24 +++++++++++- .../WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp | 26 ++++++------- Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h | 3 ++ Source/WebKit/qt/WidgetApi/qwebframe.h | 4 ++ .../qt/WidgetSupport/InspectorClientWebPage.cpp | 44 ++++++++++++++++++++++ .../qt/WidgetSupport/InspectorClientWebPage.h | 7 ++++ Source/cmake/OptionsQt.cmake | 5 ++- 8 files changed, 98 insertions(+), 17 deletions(-) diff --git a/Source/WebInspectorUI/UserInterface/Main.html b/Source/WebInspectorUI/UserInterface/Main.html index f080f7f55..8718f7941 100644 --- a/Source/WebInspectorUI/UserInterface/Main.html +++ b/Source/WebInspectorUI/UserInterface/Main.html @@ -26,7 +26,7 @@ - + diff --git a/Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js b/Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js index 54fb13a85..be8b2ad63 100644 --- a/Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js +++ b/Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js @@ -45,8 +45,28 @@ WebInspector.ImageResourceContentView = class ImageResourceContentView extends W var objectURL = this.resource.createObjectURL(); this._imageElement = document.createElement("img"); - this._imageElement.addEventListener("load", function() { URL.revokeObjectURL(objectURL); }); - this._imageElement.src = objectURL; + this._imageElement.dataset.url = this.resource.url; + + var imageElement = this._imageElement; + var xhr = new XMLHttpRequest(); + xhr.open("GET", objectURL, true); + xhr.responseType = "blob"; + xhr.onload = function() { + if (this.status == 200) { + var reader = new FileReader(); + reader.onload = function() { + imageElement.src = reader.result; + + URL.revokeObjectURL(objectURL); + } + + reader.readAsDataURL(this.response); + } else { + imageElement.addEventListener("load", function() { URL.revokeObjectURL(objectURL) }); + imageElement.src = objectURL; + } + }; + xhr.send(); this.element.appendChild(this._imageElement); } diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp index 1c14fcd07..b3b49f5d6 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp +++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp @@ -192,19 +192,6 @@ static WebCore::FrameLoadRequest frameLoadRequest(const QUrl &url, WebCore::Fram ); } -static void 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(); - } - } -} - // FIXME: Find a better place static UserContentController& userContentProvider() { @@ -1590,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/WidgetSupport/InspectorClientWebPage.cpp b/Source/WebKit/qt/WidgetSupport/InspectorClientWebPage.cpp index 9b2ba7dfd..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 +#include +#include + +#include #include +#include +#include using namespace WebKit; @@ -67,6 +74,18 @@ QWebPage* InspectorClientWebPage::createWindow(QWebPage::WebWindowType) return page; } +bool InspectorClientWebPage::event(QEvent* ev) +{ + if (ev->type() == QEvent::ContextMenu) { + auto* contextMenuEvent = static_cast(ev); + + if (contextMenuEvent) + m_clickPos = contextMenuEvent->pos(); + } + + return QWebPage::event(ev); +} + void InspectorClientWebPage::javaScriptWindowObjectCleared() { QVariant inspectorJavaScriptWindowObjects = property("_q_inspectorJavaScriptWindowObjects"); @@ -83,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(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/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake index d582ead76..0eef49095 100644 --- a/Source/cmake/OptionsQt.cmake +++ b/Source/cmake/OptionsQt.cmake @@ -33,10 +33,13 @@ if (QT_CONAN_DIR) set(_conan_imports_dest \"\${_absolute_destdir}\${_conan_imports_dest}\") endif () + message(\"Importing dependencies from conan to \${_conan_imports_dest}\") execute_process( - COMMAND conan imports -f \"${QT_CONAN_DIR}/conanfile.txt\" --dest \${_conan_imports_dest} + COMMAND conan imports --import-folder \${_conan_imports_dest} \"${QT_CONAN_DIR}/conanfile.txt\" WORKING_DIRECTORY \"${QT_CONAN_DIR}\" + RESULT_VARIABLE _conan_imports_result ) + message(\"conan imports result: \${_conan_imports_result}\") set(_conan_imports_manifest \"\${_conan_imports_dest}/conan_imports_manifest.txt\") if (EXISTS \${_conan_imports_manifest}) -- cgit v1.2.1 From 8b813e69d7764a1ad320de203fbcf17146ba469b Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Fri, 6 Sep 2019 03:30:08 +0300 Subject: [cmake] Make sure that conan executable is available If conan is missing in PATH, try using PIP3_PATH as a fallback, otherwise abort build. Change-Id: I12b8a44da677ccef1abf6e68f3b0a3f1dd99b28c Reviewed-by: Konstantin Tokarev --- Source/cmake/OptionsQt.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake index 0eef49095..7e1e55340 100644 --- a/Source/cmake/OptionsQt.cmake +++ b/Source/cmake/OptionsQt.cmake @@ -13,6 +13,10 @@ set(PROJECT_VERSION_STRING "${PROJECT_VERSION}") set(QT_CONAN_DIR "" CACHE PATH "Directory containing conanbuildinfo.cmake and conanfile.txt") if (QT_CONAN_DIR) + find_program(CONAN_COMMAND NAMES conan PATHS $ENV{PIP3_PATH}) + if (NOT CONAN_COMMAND) + message(FATAL_ERROR "conan executable not found. Make sure that Conan is installed and available in PATH") + endif () include("${QT_CONAN_DIR}/conanbuildinfo.cmake") # Remove this workaround when libxslt package is fixed @@ -35,7 +39,7 @@ if (QT_CONAN_DIR) message(\"Importing dependencies from conan to \${_conan_imports_dest}\") execute_process( - COMMAND conan imports --import-folder \${_conan_imports_dest} \"${QT_CONAN_DIR}/conanfile.txt\" + COMMAND \"${CONAN_COMMAND}\" imports --import-folder \${_conan_imports_dest} \"${QT_CONAN_DIR}/conanfile.txt\" WORKING_DIRECTORY \"${QT_CONAN_DIR}\" RESULT_VARIABLE _conan_imports_result ) -- cgit v1.2.1 From 5087e0ced43d813eb6f765913a6fc3958d2a7a9d Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Tue, 10 Sep 2019 05:01:04 +0300 Subject: Import QtWebKit commit f085f528406bf5656ce887e14c47b5e5fde4901d Change-Id: I9bd682d60cdf85d3cca75faf84fbfd151213d98e Reviewed-by: Konstantin Tokarev --- .../platform/network/qt/QNetworkReplyHandler.cpp | 6 +++--- .../platform/network/qt/ResourceRequestQt.cpp | 20 +++++++++++++++++++- Tools/QtTestBrowser/CMakeLists.txt | 4 ++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp index 0da45fbc7..792459558 100644 --- a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp +++ b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp @@ -41,7 +41,7 @@ #include -#if USE(HTTP2) +#if USE(HTTP2) && QT_VERSION < QT_VERSION_CHECK(5, 14, 0) #include #include @@ -62,7 +62,7 @@ ProtocolParameters::ProtocolParameters() QT_END_NAMESPACE -#endif // USE(HTTP2) +#endif // USE(HTTP2) && QT_VERSION < QT_VERSION_CHECK(5, 14, 0) static const int gMaxRedirections = 10; @@ -797,7 +797,7 @@ QNetworkReply* QNetworkReplyHandler::sendNetworkRequest(QNetworkAccessManager* m if (!manager) return 0; -#if USE(HTTP2) +#if USE(HTTP2) && QT_VERSION < QT_VERSION_CHECK(5, 14, 0) static const bool alpnIsSupported = ResourceRequest::alpnIsSupported(); if (alpnIsSupported && !manager->property(Http2::http2ParametersPropertyName).isValid()) { Http2::ProtocolParameters params; diff --git a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp index 2cf2e7750..310738449 100644 --- a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp +++ b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp @@ -29,7 +29,10 @@ #if USE(HTTP2) #include +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) +#include #endif +#endif // USE(HTTP2) namespace WebCore { @@ -65,6 +68,16 @@ bool ResourceRequest::alpnIsSupported() return QSslSocket::sslLibraryVersionNumber() > 0x10002000L && QSslSocket::sslLibraryVersionString().startsWith(QLatin1String("OpenSSL")); } + +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) +static QHttp2Configuration createHttp2Configuration() +{ + QHttp2Configuration params; + params.setServerPushEnabled(true); + return params; +} +#endif + #endif QNetworkRequest ResourceRequest::toNetworkRequest(NetworkingContext *context) const @@ -76,8 +89,13 @@ QNetworkRequest ResourceRequest::toNetworkRequest(NetworkingContext *context) co #if USE(HTTP2) static const bool NegotiateHttp2ForHttps = alpnIsSupported(); - if (originalUrl.protocolIs("https") && NegotiateHttp2ForHttps) + if (originalUrl.protocolIs("https") && NegotiateHttp2ForHttps) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + static const auto params = createHttp2Configuration(); + request.setHttp2Configuration(params); +#endif request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true); + } #endif // USE(HTTP2) const HTTPHeaderMap &headers = httpHeaderFields(); diff --git a/Tools/QtTestBrowser/CMakeLists.txt b/Tools/QtTestBrowser/CMakeLists.txt index ccd8e0ff2..19827fd02 100644 --- a/Tools/QtTestBrowser/CMakeLists.txt +++ b/Tools/QtTestBrowser/CMakeLists.txt @@ -48,6 +48,10 @@ qt_wrap_cpp(WebKit QtTestBrowser_SOURCES webinspector.h ) +qt5_add_resources(QtTestBrowser_SOURCES + QtTestBrowser.qrc +) + if (Qt5OpenGL_FOUND) list(APPEND QtTestBrowser_SYSTEM_INCLUDE_DIRECTORIES ${Qt5OpenGL_INCLUDE_DIRS} -- cgit v1.2.1