summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-02-08 17:31:44 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-03-15 16:52:27 +0000
commit243a2fef90dc3ac846a36738bfe97efba3050dc9 (patch)
tree9a68163527c2795f4c3ef0b11db10cc1a19f6915
parent6b35497375c07c49cca7317a4452acc6adc7a1cd (diff)
Adaptations to form validation
Form validations messages has moved entirely to being done by Blink. Change-Id: I6742c111fc59f0baba75b8b37f5d0ec9ae2fb920 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu> Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
-rw-r--r--examples/webengine/customdialogs/WebView.qml24
-rw-r--r--examples/webengine/customdialogs/doc/images/customdialogs-validation1.pngbin12523 -> 0 bytes
-rw-r--r--examples/webengine/customdialogs/doc/images/customdialogs-validation2.pngbin12171 -> 0 bytes
-rw-r--r--examples/webengine/customdialogs/doc/src/customdialogs.qdoc54
-rw-r--r--examples/webengine/customdialogs/index.html8
-rw-r--r--src/core/web_contents_adapter_client.h3
-rw-r--r--src/core/web_contents_delegate_qt.cpp32
-rw-r--r--src/core/web_contents_delegate_qt.h3
-rw-r--r--src/core/web_engine_context.cpp4
-rw-r--r--src/webengine/api/qquickwebenginedialogrequests.cpp33
-rw-r--r--src/webengine/api/qquickwebengineview.cpp44
-rw-r--r--src/webengine/api/qquickwebengineview_p_p.h4
-rw-r--r--src/webengine/doc/src/webengineview_lgpl.qdoc9
-rw-r--r--src/webengine/ui/MessageBubble.qml150
-rw-r--r--src/webengine/ui/ui.pro2
-rw-r--r--src/webengine/ui_delegates_manager.cpp34
-rw-r--r--src/webengine/ui_delegates_manager.h6
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp25
-rw-r--r--src/webenginewidgets/api/qwebenginepage_p.h3
-rw-r--r--src/webenginewidgets/api/qwebengineview.cpp8
-rw-r--r--src/webenginewidgets/ui/messagebubblewidget.cpp225
-rw-r--r--src/webenginewidgets/ui/messagebubblewidget_p.h91
-rw-r--r--src/webenginewidgets/webenginewidgets.pro6
-rw-r--r--tests/auto/quick/qmltests/data/tst_formValidation.qml120
-rw-r--r--tests/auto/quick/qmltests/qmltests.pro1
25 files changed, 13 insertions, 876 deletions
diff --git a/examples/webengine/customdialogs/WebView.qml b/examples/webengine/customdialogs/WebView.qml
index 0d3fdfacc..0715bc709 100644
--- a/examples/webengine/customdialogs/WebView.qml
+++ b/examples/webengine/customdialogs/WebView.qml
@@ -108,28 +108,4 @@ WebEngineView {
properties: {"request": request}});
}
-
- onFormValidationMessageRequested: function(request) {
- switch (request.type) {
- case FormValidationMessageRequest.Show:
- if (useDefaultDialogs)
- return;
-
- request.accepted = true;
- validationMessage.text = request.text;
- validationMessage.y = request.anchor.y + request.anchor.height + 10;
- validationMessage.visible = true;
- break;
- case FormValidationMessageRequest.Move:
- break;
- case FormValidationMessageRequest.Hide:
- validationMessage.visible = false;
- break;
- }
- }
-
- MessageRectangle {
- id: validationMessage
- z: 1
- }
}
diff --git a/examples/webengine/customdialogs/doc/images/customdialogs-validation1.png b/examples/webengine/customdialogs/doc/images/customdialogs-validation1.png
deleted file mode 100644
index 38fa86235..000000000
--- a/examples/webengine/customdialogs/doc/images/customdialogs-validation1.png
+++ /dev/null
Binary files differ
diff --git a/examples/webengine/customdialogs/doc/images/customdialogs-validation2.png b/examples/webengine/customdialogs/doc/images/customdialogs-validation2.png
deleted file mode 100644
index 247d2711b..000000000
--- a/examples/webengine/customdialogs/doc/images/customdialogs-validation2.png
+++ /dev/null
Binary files differ
diff --git a/examples/webengine/customdialogs/doc/src/customdialogs.qdoc b/examples/webengine/customdialogs/doc/src/customdialogs.qdoc
index df955ee61..ecbe36c78 100644
--- a/examples/webengine/customdialogs/doc/src/customdialogs.qdoc
+++ b/examples/webengine/customdialogs/doc/src/customdialogs.qdoc
@@ -53,7 +53,6 @@
\li JavaScript Alert, Confirm, and Prompt Dialogs
\li Color Picker Dialog
\li File Picker Dialog
- \li Form Validation Message
\endlist
\section1 Triggering Dialogs
@@ -103,7 +102,6 @@
\li JavaScriptDialogRequest
\li ColorDialogRequest
\li FileDialogRequest
- \li FormValidationMessageRequest
\endlist
\section2 Context Menu Requests
@@ -122,9 +120,8 @@
\printuntil }
\printuntil }
\dots 4
- \skipuntil onFormValidationMessageRequested
- \skipuntil }
- \skipuntil }
+ \skipuntil onFileDialogRequested
+ \skipuntil }});
\skipuntil }
\skipto }
\printline }
@@ -158,9 +155,8 @@
\printuntil }
\printuntil }
\dots 4
- \skipuntil onFormValidationMessageRequested
- \skipuntil }
- \skipuntil }
+ \skipuntil onFileDialogRequested
+ \skipuntil }});
\skipuntil }
\skipto }
\printline }
@@ -200,9 +196,8 @@
\printuntil }
\printuntil }
\dots 4
- \skipuntil onFormValidationMessageRequested
- \skipuntil }
- \skipuntil }
+ \skipuntil onFileDialogRequested
+ \skipuntil }});
\skipuntil }
\skipto }
\printline }
@@ -240,9 +235,8 @@
\printuntil }
\printuntil }
\dots 4
- \skipuntil onFormValidationMessageRequested
- \skipuntil }
- \skipuntil }
+ \skipuntil onFileDialogRequested
+ \skipuntil }});
\skipuntil }
\skipto }
\printline }
@@ -281,13 +275,7 @@
\skipto onFileDialogRequested
\printuntil }
\printuntil }
- \dots 4
- \skipuntil onFormValidationMessageRequested
- \skipuntil }
- \skipuntil }
- \skipuntil }
- \skipto }
- \printline }
+ \printuntil }
We use the \c onFileDialogRequested signal handler to check whether
we should use the default color picker dialog. If not, we accept the request
@@ -311,28 +299,4 @@
file and clicks \c OK, we pass the selected file to the \c dialogAccept
method.
- \section2 Form Validation Message Requests
-
- \image customdialogs-validation1.png
-
- \l [QML]{FormValidationMessageRequest} is a request object that is passed as a
- parameter of the WebEngineView::formValidationMessageRequested signal:
-
- \quotefromfile webengine/customdialogs/WebView.qml
- \skipto WebEngineView
- \printuntil url
- \dots 4
- \skipto onFormValidationMessageRequested
- \printuntil }
- \printuntil }
- \printuntil }
- \skipto }
- \printline }
-
- We use the \c onFormValidationMessageRequested signal handler to check
- whether we should use the default message bubble. If not, we accept the
- request and customize \c validationMessage. Depending on the type of the
- request, we show, move, or hide the message.
-
- \image customdialogs-validation2.png
*/
diff --git a/examples/webengine/customdialogs/index.html b/examples/webengine/customdialogs/index.html
index 43a2dbb67..490dd79fd 100644
--- a/examples/webengine/customdialogs/index.html
+++ b/examples/webengine/customdialogs/index.html
@@ -38,14 +38,6 @@
<td><button class="button" onclick="document.getElementById('filepicker').click()">
Open File Dialog</button></td>
</tr>
- <tr>
- <td>
- <form><table>
- <tr><td><button class="button" type="submit">Open Message Bubble</button></td></tr>
- <tr><td><input class="input" placeholder="For this field we open message bubble..." required/></td></tr>
- </table></form>
- </td>
- </tr>
</table>
<input type="color" id="colorpicker" value="#ff0000" style="visibility:hidden"/>
<input type="file" id="filepicker" accept=".cpp, .html, .h, .png, .qdoc, .qml" style="visibility:hidden"/>
diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h
index 495be3d84..899678e56 100644
--- a/src/core/web_contents_adapter_client.h
+++ b/src/core/web_contents_adapter_client.h
@@ -440,9 +440,6 @@ public:
virtual void runQuotaPermissionRequest(QSharedPointer<QuotaPermissionController>) = 0;
virtual void runRegisterProtocolHandlerPermissionRequest(QSharedPointer<RegisterProtocolHandlerPermissionController>) = 0;
virtual WebEngineSettings *webEngineSettings() const = 0;
- virtual void showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText) = 0;
- virtual void hideValidationMessage() = 0;
- virtual void moveValidationMessage(const QRect &anchor) = 0;
RenderProcessTerminationStatus renderProcessExitStatus(int);
virtual void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode) = 0;
virtual void requestGeometryChange(const QRect &geometry, const QRect &frameGeometry) = 0;
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index ed406977f..a88f7665e 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -85,16 +85,6 @@
namespace QtWebEngineCore {
-static gfx::Rect rootViewToScreenRect(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view)
-{
- RenderWidgetHostViewQt *rwhv = static_cast<RenderWidgetHostViewQt *>(web_contents->GetRenderWidgetHostView());
- if (!rwhv)
- return gfx::Rect();
- content::ScreenInfo screenInfo;
- rwhv->GetScreenInfo(&screenInfo);
- return gfx::ScaleToEnclosingRect(anchor_in_root_view, 1 / screenInfo.device_scale_factor);
-}
-
// Maps the LogSeverity defines in base/logging.h to the web engines message levels.
static WebContentsAdapterClient::JavaScriptConsoleMessageLevel mapToJavascriptConsoleMessageLevel(int32_t messageLevel) {
if (messageLevel < 1)
@@ -602,28 +592,6 @@ void WebContentsDelegateQt::launchExternalURL(const QUrl &url, ui::PageTransitio
}
}
-void WebContentsDelegateQt::ShowValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view, const base::string16 &main_text, const base::string16 &sub_text)
-{
- gfx::Rect anchor = rootViewToScreenRect(web_contents, anchor_in_root_view);
- if (anchor.IsEmpty())
- return;
- m_viewClient->showValidationMessage(toQt(anchor), toQt(main_text), toQt(sub_text));
-}
-
-void WebContentsDelegateQt::HideValidationMessage(content::WebContents *web_contents)
-{
- Q_UNUSED(web_contents);
- m_viewClient->hideValidationMessage();
-}
-
-void WebContentsDelegateQt::MoveValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view)
-{
- gfx::Rect anchor = rootViewToScreenRect(web_contents, anchor_in_root_view);
- if (anchor.IsEmpty())
- return;
- m_viewClient->moveValidationMessage(toQt(anchor));
-}
-
void WebContentsDelegateQt::BeforeUnloadFired(content::WebContents *tab, bool proceed, bool *proceed_to_fire_unload)
{
Q_UNUSED(tab);
diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h
index 3dcbf9cd8..2ef87ccd8 100644
--- a/src/core/web_contents_delegate_qt.h
+++ b/src/core/web_contents_delegate_qt.h
@@ -123,9 +123,6 @@ public:
bool IsPopupOrPanel(const content::WebContents *source) const override;
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
void RequestToLockMouse(content::WebContents *web_contents, bool user_gesture, bool last_unlocked_by_target) override;
- void ShowValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view, const base::string16 &main_text, const base::string16 &sub_text) override;
- void HideValidationMessage(content::WebContents *web_contents) override;
- void MoveValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view) override;
void BeforeUnloadFired(content::WebContents* tab, bool proceed, bool* proceed_to_fire_unload) override;
bool CheckMediaAccessPermission(content::WebContents *web_contents, const GURL& security_origin, content::MediaStreamType type) override;
void RegisterProtocolHandler(content::WebContents* web_contents, const std::string& protocol, const GURL& url, bool user_gesture) override;
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index 57248a27f..79584f55d 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -383,7 +383,6 @@ WebEngineContext::WebEngineContext()
// get rid of the warnings.
parsedCommandLine->AppendSwitch(switches::kDisableES3GLContext);
#endif
-
// Needed to allow navigations within pages that were set using setHtml(). One example is
// tst_QWebEnginePage::acceptNavigationRequest.
// This is deprecated behavior, and will be removed in a future Chromium version, as per
@@ -394,9 +393,6 @@ WebEngineContext::WebEngineContext()
// Scroll latching expects phases on all wheel events when it really only makes sense for simulated ones.
appendToFeatureSwitch(parsedCommandLine, switches::kDisableFeatures, features::kTouchpadAndWheelScrollLatching.name);
- // If the renderer renders the validation messages, we no longer get the callbacks we have in the API.
- parsedCommandLine->AppendSwitchASCII(switches::kDisableBlinkFeatures, "ValidationBubbleInRenderer");
-
if (useEmbeddedSwitches) {
appendToFeatureSwitch(parsedCommandLine, switches::kEnableFeatures, features::kOverlayScrollbar.name);
if (!parsedCommandLine->HasSwitch(switches::kDisablePinch))
diff --git a/src/webengine/api/qquickwebenginedialogrequests.cpp b/src/webengine/api/qquickwebenginedialogrequests.cpp
index c57f4c76f..b1f52a6b1 100644
--- a/src/webengine/api/qquickwebenginedialogrequests.cpp
+++ b/src/webengine/api/qquickwebenginedialogrequests.cpp
@@ -716,40 +716,11 @@ void QQuickWebEngineFileDialogRequest::dialogReject()
\instantiates QQuickWebEngineFormValidationMessageRequest
\inqmlmodule QtWebEngine
\since QtWebEngine 1.4
+ \obsolete
\brief A request for showing a HTML5 form validation message to the user.
- A FormValidationMessageRequest is passed as an argument of the
- WebEngineView::formValidationMessageRequested signal. It is generated when
- the handling of the validation message is requested.
-
- The \l accepted property of the request indicates whether the request
- is handled by the user code or the default message should be displayed.
-
- The following code uses a custom message to handle the request:
-
- \code
- WebEngineView {
- // ...
- onFormValidationMessageRequested: function(request) {
- request.accepted = true;
- switch (request.type) {
- case FormValidationMessageRequest.Show:
- validationMessage.text = request.text;
- validationMessage.x = request.x;
- validationMessage.y = request.y
- validationMessage.visible = true;
- break;
- case FormValidationMessageRequest.Move:
- break;
- case FormValidationMessageRequest.Hide:
- validationMessage.visible = false;
- break;
- }
- }
- // ...
- }
- \endcode
+ No longer used since 5.11, as Blink now renders Validation messages internally.
*/
QQuickWebEngineFormValidationMessageRequest::QQuickWebEngineFormValidationMessageRequest(
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 5e11a1c04..2fe146d4c 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -116,7 +116,6 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate()
, m_fullscreenMode(false)
, isLoading(false)
, m_activeFocusOnPress(true)
- , m_validationShowing(false)
, devicePixelRatio(QGuiApplication::primaryScreen()->devicePixelRatio())
, m_webChannel(0)
, m_webChannelWorld(0)
@@ -995,49 +994,6 @@ void QQuickWebEngineViewPrivate::didPrintPageToPdf(const QString &filePath, bool
Q_EMIT q->pdfPrintingFinished(filePath, success);
}
-void QQuickWebEngineViewPrivate::showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText)
-{
- Q_Q(QQuickWebEngineView);
- QQuickWebEngineFormValidationMessageRequest *request;
- request = new QQuickWebEngineFormValidationMessageRequest(QQuickWebEngineFormValidationMessageRequest::Show,
- anchor,mainText,subText);
- m_validationShowing = true;
- // mark the object for gc by creating temporary jsvalue
- qmlEngine(q)->newQObject(request);
- Q_EMIT q->formValidationMessageRequested(request);
- if (!request->isAccepted())
- ui()->showMessageBubble(anchor, mainText, subText);
-}
-
-void QQuickWebEngineViewPrivate::hideValidationMessage()
-{
- Q_Q(QQuickWebEngineView);
- // Suppress the initial hide message before any show messages (Since 61-based)
- if (!m_validationShowing)
- return;
- QQuickWebEngineFormValidationMessageRequest *request;
- request = new QQuickWebEngineFormValidationMessageRequest(QQuickWebEngineFormValidationMessageRequest::Hide);
- m_validationShowing = false;
- // mark the object for gc by creating temporary jsvalue
- qmlEngine(q)->newQObject(request);
- Q_EMIT q->formValidationMessageRequested(request);
- if (!request->isAccepted())
- ui()->hideMessageBubble();
-}
-
-void QQuickWebEngineViewPrivate::moveValidationMessage(const QRect &anchor)
-{
- Q_Q(QQuickWebEngineView);
- QQuickWebEngineFormValidationMessageRequest *request;
- request = new QQuickWebEngineFormValidationMessageRequest(QQuickWebEngineFormValidationMessageRequest::Move,
- anchor);
- // mark the object for gc by creating temporary jsvalue
- qmlEngine(q)->newQObject(request);
- Q_EMIT q->formValidationMessageRequested(request);
- if (!request->isAccepted())
- ui()->moveMessageBubble(anchor);
-}
-
void QQuickWebEngineViewPrivate::updateScrollPosition(const QPointF &position)
{
Q_Q(QQuickWebEngineView);
diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h
index 19cdffdea..4b8617749 100644
--- a/src/webengine/api/qquickwebengineview_p_p.h
+++ b/src/webengine/api/qquickwebengineview_p_p.h
@@ -137,9 +137,6 @@ public:
QtWebEngineCore::WebEngineSettings *webEngineSettings() const override;
void allowCertificateError(const QSharedPointer<CertificateErrorController> &errorController) override;
void runGeolocationPermissionRequest(QUrl const&) override;
- void showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText) override;
- void hideValidationMessage() override;
- void moveValidationMessage(const QRect &anchor) override;
void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode) override;
void requestGeometryChange(const QRect &geometry, const QRect &frameGeometry) override;
void updateScrollPosition(const QPointF &position) override;
@@ -181,7 +178,6 @@ public:
bool isLoading;
bool m_activeFocusOnPress;
bool m_navigationActionTriggered;
- bool m_validationShowing;
qreal devicePixelRatio;
QMap<quint64, QJSValue> m_callbacks;
QList<QSharedPointer<CertificateErrorController> > m_certificateErrorControllers;
diff --git a/src/webengine/doc/src/webengineview_lgpl.qdoc b/src/webengine/doc/src/webengineview_lgpl.qdoc
index 761eb2a2c..1621d0821 100644
--- a/src/webengine/doc/src/webengineview_lgpl.qdoc
+++ b/src/webengine/doc/src/webengineview_lgpl.qdoc
@@ -1271,14 +1271,9 @@
/*!
\qmlsignal WebEngineView::formValidationMessageRequested(FormValidationMessageRequest request)
\since QtWebEngine 1.4
+ \obsolete
- This signal is emitted when a validation message is requested.
-
- The request can be handled by using the methods of the FormValidationMessageRequest
- type.
-
- \note Signal handlers need to call \c{request.accepted = true} to prevent a
- default dialog from showing up.
+ No longer used since 5.11, as Blink now renders Validation messages internally.
*/
/*!
diff --git a/src/webengine/ui/MessageBubble.qml b/src/webengine/ui/MessageBubble.qml
deleted file mode 100644
index 056aac1fe..000000000
--- a/src/webengine/ui/MessageBubble.qml
+++ /dev/null
@@ -1,150 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.5
-
-Item {
- id: bubble
-
- width: 1
- height: 1
-
- property int maxWidth: 0
- property string mainText: ""
- property string subText: ""
-
- property int border: 1
-
- property int arrowWidth: 18
- property int arrowHeight: 18
- property int arrowOffset: 18
-
- property int marginLeft: border + 8
- property int marginTop: border + arrowHeight + 6
- property int marginRight: border + 8
- property int marginBottom: border + 6
-
- Column {
- id: messageColumn
-
- x: bubble.marginLeft
- y: bubble.marginTop
- z: 1
-
- spacing: 5
-
- Text {
- id: message
- width: bubble.maxWidth
-
- wrapMode: Text.WordWrap
- elide: Text.ElideNone
- clip: true
-
- font.pointSize: subMessage.font.pointSize + 4
-
- text: bubble.mainText
- }
-
- Text {
- id: subMessage
- width: bubble.maxWidth
-
- wrapMode: Text.WordWrap
- elide: Text.ElideNone
- clip: true
-
- text: bubble.subText
- }
- }
-
- Canvas {
- id: bubbleCanvas
-
- property int textWidth: Math.min(bubble.maxWidth, Math.max(message.paintedWidth, subMessage.paintedWidth))
- property int textHeight: message.paintedHeight + (subMessage.paintedWidth > 0 ? (messageColumn.spacing + subMessage.paintedHeight) : 0)
-
- width: textWidth + bubble.marginLeft + bubble.marginRight
- height: textHeight + bubble.marginTop + bubble.marginBottom
-
- property int cornerRadius: 7
-
- property int messageBoxLeft: 0
- property int messageBoxTop: bubble.arrowHeight
- property int messageBoxRight: width - border
- property int messageBoxBottom: height - border
-
- onPaint: {
- var ctx = getContext("2d");
-
- ctx.lineWidth = bubble.border;
- ctx.strokeStyle = "#555";
- ctx.fillStyle = "#ffffe1";
-
- ctx.beginPath();
-
- ctx.moveTo(messageBoxLeft + cornerRadius, messageBoxTop);
-
- // Arrow
- ctx.lineTo(messageBoxLeft + bubble.arrowOffset, messageBoxTop);
- ctx.lineTo(messageBoxLeft + bubble.arrowOffset, messageBoxTop - bubble.arrowHeight);
- ctx.lineTo(messageBoxLeft + bubble.arrowOffset + bubble.arrowWidth, messageBoxTop);
-
- // Message Box
- ctx.lineTo(messageBoxRight - cornerRadius, messageBoxTop);
- ctx.quadraticCurveTo(messageBoxRight, messageBoxTop, messageBoxRight, messageBoxTop + cornerRadius);
- ctx.lineTo(messageBoxRight, messageBoxBottom - cornerRadius);
- ctx.quadraticCurveTo(messageBoxRight, messageBoxBottom, messageBoxRight - cornerRadius, messageBoxBottom);
- ctx.lineTo(messageBoxLeft + cornerRadius, messageBoxBottom);
- ctx.quadraticCurveTo(messageBoxLeft, messageBoxBottom, messageBoxLeft, messageBoxBottom - cornerRadius);
- ctx.lineTo(messageBoxLeft, messageBoxTop + cornerRadius);
- ctx.quadraticCurveTo(messageBoxLeft, messageBoxTop, messageBoxLeft + cornerRadius, messageBoxTop);
-
- ctx.closePath();
-
- ctx.fill();
- ctx.stroke();
- }
-
- onPainted: {
- bubble.width = bubbleCanvas.width;
- bubble.height = bubbleCanvas.height;
- }
- }
-}
diff --git a/src/webengine/ui/ui.pro b/src/webengine/ui/ui.pro
index bce03cc0c..eb6bf435c 100644
--- a/src/webengine/ui/ui.pro
+++ b/src/webengine/ui/ui.pro
@@ -13,8 +13,6 @@ QML_FILES += \
Menu.qml \
MenuItem.qml \
MenuSeparator.qml \
- # Message Bubble
- MessageBubble.qml \
ToolTip.qml
load(qml_module)
diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp
index 046affbf4..12474a1f1 100644
--- a/src/webengine/ui_delegates_manager.cpp
+++ b/src/webengine/ui_delegates_manager.cpp
@@ -129,7 +129,6 @@ MenuItemHandler::MenuItemHandler(QObject *parent)
UIDelegatesManager::UIDelegatesManager(QQuickWebEngineView *view)
: m_view(view)
- , m_messageBubbleItem(0)
, m_toolTip(nullptr)
FOR_EACH_COMPONENT_TYPE(COMPONENT_MEMBER_INIT, NO_SEPARATOR)
{
@@ -535,39 +534,6 @@ void UIDelegatesManager::showMenu(QObject *menu)
QMetaObject::invokeMethod(menu, "popup");
}
-void UIDelegatesManager::showMessageBubble(const QRect &anchor, const QString &mainText, const QString &subText)
-{
- if (!ensureComponentLoaded(MessageBubble))
- return;
-
- Q_ASSERT(m_messageBubbleItem.isNull());
-
- QQmlContext *context = qmlContext(m_view);
- m_messageBubbleItem.reset(qobject_cast<QQuickItem *>(messageBubbleComponent->beginCreate(context)));
- m_messageBubbleItem->setParentItem(m_view);
- messageBubbleComponent->completeCreate();
-
- QQmlProperty(m_messageBubbleItem.data(), QStringLiteral("maxWidth")).write(anchor.size().width());
- QQmlProperty(m_messageBubbleItem.data(), QStringLiteral("mainText")).write(mainText);
- QQmlProperty(m_messageBubbleItem.data(), QStringLiteral("subText")).write(subText);
- QQmlProperty(m_messageBubbleItem.data(), QStringLiteral("x")).write(anchor.x());
- QQmlProperty(m_messageBubbleItem.data(), QStringLiteral("y")).write(anchor.y() + anchor.size().height());
-}
-
-void UIDelegatesManager::hideMessageBubble()
-{
- m_messageBubbleItem.reset();
-}
-
-void UIDelegatesManager::moveMessageBubble(const QRect &anchor)
-{
- if (m_messageBubbleItem.isNull())
- return;
-
- QQmlProperty(m_messageBubbleItem.data(), QStringLiteral("x")).write(anchor.x());
- QQmlProperty(m_messageBubbleItem.data(), QStringLiteral("y")).write(anchor.y() + anchor.size().height());
-}
-
void UIDelegatesManager::showToolTip(const QString &text)
{
if (!ensureComponentLoaded(ToolTip))
diff --git a/src/webengine/ui_delegates_manager.h b/src/webengine/ui_delegates_manager.h
index 54ecf0986..1cbf2ad28 100644
--- a/src/webengine/ui_delegates_manager.h
+++ b/src/webengine/ui_delegates_manager.h
@@ -58,7 +58,6 @@
F(ConfirmDialog, confirmDialog) SEPARATOR \
F(PromptDialog, promptDialog) SEPARATOR \
F(FilePicker, filePicker) SEPARATOR \
- F(MessageBubble, messageBubble) SEPARATOR \
F(AuthenticationDialog, authenticationDialog) SEPARATOR \
F(ToolTip, toolTip) SEPARATOR \
@@ -120,17 +119,12 @@ public:
void showDialog(QSharedPointer<AuthenticationDialogController>);
void showFilePicker(QSharedPointer<FilePickerController>);
virtual void showMenu(QObject *menu);
- void showMessageBubble(const QRect &anchor, const QString &mainText,
- const QString &subText);
- void hideMessageBubble();
- void moveMessageBubble(const QRect &anchor);
void showToolTip(const QString &text);
protected:
bool ensureComponentLoaded(ComponentType);
QQuickWebEngineView *m_view;
- QScopedPointer<QQuickItem> m_messageBubbleItem;
QScopedPointer<QObject> m_toolTip;
QStringList m_importDirs;
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index 0d5f83bba..30ccf26f2 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -64,10 +64,6 @@
#include "web_engine_settings.h"
#include "qwebenginescript.h"
-#ifdef QT_UI_DELEGATES
-#include "ui/messagebubblewidget_p.h"
-#endif
-
#include <QAction>
#include <QApplication>
#include <QAuthenticator>
@@ -1604,27 +1600,6 @@ void QWebEnginePagePrivate::javaScriptConsoleMessage(JavaScriptConsoleMessageLev
q->javaScriptConsoleMessage(static_cast<QWebEnginePage::JavaScriptConsoleMessageLevel>(level), message, lineNumber, sourceID);
}
-void QWebEnginePagePrivate::showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText)
-{
-#ifdef QT_UI_DELEGATES
- QtWebEngineWidgetUI::MessageBubbleWidget::showBubble(view, anchor, mainText, subText);
-#endif
-}
-
-void QWebEnginePagePrivate::hideValidationMessage()
-{
-#ifdef QT_UI_DELEGATES
- QtWebEngineWidgetUI::MessageBubbleWidget::hideBubble();
-#endif
-}
-
-void QWebEnginePagePrivate::moveValidationMessage(const QRect &anchor)
-{
-#ifdef QT_UI_DELEGATES
- QtWebEngineWidgetUI::MessageBubbleWidget::moveBubble(view, anchor);
-#endif
-}
-
void QWebEnginePagePrivate::renderProcessTerminated(RenderProcessTerminationStatus terminationStatus,
int exitCode)
{
diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h
index 61092fa6a..81caaf415 100644
--- a/src/webenginewidgets/api/qwebenginepage_p.h
+++ b/src/webenginewidgets/api/qwebenginepage_p.h
@@ -134,9 +134,6 @@ public:
QObject *accessibilityParentObject() override;
QtWebEngineCore::WebEngineSettings *webEngineSettings() const override;
void allowCertificateError(const QSharedPointer<CertificateErrorController> &controller) override;
- void showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText) override;
- void hideValidationMessage() override;
- void moveValidationMessage(const QRect &anchor) override;
void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode) override;
void requestGeometryChange(const QRect &geometry, const QRect &frameGeometry) override;
void updateScrollPosition(const QPointF &position) override;
diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp
index 7ea451fc5..27b0a6017 100644
--- a/src/webenginewidgets/api/qwebengineview.cpp
+++ b/src/webenginewidgets/api/qwebengineview.cpp
@@ -43,10 +43,6 @@
#include "qwebenginepage_p.h"
#include "web_contents_adapter.h"
-#ifdef QT_UI_DELEGATES
-#include "ui/messagebubblewidget_p.h"
-#endif
-
#include <QAction>
#include <QMenu>
#include <QContextMenuEvent>
@@ -149,10 +145,6 @@ QWebEngineView::~QWebEngineView()
{
Q_D(QWebEngineView);
QWebEngineViewPrivate::bind(0, d->page);
-
-#ifdef QT_UI_DELEGATES
- QtWebEngineWidgetUI::MessageBubbleWidget::hideBubble();
-#endif
}
QWebEnginePage* QWebEngineView::page() const
diff --git a/src/webenginewidgets/ui/messagebubblewidget.cpp b/src/webenginewidgets/ui/messagebubblewidget.cpp
deleted file mode 100644
index 70dada0c4..000000000
--- a/src/webenginewidgets/ui/messagebubblewidget.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "messagebubblewidget_p.h"
-
-#include "api/qwebengineview.h"
-
-#include <qglobal.h>
-#include <QBitmap>
-#include <QHBoxLayout>
-#include <QIcon>
-#include <QLabel>
-#include <QStyle>
-
-namespace QtWebEngineWidgetUI {
-
-Q_GLOBAL_STATIC(MessageBubbleWidget, bubbleInstance)
-
-void MessageBubbleWidget::showBubble(QWebEngineView *view, const QRect &anchor, const QString &mainText, const QString &subText)
-{
- hideBubble();
- if (mainText.isEmpty())
- return;
-
- bubbleInstance->createBubble(anchor.size().width(), mainText, subText);
- bubbleInstance->moveToAnchor(view, anchor);
-}
-
-void MessageBubbleWidget::hideBubble()
-{
- bubbleInstance->hide();
-}
-
-void MessageBubbleWidget::moveBubble(QWebEngineView *view, const QRect &anchor)
-{
- bubbleInstance->moveToAnchor(view, anchor);
-}
-
-MessageBubbleWidget::MessageBubbleWidget()
- : QWidget(0, Qt::ToolTip)
- , m_mainLabel(new QLabel)
- , m_subLabel(new QLabel)
-{
- QHBoxLayout *hLayout = new QHBoxLayout;
- hLayout->setAlignment(Qt::AlignTop);
- hLayout->setSizeConstraint(QLayout::SetFixedSize);
- hLayout->setMargin(3);
-
- const int iconSize = 18;
- QIcon si = style()->standardIcon(QStyle::SP_MessageBoxWarning);
-
- if (!si.isNull()) {
- QLabel *iconLabel = new QLabel(this);
- iconLabel->setPixmap(si.pixmap(iconSize, iconSize));
- iconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- iconLabel->setMargin(2);
- hLayout->addWidget(iconLabel, 0, Qt::AlignTop);
- }
-
- QVBoxLayout *vLayout = new QVBoxLayout;
-
- m_mainLabel->installEventFilter(this);
- m_mainLabel->setWordWrap(true);
- m_mainLabel->setTextFormat(Qt::PlainText);
- m_mainLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
- vLayout->addWidget(m_mainLabel.data());
-
- QFont mainFont = m_mainLabel->font();
- mainFont.setPointSize(mainFont.pointSize() + 4);
- m_mainLabel->setFont(mainFont);
-
- m_subLabel->installEventFilter(this);
- m_subLabel->setWordWrap(true);
- m_subLabel->setTextFormat(Qt::PlainText);
- m_subLabel->setAlignment(Qt::AlignBottom | Qt::AlignLeft);
- vLayout->addWidget(m_subLabel.data());
-
- hLayout->addLayout(vLayout);
- setLayout(hLayout);
-
- QPalette pal = palette();
- pal.setColor(QPalette::Window, QColor(0xff, 0xff, 0xe1));
- pal.setColor(QPalette::WindowText, Qt::black);
- setPalette(pal);
-}
-
-MessageBubbleWidget::~MessageBubbleWidget()
-{
-}
-
-void MessageBubbleWidget::paintEvent(QPaintEvent *)
-{
- QPainter painter(this);
- painter.drawPixmap(rect(), m_pixmap);
-}
-
-void MessageBubbleWidget::createBubble(const int maxWidth, const QString &mainText, const QString &subText)
-{
- m_mainLabel->setText(mainText);
- m_mainLabel->setMaximumWidth(maxWidth);
-
- m_subLabel->setText(subText);
- m_subLabel->setMaximumWidth(maxWidth);
- m_subLabel->setVisible(!subText.isEmpty());
-
- int border = 1;
- int arrowHeight = 18;
- bool roundedCorners = true;
-
-#if defined(QT_NO_XSHAPE) && defined(Q_WS_X11)
- // XShape is required for setting the mask, so we just
- // draw an ugly square when its not available
- arrowHeight = 0;
- roundedCorners = false;
-#endif
-
- setContentsMargins(border + 3, border + arrowHeight + 2, border + 3, border + 2);
- show(); // The widget should be visible for updateGeometry()
- updateGeometry();
- m_pixmap = QPixmap(sizeHint());
-
- QPainterPath path = drawBoxPath(QPoint(0, arrowHeight), border, roundedCorners);
-
- // Draw border and set background
- QPainter painter(&m_pixmap);
- painter.setPen(QPen(palette().color(QPalette::Window).darker(160), border));
- painter.setBrush(palette().color(QPalette::Window));
- painter.drawPath(path);
-}
-
-void MessageBubbleWidget::moveToAnchor(QWebEngineView *view, const QRect &anchor)
-{
- QPoint topLeft = view->mapToGlobal(anchor.topLeft());
- move(topLeft.x(), topLeft.y() + anchor.height());
-}
-
-QPainterPath MessageBubbleWidget::drawBoxPath(const QPoint &pos, int border, bool roundedCorners)
-{
- const int arrowHeight = pos.y();
- const int arrowOffset = 18;
- const int arrowWidth = 18;
-
- const int cornerRadius = roundedCorners ? 7 : 0;
-
- const int messageBoxLeft = pos.x();
- const int messageBoxTop = arrowHeight;
- const int messageBoxRight = m_pixmap.width() - 1;
- const int messageBoxBottom = m_pixmap.height() - 1;
-
- QPainterPath path;
- path.moveTo(messageBoxLeft + cornerRadius, messageBoxTop);
-
- if (arrowHeight) {
- path.lineTo(messageBoxLeft + arrowOffset, messageBoxTop);
- path.lineTo(messageBoxLeft + arrowOffset, messageBoxTop - arrowHeight);
- path.lineTo(messageBoxLeft + arrowOffset + arrowWidth, messageBoxTop);
- }
-
- if (roundedCorners) {
- path.lineTo(messageBoxRight - cornerRadius, messageBoxTop);
- path.quadTo(messageBoxRight, messageBoxTop, messageBoxRight, messageBoxTop + cornerRadius);
- path.lineTo(messageBoxRight, messageBoxBottom - cornerRadius);
- path.quadTo(messageBoxRight, messageBoxBottom, messageBoxRight - cornerRadius, messageBoxBottom);
- path.lineTo(messageBoxLeft + cornerRadius, messageBoxBottom);
- path.quadTo(messageBoxLeft, messageBoxBottom, messageBoxLeft, messageBoxBottom - cornerRadius);
- path.lineTo(messageBoxLeft, messageBoxTop + cornerRadius);
- path.quadTo(messageBoxLeft, messageBoxTop, messageBoxLeft + cornerRadius, messageBoxTop);
- } else {
- path.lineTo(messageBoxRight, messageBoxTop);
- path.lineTo(messageBoxRight, messageBoxBottom);
- path.lineTo(messageBoxLeft, messageBoxBottom);
- path.moveTo(messageBoxLeft, messageBoxTop);
- }
-
- // Set mask
- if (arrowHeight || roundedCorners) {
- QBitmap bitmap = QBitmap(sizeHint());
- bitmap.fill(Qt::color0);
- QPainter painter(&bitmap);
- painter.setPen(QPen(Qt::color1, border));
- painter.setBrush(QBrush(Qt::color1));
- painter.drawPath(path);
- setMask(bitmap);
- }
-
- return path;
-}
-
-} // namespace QtWebEngineWidgetUI
diff --git a/src/webenginewidgets/ui/messagebubblewidget_p.h b/src/webenginewidgets/ui/messagebubblewidget_p.h
deleted file mode 100644
index 6898aea13..000000000
--- a/src/webenginewidgets/ui/messagebubblewidget_p.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MESSAGEBUBBLEWIDGET_P_H
-#define MESSAGEBUBBLEWIDGET_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QWidget>
-#include <QPainterPath>
-
-QT_BEGIN_NAMESPACE
-class QLabel;
-class QWebEngineView;
-QT_END_NAMESPACE
-
-namespace QtWebEngineWidgetUI {
-
-class MessageBubbleWidget : public QWidget
-{
- Q_OBJECT
-public:
- MessageBubbleWidget();
- ~MessageBubbleWidget();
-
- static void showBubble(QWebEngineView *view, const QRect &anchor, const QString &mainText, const QString &subText = QString());
- static void hideBubble();
- static void moveBubble(QWebEngineView *view, const QRect &anchor);
-
-protected:
- void paintEvent(QPaintEvent *) override;
-
-private:
- void createBubble(const int maxWidth, const QString &mainText, const QString &subText);
- void moveToAnchor(QWebEngineView *view, const QRect &anchor);
-
- QPainterPath drawBoxPath(const QPoint &pos, int border, bool roundedCorners);
-
- QScopedPointer<QLabel> m_mainLabel;
- QScopedPointer<QLabel> m_subLabel;
- QPixmap m_pixmap;
-};
-
-} // namespace QtWebEngineWidgetUI
-
-#endif // MESSAGEBUBBLEWIDGET_P_H
diff --git a/src/webenginewidgets/webenginewidgets.pro b/src/webenginewidgets/webenginewidgets.pro
index 540c4d538..a891c062e 100644
--- a/src/webenginewidgets/webenginewidgets.pro
+++ b/src/webenginewidgets/webenginewidgets.pro
@@ -44,12 +44,6 @@ HEADERS = \
api/qwebengineview_p.h \
render_widget_host_view_qt_delegate_widget.h
-qtConfig(webengine-ui-delegates) {
- SOURCES += ui/messagebubblewidget.cpp
- HEADERS += ui/messagebubblewidget_p.h
- DEFINES += QT_UI_DELEGATES
-}
-
qtConfig(webengine-spellchecker) {
DEFINES += ENABLE_SPELLCHECK
}
diff --git a/tests/auto/quick/qmltests/data/tst_formValidation.qml b/tests/auto/quick/qmltests/data/tst_formValidation.qml
deleted file mode 100644
index 182a2eaa9..000000000
--- a/tests/auto/quick/qmltests/data/tst_formValidation.qml
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtTest 1.0
-import QtWebEngine 1.4
-
-TestWebEngineView {
- id: webEngineView
- width: 400
- height: 300
-
- SignalSpy {
- id: formValidationMessageRequestSpy
- target: webEngineView
- signalName: "formValidationMessageRequested"
- }
-
- TestCase {
- name: "WebEngineViewFormValidation"
- when: windowShown
-
- function init() {
- webEngineView.url = Qt.resolvedUrl("about:blank");
- verify(webEngineView.waitForLoadSucceeded());
- formValidationMessageRequestSpy.clear();
- }
-
- function test_urlForm() {
- webEngineView.url = Qt.resolvedUrl("forms.html#url_empty");
- verify(webEngineView.waitForLoadSucceeded());
- keyPress(Qt.Key_Enter);
- formValidationMessageRequestSpy.wait();
- compare(formValidationMessageRequestSpy.signalArguments[0][0].type, FormValidationMessageRequest.Show);
- compare(formValidationMessageRequestSpy.signalArguments[0][0].text, "Please fill out this field.");
-
- webEngineView.url = Qt.resolvedUrl("about:blank");
- verify(webEngineView.waitForLoadSucceeded());
- formValidationMessageRequestSpy.wait();
- compare(formValidationMessageRequestSpy.signalArguments[1][0].type, FormValidationMessageRequest.Hide);
-
- webEngineView.url = Qt.resolvedUrl("forms.html#url_invalid");
- verify(webEngineView.waitForLoadSucceeded());
- keyPress(Qt.Key_Enter);
- formValidationMessageRequestSpy.wait();
- compare(formValidationMessageRequestSpy.signalArguments[2][0].type, FormValidationMessageRequest.Show);
- compare(formValidationMessageRequestSpy.signalArguments[2][0].text, "Please enter a URL.");
- }
-
- function test_emailForm() {
- webEngineView.url = Qt.resolvedUrl("forms.html#email_empty");
- verify(webEngineView.waitForLoadSucceeded());
- keyPress(Qt.Key_Enter);
- formValidationMessageRequestSpy.wait();
- compare(formValidationMessageRequestSpy.signalArguments[0][0].type, FormValidationMessageRequest.Show);
- compare(formValidationMessageRequestSpy.signalArguments[0][0].text, "Please fill out this field.");
-
- webEngineView.url = Qt.resolvedUrl("about:blank");
- verify(webEngineView.waitForLoadSucceeded());
- formValidationMessageRequestSpy.wait();
- compare(formValidationMessageRequestSpy.signalArguments[1][0].type, FormValidationMessageRequest.Hide);
-
- webEngineView.url = Qt.resolvedUrl("forms.html#email_invalid");
- verify(webEngineView.waitForLoadSucceeded());
- keyPress(Qt.Key_Enter);
- formValidationMessageRequestSpy.wait();
- compare(formValidationMessageRequestSpy.signalArguments[2][0].type, FormValidationMessageRequest.Show);
- compare(formValidationMessageRequestSpy.signalArguments[2][0].text, "Please include an '@' in the email address. 'invalid' is missing an '@'.");
- }
-
- function test_textForm() {
- webEngineView.url = Qt.resolvedUrl("forms.html#input_empty");
- verify(webEngineView.waitForLoadSucceeded());
- keyPress(Qt.Key_Enter);
- formValidationMessageRequestSpy.wait();
- compare(formValidationMessageRequestSpy.signalArguments[0][0].type, FormValidationMessageRequest.Show);
- compare(formValidationMessageRequestSpy.signalArguments[0][0].text, "Please fill out this field.");
- // Title should be shown for pattern mismatch only
- compare(formValidationMessageRequestSpy.signalArguments[0][0].subText, "");
-
- webEngineView.url = Qt.resolvedUrl("about:blank");
- verify(webEngineView.waitForLoadSucceeded());
- formValidationMessageRequestSpy.wait();
- compare(formValidationMessageRequestSpy.signalArguments[1][0].type, FormValidationMessageRequest.Hide);
-
- webEngineView.url = Qt.resolvedUrl("forms.html#lorem_ipsum");
- verify(webEngineView.waitForLoadSucceeded());
- keyPress(Qt.Key_Enter);
- formValidationMessageRequestSpy.wait();
- compare(formValidationMessageRequestSpy.signalArguments[2][0].type, FormValidationMessageRequest.Show);
- compare(formValidationMessageRequestSpy.signalArguments[2][0].text, "Please match the requested format.");
- compare(formValidationMessageRequestSpy.signalArguments[2][0].subText, "Should type 'Lorem ipsum'");
- }
- }
-}
diff --git a/tests/auto/quick/qmltests/qmltests.pro b/tests/auto/quick/qmltests/qmltests.pro
index 16ecbc1bc..5395da0b5 100644
--- a/tests/auto/quick/qmltests/qmltests.pro
+++ b/tests/auto/quick/qmltests/qmltests.pro
@@ -51,7 +51,6 @@ OTHER_FILES += \
$$PWD/data/tst_filePicker.qml \
$$PWD/data/tst_findText.qml \
$$PWD/data/tst_focusOnNavigation.qml \
- $$PWD/data/tst_formValidation.qml \
$$PWD/data/tst_geopermission.qml \
$$PWD/data/tst_getUserMedia.qml \
$$PWD/data/tst_inputMethod.qml \