diff options
author | Liang Qi <liang.qi@qt.io> | 2018-01-13 21:26:34 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-01-13 21:26:34 +0100 |
commit | beaeeb99881184fd368c121fcbb1a31c78b794a3 (patch) | |
tree | 0e078499d8fe3e8627e3612537e61f2dd1029625 /Source/WebKit/qt | |
parent | f7697030f444b5e16331c6d0a99712736b9ff026 (diff) | |
parent | 79143ccfc158ec4fffc49eee600d600edb342b16 (diff) |
Merge remote-tracking branch 'origin/5.212' into dev
Change-Id: I9e64176fe95183acf5e093aa081b0a498795bdb2
Diffstat (limited to 'Source/WebKit/qt')
-rw-r--r-- | Source/WebKit/qt/Api/qwebsettings.cpp | 4 | ||||
-rw-r--r-- | Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp | 16 | ||||
-rw-r--r-- | Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h | 2 | ||||
-rw-r--r-- | Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp | 2 | ||||
-rw-r--r-- | Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp | 2 | ||||
-rw-r--r-- | Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp | 8 | ||||
-rw-r--r-- | Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h | 3 | ||||
-rw-r--r-- | Source/WebKit/qt/WidgetApi/qwebpage.cpp | 51 | ||||
-rw-r--r-- | Source/WebKit/qt/WidgetApi/qwebpage.h | 4 | ||||
-rw-r--r-- | Source/WebKit/qt/WidgetSupport/InitWebKitQt.cpp | 6 |
10 files changed, 73 insertions, 25 deletions
diff --git a/Source/WebKit/qt/Api/qwebsettings.cpp b/Source/WebKit/qt/Api/qwebsettings.cpp index e6b32f52a..d552cec17 100644 --- a/Source/WebKit/qt/Api/qwebsettings.cpp +++ b/Source/WebKit/qt/Api/qwebsettings.cpp @@ -173,10 +173,6 @@ void QWebSettingsPrivate::apply() global->attributes.value(QWebSettings::WebGLEnabled)); settings->setWebGLEnabled(value); -#if ENABLE(CSS_SHADERS) - // For now, enable CSS shaders when WebGL is enabled. - settings->setCSSCustomFilterEnabled(value); -#endif #endif #if ENABLE(WEB_AUDIO) value = attributes.value(QWebSettings::WebAudioEnabled, global->attributes.value(QWebSettings::WebAudioEnabled)); diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 50f91e203..b3209a572 100644 --- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -929,10 +929,12 @@ void FrameLoaderClientQt::convertMainResourceLoadToDownload(DocumentLoader* docu QNetworkReply* reply = handler->release(); if (reply) { - if (m_webFrame->pageAdapter->forwardUnsupportedContent) + if (m_webFrame->pageAdapter->forwardUnsupportedContent) { emit unsupportedContent(reply); - else + } else { reply->abort(); + reply->deleteLater(); + } } } @@ -1233,7 +1235,9 @@ void FrameLoaderClientQt::startDownload(const WebCore::ResourceRequest& request, if (!m_webFrame) return; - m_webFrame->pageAdapter->emitDownloadRequested(request.toNetworkRequest(m_frame->loader().networkingContext())); + QNetworkRequest r = request.toNetworkRequest(m_frame->loader().networkingContext()); + if (r.url().isValid()) + m_webFrame->pageAdapter->emitDownloadRequested(r); } RefPtr<Frame> FrameLoaderClientQt::createFrame(const URL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) @@ -1515,12 +1519,6 @@ String FrameLoaderClientQt::overrideMediaType() const return String(); } -QString FrameLoaderClientQt::chooseFile(const QString& oldFile) -{ - QStringList result = m_webFrame->pageAdapter->chooseFiles(m_webFrame, /*allowMulti*/ false, (QStringList() << oldFile)); - return result.isEmpty() ? QString() : result.first(); -} - PassRefPtr<FrameNetworkingContext> FrameLoaderClientQt::createNetworkingContext() { QVariant value = m_webFrame->pageAdapter->handle()->property("_q_MIMESniffingDisabled"); diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index a00bf6702..a20364f76 100644 --- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -214,8 +214,6 @@ public: void updateCachedDocumentLoader(DocumentLoader &) override; void prefetchDNS(const WTF::String &) override; - QString chooseFile(const QString& oldFile); - PassRefPtr<FrameNetworkingContext> createNetworkingContext() override; const URL& lastRequestedUrl() const { return m_lastRequestedUrl; } diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp index 79dfb906f..72563a1f9 100644 --- a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp @@ -357,7 +357,7 @@ void InspectorServerRequestHandlerQt::webSocketReadyRead() if (m_inspectorClient) { InspectorController& inspectorController = m_inspectorClient->m_inspectedWebPage->page->inspectorController(); - inspectorController.dispatchMessageFromFrontend(QString::fromUtf8(payload)); + inspectorController.dispatchMessageFromFrontend(String::fromUTF8(payload.data(), payload.size())); } } } diff --git a/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp index e6145b6ff..df28e9f21 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp +++ b/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp @@ -961,6 +961,8 @@ void QWebFrameAdapter::setViewportSize(const QSize& size) FrameView* view = frame->view(); ASSERT(view); view->resize(size); + if (view->needsLayout()) + view->layout(); view->adjustViewSize(); } diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp index ab9fb1382..00dc0c488 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp +++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp @@ -390,7 +390,10 @@ QString QWebPageAdapter::selectedText() const QString QWebPageAdapter::selectedHtml() const { - return page->focusController().focusedOrMainFrame().editor().selectedRange()->toHTML(); + RefPtr<Range> range = page->focusController().focusedOrMainFrame().editor().selectedRange(); + if (!range) + return QString(); + return range->toHTML(); } bool QWebPageAdapter::isContentEditable() const @@ -434,6 +437,9 @@ bool QWebPageAdapter::findText(const QString& subString, FindFlag options) if (options & FindBeginsInSelection) webCoreFindOptions |= WebCore::StartInSelection; + if (options & FindAtWordEndingsOnly) + webCoreFindOptions |= WebCore::AtWordEnds; + if (options & HighlightAllOccurrences) { if (subString.isEmpty()) { page->unmarkAllTextMatches(); diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h index 969ce8700..1b7199a9c 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h +++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h @@ -122,7 +122,8 @@ public: HighlightAllOccurrences = 8, FindAtWordBeginningsOnly = 16, TreatMedialCapitalAsWordBeginning = 32, - FindBeginsInSelection = 64 + FindBeginsInSelection = 64, + FindAtWordEndingsOnly = 128 }; // valid values matching those from ScrollTypes.h diff --git a/Source/WebKit/qt/WidgetApi/qwebpage.cpp b/Source/WebKit/qt/WidgetApi/qwebpage.cpp index be8bd3edb..f8d8c0abc 100644 --- a/Source/WebKit/qt/WidgetApi/qwebpage.cpp +++ b/Source/WebKit/qt/WidgetApi/qwebpage.cpp @@ -3161,6 +3161,50 @@ bool QWebPage::extension(Extension extension, const ExtensionOption *option, Ext } #endif + if (extension == ErrorPageExtension) { + auto* errorOption = static_cast<const ErrorPageExtensionOption*>(option); + + QString errorCode; + switch (errorOption->domain) { + case QWebPage::Http: + errorCode = tr("HTTP Error %0").arg(errorOption->error); + break; + case QWebPage::QtNetwork: + errorCode = tr("QtNetwork Error %0").arg(errorOption->error); + break; + case QWebPage::WebKit: + errorCode = tr("WebKit Error %0").arg(errorOption->error); + break; + } + + QString pageHeader = errorOption->errorString; + if (pageHeader.isEmpty()) + pageHeader = errorCode; + else if (pageHeader.endsWith(QLatin1Char('.'))) + pageHeader.chop(1); + + auto* pageOutput = static_cast<ErrorPageExtensionReturn*>(output); + pageOutput->baseUrl = errorOption->url; + QString escapedUrl = errorOption->url.toDisplayString().toHtmlEscaped(); + pageOutput->content = QStringLiteral("<html><head>" + "<meta charset=\"utf-8\">" + "<title>%0</title>" + "<style>" + "html{font-family:sans;background:#EEE;color:#000;}" + "body{max-width:600px;margin:150px auto 0;padding:10px;}" + "pre{text-align:right;color:#999;}" + "</style>" + "</head><body>" + "<h1>%0</h1><hr>" + "<p>%1</p><pre>%2</pre>" + "</body></html>").arg( + pageHeader.toHtmlEscaped(), + tr("Failed to load URL %0.").toHtmlEscaped().arg(QLatin1String("<a href=\"") + escapedUrl + QLatin1String("\">") + escapedUrl + QLatin1String("</a>")), + errorCode.toHtmlEscaped()).toUtf8(); + + return true; + } + return false; } @@ -3172,11 +3216,10 @@ bool QWebPage::extension(Extension extension, const ExtensionOption *option, Ext bool QWebPage::supportsExtension(Extension extension) const { #ifndef QT_NO_FILEDIALOG - return extension == ChooseMultipleFilesExtension; -#else - Q_UNUSED(extension); - return false; + if (extension == ChooseMultipleFilesExtension) + return true; #endif + return extension == ErrorPageExtension; } /*! diff --git a/Source/WebKit/qt/WidgetApi/qwebpage.h b/Source/WebKit/qt/WidgetApi/qwebpage.h index bff0852d7..c3e469102 100644 --- a/Source/WebKit/qt/WidgetApi/qwebpage.h +++ b/Source/WebKit/qt/WidgetApi/qwebpage.h @@ -207,7 +207,9 @@ public: HighlightAllOccurrences = 8, FindAtWordBeginningsOnly = 16, TreatMedialCapitalAsWordBeginning = 32, - FindBeginsInSelection = 64 + FindBeginsInSelection = 64, + FindAtWordEndingsOnly = 128, + FindExactMatchOnly = (FindAtWordBeginningsOnly | FindAtWordEndingsOnly) }; Q_DECLARE_FLAGS(FindFlags, FindFlag) diff --git a/Source/WebKit/qt/WidgetSupport/InitWebKitQt.cpp b/Source/WebKit/qt/WidgetSupport/InitWebKitQt.cpp index d4afa40e7..8263aa17f 100644 --- a/Source/WebKit/qt/WidgetSupport/InitWebKitQt.cpp +++ b/Source/WebKit/qt/WidgetSupport/InitWebKitQt.cpp @@ -36,8 +36,10 @@ QWEBKITWIDGETS_EXPORT void initializeWebKitWidgets() if (initialized) return; - setWebKitWidgetsInitCallback(QStyleFacadeImp::create); - initializeWebKitQt(); + if (qgetenv("QT_WEBKIT_THEME_NAME") != "mobile") { + setWebKitWidgetsInitCallback(QStyleFacadeImp::create); + initializeWebKitQt(); + } // QWebSettings::SearchCancelButtonGraphic setImagePlatformResource("searchCancelButton", QApplication::style()->standardPixmap(QStyle::SP_DialogCloseButton)); |