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.3