summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitmodules1
-rw-r--r--.qmake.conf8
-rw-r--r--README.md59
-rw-r--r--examples/webenginewidgets/browser/browserapplication.cpp12
-rw-r--r--examples/webenginewidgets/browser/browserapplication.h4
-rw-r--r--examples/webenginewidgets/browser/browsermainwindow.cpp11
-rw-r--r--examples/webenginewidgets/browser/doc/src/browser.qdoc3
-rw-r--r--examples/webenginewidgets/browser/history.cpp2
-rw-r--r--examples/webenginewidgets/browser/webview.cpp7
-rw-r--r--examples/webenginewidgets/browser/webview.h2
-rw-r--r--examples/webenginewidgets/fancybrowser/mainwindow.cpp1
m---------src/3rdparty0
-rw-r--r--src/core/browser_accessibility_qt.cpp381
-rw-r--r--src/core/browser_accessibility_qt.h39
-rw-r--r--src/core/browser_context_qt.cpp3
-rw-r--r--src/core/certificate_error_controller.cpp2
-rw-r--r--src/core/chromium_gpu_helper.cpp28
-rw-r--r--src/core/chromium_gpu_helper.h30
-rw-r--r--src/core/chromium_overrides.cpp1
-rw-r--r--src/core/config/embedded_android.pri8
-rw-r--r--src/core/config/embedded_linux.pri4
-rw-r--r--src/core/config/mac_osx.pri15
-rw-r--r--src/core/config/windows.pri12
-rw-r--r--src/core/content_browser_client_qt.cpp51
-rw-r--r--src/core/content_main_delegate_qt.cpp17
-rw-r--r--src/core/core_gyp_generator.pro2
-rw-r--r--src/core/core_module.pro6
-rw-r--r--src/core/delegated_frame_node.cpp115
-rw-r--r--src/core/delegated_frame_node.h2
-rw-r--r--src/core/gl_context_qt.cpp25
-rw-r--r--src/core/gl_surface_qt.cpp82
-rw-r--r--src/core/gyp_run.pro7
-rw-r--r--src/core/network_delegate_qt.cpp4
-rw-r--r--src/core/ozone_platform_eglfs.cpp43
-rw-r--r--src/core/ozone_platform_eglfs.h17
-rw-r--r--src/core/qtwebengine.gypi1
-rw-r--r--src/core/qtwebengine_extras.gypi3
-rw-r--r--src/core/render_widget_host_view_qt.cpp67
-rw-r--r--src/core/render_widget_host_view_qt.h9
-rw-r--r--src/core/renderer/content_renderer_client_qt.cpp11
-rw-r--r--src/core/renderer/content_renderer_client_qt.h3
-rw-r--r--src/core/renderer/qt_render_view_observer.cpp4
-rw-r--r--src/core/surface_factory_qt.cpp26
-rw-r--r--src/core/surface_factory_qt.h7
-rw-r--r--src/core/web_contents_adapter.cpp15
-rw-r--r--src/core/web_contents_adapter.h1
-rw-r--r--src/core/web_contents_adapter_client.h2
-rw-r--r--src/core/web_contents_delegate_qt.cpp58
-rw-r--r--src/core/web_contents_delegate_qt.h2
-rw-r--r--src/core/web_engine_context.cpp30
-rw-r--r--src/core/web_engine_library_info.cpp22
-rw-r--r--src/core/web_engine_settings.cpp26
-rw-r--r--src/core/yuv_video_node.cpp16
-rw-r--r--src/process/main.cpp5
-rw-r--r--src/webengine/api/qquickwebengineloadrequest.cpp18
-rw-r--r--src/webengine/api/qquickwebenginesettings.cpp256
-rw-r--r--src/webengine/api/qquickwebenginesettings_p.h115
-rw-r--r--src/webengine/api/qquickwebenginesettings_p_p.h57
-rw-r--r--src/webengine/api/qquickwebenginesingleton.cpp48
-rw-r--r--src/webengine/api/qquickwebenginesingleton_p.h56
-rw-r--r--src/webengine/api/qquickwebengineview.cpp58
-rw-r--r--src/webengine/api/qquickwebengineview_p_p.h7
-rw-r--r--src/webengine/doc/qtwebengine.qdocconf6
-rw-r--r--src/webengine/doc/src/qquickwebengineview_lgpl.qdoc160
-rw-r--r--src/webengine/plugin/experimental/experimental.pro2
-rw-r--r--src/webengine/plugin/experimental/plugin.cpp10
-rw-r--r--src/webengine/plugin/plugin.cpp12
-rw-r--r--src/webengine/plugin/plugin.pro2
-rw-r--r--src/webengine/ui_delegates_manager.cpp16
-rw-r--r--src/webengine/webengine.pro7
-rw-r--r--src/webenginewidgets/api/qwebenginehistory.h2
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp17
-rw-r--r--src/webenginewidgets/api/qwebenginepage.h14
-rw-r--r--src/webenginewidgets/api/qwebenginepage_p.h3
-rw-r--r--src/webenginewidgets/api/qwebengineview.cpp19
-rw-r--r--src/webenginewidgets/api/qwebengineview.h9
-rw-r--r--src/webenginewidgets/doc/qtwebenginewidgets.qdocconf6
-rw-r--r--src/webenginewidgets/doc/snippets/qtwebengine_build_snippet.qdoc4
-rw-r--r--src/webenginewidgets/doc/snippets/qtwebengine_qwebenginepage_snippet.cpp38
-rw-r--r--src/webenginewidgets/doc/snippets/qtwebengine_qwebengineview_snippet.cpp3
-rw-r--r--src/webenginewidgets/doc/src/qtwebenginewidgets.qdoc46
-rw-r--r--src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc275
-rw-r--r--src/webenginewidgets/doc/src/qwebenginehistory_lgpl.qdoc4
-rw-r--r--src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc36
-rw-r--r--src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc198
-rw-r--r--src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc28
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp7
-rw-r--r--src/webenginewidgets/webenginewidgets.pro2
-rw-r--r--tests/auto/quick/qmltests/data/tst_loadFail.qml11
-rw-r--r--tests/auto/quick/qmltests/data/tst_loadUrl.qml5
-rw-r--r--tests/auto/quick/qmltests/qmltests.pro1
-rw-r--r--tests/auto/quick/shared/qt_webengine_quicktest.h1
-rw-r--r--tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp74
-rw-r--r--tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp44
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp48
-rw-r--r--tests/quicktestbrowser/quickwindow.qml27
-rwxr-xr-xtools/buildscripts/gyp_qtwebengine12
-rw-r--r--tools/qmake/mkspecs/features/functions.prf17
-rw-r--r--tools/qmake/mkspecs/features/gyp_generator.prf24
-rw-r--r--tools/scripts/git_submodule.py65
-rwxr-xr-xtools/scripts/init-repository.py (renamed from init-repository.py)58
-rwxr-xr-xtools/scripts/take_snapshot.py35
-rw-r--r--tools/scripts/version_resolver.py67
103 files changed, 2525 insertions, 817 deletions
diff --git a/.gitmodules b/.gitmodules
index 041bf54d9..599c0a0d6 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -2,3 +2,4 @@
path = src/3rdparty
url = ../qtwebengine-chromium.git
ignore = all
+ initrepo = true
diff --git a/.qmake.conf b/.qmake.conf
index 005d226fc..cbd25f247 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -2,10 +2,4 @@ QMAKEPATH += $$PWD/tools/qmake
load(qt_build_config)
CONFIG += qt_example_installs
-# We released 1.0.0 together with 5.4.0. Since then we're 4 majors
-# and 4 minors behind, until we need to release standalone.
-QTWEBENGINE_MAJOR = $$system(python -c \"print($$QT_MAJOR_VERSION - 4)\")
-QTWEBENGINE_MINOR = $$system(python -c \"print($$QT_MINOR_VERSION - 4)\")
-QTWEBENGINE_PATCH = $$QT_PATCH_VERSION
-
-MODULE_VERSION = $${QTWEBENGINE_MAJOR}.$${QTWEBENGINE_MINOR}.$${QTWEBENGINE_PATCH}
+MODULE_VERSION = 5.4.0
diff --git a/README.md b/README.md
deleted file mode 100644
index 4861b8f9d..000000000
--- a/README.md
+++ /dev/null
@@ -1,59 +0,0 @@
-# QtWebEngine - Combining the power of Chromium and Qt #
-
-
-To be able to build QtWebEngine you need Qt 5.2 or newer.
-
-## I. Getting the Code ##
-
-### 1) Clone the QtWebEngine repository ###
-
- git clone git://gitorious.org/qt/qtwebengine.git
-
-### 2) Initialize the repository ###
-
-This will fetch a snapshot of chromium sources we rely on.
-
- ./init-repository.py
-
-## II. Build Instructions##
-
-### 1) Generate the ninja build files by running qmake. ###
-
-It's a also possible to use qmake -r to forcefully re-gyp (without relying on make to determine if it's necessary).
-
- qmake
-
-### 2) build with make ###
-
-Everything should be set up properly now.
-
- make
-
-### 3) [optional] make install ###
-
-This step is required for installing l10n files and other resources (such as the resources for the remote inspector).
-
- make install
-
-## Additional tips and tricks ##
-
-### Complete Upstream Chromium Checkout ###
-If you want to have a complete chromium checkout with the complete history instead of the snapshot,
-then you can run the init-repository script with the -u option.
-
-This will then create a complete ninja and chromium checkout in the subdirectory src/3rdparty\_upstream.
-qmake will automatically pickup the location and make use of the sources in the subsequent steps II.1) and II.2).
-
- ./init-repository.py -u
-
-### Use external Chromium sources ###
-If you want to use external chromium sources instead of the submodule provided in the QtWebEngine repository,
-you can export the CHROMIUM\_SRC\_DIR variable point it to your source directory.
-
-### Debug vs. Release builds ###
-
-By default, the configuration used for building Qt is followed.
-It is possible to override this by passing CONFIG+=release or debug at qmake time. e.g:
-
- qmake -r CONFIG+=debug
-
diff --git a/examples/webenginewidgets/browser/browserapplication.cpp b/examples/webenginewidgets/browser/browserapplication.cpp
index 14023f6e7..44713901d 100644
--- a/examples/webenginewidgets/browser/browserapplication.cpp
+++ b/examples/webenginewidgets/browser/browserapplication.cpp
@@ -104,7 +104,7 @@ BrowserApplication::BrowserApplication(int &argc, char **argv)
return;
}
-#if defined(Q_WS_MAC)
+#if defined(Q_OS_OSX)
QApplication::setQuitOnLastWindowClosed(false);
#else
QApplication::setQuitOnLastWindowClosed(true);
@@ -138,7 +138,7 @@ BrowserApplication::BrowserApplication(int &argc, char **argv)
m_lastSession = settings.value(QLatin1String("lastSession")).toByteArray();
settings.endGroup();
-#if defined(Q_WS_MAC)
+#if defined(Q_OS_OSX)
connect(this, SIGNAL(lastWindowClosed()),
this, SLOT(lastWindowClosed()));
#endif
@@ -157,7 +157,7 @@ BrowserApplication::~BrowserApplication()
delete s_bookmarksManager;
}
-#if defined(Q_WS_MAC)
+#if defined(Q_OS_OSX)
void BrowserApplication::lastWindowClosed()
{
clean();
@@ -172,7 +172,7 @@ BrowserApplication *BrowserApplication::instance()
return (static_cast<BrowserApplication *>(QCoreApplication::instance()));
}
-#if defined(Q_WS_MAC)
+#if defined(Q_OS_OSX)
#include <QtWidgets/QMessageBox>
void BrowserApplication::quitBrowser()
{
@@ -344,7 +344,7 @@ void BrowserApplication::installTranslator(const QString &name)
QApplication::installTranslator(translator);
}
-#if defined(Q_WS_MAC)
+#if defined(Q_OS_OSX)
bool BrowserApplication::event(QEvent* event)
{
switch (event->type()) {
@@ -470,6 +470,8 @@ QIcon BrowserApplication::icon(const QUrl &url) const
QIcon icon = QWebEngineSettings::iconForUrl(url);
if (!icon.isNull())
return icon.pixmap(16, 16);
+#else
+ Q_UNUSED(url);
#endif
return defaultIcon();
}
diff --git a/examples/webenginewidgets/browser/browserapplication.h b/examples/webenginewidgets/browser/browserapplication.h
index 777bef06e..acb03ded5 100644
--- a/examples/webenginewidgets/browser/browserapplication.h
+++ b/examples/webenginewidgets/browser/browserapplication.h
@@ -84,14 +84,14 @@ public:
static QNetworkAccessManager *networkAccessManager();
static BookmarksManager *bookmarksManager();
-#if defined(Q_WS_MAC)
+#if defined(Q_OS_OSX)
bool event(QEvent *event);
#endif
public slots:
BrowserMainWindow *newMainWindow();
void restoreLastSession();
-#if defined(Q_WS_MAC)
+#if defined(Q_OS_OSX)
void lastWindowClosed();
void quitBrowser();
#endif
diff --git a/examples/webenginewidgets/browser/browsermainwindow.cpp b/examples/webenginewidgets/browser/browsermainwindow.cpp
index 85b16580f..587e66490 100644
--- a/examples/webenginewidgets/browser/browsermainwindow.cpp
+++ b/examples/webenginewidgets/browser/browsermainwindow.cpp
@@ -114,7 +114,7 @@ BrowserMainWindow::BrowserMainWindow(QWidget *parent, Qt::WindowFlags flags)
QVBoxLayout *layout = new QVBoxLayout;
layout->setSpacing(0);
layout->setMargin(0);
-#if defined(Q_WS_MAC)
+#if defined(Q_OS_OSX)
layout->addWidget(m_bookmarksToolbar);
layout->addWidget(new QWidget); // <- OS X tab widget style bug
#else
@@ -151,7 +151,7 @@ BrowserMainWindow::BrowserMainWindow(QWidget *parent, Qt::WindowFlags flags)
m_navigationBar, SLOT(setVisible(bool)));
connect(m_tabWidget, SIGNAL(toolBarVisibilityChangeRequested(bool)),
m_bookmarksToolbar, SLOT(setVisible(bool)));
-#if defined(Q_WS_MAC)
+#if defined(Q_OS_OSX)
connect(m_tabWidget, SIGNAL(lastTabClosed()),
this, SLOT(close()));
#else
@@ -302,7 +302,7 @@ void BrowserMainWindow::setupMenu()
fileMenu->addSeparator();
#endif
-#if defined(Q_WS_MAC)
+#if defined(Q_OS_OSX)
fileMenu->addAction(tr("&Quit"), BrowserApplication::instance(), SLOT(quitBrowser()), QKeySequence(Qt::CTRL | Qt::Key_Q));
#else
fileMenu->addAction(tr("&Quit"), this, SLOT(close()), QKeySequence(Qt::CTRL | Qt::Key_Q));
@@ -467,7 +467,6 @@ void BrowserMainWindow::setupMenu()
void BrowserMainWindow::setupToolBar()
{
- setUnifiedTitleAndToolBarOnMac(true);
m_navigationBar = addToolBar(tr("Navigation"));
connect(m_navigationBar->toggleViewAction(), SIGNAL(toggled(bool)),
this, SLOT(updateToolbarActionText(bool)));
@@ -621,7 +620,7 @@ void BrowserMainWindow::slotUpdateWindowTitle(const QString &title)
if (title.isEmpty()) {
setWindowTitle(tr("Qt Demo Browser"));
} else {
-#if defined(Q_WS_MAC)
+#if defined(Q_OS_OSX)
setWindowTitle(title);
#else
setWindowTitle(tr("%1 - Qt Demo Browser", "Page title and Browser name").arg(title));
@@ -849,6 +848,8 @@ void BrowserMainWindow::slotToggleInspector(bool enable)
m_tabWidget->reloadAllTabs();
}
}
+#else
+ Q_UNUSED(enable);
#endif
}
diff --git a/examples/webenginewidgets/browser/doc/src/browser.qdoc b/examples/webenginewidgets/browser/doc/src/browser.qdoc
index 85cf44b80..a8208184d 100644
--- a/examples/webenginewidgets/browser/doc/src/browser.qdoc
+++ b/examples/webenginewidgets/browser/doc/src/browser.qdoc
@@ -34,7 +34,4 @@
providing a little Web browser application with support for tabs.
\image browser-demo.png
-
- This browser is the foundation for the \l{Arora Browser}, a simple cross-platform
- Web browser.
*/
diff --git a/examples/webenginewidgets/browser/history.cpp b/examples/webenginewidgets/browser/history.cpp
index a2c25ee12..53afce398 100644
--- a/examples/webenginewidgets/browser/history.cpp
+++ b/examples/webenginewidgets/browser/history.cpp
@@ -95,6 +95,8 @@ HistoryManager::HistoryManager(QObject *parent)
#if defined(QWEBENGINEHISTORYINTERFACE)
// QWebEngineHistoryInterface will delete the history manager
QWebEngineHistoryInterface::setDefaultInterface(this);
+#else
+ Q_UNUSED(parent);
#endif
}
diff --git a/examples/webenginewidgets/browser/webview.cpp b/examples/webenginewidgets/browser/webview.cpp
index ce0f7c418..5094cfa66 100644
--- a/examples/webenginewidgets/browser/webview.cpp
+++ b/examples/webenginewidgets/browser/webview.cpp
@@ -298,6 +298,7 @@ void WebPage::authenticationRequired(const QUrl &requestUrl, QAuthenticator *aut
void WebPage::proxyAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *auth, const QString &proxyHost)
{
+ Q_UNUSED(requestUrl);
BrowserMainWindow *mainWindow = BrowserApplication::instance()->mainWindow();
QDialog dialog(mainWindow);
@@ -334,7 +335,7 @@ WebView::WebView(QWidget* parent)
connect(this, SIGNAL(loadProgress(int)),
this, SLOT(setProgress(int)));
connect(this, SIGNAL(loadFinished(bool)),
- this, SLOT(loadFinished()));
+ this, SLOT(loadFinished(bool)));
connect(page(), SIGNAL(loadingUrl(QUrl)),
this, SIGNAL(urlChanged(QUrl)));
connect(page(), SIGNAL(iconUrlChanged(QUrl)),
@@ -410,9 +411,9 @@ void WebView::setProgress(int progress)
m_progress = progress;
}
-void WebView::loadFinished()
+void WebView::loadFinished(bool success)
{
- if (100 != m_progress) {
+ if (success && 100 != m_progress) {
qWarning() << "Received finished signal while progress is still:" << progress()
<< "Url:" << url();
}
diff --git a/examples/webenginewidgets/browser/webview.h b/examples/webenginewidgets/browser/webview.h
index 2238abbd5..2cedeb79b 100644
--- a/examples/webenginewidgets/browser/webview.h
+++ b/examples/webenginewidgets/browser/webview.h
@@ -116,7 +116,7 @@ signals:
private slots:
void setProgress(int progress);
- void loadFinished();
+ void loadFinished(bool success);
void setStatusBarText(const QString &string);
void downloadRequested(const QNetworkRequest &request);
void openLinkInNewTab();
diff --git a/examples/webenginewidgets/fancybrowser/mainwindow.cpp b/examples/webenginewidgets/fancybrowser/mainwindow.cpp
index a5a359350..a311c2651 100644
--- a/examples/webenginewidgets/fancybrowser/mainwindow.cpp
+++ b/examples/webenginewidgets/fancybrowser/mainwindow.cpp
@@ -115,7 +115,6 @@ MainWindow::MainWindow(const QUrl& url)
toolsMenu->addAction(tr("Remove all embedded elements"), this, SLOT(removeEmbeddedElements()));
setCentralWidget(view);
- setUnifiedTitleAndToolBarOnMac(true);
}
//! [3]
diff --git a/src/3rdparty b/src/3rdparty
-Subproject 250eb95317140bf65dfd7b4dbc03ac20f45cde4
+Subproject 2c3ccc7994980d954ec0188ea3fa3d27424ef32
diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp
index 13f2adba5..b5cd26f2f 100644
--- a/src/core/browser_accessibility_qt.cpp
+++ b/src/core/browser_accessibility_qt.cpp
@@ -34,6 +34,10 @@
**
****************************************************************************/
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
#include "browser_accessibility_qt.h"
#include "third_party/WebKit/public/web/WebAXEnums.h"
@@ -52,6 +56,82 @@ BrowserAccessibilityQt::BrowserAccessibilityQt()
QAccessible::registerAccessibleInterface(this);
}
+// This function is taken from chromium/content/browser/accessibility/browser_accessibility_win.cc
+// see also http://www.w3.org/TR/html-aapi
+void BrowserAccessibilityQt::OnDataChanged()
+{
+ BrowserAccessibility::OnDataChanged();
+
+ // The calculation of the accessible name of an element has been
+ // standardized in the HTML to Platform Accessibility APIs Implementation
+ // Guide (http://www.w3.org/TR/html-aapi/). In order to return the
+ // appropriate accessible name on Windows, we need to apply some logic
+ // to the fields we get from WebKit.
+ //
+ // TODO(dmazzoni): move most of this logic into WebKit.
+ //
+ // WebKit gives us:
+ //
+ // name: the default name, e.g. inner text
+ // title ui element: a reference to a <label> element on the same
+ // page that labels this node.
+ // description: accessible labels that override the default name:
+ // aria-label or aria-labelledby or aria-describedby
+ // help: the value of the "title" attribute
+ //
+ // On Windows, the logic we apply lets some fields take precedence and
+ // always returns the primary name in "name" and the secondary name,
+ // if any, in "description".
+
+ int title_elem_id = GetIntAttribute(
+ ui::AX_ATTR_TITLE_UI_ELEMENT);
+ std::string help = GetStringAttribute(ui::AX_ATTR_HELP);
+ std::string description = GetStringAttribute(
+ ui::AX_ATTR_DESCRIPTION);
+
+ // WebKit annoyingly puts the title in the description if there's no other
+ // description, which just confuses the rest of the logic. Put it back.
+ // Now "help" is always the value of the "title" attribute, if present.
+ std::string title_attr;
+ if (GetHtmlAttribute("title", &title_attr) &&
+ description == title_attr &&
+ help.empty()) {
+ help = description;
+ description.clear();
+ }
+
+ // Now implement the main logic: the descripion should become the name if
+ // it's nonempty, and the help should become the description if
+ // there's no description - or the name if there's no name or description.
+ if (!description.empty()) {
+ set_name(description);
+ description.clear();
+ }
+ if (!help.empty() && description.empty()) {
+ description = help;
+ help.clear();
+ }
+ if (!description.empty() && name().empty() && !title_elem_id) {
+ set_name(description);
+ description.clear();
+ }
+
+ // If it's a text field, also consider the placeholder.
+ std::string placeholder;
+ if (GetRole() == ui::AX_ROLE_TEXT_FIELD &&
+ HasState(ui::AX_STATE_FOCUSABLE) &&
+ GetHtmlAttribute("placeholder", &placeholder)) {
+ if (name().empty() && !title_elem_id) {
+ set_name(placeholder);
+ } else if (description.empty()) {
+ description = placeholder;
+ }
+ }
+
+ SetStringAttribute(ui::AX_ATTR_DESCRIPTION, description);
+ SetStringAttribute(ui::AX_ATTR_HELP, help);
+}
+
bool BrowserAccessibilityQt::isValid() const
{
return true;
@@ -93,6 +173,22 @@ void *BrowserAccessibilityQt::interface_cast(QAccessible::InterfaceType type)
return static_cast<QAccessibleValueInterface*>(this);
break;
}
+ case QAccessible::TableInterface: {
+ QAccessible::Role r = role();
+ if (r == QAccessible::Table ||
+ r == QAccessible::List ||
+ r == QAccessible::Tree)
+ return static_cast<QAccessibleTableInterface*>(this);
+ break;
+ }
+ case QAccessible::TableCellInterface: {
+ QAccessible::Role r = role();
+ if (r == QAccessible::Cell ||
+ r == QAccessible::ListItem ||
+ r == QAccessible::TreeItem)
+ return static_cast<QAccessibleTableCellInterface*>(this);
+ break;
+ }
default:
break;
}
@@ -128,7 +224,7 @@ QString BrowserAccessibilityQt::text(QAccessible::Text t) const
{
switch (t) {
case QAccessible::Name:
- return toQt(GetStringAttribute(ui::AX_ATTR_NAME));
+ return toQt(name());
case QAccessible::Description:
return toQt(GetStringAttribute(ui::AX_ATTR_DESCRIPTION));
case QAccessible::Help:
@@ -170,38 +266,51 @@ QAccessible::Role BrowserAccessibilityQt::role() const
// These roles all directly correspond to blink accessibility roles,
// keep these alphabetical.
case ui::AX_ROLE_ALERT:
+ case ui::AX_ROLE_ALERT_DIALOG:
return QAccessible::AlertMessage;
case ui::AX_ROLE_ANNOTATION:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::StaticText;
case ui::AX_ROLE_APPLICATION:
return QAccessible::Document; // returning Application here makes Qt return the top level app object
case ui::AX_ROLE_ARTICLE:
- return QAccessible::Document; // FIXME
+ return QAccessible::Section;
case ui::AX_ROLE_BROWSER:
return QAccessible::Document; // FIXME
+ case ui::AX_ROLE_BANNER:
+ return QAccessible::Section;
case ui::AX_ROLE_BUSY_INDICATOR:
return QAccessible::Animation; // FIXME
case ui::AX_ROLE_BUTTON:
return QAccessible::Button;
+ case ui::AX_ROLE_BUTTON_DROP_DOWN:
+ return QAccessible::Button;
case ui::AX_ROLE_CANVAS:
return QAccessible::Canvas;
case ui::AX_ROLE_CELL:
return QAccessible::Cell;
case ui::AX_ROLE_CHECK_BOX:
return QAccessible::CheckBox;
+ case ui::AX_ROLE_CLIENT:
+ return QAccessible::Client;
case ui::AX_ROLE_COLOR_WELL:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::ColorChooser;
case ui::AX_ROLE_COLUMN:
return QAccessible::Column;
case ui::AX_ROLE_COLUMN_HEADER:
return QAccessible::ColumnHeader;
case ui::AX_ROLE_COMBO_BOX:
return QAccessible::ComboBox;
+ case ui::AX_ROLE_COMPLEMENTARY:
+ return QAccessible::ComplementaryContent;
+ case ui::AX_ROLE_CONTENT_INFO:
+ return QAccessible::Section;
case ui::AX_ROLE_DEFINITION:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Paragraph;
case ui::AX_ROLE_DESCRIPTION_LIST_DETAIL:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Paragraph;
case ui::AX_ROLE_DESCRIPTION_LIST_TERM:
+ return QAccessible::ListItem;
+ case ui::AX_ROLE_DESKTOP:
return QAccessible::NoRole; // FIXME
case ui::AX_ROLE_DIALOG:
return QAccessible::Dialog;
@@ -214,57 +323,69 @@ QAccessible::Role BrowserAccessibilityQt::role() const
case ui::AX_ROLE_DOCUMENT:
return QAccessible::Document;
case ui::AX_ROLE_DRAWER:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Client; // FIXME
case ui::AX_ROLE_EDITABLE_TEXT:
return QAccessible::EditableText;
+ case ui::AX_ROLE_EMBEDDED_OBJECT:
+ return QAccessible::Grouping; // FIXME
case ui::AX_ROLE_FOOTER:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Footer;
case ui::AX_ROLE_FORM:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Form;
case ui::AX_ROLE_GRID:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Table;
case ui::AX_ROLE_GROUP:
return QAccessible::Grouping;
case ui::AX_ROLE_GROW_AREA:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Grip;
case ui::AX_ROLE_HEADING:
- return QAccessible::StaticText; // FIXME
+ return QAccessible::Heading;
case ui::AX_ROLE_HELP_TAG:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::HelpBalloon; // FIXME
case ui::AX_ROLE_HORIZONTAL_RULE:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Separator;
+ case ui::AX_ROLE_IFRAME:
+ return QAccessible::Grouping;
case ui::AX_ROLE_IGNORED:
return QAccessible::NoRole;
case ui::AX_ROLE_IMAGE:
return QAccessible::Graphic;
case ui::AX_ROLE_IMAGE_MAP:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Graphic;
case ui::AX_ROLE_IMAGE_MAP_LINK:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Link;
case ui::AX_ROLE_INCREMENTOR:
return QAccessible::NoRole; // FIXME
case ui::AX_ROLE_INLINE_TEXT_BOX:
return QAccessible::EditableText;
case ui::AX_ROLE_LABEL_TEXT:
return QAccessible::StaticText;
+ case ui::AX_ROLE_LEGEND:
+ return QAccessible::NoRole; // FIXME
case ui::AX_ROLE_LINK:
return QAccessible::Link;
case ui::AX_ROLE_LIST:
return QAccessible::List;
case ui::AX_ROLE_LIST_BOX:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::List;
case ui::AX_ROLE_LIST_BOX_OPTION:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::ListItem;
case ui::AX_ROLE_LIST_ITEM:
return QAccessible::ListItem;
case ui::AX_ROLE_LIST_MARKER:
+ return QAccessible::StaticText;
+ case ui::AX_ROLE_LOCATION_BAR:
return QAccessible::NoRole; // FIXME
case ui::AX_ROLE_LOG:
return QAccessible::NoRole; // FIXME
+ case ui::AX_ROLE_MAIN:
+ return QAccessible::NoRole; // FIXME
case ui::AX_ROLE_MARQUEE:
return QAccessible::NoRole; // FIXME
case ui::AX_ROLE_MATH:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Equation;
+ case ui::AX_ROLE_MATH_ELEMENT:
+ return QAccessible::Equation;
case ui::AX_ROLE_MATTE:
return QAccessible::NoRole; // FIXME
case ui::AX_ROLE_MENU:
@@ -276,15 +397,21 @@ QAccessible::Role BrowserAccessibilityQt::role() const
case ui::AX_ROLE_MENU_BUTTON:
return QAccessible::MenuItem;
case ui::AX_ROLE_MENU_LIST_OPTION:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::MenuItem;
case ui::AX_ROLE_MENU_LIST_POPUP:
return QAccessible::PopupMenu;
+ case ui::AX_ROLE_NAVIGATION:
+ return QAccessible::Section;
case ui::AX_ROLE_NOTE:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Note;
case ui::AX_ROLE_OUTLINE:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Tree;
+ case ui::AX_ROLE_PANE:
+ return QAccessible::Pane;
case ui::AX_ROLE_PARAGRAPH:
return QAccessible::Paragraph;
+ case ui::AX_ROLE_POP_UP_BUTTON:
+ return QAccessible::ComboBox;
case ui::AX_ROLE_PRESENTATIONAL:
return QAccessible::NoRole; // FIXME
case ui::AX_ROLE_PROGRESS_INDICATOR:
@@ -292,9 +419,9 @@ QAccessible::Role BrowserAccessibilityQt::role() const
case ui::AX_ROLE_RADIO_BUTTON:
return QAccessible::RadioButton;
case ui::AX_ROLE_RADIO_GROUP:
- return QAccessible::RadioButton;
+ return QAccessible::Grouping;
case ui::AX_ROLE_REGION:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Section;
case ui::AX_ROLE_ROW:
return QAccessible::Row;
case ui::AX_ROLE_ROW_HEADER:
@@ -304,9 +431,13 @@ QAccessible::Role BrowserAccessibilityQt::role() const
case ui::AX_ROLE_RULER_MARKER:
return QAccessible::NoRole; // FIXME
case ui::AX_ROLE_SCROLL_AREA:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Client; // FIXME
case ui::AX_ROLE_SCROLL_BAR:
return QAccessible::ScrollBar;
+ case ui::AX_ROLE_SEAMLESS_WEB_AREA:
+ return QAccessible::NoRole; // FIXME
+ case ui::AX_ROLE_SEARCH:
+ return QAccessible::Section;
case ui::AX_ROLE_SHEET:
return QAccessible::NoRole; // FIXME
case ui::AX_ROLE_SLIDER:
@@ -320,21 +451,21 @@ QAccessible::Role BrowserAccessibilityQt::role() const
case ui::AX_ROLE_SPLITTER:
return QAccessible::Splitter;
case ui::AX_ROLE_SPLIT_GROUP:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Splitter;
case ui::AX_ROLE_STATIC_TEXT:
return QAccessible::StaticText;
case ui::AX_ROLE_STATUS:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::StatusBar;
case ui::AX_ROLE_SVG_ROOT:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Graphic;
case ui::AX_ROLE_SYSTEM_WIDE:
return QAccessible::NoRole; // FIXME
- case ui::AX_ROLE_TAB:
- return QAccessible::PageTab;
case ui::AX_ROLE_TABLE:
return QAccessible::Table;
case ui::AX_ROLE_TABLE_HEADER_CONTAINER:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Section;
+ case ui::AX_ROLE_TAB:
+ return QAccessible::PageTab;
case ui::AX_ROLE_TAB_GROUP: // blink doesn't use (uses ROLE_TAB_LIST)
return QAccessible::NoRole; // FIXME
case ui::AX_ROLE_TAB_LIST:
@@ -346,9 +477,11 @@ QAccessible::Role BrowserAccessibilityQt::role() const
case ui::AX_ROLE_TEXT_FIELD:
return QAccessible::EditableText;
case ui::AX_ROLE_TIMER:
+ return QAccessible::Clock;
+ case ui::AX_ROLE_TITLE_BAR:
return QAccessible::NoRole; // FIXME
case ui::AX_ROLE_TOGGLE_BUTTON:
- return QAccessible::Button; // FIXME
+ return QAccessible::Button;
case ui::AX_ROLE_TOOLBAR:
return QAccessible::ToolBar;
case ui::AX_ROLE_TOOLTIP:
@@ -356,11 +489,11 @@ QAccessible::Role BrowserAccessibilityQt::role() const
case ui::AX_ROLE_TREE:
return QAccessible::Tree;
case ui::AX_ROLE_TREE_GRID:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Tree;
case ui::AX_ROLE_TREE_ITEM:
return QAccessible::TreeItem;
case ui::AX_ROLE_VALUE_INDICATOR:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Client; // FIXME
case ui::AX_ROLE_WINDOW:
return QAccessible::Window;
}
@@ -584,4 +717,184 @@ QVariant BrowserAccessibilityQt::minimumStepSize() const
return QVariant();
}
+QAccessibleInterface *BrowserAccessibilityQt::cellAt(int row, int column) const
+{
+ int columns = 0;
+ int rows = 0;
+ if (!GetIntAttribute(ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) ||
+ !GetIntAttribute(ui::AX_ATTR_TABLE_ROW_COUNT, &rows) ||
+ columns <= 0 ||
+ rows <= 0) {
+ return 0;
+ }
+
+ if (row < 0 || row >= rows || column < 0 || column >= columns)
+ return 0;
+
+ const std::vector<int32>& cell_ids = GetIntListAttribute(ui::AX_ATTR_CELL_IDS);
+ DCHECK_EQ(columns * rows, static_cast<int>(cell_ids.size()));
+
+ int cell_id = cell_ids[row * columns + column];
+ BrowserAccessibility* cell = manager()->GetFromID(cell_id);
+ if (cell) {
+ QAccessibleInterface *iface = static_cast<BrowserAccessibilityQt*>(cell);
+ return iface;
+ }
+
+ return 0;
+}
+
+QAccessibleInterface *BrowserAccessibilityQt::caption() const
+{
+ return 0;
+}
+
+QAccessibleInterface *BrowserAccessibilityQt::summary() const
+{
+ return 0;
+}
+
+QString BrowserAccessibilityQt::columnDescription(int column) const
+{
+ return QString();
+}
+
+QString BrowserAccessibilityQt::rowDescription(int row) const
+{
+ return QString();
+}
+
+int BrowserAccessibilityQt::columnCount() const
+{
+ int columns = 0;
+ if (GetIntAttribute(ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns))
+ return columns;
+
+ return 0;
+}
+
+int BrowserAccessibilityQt::rowCount() const
+{
+ int rows = 0;
+ if (GetIntAttribute(ui::AX_ATTR_TABLE_ROW_COUNT, &rows))
+ return rows;
+ return 0;
+}
+
+int BrowserAccessibilityQt::selectedCellCount() const
+{
+ return 0;
+}
+
+int BrowserAccessibilityQt::selectedColumnCount() const
+{
+ return 0;
+}
+
+int BrowserAccessibilityQt::selectedRowCount() const
+{
+ return 0;
+}
+
+QList<QAccessibleInterface *> BrowserAccessibilityQt::selectedCells() const
+{
+ return QList<QAccessibleInterface *>();
+}
+
+QList<int> BrowserAccessibilityQt::selectedColumns() const
+{
+ return QList<int>();
+}
+
+QList<int> BrowserAccessibilityQt::selectedRows() const
+{
+ return QList<int>();
+}
+
+bool BrowserAccessibilityQt::isColumnSelected(int /*column*/) const
+{
+ return false;
+}
+
+bool BrowserAccessibilityQt::isRowSelected(int /*row*/) const
+{
+ return false;
+}
+
+bool BrowserAccessibilityQt::selectRow(int /*row*/)
+{
+ return false;
+}
+
+bool BrowserAccessibilityQt::selectColumn(int /*column*/)
+{
+ return false;
+}
+
+bool BrowserAccessibilityQt::unselectRow(int /*row*/)
+{
+ return false;
+}
+
+bool BrowserAccessibilityQt::unselectColumn(int /*column*/)
+{
+ return false;
+}
+
+int BrowserAccessibilityQt::columnExtent() const
+{
+ return 1;
+}
+
+QList<QAccessibleInterface *> BrowserAccessibilityQt::columnHeaderCells() const
+{
+ return QList<QAccessibleInterface*>();
+}
+
+int BrowserAccessibilityQt::columnIndex() const
+{
+ int column = 0;
+ if (GetIntAttribute(ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX, &column))
+ return column;
+ return 0;
+}
+
+int BrowserAccessibilityQt::rowExtent() const
+{
+ return 1;
+}
+
+QList<QAccessibleInterface *> BrowserAccessibilityQt::rowHeaderCells() const
+{
+ return QList<QAccessibleInterface*>();
+}
+
+int BrowserAccessibilityQt::rowIndex() const
+{
+ int row = 0;
+ if (GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_INDEX, &row))
+ return row;
+ return 0;
+}
+
+bool BrowserAccessibilityQt::isSelected() const
+{
+ return false;
+}
+
+QAccessibleInterface *BrowserAccessibilityQt::table() const
+{
+ BrowserAccessibility* find_table = GetParent();
+ while (find_table && find_table->GetRole() != ui::AX_ROLE_TABLE)
+ find_table = find_table->GetParent();
+ if (!find_table)
+ return 0;
+ return static_cast<BrowserAccessibilityQt*>(find_table);
+}
+
+void BrowserAccessibilityQt::modelChange(QAccessibleTableModelChangeEvent *)
+{
+
+}
+
} // namespace content
diff --git a/src/core/browser_accessibility_qt.h b/src/core/browser_accessibility_qt.h
index b8cd9e67d..db190ffc4 100644
--- a/src/core/browser_accessibility_qt.h
+++ b/src/core/browser_accessibility_qt.h
@@ -48,10 +48,15 @@ class BrowserAccessibilityQt
, public QAccessibleActionInterface
, public QAccessibleTextInterface
, public QAccessibleValueInterface
+ , public QAccessibleTableInterface
+ , public QAccessibleTableCellInterface
{
public:
BrowserAccessibilityQt();
+ // BrowserAccessibility
+ virtual void OnDataChanged() Q_DECL_OVERRIDE;
+
// QAccessibleInterface
virtual bool isValid() const Q_DECL_OVERRIDE;
virtual QObject *object() const Q_DECL_OVERRIDE;
@@ -102,6 +107,40 @@ public:
QVariant maximumValue() const Q_DECL_OVERRIDE;
QVariant minimumValue() const Q_DECL_OVERRIDE;
QVariant minimumStepSize() const Q_DECL_OVERRIDE;
+
+ // QAccessibleTableInterface
+ virtual QAccessibleInterface *cellAt(int row, int column) const Q_DECL_OVERRIDE;
+ virtual QAccessibleInterface *caption() const Q_DECL_OVERRIDE;
+ virtual QAccessibleInterface *summary() const Q_DECL_OVERRIDE;
+ virtual QString columnDescription(int column) const Q_DECL_OVERRIDE;
+ virtual QString rowDescription(int row) const Q_DECL_OVERRIDE;
+ virtual int columnCount() const Q_DECL_OVERRIDE;
+ virtual int rowCount() const Q_DECL_OVERRIDE;
+ // selection
+ virtual int selectedCellCount() const Q_DECL_OVERRIDE;
+ virtual int selectedColumnCount() const Q_DECL_OVERRIDE;
+ virtual int selectedRowCount() const Q_DECL_OVERRIDE;
+ virtual QList<QAccessibleInterface*> selectedCells() const Q_DECL_OVERRIDE;
+ virtual QList<int> selectedColumns() const Q_DECL_OVERRIDE;
+ virtual QList<int> selectedRows() const Q_DECL_OVERRIDE;
+ virtual bool isColumnSelected(int column) const Q_DECL_OVERRIDE;
+ virtual bool isRowSelected(int row) const Q_DECL_OVERRIDE;
+ virtual bool selectRow(int row) Q_DECL_OVERRIDE;
+ virtual bool selectColumn(int column) Q_DECL_OVERRIDE;
+ virtual bool unselectRow(int row) Q_DECL_OVERRIDE;
+ virtual bool unselectColumn(int column) Q_DECL_OVERRIDE;
+
+ // QAccessibleTableCellInterface
+ virtual int columnExtent() const Q_DECL_OVERRIDE;
+ virtual QList<QAccessibleInterface*> columnHeaderCells() const Q_DECL_OVERRIDE;
+ virtual int columnIndex() const Q_DECL_OVERRIDE;
+ virtual int rowExtent() const Q_DECL_OVERRIDE;
+ virtual QList<QAccessibleInterface*> rowHeaderCells() const Q_DECL_OVERRIDE;
+ virtual int rowIndex() const Q_DECL_OVERRIDE;
+ virtual bool isSelected() const Q_DECL_OVERRIDE;
+ virtual QAccessibleInterface* table() const Q_DECL_OVERRIDE;
+
+ virtual void modelChange(QAccessibleTableModelChangeEvent *event) Q_DECL_OVERRIDE;
};
}
diff --git a/src/core/browser_context_qt.cpp b/src/core/browser_context_qt.cpp
index 6d209a775..3913b7548 100644
--- a/src/core/browser_context_qt.cpp
+++ b/src/core/browser_context_qt.cpp
@@ -57,7 +57,6 @@
BrowserContextQt::BrowserContextQt()
{
resourceContext.reset(new ResourceContextQt(this));
- downloadManagerDelegate.reset(new DownloadManagerDelegateQt);
}
BrowserContextQt::~BrowserContextQt()
@@ -72,7 +71,7 @@ base::FilePath BrowserContextQt::GetPath() const
if (dataLocation.isEmpty())
dataLocation = QDir::homePath() % QDir::separator() % QChar::fromLatin1('.') % QCoreApplication::applicationName();
- dataLocation.append(QDir::separator() % QStringLiteral("QtWebEngine"));
+ dataLocation.append(QDir::separator() % QLatin1String("QtWebEngine"));
return base::FilePath(toFilePathString(dataLocation));
}
diff --git a/src/core/certificate_error_controller.cpp b/src/core/certificate_error_controller.cpp
index 64e5b36d4..b5c705de3 100644
--- a/src/core/certificate_error_controller.cpp
+++ b/src/core/certificate_error_controller.cpp
@@ -111,7 +111,7 @@ CertificateErrorController::ResourceType CertificateErrorController::resourceTyp
static QString getQStringForMessageId(int message_id) {
base::string16 string = l10n_util::GetStringUTF16(message_id);
- return QString::fromUtf16(string.data(), string.length());
+ return toQt(string);
}
QString CertificateErrorController::errorString() const
diff --git a/src/core/chromium_gpu_helper.cpp b/src/core/chromium_gpu_helper.cpp
index c4cb2ec0b..6287bd7c0 100644
--- a/src/core/chromium_gpu_helper.cpp
+++ b/src/core/chromium_gpu_helper.cpp
@@ -57,27 +57,17 @@ static void addSyncPointCallbackDelegate(content::SyncPointManager *syncPointMan
syncPointManager->AddSyncPointCallback(sync_point, callback);
}
-FenceSync createFence()
+QMap<uint32, gfx::TransferableFence> transferFences()
{
- FenceSync ret;
- // Logic taken from chromium/ui/gl/gl_fence.cc
-#if !defined(OS_MACOSX)
- if (gfx::g_driver_egl.ext.b_EGL_KHR_fence_sync) {
- ret.type = FenceSync::EglSync;
- ret.egl.display = eglGetCurrentDisplay();
- ret.egl.sync = eglCreateSyncKHR(ret.egl.display, EGL_SYNC_FENCE_KHR, NULL);
- } else
-#endif
- if (gfx::g_driver_gl.ext.b_GL_ARB_sync) {
- ret.type = FenceSync::ArbSync;
- ret.arb.sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
+ QMap<uint32, gfx::TransferableFence> ret;
+ content::GpuChannelManager *gpuChannelManager = content::GpuChildThread::instance()->ChannelManager();
+ content::GpuChannelManager::SyncPointGLFences::iterator it = gpuChannelManager->sync_point_gl_fences_.begin();
+ content::GpuChannelManager::SyncPointGLFences::iterator end = gpuChannelManager->sync_point_gl_fences_.end();
+ for (; it != end; ++it) {
+ ret[it->first] = it->second->Transfer();
+ delete it->second;
}
-
- // glFlush is necessary to make sure that our fence creation reaches the GL server
- // before we try waiting on it from a different context, which could deadlock.
- // In cases where no fence extension is available, this also serves as flushing
- // Chromium's GL context command stream before yielding to the SG thread.
- glFlush();
+ gpuChannelManager->sync_point_gl_fences_.clear();
return ret;
}
diff --git a/src/core/chromium_gpu_helper.h b/src/core/chromium_gpu_helper.h
index 364f82bbc..8b11c9b5f 100644
--- a/src/core/chromium_gpu_helper.h
+++ b/src/core/chromium_gpu_helper.h
@@ -38,8 +38,10 @@
#define CHROMIUM_GPU_HELPER_H
#include <QtGlobal> // We need this for the Q_OS_QNX define.
+#include <QMap>
#include "base/callback.h"
+#include "ui/gl/gl_fence.h"
namespace base {
class MessageLoop;
@@ -57,38 +59,12 @@ class Texture;
}
}
-typedef void *EGLDisplay;
-typedef void *EGLSyncKHR;
-typedef struct __GLsync *GLsync;
-
-union FenceSync {
- enum SyncType {
- NoSync,
- EglSync,
- ArbSync
- };
- SyncType type;
- struct {
- SyncType type;
- EGLDisplay display;
- EGLSyncKHR sync;
- } egl;
- struct {
- SyncType type;
- GLsync sync;
- } arb;
-
- FenceSync() : type(NoSync) { }
- operator bool() { return type != NoSync; }
- void reset() { type = NoSync; }
-};
-
// These functions wrap code that needs to include headers that are
// incompatible with Qt GL headers.
// From the outside, types from incompatible headers referenced in these
// functions should only be forward-declared and considered as opaque types.
-FenceSync createFence();
+QMap<uint32, gfx::TransferableFence> transferFences();
base::MessageLoop *gpu_message_loop();
content::SyncPointManager *sync_point_manager();
gpu::gles2::MailboxManager *mailbox_manager();
diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp
index 39514aea6..9e97e3226 100644
--- a/src/core/chromium_overrides.cpp
+++ b/src/core/chromium_overrides.cpp
@@ -47,7 +47,6 @@
#include <QGuiApplication>
#include <QScreen>
#include <QWindow>
-#include <qpa/qplatformnativeinterface.h>
#if defined(OS_ANDROID)
#include "media/video/capture/fake_video_capture_device.h"
diff --git a/src/core/config/embedded_android.pri b/src/core/config/embedded_android.pri
index 6ffa1c077..4684c2aef 100644
--- a/src/core/config/embedded_android.pri
+++ b/src/core/config/embedded_android.pri
@@ -12,6 +12,7 @@ GYP_CONFIG += \
build_ffmpegsumo=0 \
configuration_policy=0 \
disable_nacl=1 \
+ embedded=1 \
enable_autofill_dialog=0 \
enable_automation=0 \
enable_background=0 \
@@ -30,7 +31,6 @@ GYP_CONFIG += \
enable_webrtc=0 \
gcc_version=46 \
gtest_target_type=none \
- icu_use_data_file_flag=0 \
input_speech=0 \
java_bridge=0 \
media_use_ffmpeg=0 \
@@ -44,11 +44,12 @@ GYP_CONFIG += \
remoting=0 \
safe_browsing=0 \
skia_os=android \
+ test_isolation_mode=noop \
use_aura=0 \
use_cairo=0 \
use_canvas_skia=0 \
use_cups=0 \
- use_default_render_theme=0 \
+ use_default_render_theme=1 \
use_ffmpeg=0 \
use_gconf=0 \
use_gio=0 \
@@ -58,11 +59,12 @@ GYP_CONFIG += \
use_libffmpeg=0 \
use_openmax_dl_fft=0 \
use_openssl=1 \
+ use_openssl_certs=1 \
use_ozone=0 \
use_pango=0 \
use_pulseaudio=0 \
use_system_expat=1 \
- use_system_icu=1 \
+ use_system_icu=0 \
use_system_libjpeg=0 \
use_system_skia=0 \
use_system_sqlite=0 \
diff --git a/src/core/config/embedded_linux.pri b/src/core/config/embedded_linux.pri
index 88af144ba..dc6a5f612 100644
--- a/src/core/config/embedded_linux.pri
+++ b/src/core/config/embedded_linux.pri
@@ -29,6 +29,7 @@ GYP_CONFIG += \
p2p_apis=0 \
safe_browsing=0 \
toolkit_uses_gtk=0 \
+ toolkit_views=1 \
use_ash=0 \
use_aura=1 \
use_cairo=0 \
@@ -43,8 +44,9 @@ GYP_CONFIG += \
use_ozone=1 \
use_pango=0 \
use_pulseaudio=0 \
+ use_system_harfbuzz=0 \
use_system_icu=1 \
use_x11=0 \
v8_use_snapshot=false \
- want_separate_host_toolset=0 \
+ want_separate_host_toolset=1 \
diff --git a/src/core/config/mac_osx.pri b/src/core/config/mac_osx.pri
index b24d981b2..3f42b6fd7 100644
--- a/src/core/config/mac_osx.pri
+++ b/src/core/config/mac_osx.pri
@@ -1,5 +1,20 @@
+QMAKE_CLANG_DIR = "/usr"
+QMAKE_CLANG_PATH = $$eval(QMAKE_MAC_SDK.macx-clang.$${QMAKE_MAC_SDK}.QMAKE_CXX)
+!isEmpty(QMAKE_CLANG_PATH) {
+ clang_dir = $$clean_path("$$dirname(QMAKE_CLANG_PATH)/../")
+ exists($$clang_dir): QMAKE_CLANG_DIR = $$clang_dir
+}
+
+QMAKE_CLANG_PATH = "$${QMAKE_CLANG_DIR}/bin/clang++"
+message("Using clang++ from $${QMAKE_CLANG_PATH}")
+system("$${QMAKE_CLANG_PATH} --version")
+
GYP_CONFIG += \
qt_os=\"mac\" \
mac_sdk_min=\"10.7\" \
mac_deployment_target=\"$${QMAKE_MACOSX_DEPLOYMENT_TARGET}\" \
+ make_clang_dir=\"$${QMAKE_CLANG_DIR}\" \
clang_use_chrome_plugins=0
+
+QMAKE_MAC_SDK_PATH = "$$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path)"
+exists($$QMAKE_MAC_SDK_PATH): GYP_CONFIG += mac_sdk_path=\"$${QMAKE_MAC_SDK_PATH}\"
diff --git a/src/core/config/windows.pri b/src/core/config/windows.pri
index 520500c63..f7644c83b 100644
--- a/src/core/config/windows.pri
+++ b/src/core/config/windows.pri
@@ -17,6 +17,14 @@ GYP_ARGS += "-D perl_exe=\"perl.exe\" -D bison_exe=\"bison.exe\" -D gperf_exe=\"
# Gyp's parallel processing is broken on Windows
GYP_ARGS += "--no-parallel"
-CONFIG(release, debug|release): GYP_ARGS+= "-D qt_egl_library=\"libEGL.lib\" -D qt_glesv2_library=\"libGLESv2.lib\""
-else: GYP_ARGS+= "-D qt_egl_library=\"libEGLd.lib\" -D qt_glesv2_library=\"libGLESv2d.lib\""
+contains(QT_CONFIG, angle) {
+ CONFIG(release, debug|release) {
+ GYP_ARGS += "-D qt_egl_library=\"libEGL.lib\" -D qt_glesv2_library=\"libGLESv2.lib\""
+ } else {
+ GYP_ARGS += "-D qt_egl_library=\"libEGLd.lib\" -D qt_glesv2_library=\"libGLESv2d.lib\""
+ }
+ GYP_ARGS += "-D qt_gl=\"angle\""
+} else {
+ GYP_ARGS += "-D qt_gl=\"opengl\""
+}
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index f19199cc3..28294dce7 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -99,18 +99,25 @@ public:
// Usually this gets passed through Run, but since we have
// our own event loop, attach it explicitly ourselves.
: m_delegate(base::MessageLoopForUI::current())
+ , m_explicitLoop(0)
+ , m_timerId(0)
{
}
virtual void Run(Delegate *delegate) Q_DECL_OVERRIDE
{
- // FIXME: This could be needed if we want to run Chromium tests.
- // We could run a QEventLoop here.
+ Q_ASSERT(delegate == m_delegate);
+ // This is used only when MessagePumpForUIQt is used outside of the GUI thread.
+ QEventLoop loop;
+ m_explicitLoop = &loop;
+ loop.exec();
+ m_explicitLoop = 0;
}
virtual void Quit() Q_DECL_OVERRIDE
{
- Q_UNREACHABLE();
+ Q_ASSERT(m_explicitLoop);
+ m_explicitLoop->quit();
}
virtual void ScheduleWork() Q_DECL_OVERRIDE
@@ -120,7 +127,15 @@ public:
virtual void ScheduleDelayedWork(const base::TimeTicks &delayed_work_time) Q_DECL_OVERRIDE
{
- startTimer(GetTimeIntervalMilliseconds(delayed_work_time));
+ if (delayed_work_time.is_null()) {
+ killTimer(m_timerId);
+ m_timerId = 0;
+ m_timerScheduledTime = base::TimeTicks();
+ } else if (!m_timerId || delayed_work_time < m_timerScheduledTime) {
+ killTimer(m_timerId);
+ m_timerId = startTimer(GetTimeIntervalMilliseconds(delayed_work_time));
+ m_timerScheduledTime = delayed_work_time;
+ }
}
protected:
@@ -132,13 +147,14 @@ protected:
virtual void timerEvent(QTimerEvent *ev) Q_DECL_OVERRIDE
{
- killTimer(ev->timerId());
+ Q_ASSERT(m_timerId == ev->timerId());
+ killTimer(m_timerId);
+ m_timerId = 0;
+ m_timerScheduledTime = base::TimeTicks();
base::TimeTicks next_delayed_work_time;
m_delegate->DoDelayedWork(&next_delayed_work_time);
-
- if (!next_delayed_work_time.is_null())
- startTimer(GetTimeIntervalMilliseconds(next_delayed_work_time));
+ ScheduleDelayedWork(next_delayed_work_time);
}
private:
@@ -152,13 +168,16 @@ private:
return true;
more_work_is_plausible |= m_delegate->DoIdleWork();
- if (!more_work_is_plausible && !delayed_work_time.is_null())
- startTimer(GetTimeIntervalMilliseconds(delayed_work_time));
+ if (!more_work_is_plausible)
+ ScheduleDelayedWork(delayed_work_time);
return more_work_is_plausible;
}
Delegate *m_delegate;
+ QEventLoop *m_explicitLoop;
+ int m_timerId;
+ base::TimeTicks m_timerScheduledTime;
};
scoped_ptr<base::MessagePump> messagePumpFactory()
@@ -216,22 +235,22 @@ public:
{
QString platform = qApp->platformName().toLower();
QPlatformNativeInterface *pni = QGuiApplication::platformNativeInterface();
- if (platform == QStringLiteral("xcb")) {
+ if (platform == QLatin1String("xcb")) {
if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2)
m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext);
else
m_handle = pni->nativeResourceForContext(QByteArrayLiteral("glxcontext"), qtContext);
- } else if (platform == QStringLiteral("cocoa"))
+ } else if (platform == QLatin1String("cocoa"))
m_handle = pni->nativeResourceForContext(QByteArrayLiteral("cglcontextobj"), qtContext);
- else if (platform == QStringLiteral("qnx"))
+ else if (platform == QLatin1String("qnx"))
m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext);
- else if (platform == QStringLiteral("eglfs"))
+ else if (platform == QLatin1String("eglfs"))
m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext);
- else if (platform == QStringLiteral("windows")) {
+ else if (platform == QLatin1String("windows")) {
if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2)
m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglContext"), qtContext);
else
- qFatal("Only the EGLGLES2 implementation is supported on %s platform.", platform.toLatin1().constData());
+ m_handle = pni->nativeResourceForContext(QByteArrayLiteral("renderingcontext"), qtContext);
} else {
qFatal("%s platform not yet supported", platform.toLatin1().constData());
// Add missing platforms once they work.
diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp
index 10ee4fcda..e41888976 100644
--- a/src/core/content_main_delegate_qt.cpp
+++ b/src/core/content_main_delegate_qt.cpp
@@ -36,8 +36,12 @@
#include "content_main_delegate_qt.h"
+#include "base/command_line.h"
+#include "base/logging.h"
#include "base/path_service.h"
+#include "base/strings/string_number_conversions.h"
#include "content/public/common/content_paths.h"
+#include "content/public/common/content_switches.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/ui_base_paths.h"
#include "ui/base/resource/resource_bundle.h"
@@ -60,6 +64,19 @@ void ContentMainDelegateQt::PreSandboxStartup()
{
net::NetModule::SetResourceProvider(PlatformResourceProvider);
ui::ResourceBundle::InitSharedInstanceWithLocale(l10n_util::GetApplicationLocale(std::string("en-US")), 0);
+
+ // Suppress info, warning and error messages per default.
+ int logLevel = logging::LOG_FATAL;
+
+ CommandLine* parsedCommandLine = CommandLine::ForCurrentProcess();
+ if (parsedCommandLine->HasSwitch(switches::kLoggingLevel)) {
+ std::string logLevelValue = parsedCommandLine->GetSwitchValueASCII(switches::kLoggingLevel);
+ int level = 0;
+ if (base::StringToInt(logLevelValue, &level) && level >= logging::LOG_INFO && level < logging::LOG_NUM_SEVERITIES)
+ logLevel = level;
+ }
+
+ logging::SetMinLogLevel(logLevel);
}
content::ContentBrowserClient *ContentMainDelegateQt::CreateContentBrowserClient()
diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro
index f2329d779..c50d56df4 100644
--- a/src/core/core_gyp_generator.pro
+++ b/src/core/core_gyp_generator.pro
@@ -11,7 +11,7 @@ TEMPLATE = lib
# gyp/ninja will take care of the compilation, qmake/make will finish with linking and install.
TARGET = QtWebEngineCore
QT += qml quick
-QT_PRIVATE += qml-private quick-private gui-private core-private
+QT_PRIVATE += gui-private
# Defining keywords such as 'signal' clashes with the chromium code base.
DEFINES += QT_NO_KEYWORDS \
diff --git a/src/core/core_module.pro b/src/core/core_module.pro
index 1548a4d3f..08e0b7822 100644
--- a/src/core/core_module.pro
+++ b/src/core/core_module.pro
@@ -4,7 +4,7 @@ TARGET = QtWebEngineCore
CMAKE_MODULE_TESTS = "-"
QT += qml quick
-QT_PRIVATE += qml-private quick-private gui-private core-private
+QT_PRIVATE += gui-private
# Look for linking information produced by gyp for our target according to core_generated.gyp
!include($$OUT_PWD/$$getConfigDir()/$${TARGET}_linking.pri) {
@@ -21,6 +21,4 @@ CONFIG -= bsymbolic_functions
contains(QT_CONFIG, egl): CONFIG += egl
-linux {
- CONFIG(release, debug|release) | contains(QT_CONFIG, separate_debug_info): QMAKE_POST_LINK="cd $(DESTDIR) && $(STRIP) --strip-unneeded $(TARGET)"
-}
+linux: contains(QT_CONFIG, separate_debug_info): QMAKE_POST_LINK="cd $(DESTDIR) && $(STRIP) --strip-unneeded $(TARGET)"
diff --git a/src/core/delegated_frame_node.cpp b/src/core/delegated_frame_node.cpp
index 57ce581f1..1a393a0c7 100644
--- a/src/core/delegated_frame_node.cpp
+++ b/src/core/delegated_frame_node.cpp
@@ -64,6 +64,7 @@
#include "cc/quads/yuv_video_draw_quad.h"
#include <QOpenGLContext>
#include <QOpenGLFramebufferObject>
+#include <QOpenGLFunctions>
#include <QSGAbstractRenderer>
#include <QSGEngine>
#include <QSGSimpleRectNode>
@@ -75,7 +76,7 @@
#include <EGL/eglext.h>
#endif
-class RenderPassTexture : public QSGTexture
+class RenderPassTexture : public QSGTexture, protected QOpenGLFunctions
{
public:
RenderPassTexture(const cc::RenderPass::Id &id);
@@ -105,7 +106,7 @@ private:
QScopedPointer<QOpenGLFramebufferObject> m_fbo;
};
-class MailboxTexture : public QSGTexture {
+class MailboxTexture : public QSGTexture, protected QOpenGLFunctions {
public:
MailboxTexture(const cc::TransferableResource &resource);
virtual int textureId() const Q_DECL_OVERRIDE { return m_textureId; }
@@ -202,43 +203,89 @@ static QSGNode *buildLayerChain(QSGNode *chainParent, const cc::SharedQuadState
return layerChain;
}
-static void waitAndDeleteChromiumSync(FenceSync *sync)
+static void waitChromiumSync(gfx::TransferableFence *sync)
{
// Chromium uses its own GL bindings and stores in in thread local storage.
// For that reason, let chromium_gpu_helper.cpp contain the producing code that will run in the Chromium
// GPU thread, and put the sync consuming code here that will run in the QtQuick SG or GUI thread.
switch (sync->type) {
- case FenceSync::NoSync:
+ case gfx::TransferableFence::NoSync:
break;
- case FenceSync::EglSync:
+ case gfx::TransferableFence::EglSync:
#ifdef EGL_KHR_reusable_sync
{
static bool resolved = false;
static PFNEGLCLIENTWAITSYNCKHRPROC eglClientWaitSyncKHR = 0;
- static PFNEGLDESTROYSYNCKHRPROC eglDestroySyncKHR = 0;
if (!resolved) {
if (gfx::GLSurfaceQt::HasEGLExtension("EGL_KHR_reusable_sync")) {
QOpenGLContext *context = QOpenGLContext::currentContext();
eglClientWaitSyncKHR = (PFNEGLCLIENTWAITSYNCKHRPROC)context->getProcAddress("eglClientWaitSyncKHR");
- eglDestroySyncKHR = (PFNEGLDESTROYSYNCKHRPROC)context->getProcAddress("eglDestroySyncKHR");
}
resolved = true;
}
- if (eglClientWaitSyncKHR && eglDestroySyncKHR) {
+ if (eglClientWaitSyncKHR)
// FIXME: Use the less wasteful eglWaitSyncKHR once we have a device that supports EGL_KHR_wait_sync.
eglClientWaitSyncKHR(sync->egl.display, sync->egl.sync, 0, EGL_FOREVER_KHR);
+ }
+#endif
+ break;
+ case gfx::TransferableFence::ArbSync:
+#ifdef GL_ARB_sync
+ typedef void (QOPENGLF_APIENTRYP WaitSyncPtr)(GLsync sync, GLbitfield flags, GLuint64 timeout);
+ static WaitSyncPtr glWaitSync_ = 0;
+ if (!glWaitSync_) {
+ QOpenGLContext *context = QOpenGLContext::currentContext();
+ glWaitSync_ = (WaitSyncPtr)context->getProcAddress("glWaitSync");
+ Q_ASSERT(glWaitSync_);
+ }
+ glWaitSync_(sync->arb.sync, 0, GL_TIMEOUT_IGNORED);
+#endif
+ break;
+ }
+}
+
+static void deleteChromiumSync(gfx::TransferableFence *sync)
+{
+ // Chromium uses its own GL bindings and stores in in thread local storage.
+ // For that reason, let chromium_gpu_helper.cpp contain the producing code that will run in the Chromium
+ // GPU thread, and put the sync consuming code here that will run in the QtQuick SG or GUI thread.
+ switch (sync->type) {
+ case gfx::TransferableFence::NoSync:
+ break;
+ case gfx::TransferableFence::EglSync:
+#ifdef EGL_KHR_reusable_sync
+ {
+ static bool resolved = false;
+ static PFNEGLDESTROYSYNCKHRPROC eglDestroySyncKHR = 0;
+
+ if (!resolved) {
+ if (gfx::GLSurfaceQt::HasEGLExtension("EGL_KHR_reusable_sync")) {
+ QOpenGLContext *context = QOpenGLContext::currentContext();
+ eglDestroySyncKHR = (PFNEGLDESTROYSYNCKHRPROC)context->getProcAddress("eglDestroySyncKHR");
+ }
+ resolved = true;
+ }
+
+ if (eglDestroySyncKHR) {
+ // FIXME: Use the less wasteful eglWaitSyncKHR once we have a device that supports EGL_KHR_wait_sync.
eglDestroySyncKHR(sync->egl.display, sync->egl.sync);
sync->reset();
}
}
#endif
break;
- case FenceSync::ArbSync:
+ case gfx::TransferableFence::ArbSync:
#ifdef GL_ARB_sync
- glWaitSync(sync->arb.sync, 0, GL_TIMEOUT_IGNORED);
- glDeleteSync(sync->arb.sync);
+ typedef void (QOPENGLF_APIENTRYP DeleteSyncPtr)(GLsync sync);
+ static DeleteSyncPtr glDeleteSync_ = 0;
+ if (!glDeleteSync_) {
+ QOpenGLContext *context = QOpenGLContext::currentContext();
+ glDeleteSync_ = (DeleteSyncPtr)context->getProcAddress("glDeleteSync");
+ Q_ASSERT(glDeleteSync_);
+ }
+ glDeleteSync_(sync->arb.sync);
sync->reset();
#endif
break;
@@ -254,6 +301,7 @@ RenderPassTexture::RenderPassTexture(const cc::RenderPass::Id &id)
, m_sgEngine(new QSGEngine)
, m_rootNode(new QSGRootNode)
{
+ initializeOpenGLFunctions();
}
void RenderPassTexture::bind()
@@ -298,6 +346,7 @@ MailboxTexture::MailboxTexture(const cc::TransferableResource &resource)
, m_target(GL_TEXTURE_2D)
, m_importCount(1)
{
+ initializeOpenGLFunctions();
}
void MailboxTexture::bind()
@@ -385,20 +434,33 @@ void DelegatedFrameNode::preprocess()
mailboxesToFetch.append(mailboxTexture.data());
if (!mailboxesToFetch.isEmpty()) {
- QMutexLocker lock(&m_mutex);
- base::MessageLoop *gpuMessageLoop = gpu_message_loop();
- content::SyncPointManager *syncPointManager = sync_point_manager();
+ QMap<uint32, gfx::TransferableFence> transferredFences;
+ {
+ QMutexLocker lock(&m_mutex);
+ base::MessageLoop *gpuMessageLoop = gpu_message_loop();
+ content::SyncPointManager *syncPointManager = sync_point_manager();
+
+ Q_FOREACH (MailboxTexture *mailboxTexture, mailboxesToFetch) {
+ m_numPendingSyncPoints++;
+ AddSyncPointCallbackOnGpuThread(gpuMessageLoop, syncPointManager, mailboxTexture->resource().mailbox_holder.sync_point, base::Bind(&DelegatedFrameNode::syncPointRetired, this, &mailboxesToFetch));
+ }
- Q_FOREACH (MailboxTexture *mailboxTexture, mailboxesToFetch) {
- m_numPendingSyncPoints++;
- AddSyncPointCallbackOnGpuThread(gpuMessageLoop, syncPointManager, mailboxTexture->resource().mailbox_holder.sync_point, base::Bind(&DelegatedFrameNode::syncPointRetired, this, &mailboxesToFetch));
+ m_mailboxesFetchedWaitCond.wait(&m_mutex);
+ m_mailboxGLFences.swap(transferredFences);
}
- m_mailboxesFetchedWaitCond.wait(&m_mutex);
-
- // Tell GL to wait until Chromium is done generating resource textures on the GPU thread.
- // We can safely start referencing those textures onto geometries afterward.
- waitAndDeleteChromiumSync(&m_mailboxesGLFence);
+ // Tell GL to wait until Chromium is done generating resource textures on the GPU thread
+ // for each mailbox. We can safely start referencing those textures onto geometries afterward.
+ Q_FOREACH (MailboxTexture *mailboxTexture, mailboxesToFetch) {
+ gfx::TransferableFence fence = transferredFences.take(mailboxTexture->resource().mailbox_holder.sync_point);
+ waitChromiumSync(&fence);
+ deleteChromiumSync(&fence);
+ }
+ // We transferred all sync point fences from Chromium,
+ // destroy all the ones not referenced by one of our mailboxes without waiting.
+ QMap<uint32, gfx::TransferableFence>::iterator end = transferredFences.end();
+ for (QMap<uint32, gfx::TransferableFence>::iterator it = transferredFences.begin(); it != end; ++it)
+ deleteChromiumSync(&*it);
}
// Then render any intermediate RenderPass in order.
@@ -602,14 +664,13 @@ void DelegatedFrameNode::fetchTexturesAndUnlockQt(DelegatedFrameNode *frameNode,
Q_FOREACH (MailboxTexture *mailboxTexture, *mailboxesToFetch)
mailboxTexture->fetchTexture(mailboxManager);
- // Set a fence at this point in Chromium's GL command stream
- // and transfer the handle to the Qt scene graph thread.
- FenceSync fence = createFence();
+ // Pick fences that we can ask GL to wait for before trying to sample the mailbox texture IDs.
+ QMap<uint32, gfx::TransferableFence> transferredFences = transferFences();
// Chromium provided everything we were waiting for, let Qt start rendering.
QMutexLocker lock(&frameNode->m_mutex);
- Q_ASSERT(!frameNode->m_mailboxesGLFence);
- frameNode->m_mailboxesGLFence = fence;
+ Q_ASSERT(frameNode->m_mailboxGLFences.isEmpty());
+ frameNode->m_mailboxGLFences.swap(transferredFences);
frameNode->m_mailboxesFetchedWaitCond.wakeOne();
}
diff --git a/src/core/delegated_frame_node.h b/src/core/delegated_frame_node.h
index 98861eefa..a031a464f 100644
--- a/src/core/delegated_frame_node.h
+++ b/src/core/delegated_frame_node.h
@@ -75,7 +75,7 @@ private:
QExplicitlySharedDataPointer<DelegatedFrameNodeData> m_data;
QList<QSharedPointer<RenderPassTexture> > m_renderPassTextures;
int m_numPendingSyncPoints;
- FenceSync m_mailboxesGLFence;
+ QMap<uint32, gfx::TransferableFence> m_mailboxGLFences;
QWaitCondition m_mailboxesFetchedWaitCond;
QMutex m_mutex;
diff --git a/src/core/gl_context_qt.cpp b/src/core/gl_context_qt.cpp
index 4c196d969..e1255219d 100644
--- a/src/core/gl_context_qt.cpp
+++ b/src/core/gl_context_qt.cpp
@@ -37,26 +37,30 @@
#include "gl_context_qt.h"
#include <QGuiApplication>
+#include <QOpenGLContext>
#include <QThread>
-#include "ui/gl/gl_context_egl.h"
-
-#include <private/qopenglcontext_p.h>
-#include <private/qsgcontext_p.h>
#include <qpa/qplatformnativeinterface.h>
+#include "ui/gl/gl_context_egl.h"
+#include "ui/gl/gl_implementation.h"
#if defined(USE_X11)
#include <X11/Xlib.h>
#endif
+#if defined(OS_WIN)
+#include "ui/gl/gl_context_wgl.h"
+#endif
+
QT_BEGIN_NAMESPACE
+Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context();
GLContextHelper* GLContextHelper::contextHelper = 0;
namespace {
inline void *resourceForContext(const QByteArray &resource)
{
- return qApp->platformNativeInterface()->nativeResourceForContext(resource, QOpenGLContextPrivate::globalShareContext());
+ return qApp->platformNativeInterface()->nativeResourceForContext(resource, qt_gl_global_share_context());
}
inline void *resourceForIntegration(const QByteArray &resource)
@@ -136,7 +140,16 @@ namespace gfx {
scoped_refptr<GLContext> GLContext::CreateGLContext(GLShareGroup* share_group, GLSurface* compatible_surface, GpuPreference gpu_preference)
{
- scoped_refptr<GLContext> context(new GLContextEGL(share_group));
+#if defined(OS_WIN)
+ scoped_refptr<GLContext> context;
+ if (GetGLImplementation() == kGLImplementationDesktopGL)
+ context = new GLContextWGL(share_group);
+ else
+ context = new GLContextEGL(share_group);
+#else
+ scoped_refptr<GLContext> context = new GLContextEGL(share_group);
+#endif
+
if (!GLContextHelper::initializeContext(context.get(), compatible_surface))
return NULL;
diff --git a/src/core/gl_surface_qt.cpp b/src/core/gl_surface_qt.cpp
index 6510680ca..bc1b8b399 100644
--- a/src/core/gl_surface_qt.cpp
+++ b/src/core/gl_surface_qt.cpp
@@ -43,7 +43,6 @@
#if !defined(OS_MACOSX)
#include <QGuiApplication>
-#include <qpa/qplatformnativeinterface.h>
#include "gl_context_qt.h"
#include "qtwebenginecoreglobal.h"
@@ -65,6 +64,11 @@ extern "C" {
}
#endif
+#if defined(OS_WIN)
+#include "ui/gl/gl_surface_wgl.h"
+#include "ui/gl/gl_context_wgl.h"
+#endif
+
using ui::GetLastEGLErrorString;
namespace gfx {
@@ -240,7 +244,72 @@ void* GLSurfaceQtGLX::GetHandle()
return reinterpret_cast<void*>(m_surfaceBuffer);
}
-#endif // defined(USE_X11)
+#elif defined(OS_WIN)
+
+class GLSurfaceQtWGL: public GLSurfaceQt {
+public:
+ explicit GLSurfaceQtWGL(const gfx::Size& size);
+
+ static bool InitializeOneOff();
+
+ virtual bool Initialize() Q_DECL_OVERRIDE;
+ virtual void Destroy() Q_DECL_OVERRIDE;
+ virtual void* GetHandle() Q_DECL_OVERRIDE;
+ virtual void* GetDisplay() Q_DECL_OVERRIDE;
+ virtual void* GetConfig() Q_DECL_OVERRIDE;
+
+protected:
+ ~GLSurfaceQtWGL();
+
+private:
+ scoped_refptr<PbufferGLSurfaceWGL> m_surfaceBuffer;
+ DISALLOW_COPY_AND_ASSIGN(GLSurfaceQtWGL);
+};
+
+GLSurfaceQtWGL::GLSurfaceQtWGL(const gfx::Size& size)
+ : GLSurfaceQt(size),
+ m_surfaceBuffer(0)
+{
+}
+
+GLSurfaceQtWGL::~GLSurfaceQtWGL()
+{
+ Destroy();
+}
+
+bool GLSurfaceQtWGL::InitializeOneOff()
+{
+ return GLSurfaceWGL::InitializeOneOff();
+}
+
+bool GLSurfaceQtWGL::Initialize()
+{
+ m_surfaceBuffer = new PbufferGLSurfaceWGL(m_size);
+
+ return m_surfaceBuffer->Initialize();
+}
+
+void GLSurfaceQtWGL::Destroy()
+{
+ m_surfaceBuffer = 0;
+}
+
+void *GLSurfaceQtWGL::GetHandle()
+{
+ return m_surfaceBuffer->GetHandle();
+}
+
+void *GLSurfaceQtWGL::GetDisplay()
+{
+ return m_surfaceBuffer->GetDisplay();
+}
+
+void *GLSurfaceQtWGL::GetConfig()
+{
+ return m_surfaceBuffer->GetConfig();
+}
+
+#endif // defined(OS_WIN)
GLSurfaceQt::GLSurfaceQt()
{
@@ -288,9 +357,11 @@ bool GLSurface::InitializeOneOffInternal()
if (GetGLImplementation() == kGLImplementationEGLGLES2)
return GLSurfaceQtEGL::InitializeOneOff();
-#if defined(USE_X11)
if (GetGLImplementation() == kGLImplementationDesktopGL)
+#if defined(USE_X11)
return GLSurfaceQtGLX::InitializeOneOff();
+#elif defined(OS_WIN)
+ return GLSurfaceQtWGL::InitializeOneOff();
#endif
return false;
@@ -457,6 +528,11 @@ GLSurface::CreateOffscreenGLSurface(const gfx::Size& size)
if (!surface->Initialize())
return NULL;
return surface;
+#elif defined(OS_WIN)
+ scoped_refptr<GLSurface> surface = new GLSurfaceQtWGL(size);
+ if (!surface->Initialize())
+ return NULL;
+ return surface;
#else
LOG(ERROR) << "Desktop GL is not supported on this platform.";
Q_UNREACHABLE();
diff --git a/src/core/gyp_run.pro b/src/core/gyp_run.pro
index ed592e1fd..f79972a2e 100644
--- a/src/core/gyp_run.pro
+++ b/src/core/gyp_run.pro
@@ -23,6 +23,11 @@ GYP_CONFIG += disable_glibcxx_debug=1
linux:contains(QT_CONFIG, separate_debug_info): GYP_CONFIG += linux_dump_symbols=1
+force_debug_info {
+ win32: GYP_CONFIG += win_release_extra_cflags=-Zi
+ else: GYP_CONFIG += release_extra_cflags=-g
+}
+
# Append additional platform options defined in GYP_CONFIG
for (config, GYP_CONFIG): GYP_ARGS += "-D $$config"
@@ -47,7 +52,7 @@ cross_compile {
!isEmpty(MARCH): GYP_ARGS += "-D arm_arch=\"$$MARCH\""
MTUNE = $$extractCFlag("-mtune=.*")
- !isEmpty(MTUNE): GYP_ARGS += "-D arm_tune=\"$$MTUNE\""
+ GYP_ARGS += "-D arm_tune=\"$$MTUNE\""
MFLOAT = $$extractCFlag("-mfloat-abi=.*")
!isEmpty(MFLOAT): GYP_ARGS += "-D arm_float_abi=\"$$MFLOAT\""
diff --git a/src/core/network_delegate_qt.cpp b/src/core/network_delegate_qt.cpp
index 8a79bbc8a..81ab4b6bc 100644
--- a/src/core/network_delegate_qt.cpp
+++ b/src/core/network_delegate_qt.cpp
@@ -136,9 +136,7 @@ void NetworkDelegateQt::CompleteURLRequestOnIOThread(net::URLRequest *request,
error = net::OK;
break;
case WebContentsAdapterClient::IgnoreRequest:
- error = net::OK;
- // We can cancel the request here since we are on the IO thread.
- request->Cancel();
+ error = net::ERR_ABORTED;
break;
default:
error = net::ERR_FAILED;
diff --git a/src/core/ozone_platform_eglfs.cpp b/src/core/ozone_platform_eglfs.cpp
index ee1f066b5..b6b367aeb 100644
--- a/src/core/ozone_platform_eglfs.cpp
+++ b/src/core/ozone_platform_eglfs.cpp
@@ -36,26 +36,63 @@
#include "ozone_platform_eglfs.h"
+#include "media/ozone/media_ozone_platform.h"
+#include "ui/events/ozone/device/device_manager.h"
#include "ui/ozone/ozone_platform.h"
+#include "ui/ozone/public/cursor_factory_ozone.h"
+#include "ui/ozone/public/gpu_platform_support.h"
+#include "ui/ozone/public/gpu_platform_support_host.h"
#if defined(USE_OZONE)
+namespace media {
+
+MediaOzonePlatform* CreateMediaOzonePlatformEglfs() {
+ return new MediaOzonePlatform;
+}
+
+}
+
namespace ui {
OzonePlatformEglfs::OzonePlatformEglfs() {}
OzonePlatformEglfs::~OzonePlatformEglfs() {}
-gfx::SurfaceFactoryOzone* OzonePlatformEglfs::GetSurfaceFactoryOzone() {
- return &surface_factory_ozone_;
+ui::SurfaceFactoryOzone* OzonePlatformEglfs::GetSurfaceFactoryOzone() {
+ return surface_factory_ozone_.get();
}
ui::EventFactoryOzone* OzonePlatformEglfs::GetEventFactoryOzone() {
- return &event_factory_ozone_;
+ return event_factory_ozone_.get();
+}
+
+ui::CursorFactoryOzone* OzonePlatformEglfs::GetCursorFactoryOzone() {
+ return cursor_factory_ozone_.get();
+}
+
+GpuPlatformSupport* OzonePlatformEglfs::GetGpuPlatformSupport() {
+ return gpu_platform_support_.get();
+}
+
+GpuPlatformSupportHost* OzonePlatformEglfs::GetGpuPlatformSupportHost() {
+ return gpu_platform_support_host_.get();
}
OzonePlatform* CreateOzonePlatformEglfs() { return new OzonePlatformEglfs; }
+void OzonePlatformEglfs::InitializeUI() {
+ device_manager_ = CreateDeviceManager();
+ cursor_factory_ozone_.reset(new CursorFactoryOzone());
+ event_factory_ozone_.reset(new EventFactoryEvdev(NULL, device_manager_.get()));
+ gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost());
+}
+
+void OzonePlatformEglfs::InitializeGPU() {
+ surface_factory_ozone_.reset(new SurfaceFactoryQt());
+ gpu_platform_support_.reset(CreateStubGpuPlatformSupport());
+}
+
} // namespace ui
#endif
diff --git a/src/core/ozone_platform_eglfs.h b/src/core/ozone_platform_eglfs.h
index 4dcc419a6..9d96688a5 100644
--- a/src/core/ozone_platform_eglfs.h
+++ b/src/core/ozone_platform_eglfs.h
@@ -51,12 +51,23 @@ class OzonePlatformEglfs : public OzonePlatform {
OzonePlatformEglfs();
virtual ~OzonePlatformEglfs();
- virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE;
+ virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE;
virtual ui::EventFactoryOzone* GetEventFactoryOzone() OVERRIDE;
+ virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE;
+ virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE;
+ virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE;
+ virtual void InitializeUI() OVERRIDE;
+ virtual void InitializeGPU() OVERRIDE;
private:
- SurfaceFactoryQt surface_factory_ozone_;
- ui::EventFactoryEvdev event_factory_ozone_;
+ scoped_ptr<DeviceManager> device_manager_;
+
+ scoped_ptr<SurfaceFactoryQt> surface_factory_ozone_;
+ scoped_ptr<ui::CursorFactoryOzone> cursor_factory_ozone_;
+ scoped_ptr<ui::EventFactoryEvdev> event_factory_ozone_;
+
+ scoped_ptr<GpuPlatformSupport> gpu_platform_support_;
+ scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_;
DISALLOW_COPY_AND_ASSIGN(OzonePlatformEglfs);
};
diff --git a/src/core/qtwebengine.gypi b/src/core/qtwebengine.gypi
index ba08c72c1..17287669f 100644
--- a/src/core/qtwebengine.gypi
+++ b/src/core/qtwebengine.gypi
@@ -59,6 +59,7 @@
'conditions': [
['qt_os=="embedded_android"', {
'dependencies': [
+ '<(chromium_src_dir)/ui/ozone/ozone.gyp:ozone_base',
'<(chromium_src_dir)/third_party/ashmem/ashmem.gyp:ashmem',
'<(chromium_src_dir)/third_party/freetype/freetype.gyp:ft2',
'<(chromium_src_dir)/third_party/android_tools/ndk/android_tools_ndk.gyp:cpu_features',
diff --git a/src/core/qtwebengine_extras.gypi b/src/core/qtwebengine_extras.gypi
index 916dd4195..f30c16401 100644
--- a/src/core/qtwebengine_extras.gypi
+++ b/src/core/qtwebengine_extras.gypi
@@ -50,6 +50,7 @@
['exclude', 'gl_surface_glx\\.cc$'],
['exclude', 'gl_surface_x11\\.cc$'],
['exclude', 'gl_surface_win\\.cc$'],
+ ['exclude', 'gl_surface_ozone\\.cc$'],
# Avoid the ATL dependency to allow building with VS Express
['exclude', 'browser/accessibility/accessibility_tree_formatter\\.(cc|h)$',],
['exclude', 'browser/accessibility/accessibility_tree_formatter_android\\.(cc|h)$',],
@@ -78,6 +79,8 @@
# At runtime the env variable SSL_CERT_DIR can be used to override this
'OPENSSLDIR="/usr/lib/ssl"',
'OPENSSL_LOAD_CONF',
+ 'EGL_API_FB=1',
+ 'LINUX=1',
],
'defines!': [
'OPENSSLDIR="/etc/ssl"',
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index ee099170a..2cc5510ae 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -115,17 +115,28 @@ static inline Qt::InputMethodHints toQtInputMethodHints(ui::TextInputType inputT
}
}
+static inline int firstAvailableId(const QMap<int, int> &map)
+{
+ ui::BitSet32 usedIds;
+ QMap<int, int>::const_iterator end = map.end();
+ for (QMap<int, int>::const_iterator it = map.begin(); it != end; ++it)
+ usedIds.mark_bit(it.value());
+ return usedIds.first_unmarked_bit();
+}
+
static inline ui::GestureProvider::Config QtGestureProviderConfig() {
ui::GestureProvider::Config config = ui::DefaultGestureProviderConfig();
// Causes an assert in CreateWebGestureEventFromGestureEventData and we don't need them in Qt.
config.gesture_begin_end_types_enabled = false;
+ // Swipe gestures aren't forwarded, we don't use them and they abort the gesture detection.
+ config.scale_gesture_detector_config.gesture_detector_config.swipe_enabled = config.gesture_detector_config.swipe_enabled = false;
return config;
}
class MotionEventQt : public ui::MotionEvent {
public:
- MotionEventQt(QTouchEvent *ev, const base::TimeTicks &eventTime, Action action, int index = -1)
- : touchPoints(ev->touchPoints())
+ MotionEventQt(const QList<QTouchEvent::TouchPoint> &touchPoints, const base::TimeTicks &eventTime, Action action, int index = -1)
+ : touchPoints(touchPoints)
, eventTime(eventTime)
, action(action)
, index(index)
@@ -152,6 +163,8 @@ public:
virtual float GetHistoricalTouchMajor(size_t pointer_index, size_t historical_index) const Q_DECL_OVERRIDE { return 0; }
virtual float GetHistoricalX(size_t pointer_index, size_t historical_index) const Q_DECL_OVERRIDE { return 0; }
virtual float GetHistoricalY(size_t pointer_index, size_t historical_index) const Q_DECL_OVERRIDE { return 0; }
+ virtual ToolType GetToolType(size_t pointer_index) const Q_DECL_OVERRIDE { return ui::MotionEvent::TOOL_TYPE_UNKNOWN; }
+ virtual int GetButtonState() const Q_DECL_OVERRIDE { return 0; }
virtual scoped_ptr<MotionEvent> Cancel() const Q_DECL_OVERRIDE { Q_UNREACHABLE(); return scoped_ptr<MotionEvent>(); }
@@ -179,10 +192,15 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget
, m_initPending(false)
{
m_host->SetView(this);
+
+ QAccessible::installActivationObserver(this);
+ if (QAccessible::isActive())
+ content::BrowserAccessibilityStateImpl::GetInstance()->EnableAccessibility();
}
RenderWidgetHostViewQt::~RenderWidgetHostViewQt()
{
+ QAccessible::removeActivationObserver(this);
}
void RenderWidgetHostViewQt::setDelegate(RenderWidgetHostViewQtDelegate* delegate)
@@ -617,7 +635,7 @@ void RenderWidgetHostViewQt::SelectionChanged(const base::string16 &text, size_t
content::RenderWidgetHostViewBase::SelectionChanged(text, offset, range);
m_adapterClient->selectionChanged();
-#if defined(USE_X11) && !defined(OS_CHROMEOS)
+#if defined(USE_X11)
// Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard.
ui::ScopedClipboardWriter clipboard_writer(
ui::Clipboard::GetForCurrentThread(),
@@ -658,6 +676,8 @@ void RenderWidgetHostViewQt::notifyResize()
void RenderWidgetHostViewQt::windowBoundsChanged()
{
m_host->SendScreenRects();
+ if (m_delegate->window())
+ m_host->NotifyScreenInfoChanged();
}
void RenderWidgetHostViewQt::windowChanged()
@@ -763,6 +783,25 @@ void RenderWidgetHostViewQt::processMotionEvent(const ui::MotionEvent &motionEve
m_host->ForwardTouchEvent(content::CreateWebTouchEventFromMotionEvent(motionEvent));
}
+QList<QTouchEvent::TouchPoint> RenderWidgetHostViewQt::mapTouchPointIds(const QList<QTouchEvent::TouchPoint> &inputPoints)
+{
+ QList<QTouchEvent::TouchPoint> outputPoints = inputPoints;
+ for (int i = 0; i < outputPoints.size(); ++i) {
+ QTouchEvent::TouchPoint &point = outputPoints[i];
+
+ int qtId = point.id();
+ QMap<int, int>::const_iterator it = m_touchIdMapping.find(qtId);
+ if (it == m_touchIdMapping.end())
+ it = m_touchIdMapping.insert(qtId, firstAvailableId(m_touchIdMapping));
+ point.setId(it.value());
+
+ if (point.state() == Qt::TouchPointReleased)
+ m_touchIdMapping.remove(qtId);
+ }
+
+ return outputPoints;
+}
+
float RenderWidgetHostViewQt::dpiScale() const
{
return m_adapterClient ? m_adapterClient->dpiScale() : 1.0;
@@ -908,6 +947,14 @@ void RenderWidgetHostViewQt::AccessibilityFatalError()
SetBrowserAccessibilityManager(NULL);
}
+void RenderWidgetHostViewQt::accessibilityActiveChanged(bool active)
+{
+ if (active)
+ content::BrowserAccessibilityStateImpl::GetInstance()->EnableAccessibility();
+ else
+ content::BrowserAccessibilityStateImpl::GetInstance()->DisableAccessibility();
+}
+
void RenderWidgetHostViewQt::handleWheelEvent(QWheelEvent *ev)
{
m_host->ForwardWheelEvent(WebEventFactory::toWebWheelEvent(ev, dpiScale()));
@@ -925,8 +972,10 @@ void RenderWidgetHostViewQt::handleTouchEvent(QTouchEvent *ev)
m_eventsToNowDelta = base::TimeTicks::Now() - eventTimestamp;
eventTimestamp += m_eventsToNowDelta;
+ QList<QTouchEvent::TouchPoint> touchPoints = mapTouchPointIds(ev->touchPoints());
+
if (ev->type() == QEvent::TouchCancel) {
- MotionEventQt cancelEvent(ev, eventTimestamp, ui::MotionEvent::ACTION_CANCEL);
+ MotionEventQt cancelEvent(touchPoints, eventTimestamp, ui::MotionEvent::ACTION_CANCEL);
processMotionEvent(cancelEvent);
return;
}
@@ -934,9 +983,9 @@ void RenderWidgetHostViewQt::handleTouchEvent(QTouchEvent *ev)
if (ev->type() == QEvent::TouchBegin)
m_sendMotionActionDown = true;
- for (int i = 0; i < ev->touchPoints().size(); ++i) {
+ for (int i = 0; i < touchPoints.size(); ++i) {
ui::MotionEvent::Action action;
- switch (ev->touchPoints()[i].state()) {
+ switch (touchPoints[i].state()) {
case Qt::TouchPointPressed:
if (m_sendMotionActionDown) {
action = ui::MotionEvent::ACTION_DOWN;
@@ -948,14 +997,14 @@ void RenderWidgetHostViewQt::handleTouchEvent(QTouchEvent *ev)
action = ui::MotionEvent::ACTION_MOVE;
break;
case Qt::TouchPointReleased:
- action = ev->touchPoints().size() > 1 ? ui::MotionEvent::ACTION_POINTER_UP : ui::MotionEvent::ACTION_UP;
+ action = touchPoints.size() > 1 ? ui::MotionEvent::ACTION_POINTER_UP : ui::MotionEvent::ACTION_UP;
break;
default:
// Ignore Qt::TouchPointStationary
continue;
}
- MotionEventQt motionEvent(ev, eventTimestamp, action, i);
+ MotionEventQt motionEvent(touchPoints, eventTimestamp, action, i);
processMotionEvent(motionEvent);
}
}
@@ -988,8 +1037,6 @@ QAccessibleInterface *RenderWidgetHostViewQt::GetQtAccessible()
// Assume we have a screen reader doing stuff
CreateBrowserAccessibilityManagerIfNeeded();
content::BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected();
- content::BrowserAccessibilityStateImpl::GetInstance()->EnableAccessibility();
-
content::BrowserAccessibility *acc = GetBrowserAccessibilityManager()->GetRoot();
content::BrowserAccessibilityQt *accQt = static_cast<content::BrowserAccessibilityQt*>(acc);
return accQt;
diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h
index db9a0e687..d4a3ff248 100644
--- a/src/core/render_widget_host_view_qt.h
+++ b/src/core/render_widget_host_view_qt.h
@@ -45,9 +45,11 @@
#include "content/browser/accessibility/browser_accessibility_manager.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "ui/events/gesture_detection/filtered_gesture_provider.h"
+#include <QMap>
#include <QPoint>
#include <QRect>
#include <QtGlobal>
+#include <QtGui/qaccessible.h>
#include "delegated_frame_node.h"
@@ -91,6 +93,7 @@ class RenderWidgetHostViewQt
, public RenderWidgetHostViewQtDelegateClient
, public content::BrowserAccessibilityDelegate
, public base::SupportsWeakPtr<RenderWidgetHostViewQt>
+ , public QAccessible::ActivationObserver
{
public:
RenderWidgetHostViewQt(content::RenderWidgetHost* widget);
@@ -184,7 +187,8 @@ public:
#if defined(OS_ANDROID)
virtual void ShowDisambiguationPopup(const gfx::Rect&, const SkBitmap&) Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED }
- virtual void HasTouchEventHandlers(bool) Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED }
+ virtual void LockCompositingSurface() Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED }
+ virtual void UnlockCompositingSurface() Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED }
#endif // defined(OS_ANDROID)
#if defined(OS_WIN)
@@ -209,6 +213,7 @@ public:
virtual gfx::Point AccessibilityOriginInScreen(const gfx::Rect& bounds) const Q_DECL_OVERRIDE { return gfx::Point(); }
virtual void AccessibilityHitTest(const gfx::Point& point) Q_DECL_OVERRIDE { }
virtual void AccessibilityFatalError() Q_DECL_OVERRIDE;
+ virtual void accessibilityActiveChanged(bool active) Q_DECL_OVERRIDE;
QAccessibleInterface *GetQtAccessible();
@@ -217,6 +222,7 @@ public:
private:
void sendDelegatedFrameAck();
void processMotionEvent(const ui::MotionEvent &motionEvent);
+ QList<QTouchEvent::TouchPoint> mapTouchPointIds(const QList<QTouchEvent::TouchPoint> &inputPoints);
float dpiScale() const;
bool IsPopup() const;
@@ -226,6 +232,7 @@ private:
ui::FilteredGestureProvider m_gestureProvider;
base::TimeDelta m_eventsToNowDelta;
bool m_sendMotionActionDown;
+ QMap<int, int> m_touchIdMapping;
scoped_ptr<RenderWidgetHostViewQtDelegate> m_delegate;
QExplicitlySharedDataPointer<DelegatedFrameNodeData> m_frameNodeData;
diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp
index bb8c52266..6d4315b64 100644
--- a/src/core/renderer/content_renderer_client_qt.cpp
+++ b/src/core/renderer/content_renderer_client_qt.cpp
@@ -73,6 +73,17 @@ void ContentRendererClientQt::RenderViewCreated(content::RenderView* render_view
new QtRenderViewObserver(render_view);
}
+bool ContentRendererClientQt::HasErrorPage(int httpStatusCode, std::string *errorDomain)
+{
+ // Use an internal error page, if we have one for the status code.
+ if (!LocalizedError::HasStrings(LocalizedError::kHttpErrorDomain, httpStatusCode)) {
+ return false;
+ }
+
+ *errorDomain = LocalizedError::kHttpErrorDomain;
+ return true;
+}
+
// To tap into the chromium localized strings. Ripped from the chrome layer (highly simplified).
void ContentRendererClientQt::GetNavigationErrorStrings(content::RenderView* render_view, blink::WebFrame *frame, const blink::WebURLRequest &failed_request, const blink::WebURLError &error, std::string *error_html, base::string16 *error_description)
{
diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h
index af1aa0676..386495e20 100644
--- a/src/core/renderer/content_renderer_client_qt.h
+++ b/src/core/renderer/content_renderer_client_qt.h
@@ -50,7 +50,8 @@ public:
virtual void RenderThreadStarted() Q_DECL_OVERRIDE;
virtual void RenderViewCreated(content::RenderView *render_view) Q_DECL_OVERRIDE;
- virtual bool ShouldSuppressErrorPage(content::RenderFrame *, const GURL &) Q_DECL_OVERRIDE { return true; }
+ virtual bool ShouldSuppressErrorPage(content::RenderFrame *, const GURL &) Q_DECL_OVERRIDE { return false; }
+ virtual bool HasErrorPage(int httpStatusCode, std::string *errorDomain) Q_DECL_OVERRIDE;
virtual void GetNavigationErrorStrings(content::RenderView* render_view, blink::WebFrame* frame, const blink::WebURLRequest& failed_request
, const blink::WebURLError& error, std::string* error_html, base::string16* error_description) Q_DECL_OVERRIDE;
diff --git a/src/core/renderer/qt_render_view_observer.cpp b/src/core/renderer/qt_render_view_observer.cpp
index 0986d31ef..d7dbee67d 100644
--- a/src/core/renderer/qt_render_view_observer.cpp
+++ b/src/core/renderer/qt_render_view_observer.cpp
@@ -54,7 +54,7 @@ void QtRenderViewObserver::onFetchDocumentMarkup(quint64 requestId)
Send(new QtRenderViewObserverHost_DidFetchDocumentMarkup(
routing_id(),
requestId,
- render_view()->GetWebView()->mainFrame()->document().createMarkup()));
+ render_view()->GetWebView()->mainFrame()->contentAsMarkup()));
}
void QtRenderViewObserver::onFetchDocumentInnerText(quint64 requestId)
@@ -62,7 +62,7 @@ void QtRenderViewObserver::onFetchDocumentInnerText(quint64 requestId)
Send(new QtRenderViewObserverHost_DidFetchDocumentInnerText(
routing_id(),
requestId,
- render_view()->GetWebView()->mainFrame()->document().documentElement().innerText()));
+ render_view()->GetWebView()->mainFrame()->contentAsText(std::numeric_limits<std::size_t>::max())));
}
void QtRenderViewObserver::OnFirstVisuallyNonEmptyLayout()
diff --git a/src/core/surface_factory_qt.cpp b/src/core/surface_factory_qt.cpp
index a9c175a23..23fafb3c9 100644
--- a/src/core/surface_factory_qt.cpp
+++ b/src/core/surface_factory_qt.cpp
@@ -36,6 +36,7 @@
#include "surface_factory_qt.h"
+#include "gl_context_qt.h"
#include "type_conversion.h"
#include "base/files/file_path.h"
@@ -43,7 +44,6 @@
#include "ui/gl/gl_implementation.h"
#include <QGuiApplication>
-#include <qpa/qplatformnativeinterface.h>
#if defined(USE_OZONE) || defined(OS_ANDROID)
#include <EGL/egl.h>
@@ -55,6 +55,16 @@
#define QT_LIBDIR_GLES2 QT_LIBDIR_EGL
#endif
+base::NativeLibrary LoadLibrary(const base::FilePath& filename) {
+ base::NativeLibraryLoadError error;
+ base::NativeLibrary library = base::LoadNativeLibrary(filename, &error);
+ if (!library) {
+ LOG(ERROR) << "Failed to load " << filename.MaybeAsASCII() << ": " << error.ToString();
+ return NULL;
+ }
+ return library;
+}
+
bool SurfaceFactoryQt::LoadEGLGLES2Bindings(AddGLLibraryCallback add_gl_library, SetGLGetProcAddressProcCallback set_gl_get_proc_address)
{
#if defined(OS_ANDROID)
@@ -65,19 +75,15 @@ bool SurfaceFactoryQt::LoadEGLGLES2Bindings(AddGLLibraryCallback add_gl_library,
#else
base::FilePath libEGLPath = toFilePath(QT_LIBDIR_EGL);
libEGLPath = libEGLPath.Append("libEGL.so");
- base::NativeLibrary eglLibrary = gfx::LoadLibrary(libEGLPath);
- if (!eglLibrary) {
- LOG(ERROR) << "Failed to load EGL: " << libEGLPath.LossyDisplayName();
+ base::NativeLibrary eglLibrary = LoadLibrary(libEGLPath);
+ if (!eglLibrary)
return false;
- }
base::FilePath libGLES2Path = toFilePath(QT_LIBDIR_GLES2);
libGLES2Path = libGLES2Path.Append("libGLESv2.so");
- base::NativeLibrary gles2Library = gfx::LoadLibrary(libGLES2Path);
- if (!gles2Library) {
- LOG(ERROR) << "failed to load GLESv2: " << libGLES2Path.LossyDisplayName();
+ base::NativeLibrary gles2Library = LoadLibrary(libGLES2Path);
+ if (!gles2Library)
return false;
- }
gfx::GLGetProcAddressProc get_proc_address = reinterpret_cast<gfx::GLGetProcAddressProc>(base::GetFunctionPointerFromNativeLibrary(eglLibrary, "eglGetProcAddress"));
if (!get_proc_address) {
@@ -96,7 +102,7 @@ bool SurfaceFactoryQt::LoadEGLGLES2Bindings(AddGLLibraryCallback add_gl_library,
intptr_t SurfaceFactoryQt::GetNativeDisplay()
{
- static void *display = qApp->platformNativeInterface()->nativeResourceForIntegration(QByteArrayLiteral("nativedisplay"));
+ static void *display = GLContextHelper::getNativeDisplay();
if (display)
return reinterpret_cast<intptr_t>(display);
diff --git a/src/core/surface_factory_qt.h b/src/core/surface_factory_qt.h
index cf9a00875..1b2ec744d 100644
--- a/src/core/surface_factory_qt.h
+++ b/src/core/surface_factory_qt.h
@@ -39,21 +39,20 @@
#if defined(USE_OZONE) || defined(OS_ANDROID)
-#include "ui/gfx/ozone/surface_factory_ozone.h"
+#include "ui/ozone/public/surface_factory_ozone.h"
#include <QtGlobal>
class SurfaceFactoryQt
- : public gfx::SurfaceFactoryOzone
+ : public ui::SurfaceFactoryOzone
{
virtual bool LoadEGLGLES2Bindings(AddGLLibraryCallback add_gl_library, SetGLGetProcAddressProcCallback set_gl_get_proc_address) Q_DECL_OVERRIDE;
virtual intptr_t GetNativeDisplay() Q_DECL_OVERRIDE;
- virtual gfx::SurfaceFactoryOzone::HardwareState InitializeHardware() Q_DECL_OVERRIDE { return gfx::SurfaceFactoryOzone::INITIALIZED; }
+ virtual ui::SurfaceFactoryOzone::HardwareState InitializeHardware() Q_DECL_OVERRIDE { return ui::SurfaceFactoryOzone::INITIALIZED; }
virtual void ShutdownHardware() Q_DECL_OVERRIDE {}
virtual gfx::AcceleratedWidget GetAcceleratedWidget() Q_DECL_OVERRIDE { return 0; }
virtual gfx::AcceleratedWidget RealizeAcceleratedWidget(gfx::AcceleratedWidget w) Q_DECL_OVERRIDE { return 0; }
virtual bool AttemptToResizeAcceleratedWidget(gfx::AcceleratedWidget w, const gfx::Rect& bounds) Q_DECL_OVERRIDE { return false; }
- virtual gfx::VSyncProvider* GetVSyncProvider(gfx::AcceleratedWidget w) Q_DECL_OVERRIDE { return NULL; }
};
#endif
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index e221e0ce8..3533c0743 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -399,12 +399,6 @@ bool WebContentsAdapter::canGoForward() const
return d->webContents->GetController().CanGoForward();
}
-bool WebContentsAdapter::isLoading() const
-{
- Q_D(const WebContentsAdapter);
- return d->webContents->IsLoading();
-}
-
void WebContentsAdapter::stop()
{
Q_D(WebContentsAdapter);
@@ -460,10 +454,15 @@ QUrl WebContentsAdapter::activeUrl() const
QUrl WebContentsAdapter::requestedUrl() const
{
Q_D(const WebContentsAdapter);
- if (content::NavigationEntry* entry = d->webContents->GetController().GetVisibleEntry()) {
+ content::NavigationEntry* entry = d->webContents->GetController().GetVisibleEntry();
+ content::NavigationEntry* pendingEntry = d->webContents->GetController().GetPendingEntry();
+
+ if (entry) {
if (!entry->GetOriginalRequestURL().is_empty())
return toQt(entry->GetOriginalRequestURL());
- return toQt(entry->GetURL());
+
+ if (pendingEntry && pendingEntry == entry)
+ return toQt(entry->GetURL());
}
return QUrl();
}
diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h
index bddc3e045..6bec50316 100644
--- a/src/core/web_contents_adapter.h
+++ b/src/core/web_contents_adapter.h
@@ -64,7 +64,6 @@ public:
bool canGoBack() const;
bool canGoForward() const;
- bool isLoading() const;
void stop();
void reload();
void load(const QUrl&);
diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h
index 215942f8f..8fd401fe4 100644
--- a/src/core/web_contents_adapter_client.h
+++ b/src/core/web_contents_adapter_client.h
@@ -151,7 +151,7 @@ public:
virtual void loadStarted(const QUrl &provisionalUrl) = 0;
virtual void loadCommitted() = 0;
virtual void loadVisuallyCommitted() = 0;
- virtual void loadFinished(bool success, int error_code = 0, const QString &error_description = QString()) = 0;
+ virtual void loadFinished(bool success, const QUrl &url, int errorCode = 0, const QString &errorDescription = QString()) = 0;
virtual void focusContainer() = 0;
virtual void adoptNewWindow(WebContentsAdapter *newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect & initialGeometry) = 0;
virtual void close() = 0;
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index 0523d8b22..c2cccfedb 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -56,9 +56,9 @@
#include "content/public/common/favicon_url.h"
#include "content/public/common/file_chooser_params.h"
#include "content/public/common/frame_navigate_params.h"
+#include "content/public/common/url_constants.h"
#include "webkit/common/webpreferences.h"
-
// Maps the LogSeverity defines in base/logging.h to the web engines message levels.
static WebContentsAdapterClient::JavaScriptConsoleMessageLevel mapToJavascriptConsoleMessageLevel(int32 messageLevel) {
if (messageLevel < 1)
@@ -124,13 +124,23 @@ void WebContentsDelegateQt::CloseContents(content::WebContents *source)
void WebContentsDelegateQt::LoadProgressChanged(content::WebContents* source, double progress)
{
+ if (!m_loadingErrorFrameList.isEmpty())
+ return;
m_viewClient->loadProgressChanged(qRound(progress * 100));
}
-void WebContentsDelegateQt::DidStartProvisionalLoadForFrame(int64, int64, bool is_main_frame, const GURL &validated_url, bool, bool, content::RenderViewHost*)
+void WebContentsDelegateQt::DidStartProvisionalLoadForFrame(int64 frame_id, int64 parent_frame_id, bool is_main_frame, const GURL &validated_url, bool isErrorPage, bool, content::RenderViewHost*)
{
- if (is_main_frame)
- m_viewClient->loadStarted(toQt(validated_url));
+ if (isErrorPage) {
+ m_loadingErrorFrameList.append(frame_id);
+ return;
+ }
+
+ if (!is_main_frame)
+ return;
+
+ m_loadingErrorFrameList.clear();
+ m_viewClient->loadStarted(toQt(validated_url));
}
void WebContentsDelegateQt::DidCommitProvisionalLoadForFrame(int64 frame_id, const base::string16& frame_unique_name, bool is_main_frame, const GURL& url, content::PageTransition transition_type, content::RenderViewHost* render_view_host)
@@ -147,26 +157,36 @@ void WebContentsDelegateQt::DidFailProvisionalLoad(int64 frame_id, const base::s
DidFailLoad(frame_id, validated_url, is_main_frame, error_code, error_description, render_view_host);
}
-void WebContentsDelegateQt::DidFailLoad(int64, const GURL&, bool is_main_frame, int error_code, const base::string16 &error_description, content::RenderViewHost*)
+void WebContentsDelegateQt::DidFailLoad(int64 frame_id, const GURL &validated_url, bool is_main_frame, int error_code, const base::string16 &error_description, content::RenderViewHost *rvh)
{
- if (is_main_frame)
- m_viewClient->loadFinished(false, error_code, toQt(error_description));
+ if (m_loadingErrorFrameList.removeOne(frame_id) || !is_main_frame)
+ return;
+
+ m_viewClient->loadFinished(false, toQt(validated_url), error_code, toQt(error_description));
+ m_viewClient->loadProgressChanged(0);
}
-void WebContentsDelegateQt::DidFinishLoad(int64, const GURL&, bool is_main_frame, content::RenderViewHost*)
+void WebContentsDelegateQt::DidFinishLoad(int64 frame_id, const GURL &url, bool is_main_frame, content::RenderViewHost*)
{
- if (is_main_frame) {
- m_viewClient->loadFinished(true);
-
- content::NavigationEntry *entry = web_contents()->GetController().GetActiveEntry();
- if (!entry)
- return;
- content::FaviconStatus &favicon = entry->GetFavicon();
- if (favicon.valid)
- m_viewClient->iconChanged(toQt(favicon.url));
- else
- m_viewClient->iconChanged(QUrl());
+ if (m_loadingErrorFrameList.removeOne(frame_id)) {
+ Q_ASSERT(url.is_valid() && url.spec() == content::kUnreachableWebDataURL);
+ m_viewClient->iconChanged(QUrl());
+ return;
}
+
+ if (!is_main_frame)
+ return;
+
+ m_viewClient->loadFinished(true, toQt(url));
+
+ content::NavigationEntry *entry = web_contents()->GetController().GetActiveEntry();
+ if (!entry)
+ return;
+ content::FaviconStatus &favicon = entry->GetFavicon();
+ if (favicon.valid)
+ m_viewClient->iconChanged(toQt(favicon.url));
+ else
+ m_viewClient->iconChanged(QUrl());
}
void WebContentsDelegateQt::DidUpdateFaviconURL(const std::vector<content::FaviconURL>& candidates)
diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h
index c1f0c4647..2ab5fc8cd 100644
--- a/src/core/web_contents_delegate_qt.h
+++ b/src/core/web_contents_delegate_qt.h
@@ -60,6 +60,7 @@ class WebContentsDelegateQt : public content::WebContentsDelegate
{
public:
WebContentsDelegateQt(content::WebContents*, WebContentsAdapterClient *adapterClient);
+ ~WebContentsDelegateQt() { Q_ASSERT(m_loadingErrorFrameList.isEmpty()); }
QString lastSearchedString() const { return m_lastSearchedString; }
void setLastSearchedString(const QString &s) { m_lastSearchedString = s; }
int lastReceivedFindReply() const { return m_lastReceivedFindReply; }
@@ -94,6 +95,7 @@ private:
WebContentsAdapterClient *m_viewClient;
QString m_lastSearchedString;
int m_lastReceivedFindReply;
+ QList<int64> m_loadingErrorFrameList;
};
#endif // WEB_CONTENTS_DELEGATE_QT_H
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index 943de407e..13daef5f6 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -58,6 +58,7 @@
#include "content/utility/in_process_utility_thread.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "ui/events/event_switches.h"
+#include "ui/native_theme/native_theme_switches.h"
#include "ui/gl/gl_switches.h"
#if defined(OS_WIN)
#include "sandbox/win/src/sandbox_types.h"
@@ -74,6 +75,7 @@
#include "web_engine_library_info.h"
#include "web_engine_visited_links_manager.h"
#include <QGuiApplication>
+#include <QOpenGLContext>
#include <QStringList>
#include <QVector>
#include <qpa/qplatformnativeinterface.h>
@@ -138,31 +140,24 @@ WebEngineContext::WebEngineContext()
parsedCommandLine->AppendSwitch(switches::kInProcessGPU);
#if defined(OS_WIN)
- // FIXME: The renderer process should be fixed on windows.
- parsedCommandLine->AppendSwitch(switches::kSingleProcess);
parsedCommandLine->AppendSwitch(switches::kDisableD3D11);
parsedCommandLine->AppendSwitch(switches::kDisableExperimentalWebGL);
#endif
#if defined(QTWEBENGINE_MOBILE_SWITCHES)
// Inspired from the Android port's default switches
- parsedCommandLine->AppendSwitch(switches::kEnableOverlayScrollbars);
+ parsedCommandLine->AppendSwitch(switches::kEnableOverlayScrollbar);
parsedCommandLine->AppendSwitch(switches::kEnableGestureTapHighlight);
parsedCommandLine->AppendSwitch(switches::kEnablePinch);
parsedCommandLine->AppendSwitch(switches::kEnableViewport);
parsedCommandLine->AppendSwitch(switches::kEnableViewportMeta);
parsedCommandLine->AppendSwitch(switches::kEnableSmoothScrolling);
- parsedCommandLine->AppendSwitch(switches::kDisableAcceleratedVideo);
- parsedCommandLine->AppendSwitch(switches::kDisableAudio);
+ parsedCommandLine->AppendSwitch(switches::kDisableAcceleratedVideoDecode);
parsedCommandLine->AppendSwitch(switches::kEnableAcceleratedOverflowScroll);
parsedCommandLine->AppendSwitch(switches::kEnableCompositingForFixedPosition);
- parsedCommandLine->AppendSwitch(switches::kEnableAcceleratedScrollableFrames);
- parsedCommandLine->AppendSwitch(switches::kEnableCompositedScrollingForFrames);
- parsedCommandLine->AppendSwitch(switches::kForceCompositingMode);
parsedCommandLine->AppendSwitch(switches::kDisableGpuShaderDiskCache);
parsedCommandLine->AppendSwitch(switches::kDisable2dCanvasAntialiasing);
- parsedCommandLine->AppendSwitch(switches::kEnableDeadlineScheduling);
- parsedCommandLine->AppendSwitch(cc::switches::kEnableImplSidePainting);
+ parsedCommandLine->AppendSwitch(switches::kEnableImplSidePainting);
parsedCommandLine->AppendSwitch(cc::switches::kDisableCompositedAntialiasing);
parsedCommandLine->AppendSwitchASCII(switches::kProfilerTiming, switches::kProfilerTimingDisabledValue);
@@ -172,15 +167,20 @@ WebEngineContext::WebEngineContext()
// On eAndroid we use this to get the native display
// from Qt in GLSurfaceEGL::InitializeOneOff.
m_surfaceFactory.reset(new SurfaceFactoryQt());
- gfx::SurfaceFactoryOzone::SetInstance(m_surfaceFactory.get());
#endif
GLContextHelper::initialize();
- // Tell Chromium to use EGL instead of GLX if the Qt xcb plugin also does.
- if ((qApp->platformName() == QStringLiteral("xcb") || qApp->platformName() == QStringLiteral("eglfs"))
- && qApp->platformNativeInterface()->nativeResourceForWindow(QByteArrayLiteral("egldisplay"), 0))
- parsedCommandLine->AppendSwitchASCII(switches::kUseGL, gfx::kGLImplementationEGLName);
+ const char *glType;
+ switch (QOpenGLContext::currentContext()->openGLModuleType()) {
+ case QOpenGLContext::LibGL:
+ glType = gfx::kGLImplementationDesktopName;
+ break;
+ case QOpenGLContext::LibGLES:
+ glType = gfx::kGLImplementationEGLName;
+ break;
+ }
+ parsedCommandLine->AppendSwitchASCII(switches::kUseGL, glType);
content::UtilityProcessHostImpl::RegisterUtilityMainThreadFactory(content::CreateInProcessUtilityThread);
content::RenderProcessHostImpl::RegisterRendererMainThreadFactory(content::CreateInProcessRendererThread);
diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp
index 6c1cecc3a..4cdf3813e 100644
--- a/src/core/web_engine_library_info.cpp
+++ b/src/core/web_engine_library_info.cpp
@@ -78,7 +78,7 @@ QString location(QLibraryInfo::LibraryLocation path)
switch (path) {
case QLibraryInfo::TranslationsPath:
if (!webEnginePath.isEmpty())
- return webEnginePath % QDir::separator() % QStringLiteral("translations");
+ return webEnginePath % QDir::separator() % QLatin1String("translations");
break;
case QLibraryInfo::DataPath:
if (!webEnginePath.isEmpty())
@@ -96,18 +96,22 @@ QString subProcessPath()
{
static bool initialized = false;
#if defined(OS_WIN)
- static QString processPath (location(QLibraryInfo::LibraryExecutablesPath)
- % QDir::separator() % QStringLiteral(QTWEBENGINEPROCESS_NAME) % QStringLiteral(".exe"));
+ static QString processBinary (QLatin1String(QTWEBENGINEPROCESS_NAME) % QLatin1String(".exe"));
#else
- static QString processPath (location(QLibraryInfo::LibraryExecutablesPath)
- % QDir::separator() % QStringLiteral(QTWEBENGINEPROCESS_NAME));
+ static QString processBinary (QLatin1String(QTWEBENGINEPROCESS_NAME));
#endif
+ static QString processPath (location(QLibraryInfo::LibraryExecutablesPath)
+ % QDir::separator() % processBinary);
if (!initialized) {
// Allow overriding at runtime for the time being.
const QByteArray fromEnv = qgetenv("QTWEBENGINEPROCESS_PATH");
if (!fromEnv.isEmpty())
processPath = QString::fromLatin1(fromEnv);
- if (processPath.isEmpty() || !QFileInfo(processPath).exists())
+ if (processPath.isEmpty() || !QFileInfo(processPath).exists()) {
+ qWarning("QtWebEngineProcess not found at location %s. Trying fallback path...", qPrintable(processPath));
+ processPath = QCoreApplication::applicationDirPath() % QDir::separator() % processBinary;
+ }
+ if (!QFileInfo(processPath).exists())
qFatal("QtWebEngineProcess not found at location %s. Try setting the QTWEBENGINEPROCESS_PATH environment variable.", qPrintable(processPath));
initialized = true;
}
@@ -117,12 +121,12 @@ QString subProcessPath()
QString pluginsPath()
{
- return location(QLibraryInfo::PluginsPath) % QDir::separator() % QStringLiteral("qtwebengine");
+ return location(QLibraryInfo::PluginsPath) % QDir::separator() % QLatin1String("qtwebengine");
}
QString localesPath()
{
- return location(QLibraryInfo::TranslationsPath) % QStringLiteral("/qtwebengine_locales");
+ return location(QLibraryInfo::TranslationsPath) % QLatin1String("/qtwebengine_locales");
}
QString fallbackDir() {
@@ -151,7 +155,7 @@ base::FilePath WebEngineLibraryInfo::getPath(int key)
QString directory;
switch (key) {
case QT_RESOURCES_PAK:
- return toFilePath(location(QLibraryInfo::DataPath) % QStringLiteral("/qtwebengine_resources.pak"));
+ return toFilePath(location(QLibraryInfo::DataPath) % QLatin1String("/qtwebengine_resources.pak"));
case base::FILE_EXE:
case content::CHILD_PROCESS_EXE:
return toFilePath(subProcessPath());
diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp
index fdbc65ed6..03f746f41 100644
--- a/src/core/web_engine_settings.cpp
+++ b/src/core/web_engine_settings.cpp
@@ -42,8 +42,9 @@
#include <QFont>
#include <QTimer>
+#include <QTouchDevice>
-static const int batchTimerTimeout = 100;
+static const int batchTimerTimeout = 0;
class BatchTimer : public QTimer {
Q_OBJECT
@@ -68,6 +69,21 @@ private:
#include "web_engine_settings.moc"
+static inline bool isTouchScreenAvailable() {
+ static bool initialized = false;
+ static bool touchScreenAvailable = false;
+ if (!initialized) {
+ Q_FOREACH (const QTouchDevice *d, QTouchDevice::devices()) {
+ if (d->type() == QTouchDevice::TouchScreen) {
+ touchScreenAvailable = true;
+ break;
+ }
+ }
+ initialized = true;
+ }
+ return touchScreenAvailable;
+}
+
WebEngineSettings::WebEngineSettings(WebEngineSettingsDelegate *delegate)
: m_adapter(0)
@@ -185,13 +201,12 @@ QString WebEngineSettings::defaultTextEncoding() const
void WebEngineSettings::initDefaults()
{
// Initialize the default settings.
-
m_attributes.insert(AutoLoadImages, true);
m_attributes.insert(JavascriptEnabled, true);
- m_attributes.insert(JavascriptCanOpenWindows, false);
+ m_attributes.insert(JavascriptCanOpenWindows, true);
m_attributes.insert(JavascriptCanAccessClipboard, false);
m_attributes.insert(LinksIncludedInFocusChain, true);
- m_attributes.insert(LocalStorageEnabled, false);
+ m_attributes.insert(LocalStorageEnabled, true);
m_attributes.insert(LocalContentCanAccessRemoteUrls, false);
m_attributes.insert(XSSAuditingEnabled, false);
m_attributes.insert(SpatialNavigationEnabled, false);
@@ -236,7 +251,6 @@ void WebEngineSettings::doApply()
if (webPreferences.isNull())
return;
// Override with our settings when applicable
- // FIXME: batch sequential calls to apply?
applySettingsToWebPreferences(webPreferences.data());
Q_ASSERT(m_adapter);
@@ -247,6 +261,7 @@ void WebEngineSettings::applySettingsToWebPreferences(WebPreferences *prefs)
{
// Override for now
prefs->java_enabled = false;
+ prefs->touch_enabled = isTouchScreenAvailable();
// Attributes mapping.
prefs->loads_images_automatically = testAttribute(AutoLoadImages);
@@ -275,4 +290,5 @@ void WebEngineSettings::applySettingsToWebPreferences(WebPreferences *prefs)
prefs->default_fixed_font_size = fontSize(DefaultFixedFontSize);
prefs->minimum_font_size = fontSize(MinimumFontSize);
prefs->minimum_logical_font_size = fontSize(MinimumLogicalFontSize);
+ prefs->default_encoding = defaultTextEncoding().toStdString();
}
diff --git a/src/core/yuv_video_node.cpp b/src/core/yuv_video_node.cpp
index 256bf224e..0e3f17d85 100644
--- a/src/core/yuv_video_node.cpp
+++ b/src/core/yuv_video_node.cpp
@@ -36,6 +36,8 @@
#include "yuv_video_node.h"
+#include <QtGui/qopenglcontext.h>
+#include <QtGui/qopenglfunctions.h>
#include <QtQuick/qsgtexture.h>
class YUVVideoMaterialShader : public QSGMaterialShader
@@ -159,11 +161,13 @@ void YUVVideoMaterialShader::updateState(const RenderState &state, QSGMaterial *
program()->setUniformValue(m_id_uTexture, 1);
program()->setUniformValue(m_id_vTexture, 2);
- glActiveTexture(GL_TEXTURE1);
+ QOpenGLFunctions glFuncs(QOpenGLContext::currentContext());
+
+ glFuncs.glActiveTexture(GL_TEXTURE1);
mat->m_uTexture->bind();
- glActiveTexture(GL_TEXTURE2);
+ glFuncs.glActiveTexture(GL_TEXTURE2);
mat->m_vTexture->bind();
- glActiveTexture(GL_TEXTURE0); // Finish with 0 as default texture unit
+ glFuncs.glActiveTexture(GL_TEXTURE0); // Finish with 0 as default texture unit
mat->m_yTexture->bind();
program()->setUniformValue(m_id_texOffset, mat->m_texCoordRect.topLeft());
@@ -203,11 +207,13 @@ void YUVAVideoMaterialShader::updateState(const RenderState &state, QSGMaterial
YUVAVideoMaterial *mat = static_cast<YUVAVideoMaterial *>(newMaterial);
program()->setUniformValue(m_id_aTexture, 3);
- glActiveTexture(GL_TEXTURE3);
+ QOpenGLFunctions glFuncs(QOpenGLContext::currentContext());
+
+ glFuncs.glActiveTexture(GL_TEXTURE3);
mat->m_aTexture->bind();
// Reset the default texture unit.
- glActiveTexture(GL_TEXTURE0);
+ glFuncs.glActiveTexture(GL_TEXTURE0);
}
diff --git a/src/process/main.cpp b/src/process/main.cpp
index ec523ad9b..c340b1965 100644
--- a/src/process/main.cpp
+++ b/src/process/main.cpp
@@ -36,6 +36,7 @@
#include "process_main.h"
+#include <QCoreApplication>
#include <stdio.h>
#if defined(OS_LINUX)
@@ -147,6 +148,10 @@ int stat64_proxy(const char *path, struct stat64 *buf)
int main(int argc, const char **argv)
{
+ // QCoreApplication needs a non-const pointer, while the
+ // ContentMain in Chromium needs the pointer to be const.
+ QCoreApplication qtApplication(argc, const_cast<char**>(argv));
+
return QtWebEngine::processMain(argc, argv);
}
diff --git a/src/webengine/api/qquickwebengineloadrequest.cpp b/src/webengine/api/qquickwebengineloadrequest.cpp
index 7e207ea3f..a29381af6 100644
--- a/src/webengine/api/qquickwebengineloadrequest.cpp
+++ b/src/webengine/api/qquickwebengineloadrequest.cpp
@@ -60,13 +60,14 @@ public:
\qmltype WebEngineLoadRequest
\instantiates QQuickWebEngineLoadRequest
\inqmlmodule QtWebEngine 1.0
+ \since QtWebEngine 1.0
\brief A utility class for the WebEngineView::loadingChanged signal.
- This class contains information about a requested load of a web page, like the URL and
+ This class contains information about a requested load of a web page, such as the URL and
current loading status (started, finished, failed).
- \sa WebEngineView::onLoadingChanged
+ \sa WebEngineView::loadingChanged
*/
QQuickWebEngineLoadRequest::QQuickWebEngineLoadRequest(const QUrl& url, QQuickWebEngineView::LoadStatus status, const QString& errorString, int errorCode, QQuickWebEngineView::ErrorDomain errorDomain, QObject* parent)
: QObject(parent)
@@ -91,16 +92,13 @@ QUrl QQuickWebEngineLoadRequest::url() const
/*!
\qmlproperty enumeration WebEngineLoadRequest::status
- The load status of a web page load request.
+ This enumeration represents the load status of a web page load request.
- \list
- \li WebEngineView::LoadStartedStatus - the page is currently loading.
- \li WebEngineView::LoadSucceededStatus - the page has been loaded with success.
- \li WebEngineView::LoadFailedStatus - the page has failed loading.
- \endlist
+ \value WebEngineView::LoadStartedStatus The page is currently loading.
+ \value WebEngineView::LoadSucceededStatus The page has been loaded with success.
+ \value WebEngineView::LoadFailedStatus The page has failed loading.
- \sa WebEngineLoadRequest
- \sa WebEngineView::onLoadingChanged
+ \sa WebEngineView::loadingChanged
*/
QQuickWebEngineView::LoadStatus QQuickWebEngineLoadRequest::status() const
{
diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp
new file mode 100644
index 000000000..aa6290aa8
--- /dev/null
+++ b/src/webengine/api/qquickwebenginesettings.cpp
@@ -0,0 +1,256 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickwebenginesettings_p.h"
+#include "qquickwebenginesettings_p_p.h"
+
+#include <QtCore/QList>
+
+QT_BEGIN_NAMESPACE
+
+Q_GLOBAL_STATIC(QList<QQuickWebEngineSettingsPrivate*>, allSettings)
+
+QQuickWebEngineSettingsPrivate::QQuickWebEngineSettingsPrivate()
+ : coreSettings(new WebEngineSettings(this))
+{
+ allSettings->append(this);
+}
+
+void QQuickWebEngineSettingsPrivate::apply()
+{
+ coreSettings->scheduleApply();
+ QQuickWebEngineSettingsPrivate *globals = QQuickWebEngineSettings::globalSettings()->d_func();
+ Q_ASSERT((this == globals) != (allSettings->contains(this)));
+ if (this == globals)
+ Q_FOREACH (QQuickWebEngineSettingsPrivate *settings, *allSettings)
+ settings->coreSettings->scheduleApply();
+}
+
+WebEngineSettings *QQuickWebEngineSettingsPrivate::fallbackSettings() const
+{
+ return QQuickWebEngineSettings::globalSettings()->d_func()->coreSettings.data();
+}
+
+
+QQuickWebEngineSettings *QQuickWebEngineSettings::globalSettings()
+{
+ static QQuickWebEngineSettings *globals = 0;
+ if (!globals) {
+ globals = new QQuickWebEngineSettings;
+ allSettings->removeAll(globals->d_func());
+ globals->d_func()->coreSettings->initDefaults();
+ }
+ return globals;
+}
+
+QQuickWebEngineSettings::~QQuickWebEngineSettings()
+{
+}
+
+bool QQuickWebEngineSettings::autoLoadImages() const
+{
+ Q_D(const QQuickWebEngineSettings);
+ return d->coreSettings->testAttribute(WebEngineSettings::AutoLoadImages);
+}
+
+bool QQuickWebEngineSettings::javascriptEnabled() const
+{
+ Q_D(const QQuickWebEngineSettings);
+ return d->coreSettings->testAttribute(WebEngineSettings::JavascriptEnabled);
+}
+
+bool QQuickWebEngineSettings::javascriptCanOpenWindows() const
+{
+ Q_D(const QQuickWebEngineSettings);
+ return d->coreSettings->testAttribute(WebEngineSettings::JavascriptCanOpenWindows);
+}
+
+bool QQuickWebEngineSettings::javascriptCanAccessClipboard() const
+{
+ Q_D(const QQuickWebEngineSettings);
+ return d->coreSettings->testAttribute(WebEngineSettings::JavascriptCanAccessClipboard);
+}
+
+bool QQuickWebEngineSettings::linksIncludedInFocusChain() const
+{
+ Q_D(const QQuickWebEngineSettings);
+ return d->coreSettings->testAttribute(WebEngineSettings::LinksIncludedInFocusChain);
+}
+
+bool QQuickWebEngineSettings::localStorageEnabled() const
+{
+ Q_D(const QQuickWebEngineSettings);
+ return d->coreSettings->testAttribute(WebEngineSettings::LocalStorageEnabled);
+}
+
+bool QQuickWebEngineSettings::localContentCanAccessRemoteUrls() const
+{
+ Q_D(const QQuickWebEngineSettings);
+ return d->coreSettings->testAttribute(WebEngineSettings::LocalContentCanAccessRemoteUrls);
+}
+
+bool QQuickWebEngineSettings::spatialNavigationEnabled() const
+{
+ Q_D(const QQuickWebEngineSettings);
+ return d->coreSettings->testAttribute(WebEngineSettings::SpatialNavigationEnabled);
+}
+
+bool QQuickWebEngineSettings::localContentCanAccessFileUrls() const
+{
+ Q_D(const QQuickWebEngineSettings);
+ return d->coreSettings->testAttribute(WebEngineSettings::LocalContentCanAccessFileUrls);
+}
+
+bool QQuickWebEngineSettings::hyperlinkAuditingEnabled() const
+{
+ Q_D(const QQuickWebEngineSettings);
+ return d->coreSettings->testAttribute(WebEngineSettings::HyperlinkAuditingEnabled);
+}
+
+QString QQuickWebEngineSettings::defaultTextEncoding() const
+{
+ Q_D(const QQuickWebEngineSettings);
+ return d->coreSettings->defaultTextEncoding();
+}
+
+void QQuickWebEngineSettings::setAutoLoadImages(bool on)
+{
+ Q_D(QQuickWebEngineSettings);
+ bool wasOn = d->coreSettings->testAttribute(WebEngineSettings::AutoLoadImages);
+ // Set unconditionally as it sets the override for the current settings while the current setting
+ // could be from the fallback and is prone to changing later on.
+ d->coreSettings->setAttribute(WebEngineSettings::AutoLoadImages, on);
+ if (wasOn ^ on)
+ Q_EMIT autoLoadImagesChanged(on);
+}
+
+void QQuickWebEngineSettings::setJavascriptEnabled(bool on)
+{
+ Q_D(QQuickWebEngineSettings);
+ bool wasOn = d->coreSettings->testAttribute(WebEngineSettings::JavascriptEnabled);
+ d->coreSettings->setAttribute(WebEngineSettings::JavascriptEnabled, on);
+ if (wasOn ^ on)
+ Q_EMIT javascriptEnabledChanged(on);
+}
+
+void QQuickWebEngineSettings::setJavascriptCanOpenWindows(bool on)
+{
+ Q_D(QQuickWebEngineSettings);
+ bool wasOn = d->coreSettings->testAttribute(WebEngineSettings::JavascriptCanOpenWindows);
+ d->coreSettings->setAttribute(WebEngineSettings::JavascriptCanOpenWindows, on);
+ if (wasOn ^ on)
+ Q_EMIT javascriptCanOpenWindowsChanged(on);
+}
+
+void QQuickWebEngineSettings::setJavascriptCanAccessClipboard(bool on)
+{
+ Q_D(QQuickWebEngineSettings);
+ bool wasOn = d->coreSettings->testAttribute(WebEngineSettings::JavascriptCanAccessClipboard);
+ d->coreSettings->setAttribute(WebEngineSettings::JavascriptCanAccessClipboard, on);
+ if (wasOn ^ on)
+ Q_EMIT javascriptCanAccessClipboardChanged(on);
+}
+
+void QQuickWebEngineSettings::setLinksIncludedInFocusChain(bool on)
+{
+ Q_D(QQuickWebEngineSettings);
+ bool wasOn = d->coreSettings->testAttribute(WebEngineSettings::LinksIncludedInFocusChain);
+ d->coreSettings->setAttribute(WebEngineSettings::LinksIncludedInFocusChain, on);
+ if (wasOn ^ on)
+ Q_EMIT linksIncludedInFocusChainChanged(on);
+}
+
+void QQuickWebEngineSettings::setLocalStorageEnabled(bool on)
+{
+ Q_D(QQuickWebEngineSettings);
+ bool wasOn = d->coreSettings->testAttribute(WebEngineSettings::LocalStorageEnabled);
+ d->coreSettings->setAttribute(WebEngineSettings::LocalStorageEnabled, on);
+ if (wasOn ^ on)
+ Q_EMIT localStorageEnabledChanged(on);
+}
+
+void QQuickWebEngineSettings::setLocalContentCanAccessRemoteUrls(bool on)
+{
+ Q_D(QQuickWebEngineSettings);
+ bool wasOn = d->coreSettings->testAttribute(WebEngineSettings::LocalContentCanAccessRemoteUrls);
+ d->coreSettings->setAttribute(WebEngineSettings::LocalContentCanAccessRemoteUrls, on);
+ if (wasOn ^ on)
+ Q_EMIT localContentCanAccessRemoteUrlsChanged(on);
+}
+
+
+void QQuickWebEngineSettings::setSpatialNavigationEnabled(bool on)
+{
+ Q_D(QQuickWebEngineSettings);
+ bool wasOn = d->coreSettings->testAttribute(WebEngineSettings::SpatialNavigationEnabled);
+ d->coreSettings->setAttribute(WebEngineSettings::SpatialNavigationEnabled, on);
+ if (wasOn ^ on)
+ Q_EMIT spatialNavigationEnabledChanged(on);
+}
+
+void QQuickWebEngineSettings::setLocalContentCanAccessFileUrls(bool on)
+{
+ Q_D(QQuickWebEngineSettings);
+ bool wasOn = d->coreSettings->testAttribute(WebEngineSettings::LocalContentCanAccessFileUrls);
+ d->coreSettings->setAttribute(WebEngineSettings::LocalContentCanAccessFileUrls, on);
+ if (wasOn ^ on)
+ Q_EMIT localContentCanAccessFileUrlsChanged(on);
+}
+
+void QQuickWebEngineSettings::setHyperlinkAuditingEnabled(bool on)
+{
+ Q_D(QQuickWebEngineSettings);
+ bool wasOn = d->coreSettings->testAttribute(WebEngineSettings::HyperlinkAuditingEnabled);
+ d->coreSettings->setAttribute(WebEngineSettings::HyperlinkAuditingEnabled, on);
+ if (wasOn ^ on)
+ Q_EMIT hyperlinkAuditingEnabledChanged(on);
+}
+
+void QQuickWebEngineSettings::setDefaultTextEncoding(QString encoding)
+{
+ Q_D(QQuickWebEngineSettings);
+ const QString oldDefaultTextEncoding = d->coreSettings->defaultTextEncoding();
+ d->coreSettings->setDefaultTextEncoding(encoding);
+ if (oldDefaultTextEncoding.compare(encoding))
+ Q_EMIT defaultTextEncodingChanged(encoding);
+}
+
+QQuickWebEngineSettings::QQuickWebEngineSettings()
+ : d_ptr(new QQuickWebEngineSettingsPrivate)
+{
+}
+
+QT_END_NAMESPACE
diff --git a/src/webengine/api/qquickwebenginesettings_p.h b/src/webengine/api/qquickwebenginesettings_p.h
new file mode 100644
index 000000000..0fa44ef44
--- /dev/null
+++ b/src/webengine/api/qquickwebenginesettings_p.h
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKWEBENGINESETTINGS_P_H
+#define QQUICKWEBENGINESETTINGS_P_H
+
+#include <private/qtwebengineglobal_p.h>
+#include <QObject>
+#include <QScopedPointer>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickWebEngineSettingsPrivate;
+
+class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineSettings : public QObject {
+ Q_OBJECT
+ Q_PROPERTY(bool autoLoadImages READ autoLoadImages WRITE setAutoLoadImages NOTIFY autoLoadImagesChanged)
+ Q_PROPERTY(bool javascriptEnabled READ javascriptEnabled WRITE setJavascriptEnabled NOTIFY javascriptEnabledChanged)
+ Q_PROPERTY(bool javascriptCanOpenWindows READ javascriptCanOpenWindows WRITE setJavascriptCanOpenWindows NOTIFY javascriptCanOpenWindowsChanged)
+ Q_PROPERTY(bool javascriptCanAccessClipboard READ javascriptCanAccessClipboard WRITE setJavascriptCanAccessClipboard NOTIFY javascriptCanAccessClipboardChanged)
+ Q_PROPERTY(bool linksIncludedInFocusChain READ linksIncludedInFocusChain WRITE setLinksIncludedInFocusChain NOTIFY linksIncludedInFocusChainChanged)
+ Q_PROPERTY(bool localStorageEnabled READ localStorageEnabled WRITE setLocalStorageEnabled NOTIFY localStorageEnabledChanged)
+ Q_PROPERTY(bool localContentCanAccessRemoteUrls READ localContentCanAccessRemoteUrls WRITE setLocalContentCanAccessRemoteUrls NOTIFY localContentCanAccessRemoteUrlsChanged)
+ Q_PROPERTY(bool spatialNavigationEnabled READ spatialNavigationEnabled WRITE setSpatialNavigationEnabled NOTIFY spatialNavigationEnabledChanged)
+ Q_PROPERTY(bool localContentCanAccessFileUrls READ localContentCanAccessFileUrls WRITE setLocalContentCanAccessFileUrls NOTIFY localContentCanAccessFileUrlsChanged)
+ Q_PROPERTY(bool hyperlinkAuditingEnabled READ hyperlinkAuditingEnabled WRITE setHyperlinkAuditingEnabled NOTIFY hyperlinkAuditingEnabledChanged)
+ Q_PROPERTY(QString defaultTextEncoding READ defaultTextEncoding WRITE setDefaultTextEncoding NOTIFY defaultTextEncodingChanged)
+
+public:
+ static QQuickWebEngineSettings *globalSettings();
+
+ ~QQuickWebEngineSettings();
+
+ bool autoLoadImages() const;
+ bool javascriptEnabled() const;
+ bool javascriptCanOpenWindows() const;
+ bool javascriptCanAccessClipboard() const;
+ bool linksIncludedInFocusChain() const;
+ bool localStorageEnabled() const;
+ bool localContentCanAccessRemoteUrls() const;
+ bool spatialNavigationEnabled() const;
+ bool localContentCanAccessFileUrls() const;
+ bool hyperlinkAuditingEnabled() const;
+ QString defaultTextEncoding() const;
+
+ void setAutoLoadImages(bool on);
+ void setJavascriptEnabled(bool on);
+ void setJavascriptCanOpenWindows(bool on);
+ void setJavascriptCanAccessClipboard(bool on);
+ void setLinksIncludedInFocusChain(bool on);
+ void setLocalStorageEnabled(bool on);
+ void setLocalContentCanAccessRemoteUrls(bool on);
+ void setSpatialNavigationEnabled(bool on);
+ void setLocalContentCanAccessFileUrls(bool on);
+ void setHyperlinkAuditingEnabled(bool on);
+ void setDefaultTextEncoding(QString encoding);
+
+signals:
+ void autoLoadImagesChanged(bool on);
+ void javascriptEnabledChanged(bool on);
+ void javascriptCanOpenWindowsChanged(bool on);
+ void javascriptCanAccessClipboardChanged(bool on);
+ void linksIncludedInFocusChainChanged(bool on);
+ void localStorageEnabledChanged(bool on);
+ void localContentCanAccessRemoteUrlsChanged(bool on);
+ void spatialNavigationEnabledChanged(bool on);
+ void localContentCanAccessFileUrlsChanged(bool on);
+ void hyperlinkAuditingEnabledChanged(bool on);
+ void defaultTextEncodingChanged(QString encoding);
+
+private:
+ QQuickWebEngineSettings();
+ Q_DISABLE_COPY(QQuickWebEngineSettings)
+ Q_DECLARE_PRIVATE(QQuickWebEngineSettings)
+ friend class QQuickWebEngineViewPrivate;
+
+ QScopedPointer<QQuickWebEngineSettingsPrivate> d_ptr;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKWEBENGINESETTINGS_P_H
diff --git a/src/webengine/api/qquickwebenginesettings_p_p.h b/src/webengine/api/qquickwebenginesettings_p_p.h
new file mode 100644
index 000000000..8f3e95eea
--- /dev/null
+++ b/src/webengine/api/qquickwebenginesettings_p_p.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKWEBENGINESETTINGS_P_P_H
+#define QQUICKWEBENGINESETTINGS_P_P_H
+
+#include "web_engine_settings.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickWebEngineSettingsPrivate : public WebEngineSettingsDelegate {
+public:
+ QQuickWebEngineSettingsPrivate();
+ QQuickWebEngineSettingsPrivate(WebContentsAdapter *adapter);
+
+ void apply() Q_DECL_OVERRIDE;
+ WebEngineSettings *fallbackSettings() const Q_DECL_OVERRIDE;
+
+ QScopedPointer<WebEngineSettings> coreSettings;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKWEBENGINESETTINGS_P_P_H
diff --git a/src/webengine/api/qquickwebenginesingleton.cpp b/src/webengine/api/qquickwebenginesingleton.cpp
new file mode 100644
index 000000000..bf4951f3b
--- /dev/null
+++ b/src/webengine/api/qquickwebenginesingleton.cpp
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickwebenginesingleton_p.h"
+
+#include "qquickwebenginesettings_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QQuickWebEngineSettings *QQuickWebEngineSingleton::settings() const
+{
+ return QQuickWebEngineSettings::globalSettings();
+}
+
+QT_END_NAMESPACE
diff --git a/src/webengine/api/qquickwebenginesingleton_p.h b/src/webengine/api/qquickwebenginesingleton_p.h
new file mode 100644
index 000000000..23205e2df
--- /dev/null
+++ b/src/webengine/api/qquickwebenginesingleton_p.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKWEBENGINESINGLETON_P_H
+#define QQUICKWEBENGINESINGLETON_P_H
+
+#include <QObject>
+#include <qtwebengineglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+class QQuickWebEngineSettings;
+
+class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineSingleton : public QObject {
+ Q_OBJECT
+ Q_PROPERTY(QQuickWebEngineSettings* settings READ settings CONSTANT FINAL)
+
+public:
+ QQuickWebEngineSettings *settings() const;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKWEBENGINESINGLETON_P_H
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index e08232e78..b466c8566 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -43,6 +43,8 @@
#include "qquickwebengineloadrequest_p.h"
#include "qquickwebenginenavigationrequest_p.h"
#include "qquickwebenginenewviewrequest_p.h"
+#include "qquickwebenginesettings_p.h"
+#include "qquickwebenginesettings_p_p.h"
#include "render_widget_host_view_qt_delegate_quick.h"
#include "render_widget_host_view_qt_delegate_quickwindow.h"
#include "ui_delegates_manager.h"
@@ -75,10 +77,12 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate()
, e(new QQuickWebEngineViewExperimental(this))
, v(new QQuickWebEngineViewport(this))
, m_history(new QQuickWebEngineHistory(this))
+ , m_settings(new QQuickWebEngineSettings)
, contextMenuExtraItems(0)
, loadProgress(0)
, inspectable(false)
, m_isFullScreen(false)
+ , isLoading(false)
, devicePixelRatio(QGuiApplication::primaryScreen()->devicePixelRatio())
, m_dpiScale(1.0)
{
@@ -91,7 +95,7 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate()
// and instead use a reasonable default value for viewport.devicePixelRatio to avoid every
// app having to use this experimental API.
QString platform = qApp->platformName().toLower();
- if (platform == QStringLiteral("qnx")) {
+ if (platform == QLatin1String("qnx")) {
qreal webPixelRatio = QGuiApplication::primaryScreen()->physicalDotsPerInch() / 160;
// Quantize devicePixelRatio to increments of 1 to allow JS and media queries to select
@@ -131,7 +135,7 @@ RenderWidgetHostViewQtDelegate *QQuickWebEngineViewPrivate::CreateRenderWidgetHo
RenderWidgetHostViewQtDelegate *QQuickWebEngineViewPrivate::CreateRenderWidgetHostViewQtDelegateForPopup(RenderWidgetHostViewQtDelegateClient *client)
{
Q_Q(QQuickWebEngineView);
- const bool hasWindowCapability = qApp->platformName().toLower() != QStringLiteral("eglfs");
+ const bool hasWindowCapability = qApp->platformName().toLower() != QLatin1String("eglfs");
RenderWidgetHostViewQtDelegateQuick *quickDelegate = new RenderWidgetHostViewQtDelegateQuick(client, /*isPopup = */ true);
if (hasWindowCapability) {
RenderWidgetHostViewQtDelegateQuickWindow *wrapperWindow = new RenderWidgetHostViewQtDelegateQuickWindow(quickDelegate);
@@ -274,6 +278,7 @@ qreal QQuickWebEngineViewPrivate::dpiScale() const
void QQuickWebEngineViewPrivate::loadStarted(const QUrl &provisionalUrl)
{
Q_Q(QQuickWebEngineView);
+ isLoading = true;
m_history->reset();
QQuickWebEngineLoadRequest loadRequest(provisionalUrl, QQuickWebEngineView::LoadStartedStatus);
Q_EMIT q->loadingChanged(&loadRequest);
@@ -293,28 +298,29 @@ Q_STATIC_ASSERT(static_cast<int>(WebEngineError::NoErrorDomain) == static_cast<i
Q_STATIC_ASSERT(static_cast<int>(WebEngineError::CertificateErrorDomain) == static_cast<int>(QQuickWebEngineView::CertificateErrorDomain));
Q_STATIC_ASSERT(static_cast<int>(WebEngineError::DnsErrorDomain) == static_cast<int>(QQuickWebEngineView::DnsErrorDomain));
-void QQuickWebEngineViewPrivate::loadFinished(bool success, int error_code, const QString &error_description)
+void QQuickWebEngineViewPrivate::loadFinished(bool success, const QUrl &url, int errorCode, const QString &errorDescription)
{
Q_Q(QQuickWebEngineView);
+ isLoading = false;
m_history->reset();
- if (error_code == WebEngineError::UserAbortedError) {
- QQuickWebEngineLoadRequest loadRequest(q->url(), QQuickWebEngineView::LoadStoppedStatus);
+ if (errorCode == WebEngineError::UserAbortedError) {
+ QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadStoppedStatus);
Q_EMIT q->loadingChanged(&loadRequest);
return;
}
if (success) {
- QQuickWebEngineLoadRequest loadRequest(q->url(), QQuickWebEngineView::LoadSucceededStatus);
+ QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadSucceededStatus);
Q_EMIT q->loadingChanged(&loadRequest);
return;
}
- Q_ASSERT(error_code);
+ Q_ASSERT(errorCode);
QQuickWebEngineLoadRequest loadRequest(
- q->url(),
+ url,
QQuickWebEngineView::LoadFailedStatus,
- error_description,
- error_code,
- static_cast<QQuickWebEngineView::ErrorDomain>(WebEngineError::toQtErrorDomain(error_code)));
+ errorDescription,
+ errorCode,
+ static_cast<QQuickWebEngineView::ErrorDomain>(WebEngineError::toQtErrorDomain(errorCode)));
Q_EMIT q->loadingChanged(&loadRequest);
return;
}
@@ -353,7 +359,7 @@ void QQuickWebEngineViewPrivate::adoptNewWindow(WebContentsAdapter *newWebConten
void QQuickWebEngineViewPrivate::close()
{
- Q_UNREACHABLE();
+ // Not implemented yet.
}
void QQuickWebEngineViewPrivate::requestFullScreen(bool fullScreen)
@@ -393,28 +399,9 @@ QObject *QQuickWebEngineViewPrivate::accessibilityParentObject()
return q;
}
-namespace {
-class DummySettingsDelegate : public WebEngineSettingsDelegate {
-public:
- DummySettingsDelegate()
- : settings(0) {}
- void apply() { }
- WebEngineSettings* fallbackSettings() const { return settings; }
- WebEngineSettings *settings;
-};
-
-}// anonymous namespace
-
WebEngineSettings *QQuickWebEngineViewPrivate::webEngineSettings() const
{
- static WebEngineSettings *dummySettings = 0;
- if (!dummySettings) {
- DummySettingsDelegate *dummyDelegate = new DummySettingsDelegate;
- dummySettings = new WebEngineSettings(dummyDelegate);
- dummyDelegate->settings = dummySettings;
- dummySettings->initDefaults();
- }
- return dummySettings;
+ return m_settings->d_func()->coreSettings.data();
}
void QQuickWebEngineViewPrivate::setDevicePixelRatio(qreal devicePixelRatio)
@@ -587,7 +574,7 @@ void QQuickWebEngineViewPrivate::didFindText(quint64 requestId, int matchCount)
bool QQuickWebEngineView::isLoading() const
{
Q_D(const QQuickWebEngineView);
- return d->adapter->isLoading();
+ return d->isLoading;
}
int QQuickWebEngineView::loadProgress() const
@@ -667,6 +654,11 @@ QQmlComponent *QQuickWebEngineViewExperimental::extraContextMenuEntriesComponent
return d_ptr->contextMenuExtraItems;
}
+QQuickWebEngineSettings *QQuickWebEngineViewExperimental::settings() const
+{
+ return d_ptr->m_settings.data();
+}
+
void QQuickWebEngineViewExperimental::findText(const QString &subString, FindFlags options, const QJSValue &callback)
{
if (subString.isEmpty()) {
diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h
index e26255535..ac8b8564f 100644
--- a/src/webengine/api/qquickwebengineview_p_p.h
+++ b/src/webengine/api/qquickwebengineview_p_p.h
@@ -55,6 +55,7 @@ class QQuickWebEngineNewViewRequest;
class QQuickWebEngineView;
class QQmlComponent;
class QQmlContext;
+class QQuickWebEngineSettings;
class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineViewport : public QObject {
Q_OBJECT
@@ -81,6 +82,7 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineViewExperimental : public QObjec
Q_PROPERTY(bool inspectable READ inspectable WRITE setInspectable)
Q_PROPERTY(bool isFullScreen READ isFullScreen WRITE setIsFullScreen NOTIFY isFullScreenChanged)
Q_PROPERTY(QQuickWebEngineHistory *navigationHistory READ navigationHistory CONSTANT FINAL)
+ Q_PROPERTY(QQuickWebEngineSettings *settings READ settings)
Q_ENUMS(Feature)
Q_FLAGS(FindFlags)
@@ -105,6 +107,7 @@ public:
void setExtraContextMenuEntriesComponent(QQmlComponent *);
QQmlComponent *extraContextMenuEntriesComponent() const;
QQuickWebEngineHistory *navigationHistory() const;
+ QQuickWebEngineSettings *settings() const;
public Q_SLOTS:
void goBackTo(int index);
@@ -154,7 +157,7 @@ public:
virtual void loadStarted(const QUrl &provisionalUrl) Q_DECL_OVERRIDE;
virtual void loadCommitted() Q_DECL_OVERRIDE;
virtual void loadVisuallyCommitted() Q_DECL_OVERRIDE;
- virtual void loadFinished(bool success, int error_code = 0, const QString &error_description = QString()) Q_DECL_OVERRIDE;
+ virtual void loadFinished(bool success, const QUrl &url, int errorCode = 0, const QString &errorDescription = QString()) Q_DECL_OVERRIDE;
virtual void focusContainer() Q_DECL_OVERRIDE;
virtual void adoptNewWindow(WebContentsAdapter *newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &) Q_DECL_OVERRIDE;
virtual void close() Q_DECL_OVERRIDE;
@@ -183,11 +186,13 @@ public:
QScopedPointer<QQuickWebEngineViewExperimental> e;
QScopedPointer<QQuickWebEngineViewport> v;
QScopedPointer<QQuickWebEngineHistory> m_history;
+ QScopedPointer<QQuickWebEngineSettings> m_settings;
QQmlComponent *contextMenuExtraItems;
QUrl icon;
int loadProgress;
bool inspectable;
bool m_isFullScreen;
+ bool isLoading;
qreal devicePixelRatio;
QMap<quint64, QJSValue> m_callbacks;
diff --git a/src/webengine/doc/qtwebengine.qdocconf b/src/webengine/doc/qtwebengine.qdocconf
index 831339bff..e5abeafd6 100644
--- a/src/webengine/doc/qtwebengine.qdocconf
+++ b/src/webengine/doc/qtwebengine.qdocconf
@@ -2,7 +2,6 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtWebEngine
description = Qt WebEngine Reference Documentation
-url = http://qt-project.org/doc/qt-$QT_VER
version = $QT_VERSION
examplesinstallpath = webengine
@@ -21,11 +20,12 @@ qhp.QtWebEngine.customFilters.Qt.filterAttributes = qtwebengine $QT_VERSION
qhp.QtWebEngine.subprojects = qmltypes examples
qhp.QtWebEngine.subprojects.qmltypes.title = QML Types
qhp.QtWebEngine.subprojects.qmltypes.indexTitle = Qt WebEngine QML Types
-qhp.QtWebEngine.subprojects.qmltypes.selectors = fake:qmlclass
+qhp.QtWebEngine.subprojects.qmltypes.selectors = qmlclass
qhp.QtWebEngine.subprojects.qmltypes.sortPages = true
qhp.QtWebEngine.subprojects.examples.title = Examples
-qhp.QtWebEngine.subprojects.examples.indexTitle = Qt WebEngine Code Samples
+qhp.QtWebEngine.subprojects.examples.indexTitle = Qt WebEngine Examples
qhp.QtWebEngine.subprojects.examples.selectors = fake:example
+qhp.QtWebEngine.subprojects.examples.sortPages = true
tagfile = ../../../doc/qtwebengine/qtwebengine.tags
diff --git a/src/webengine/doc/src/qquickwebengineview_lgpl.qdoc b/src/webengine/doc/src/qquickwebengineview_lgpl.qdoc
index fb38c1108..379c45e1c 100644
--- a/src/webengine/doc/src/qquickwebengineview_lgpl.qdoc
+++ b/src/webengine/doc/src/qquickwebengineview_lgpl.qdoc
@@ -76,14 +76,15 @@
\qmltype WebEngineView
\instantiates QQuickWebEngineView
\inqmlmodule QtWebEngine 1.0
- \brief A WebEngineView renders web content within a QML application
+ \since QtWebEngine 1.0
+ \brief A WebEngineView renders web content within a QML application.
*/
/*!
\qmlmethod void WebEngineView::goBack()
Go backward within the browser's session history, if possible.
- (Equivalent to the \c{window.history.back()} DOM method.)
+ This function is equivalent to the \c{window.history.back()} DOM method.
\sa WebEngineView::canGoBack
*/
@@ -92,20 +93,20 @@
\qmlmethod void WebEngineView::goForward()
Go forward within the browser's session history, if possible.
- (Equivalent to the \c{window.history.forward()} DOM method.)
+ This function is equivalent to the \c{window.history.forward()} DOM method.
*/
/*!
\qmlmethod void WebEngineView::stop()
- Stop loading the current page.
+ Stops loading the current page.
*/
/*!
\qmlmethod void WebEngineView::reload()
- Reload the current page. (Equivalent to the
- \c{window.location.reload()} DOM method.)
+ Reloads the current page. This function is equivalent to the
+ \c{window.location.reload()} DOM method.
*/
/*!
@@ -120,13 +121,15 @@
/*!
\qmlproperty url WebEngineView::icon
+ \readonly
- The location of the currently displaying Web site icon, also known as favicon
- or shortcut icon. This read-only URL corresponds to the image used within a
- mobile browser application to represent a bookmarked page on the device's home
- screen.
+ This property holds the location of the currently displaying web site icon,
+ also known as favicon or shortcut icon. This read-only URL corresponds to
+ the image used within a mobile browser application to represent a
+ bookmarked page on the device's home screen.
- This example uses the \c{icon} property to build an \c{Image} element:
+ The following snippet uses the \c{icon} property to build an \c{Image}
+ component:
\code
Image {
@@ -140,8 +143,8 @@
/*!
\qmlproperty int WebEngineView::loadProgress
- The amount of the page that has been loaded, expressed as an integer
- percentage in the range from \c{0} to \c{100}.
+ This property holds the amount of the page that has been loaded, expressed
+ as an integer percentage in the range from \c{0} to \c{100}.
*/
/*!
@@ -166,23 +169,24 @@
/*!
\qmlproperty string WebEngineView::title
+ \readonly
- The title of the currently displaying HTML page, a read-only value
- that reflects the contents of the \c{<title>} tag.
+ This property holds the title of the currently displaying HTML page, a
+ read-only value that reflects the contents of the \c{<title>} tag.
*/
/*!
\qmlmethod void WebEngineView::loadHtml(string html, url baseUrl)
\brief Loads the specified \a html as the content of the web view.
- (This method offers a lower-level alternative to the \c{url} property,
- which references HTML pages via URL.)
+ This method offers a lower-level alternative to the \c{url} property,
+ which references HTML pages via URL.
External objects such as stylesheets or images referenced in the HTML
- document are located relative to \a baseUrl. For example if provided \a html
- was originally retrieved from \c http://www.example.com/documents/overview.html
- and that was the base url, then an image referenced with the relative url \c diagram.png
- would be looked for at \c{http://www.example.com/documents/diagram.png}.
+ document should be located relative to \a baseUrl. For example, if \a html
+ is retrieved from \c http://www.example.com/documents/overview.html, which
+ is the base url, then an image referenced with the relative url, \c diagram.png,
+ should be at \c{http://www.example.com/documents/diagram.png}.
\sa WebEngineView::url
*/
@@ -202,85 +206,75 @@
*/
/*!
- \qmlsignal WebEngineView::onLoadingChanged(loadRequest)
+ \qmlsignal WebEngineView::loadingChanged(loadRequest)
- Occurs when any page load begins, ends, or fails. Various read-only
- parameters are available on the \a loadRequest:
-
- \list
-
- \li \c{url}: the location of the resource that is loading.
-
- \li \c{status}: Reflects one of four load states:
- \c{LoadStartedStatus}, \c{LoadStoppedStatus},
- \c{LoadSucceededStatus}, or \c{LoadFailedStatus}.
- See \c{WebEngineView::LoadStatus}.
+ This signal is emitted when a page load begins, ends, or fails.
+ The corresponding handler is onLoadingChanged.
- \li \c{errorString}: description of load error.
-
- \li \c{errorCode}: HTTP error code.
-
- \li \c{errorDomain}: high-level error types, one of
- \c{NetworkErrorDomain}, \c{HttpErrorDomain}, \c{InternalErrorDomain},
- \c{DownloadErrorDomain}, or \c{NoErrorDomain}. See
- \l{WebEngineView::ErrorDomain}.
+ When handling the signal with onLoadingChanged, various read-only
+ parameters are available on the \a loadRequest:
- \endlist
+ \table
+ \header
+ \li Property
+ \li Description
+ \row
+ \li url
+ \li The location of the resource that is loading.
+ \row
+ \li status
+ \li Reflects one of four load states:
+ \c{WebEngineView::LoadStartedStatus}, \c{WebEngineView::LoadStoppedStatus},
+ \c{WebEngineView::LoadSucceededStatus}, or \c{WebEngineView::LoadFailedStatus}.
+ See WebEngineLoadRequest::status and WebEngineView::LoadStatus.
+ \row
+ \li errorString
+ \li The description of load error.
+ \row
+ \li errorCode
+ \li The HTTP error code.
+ \row
+ \li errorDomain
+ \li The high-level error types, one of
+ \c{WebEngineView::ConnectionErrorDomain}, \c{WebEngineView::HttpErrorDomain}, \c{WebEngineView::InternalErrorDomain},
+ \c{WebEngineView::DownloadErrorDomain}, or \c{WebEngineView::NoErrorDomain}. See
+ \l{WebEngineView::ErrorDomain} for the full list.
+ \endtable
\sa WebEngineView::loading
*/
/*!
- \qmlsignal WebEngineView::onLinkHovered(hoveredUrl, hoveredTitle)
+ \qmlsignal WebEngineView::linkHovered(hoveredUrl, hoveredTitle)
Within a mouse-driven interface, this signal is emitted when a mouse
pointer passes over a link, corresponding to the \c{mouseover} DOM
- event. (May also occur in touch interfaces for \c{mouseover} events
- that are not cancelled with \c{preventDefault()}.) The \a{hoveredUrl}
- provides the link's location, and the \a{hoveredTitle} is any avalable
+ event. This event may also occur in touch interfaces for \c{mouseover}
+ events that are not cancelled with \c{preventDefault()}. \a{hoveredUrl}
+ provides the link's location, and \a{hoveredTitle} is any available
link text.
+
+ The corresponding handler is onLinkHovered.
*/
/*!
\qmlproperty enumeration WebEngineView::ErrorDomain
- Details various high-level error types.
-
- \table
-
- \header
- \li Constant
- \li Description
-
- \row
- \li InternalErrorDomain
- \li Content fails to be interpreted by Qt WebEngine.
-
- \row
- \li ConnectionErrorDomain
- \li Error results from faulty network connection.
-
- \row
- \li HttpErrorDomain
- \li Error is produced by server.
-
- \row
- \li CertificateErrorDomain
- \li Error related to the SSL/TLS certficate.
-
- \row
- \li FtpErrorDomain
- \li An error related to the file transfer protocol.
-
- \row
- \li DnsErrorDomain
- \li An error related to DNS lookup.
-
- \row
- \li NoErrorDomain
- \li Unspecified fallback error.
-
- \endtable
+ This enumeration details various high-level error types.
+
+ \value NoErrorDomain
+ \value WebEngineView::InternalErrorDomain
+ Content fails to be interpreted by Qt WebEngine.
+ \value WebEngineView::ConnectionErrorDomain
+ Error results from faulty network connection.
+ \value WebEngineView::CertificateErrorDomain
+ Error related to the SSL/TLS certficate.
+ \value WebEngineView::HttpErrorDomain
+ Error related to the HTTP connection.
+ \value WebEngineView::FtpErrorDomain
+ Error related to the FTP connection.
+ \value WebEngineView::DnsErrorDomain
+ Error related to the DNS connection.
*/
/*!
diff --git a/src/webengine/plugin/experimental/experimental.pro b/src/webengine/plugin/experimental/experimental.pro
index 565d931ba..36162e359 100644
--- a/src/webengine/plugin/experimental/experimental.pro
+++ b/src/webengine/plugin/experimental/experimental.pro
@@ -4,7 +4,7 @@ TARGETPATH = QtWebEngine/experimental
IMPORT_VERSION = 1.0
QT += webengine qml quick
-QT_PRIVATE += webengine-private qml-private quick-private gui-private core-private
+QT_PRIVATE += webengine-private
INCLUDEPATH += $$QTWEBENGINE_ROOT/src/core $$QTWEBENGINE_ROOT/src/webengine $$QTWEBENGINE_ROOT/src/webengine/api
diff --git a/src/webengine/plugin/experimental/plugin.cpp b/src/webengine/plugin/experimental/plugin.cpp
index f517a28ca..883ebc598 100644
--- a/src/webengine/plugin/experimental/plugin.cpp
+++ b/src/webengine/plugin/experimental/plugin.cpp
@@ -37,11 +37,18 @@
#include <QtQml/qqmlextensionplugin.h>
#include "qquickwebenginehistory_p.h"
+#include "qquickwebenginesettings_p.h"
+#include "qquickwebenginesingleton_p.h"
#include "qquickwebengineview_p.h"
#include "qquickwebengineview_p_p.h"
QT_BEGIN_NAMESPACE
+static QObject *webEngineSingletonProvider(QQmlEngine *, QJSEngine *)
+{
+ return new QQuickWebEngineSingleton;
+}
+
class QQuickWebEngineViewExperimentalExtension : public QObject {
Q_OBJECT
Q_PROPERTY(QQuickWebEngineViewExperimental* experimental READ experimental CONSTANT FINAL)
@@ -71,6 +78,9 @@ public:
QObject::tr("Cannot create a separate instance of NavigationHistory"));
qmlRegisterUncreatableType<QQuickWebEngineHistoryListModel>(uri, 1, 0, "NavigationHistoryListModel",
QObject::tr("Cannot create a separate instance of NavigationHistory"));
+ qmlRegisterUncreatableType<QQuickWebEngineSettings>(uri, 1, 0, "WebEngineSettings",
+ QObject::tr("Cannot create a separate instance of WebEngineSettings"));
+ qmlRegisterSingletonType<QQuickWebEngineSingleton>(uri, 1, 0, "WebEngine", webEngineSingletonProvider);
}
};
diff --git a/src/webengine/plugin/plugin.cpp b/src/webengine/plugin/plugin.cpp
index 689eca997..60e401301 100644
--- a/src/webengine/plugin/plugin.cpp
+++ b/src/webengine/plugin/plugin.cpp
@@ -36,11 +36,11 @@
#include <QtQml/qqmlextensionplugin.h>
-#include "qtwebengineversion.h"
-#include "qquickwebengineview_p.h"
#include "qquickwebengineloadrequest_p.h"
#include "qquickwebenginenavigationrequest_p.h"
#include "qquickwebenginenewviewrequest_p.h"
+#include "qquickwebengineview_p.h"
+#include "qtwebengineversion.h"
QT_BEGIN_NAMESPACE
@@ -61,14 +61,6 @@ public:
qmlRegisterUncreatableType<QQuickWebEngineLoadRequest>(uri, 1, 0, "WebEngineLoadRequest", QObject::tr("Cannot create separate instance of WebEngineLoadRequest"));
qmlRegisterUncreatableType<QQuickWebEngineNewViewRequest>(uri, 1, 0, "WebEngineNewViewRequest", QObject::tr("Cannot create separate instance of WebEngineNewViewRequest"));
qmlRegisterUncreatableType<QQuickWebEngineNavigationRequest>(uri, 1, 0, "WebEngineNavigationRequest", QObject::tr("Cannot create separate instance of WebEngineNavigationRequest"));
-
- // The QML type loader relies on the minimum and maximum minor version of registered types
- // to validate imports. We want to tie our import version to the module version, so register
- // a dummy type in order to allow importing the latest version even if it didn't include
- // an API update that would appear here in a registered type.
- int major = QTWEBENGINE_VERSION >> 16;
- int minor = (QTWEBENGINE_VERSION >> 8) & 0xFF;
- qmlRegisterUncreatableType<QQuickWebEngineVersionBumper>(uri, major, minor, "WebEngineVersionBumper", QObject::tr("This is a dummy type and cannot be created."));
}
};
diff --git a/src/webengine/plugin/plugin.pro b/src/webengine/plugin/plugin.pro
index cee05ba9b..5682e90ed 100644
--- a/src/webengine/plugin/plugin.pro
+++ b/src/webengine/plugin/plugin.pro
@@ -4,7 +4,7 @@ TARGETPATH = QtWebEngine
IMPORT_VERSION = 1.0
QT += webengine qml quick
-QT_PRIVATE += webengine-private qml-private quick-private gui-private core-private
+QT_PRIVATE += webengine-private
INCLUDEPATH += $$QTWEBENGINE_ROOT/src/core $$QTWEBENGINE_ROOT/src/webengine $$QTWEBENGINE_ROOT/src/webengine/api $$QTWEBENGINE_ROOT/include/QtWebEngine
diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp
index 9b7b0dd18..95e04d699 100644
--- a/src/webengine/ui_delegates_manager.cpp
+++ b/src/webengine/ui_delegates_manager.cpp
@@ -78,7 +78,7 @@ static QString getUIDelegatesImportDir(QQmlEngine *engine) {
if (initialized)
return importDir;
Q_FOREACH (const QString &path, engine->importPathList()) {
- QFileInfo fi(path % QStringLiteral("/QtWebEngine/UIDelegates/"));
+ QFileInfo fi(path % QLatin1String("/QtWebEngine/UIDelegates/"));
if (fi.exists()) {
importDir = fi.absolutePath();
break;
@@ -347,7 +347,7 @@ public:
FilePickerController(WebContentsAdapterClient::FileChooserMode, const QExplicitlySharedDataPointer<WebContentsAdapter> &, QObject * = 0);
public Q_SLOTS:
- void accepted(const QVariant &files);
+ void accepted(const QJSValue &files);
void rejected();
private:
@@ -364,12 +364,13 @@ FilePickerController::FilePickerController(WebContentsAdapterClient::FileChooser
{
}
-void FilePickerController::accepted(const QVariant &files)
+void FilePickerController::accepted(const QJSValue &filesValue)
{
QStringList stringList;
- // Qt Quick's file dialog returns a list of QUrls, this will hence shape our API there.
- Q_FOREACH (const QUrl &url, files.value<QList<QUrl> >())
- stringList.append(url.toLocalFile());
+ int length = filesValue.property(QStringLiteral("length")).toInt();
+ for (int i = 0; i < length; i++) {
+ stringList.append(QUrl(filesValue.property(i).toString()).toLocalFile());
+ }
m_adapter->filesSelectedInChooser(stringList, m_mode);
}
@@ -389,6 +390,7 @@ void UIDelegatesManager::showFilePicker(WebContentsAdapterClient::FileChooserMod
if (!ensureComponentLoaded(FilePicker))
return;
+
QQmlContext *context(creationContextForComponent(filePickerComponent));
QObject *filePicker = filePickerComponent->beginCreate(context);
if (QQuickItem* item = qobject_cast<QQuickItem*>(filePicker))
@@ -418,7 +420,7 @@ void UIDelegatesManager::showFilePicker(WebContentsAdapterClient::FileChooserMod
CHECK_QML_SIGNAL_PROPERTY(filesPickedSignal, filePickerComponent->url());
QQmlProperty rejectSignal(filePicker, QStringLiteral("onRejected"));
CHECK_QML_SIGNAL_PROPERTY(rejectSignal, filePickerComponent->url());
- static int acceptedIndex = controller->metaObject()->indexOfSlot("accepted(QVariant)");
+ static int acceptedIndex = controller->metaObject()->indexOfSlot("accepted(QJSValue)");
QObject::connect(filePicker, filesPickedSignal.method(), controller, controller->metaObject()->method(acceptedIndex));
static int rejectedIndex = controller->metaObject()->indexOfSlot("rejected()");
QObject::connect(filePicker, rejectSignal.method(), controller, controller->metaObject()->method(rejectedIndex));
diff --git a/src/webengine/webengine.pro b/src/webengine/webengine.pro
index 6f2434700..6f48e9d49 100644
--- a/src/webengine/webengine.pro
+++ b/src/webengine/webengine.pro
@@ -6,7 +6,7 @@ CMAKE_MODULE_TESTS = "-"
DEFINES += QT_BUILD_WEBENGINE_LIB
QT += qml quick
-QT_PRIVATE += webenginecore qml-private quick-private gui-private core-private
+QT_PRIVATE += webenginecore quick-private
QMAKE_DOCS = $$PWD/doc/qtwebengine.qdocconf
@@ -17,6 +17,8 @@ SOURCES = \
api/qquickwebengineloadrequest.cpp \
api/qquickwebenginenavigationrequest.cpp \
api/qquickwebenginenewviewrequest.cpp \
+ api/qquickwebenginesettings.cpp \
+ api/qquickwebenginesingleton.cpp \
api/qquickwebengineview.cpp \
api/qtwebengineglobal.cpp \
render_widget_host_view_qt_delegate_quick.cpp \
@@ -30,6 +32,9 @@ HEADERS = \
api/qquickwebengineloadrequest_p.h \
api/qquickwebenginenavigationrequest_p.h \
api/qquickwebenginenewviewrequest_p.h \
+ api/qquickwebenginesettings_p.h \
+ api/qquickwebenginesettings_p_p.h \
+ api/qquickwebenginesingleton_p.h \
api/qquickwebengineview_p.h \
api/qquickwebengineview_p_p.h \
render_widget_host_view_qt_delegate_quick.h \
diff --git a/src/webenginewidgets/api/qwebenginehistory.h b/src/webenginewidgets/api/qwebenginehistory.h
index cf950582f..5d3ba8ce3 100644
--- a/src/webenginewidgets/api/qwebenginehistory.h
+++ b/src/webenginewidgets/api/qwebenginehistory.h
@@ -104,7 +104,7 @@ private:
~QWebEngineHistory();
Q_DISABLE_COPY(QWebEngineHistory)
- Q_DECLARE_PRIVATE(QWebEngineHistory);
+ Q_DECLARE_PRIVATE(QWebEngineHistory)
QScopedPointer<QWebEngineHistoryPrivate> d_ptr;
friend QWEBENGINEWIDGETS_EXPORT QDataStream& operator>>(QDataStream&, QWebEngineHistory&);
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index 51e733e70..8c3c2bb45 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -171,6 +171,7 @@ QWebEnginePagePrivate::QWebEnginePagePrivate()
, history(new QWebEngineHistory(new QWebEngineHistoryPrivate(this)))
, settings(new QWebEngineSettings)
, view(0)
+ , isLoading(false)
{
memset(actions, 0, sizeof(actions));
}
@@ -237,6 +238,7 @@ void QWebEnginePagePrivate::loadStarted(const QUrl &provisionalUrl)
{
Q_UNUSED(provisionalUrl)
Q_Q(QWebEnginePage);
+ isLoading = true;
Q_EMIT q->loadStarted();
updateNavigationActions();
}
@@ -246,11 +248,13 @@ void QWebEnginePagePrivate::loadCommitted()
updateNavigationActions();
}
-void QWebEnginePagePrivate::loadFinished(bool success, int error_code, const QString &error_description)
+void QWebEnginePagePrivate::loadFinished(bool success, const QUrl &url, int errorCode, const QString &errorDescription)
{
Q_Q(QWebEnginePage);
- Q_UNUSED(error_code);
- Q_UNUSED(error_description);
+ Q_UNUSED(url);
+ Q_UNUSED(errorCode);
+ Q_UNUSED(errorDescription);
+ isLoading = false;
if (success)
m_explicitUrl = QUrl();
Q_EMIT q->loadFinished(success);
@@ -362,11 +366,11 @@ void QWebEnginePagePrivate::updateAction(QWebEnginePage::WebAction action) const
enabled = adapter->canGoForward();
break;
case QWebEnginePage::Stop:
- enabled = adapter->isLoading();
+ enabled = isLoading;
break;
case QWebEnginePage::Reload:
case QWebEnginePage::ReloadAndBypassCache:
- enabled = !adapter->isLoading();
+ enabled = !isLoading;
break;
default:
break;
@@ -579,6 +583,9 @@ void QWebEnginePage::findText(const QString &subString, FindFlags options, const
}
}
+/*!
+ * \reimp
+ */
bool QWebEnginePage::event(QEvent *e)
{
return QObject::event(e);
diff --git a/src/webenginewidgets/api/qwebenginepage.h b/src/webenginewidgets/api/qwebenginepage.h
index 667098032..cda6e620f 100644
--- a/src/webenginewidgets/api/qwebenginepage.h
+++ b/src/webenginewidgets/api/qwebenginepage.h
@@ -172,7 +172,12 @@ public:
virtual void triggerAction(WebAction action, bool checked = false);
virtual bool event(QEvent*);
+#ifdef Q_QDOC
+ void findText(const QString &subString, FindFlags options = 0);
+ void findText(const QString &subString, FindFlags options, FunctorOrLambda resultCallback);
+#else
void findText(const QString &subString, FindFlags options = 0, const QWebEngineCallback<bool> &resultCallback = QWebEngineCallback<bool>());
+#endif
QMenu *createStandardContextMenu();
void setFeaturePermission(const QUrl &securityOrigin, Feature feature, PermissionPolicy policy);
@@ -182,8 +187,13 @@ public:
void setHtml(const QString &html, const QUrl &baseUrl = QUrl());
void setContent(const QByteArray &data, const QString &mimeType = QString(), const QUrl &baseUrl = QUrl());
+#ifdef Q_QDOC
+ void toHtml(FunctorOrLambda resultCallback) const;
+ void toPlainText(FunctorOrLambda resultCallback) const;
+#else
void toHtml(const QWebEngineCallback<const QString &> &resultCallback) const;
void toPlainText(const QWebEngineCallback<const QString &> &resultCallback) const;
+#endif
QString title() const;
void setUrl(const QUrl &url);
@@ -195,7 +205,11 @@ public:
void setZoomFactor(qreal factor);
void runJavaScript(const QString& scriptSource);
+#ifdef Q_QDOC
+ void runJavaScript(const QString& scriptSource, FunctorOrLambda resultCallback);
+#else
void runJavaScript(const QString& scriptSource, const QWebEngineCallback<const QVariant &> &resultCallback);
+#endif
QWebEngineSettings *settings() const;
diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h
index 10a253d8d..ccbfb2bc1 100644
--- a/src/webenginewidgets/api/qwebenginepage_p.h
+++ b/src/webenginewidgets/api/qwebenginepage_p.h
@@ -117,7 +117,7 @@ public:
virtual void loadStarted(const QUrl &provisionalUrl) Q_DECL_OVERRIDE;
virtual void loadCommitted() Q_DECL_OVERRIDE;
virtual void loadVisuallyCommitted() Q_DECL_OVERRIDE { }
- virtual void loadFinished(bool success, int error_code, const QString &error_description = QString()) Q_DECL_OVERRIDE;
+ virtual void loadFinished(bool success, const QUrl &url, int errorCode = 0, const QString &errorDescription = QString()) Q_DECL_OVERRIDE;
virtual void focusContainer() Q_DECL_OVERRIDE;
virtual void adoptNewWindow(WebContentsAdapter *newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &initialGeometry) Q_DECL_OVERRIDE;
virtual void close() Q_DECL_OVERRIDE;
@@ -153,6 +153,7 @@ public:
QSize viewportSize;
QUrl m_explicitUrl;
WebEngineContextMenuData m_menuData;
+ bool isLoading;
mutable CallbackDirectory m_callbacks;
mutable QAction *actions[QWebEnginePage::WebActionCount];
diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp
index 7104df747..8d2198998 100644
--- a/src/webenginewidgets/api/qwebengineview.cpp
+++ b/src/webenginewidgets/api/qwebengineview.cpp
@@ -199,6 +199,19 @@ void QWebEngineView::findText(const QString &subString, QWebEnginePage::FindFlag
page()->findText(subString, options, resultCallback);
}
+/*!
+ * \reimp
+ */
+QSize QWebEngineView::sizeHint() const
+{
+ return QSize(800, 600);
+}
+
+QWebEngineSettings *QWebEngineView::settings() const
+{
+ return page()->settings();
+}
+
void QWebEngineView::stop()
{
page()->triggerAction(QWebEnginePage::Stop);
@@ -236,6 +249,9 @@ void QWebEngineView::setZoomFactor(qreal factor)
page()->setZoomFactor(factor);
}
+/*!
+ * \reimp
+ */
bool QWebEngineView::event(QEvent *ev)
{
Q_D(QWebEngineView);
@@ -249,6 +265,9 @@ bool QWebEngineView::event(QEvent *ev)
return QWidget::event(ev);
}
+/*!
+ * \reimp
+ */
void QWebEngineView::contextMenuEvent(QContextMenuEvent *event)
{
QMenu *menu = page()->createStandardContextMenu();
diff --git a/src/webenginewidgets/api/qwebengineview.h b/src/webenginewidgets/api/qwebengineview.h
index cc828482c..ce3c5495d 100644
--- a/src/webenginewidgets/api/qwebengineview.h
+++ b/src/webenginewidgets/api/qwebengineview.h
@@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE
class QContextMenuEvent;
class QUrl;
class QWebEnginePage;
+class QWebEngineSettings;
class QWebEngineViewPrivate;
class QWEBENGINEWIDGETS_EXPORT QWebEngineView : public QWidget {
@@ -88,9 +89,15 @@ public:
qreal zoomFactor() const;
void setZoomFactor(qreal factor);
+#ifdef Q_QDOC
+ void findText(const QString &subString, QWebEnginePage::FindFlags options = 0);
+ void findText(const QString &subString, QWebEnginePage::FindFlags options, FunctorOrLambda resultCallback);
+#else
void findText(const QString &subString, QWebEnginePage::FindFlags options = 0, const QWebEngineCallback<bool> &resultCallback = QWebEngineCallback<bool>());
+#endif
- virtual QSize sizeHint() const { return QSize(800, 600); }
+ virtual QSize sizeHint() const Q_DECL_OVERRIDE;
+ QWebEngineSettings *settings() const;
public Q_SLOTS:
void stop();
diff --git a/src/webenginewidgets/doc/qtwebenginewidgets.qdocconf b/src/webenginewidgets/doc/qtwebenginewidgets.qdocconf
index 200132099..ad1e46f1c 100644
--- a/src/webenginewidgets/doc/qtwebenginewidgets.qdocconf
+++ b/src/webenginewidgets/doc/qtwebenginewidgets.qdocconf
@@ -2,7 +2,6 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtWebEngineWidgets
description = Qt WebEngineWidgets Reference Documentation
-url = http://qt-project.org/doc/qt-$QT_VER
version = $QT_VERSION
examplesinstallpath = webenginewidgets
@@ -24,12 +23,13 @@ qhp.QtWebEngineWidgets.subprojects.classes.indexTitle = Qt WebEngine Widgets C++
qhp.QtWebEngineWidgets.subprojects.classes.selectors = class fake:headerfile
qhp.QtWebEngineWidgets.subprojects.classes.sortPages = true
qhp.QtWebEngineWidgets.subprojects.examples.title = Examples
-qhp.QtWebEngineWidgets.subprojects.examples.indexTitle = Qt WebEngine Widgets Code Samples
+qhp.QtWebEngineWidgets.subprojects.examples.indexTitle = Qt WebEngine Widgets Examples
qhp.QtWebEngineWidgets.subprojects.examples.selectors = fake:example
+qhp.QtWebEngineWidgets.subprojects.examples.sortPages = true
tagfile = ../../../doc/qtwebenginewidgets/qtwebenginewidgets.tags
-depends += qtcore qtnetwork qtgui qtwidgets qtdoc
+depends += qtwebengine qtcore qtnetwork qtgui qtwidgets qtwebkit qtdoc
headerdirs += ../api
sourcedirs += ../api
diff --git a/src/webenginewidgets/doc/snippets/qtwebengine_build_snippet.qdoc b/src/webenginewidgets/doc/snippets/qtwebengine_build_snippet.qdoc
index 248296588..dcdd82e04 100644
--- a/src/webenginewidgets/doc/snippets/qtwebengine_build_snippet.qdoc
+++ b/src/webenginewidgets/doc/snippets/qtwebengine_build_snippet.qdoc
@@ -1,8 +1,8 @@
//! [0]
-QT += webengine
+QT += webenginewidgets
//! [0]
//! [1]
-#include <QtWebEngine>
+#include <QtWebEngineWidgets>
//! [1]
diff --git a/src/webenginewidgets/doc/snippets/qtwebengine_qwebenginepage_snippet.cpp b/src/webenginewidgets/doc/snippets/qtwebengine_qwebenginepage_snippet.cpp
new file mode 100644
index 000000000..135c04fac
--- /dev/null
+++ b/src/webenginewidgets/doc/snippets/qtwebengine_qwebenginepage_snippet.cpp
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+void wrapInFunction()
+{
+
+//! [0]
+ m_view->page()->findText(QStringLiteral("Qt"), QWebEnginePage::FindFlags(), [this](bool found) {
+ if (!found) QMessageBox::information(m_view, QString(), QStringLiteral("No occurrences found"));
+ });
+//! [0]
+
+}
+
diff --git a/src/webenginewidgets/doc/snippets/qtwebengine_qwebengineview_snippet.cpp b/src/webenginewidgets/doc/snippets/qtwebengine_qwebengineview_snippet.cpp
index 2bf43b848..20edd73c6 100644
--- a/src/webenginewidgets/doc/snippets/qtwebengine_qwebengineview_snippet.cpp
+++ b/src/webenginewidgets/doc/snippets/qtwebengine_qwebengineview_snippet.cpp
@@ -54,5 +54,8 @@ void wrapInFunction()
view->page()->triggerPageAction(QWebPage::GoForward);
//! [5]
+//! [6]
+ view->page()->settings();
+//! [6]
}
diff --git a/src/webenginewidgets/doc/src/qtwebenginewidgets.qdoc b/src/webenginewidgets/doc/src/qtwebenginewidgets.qdoc
index fa3954fb4..3f6e888f3 100644
--- a/src/webenginewidgets/doc/src/qtwebenginewidgets.qdoc
+++ b/src/webenginewidgets/doc/src/qtwebenginewidgets.qdoc
@@ -26,7 +26,7 @@
****************************************************************************/
/*!
- \module QtWebEngine
+ \module QtWebEngineWidgets
\title Qt WebEngine Widgets C++ Classes
\brief Provides a web browser engine as well as C++ classes to render and
interact with web content
@@ -54,7 +54,7 @@
content from the World Wide Web into your Qt application.
Qt WebEngine Widgets provides facilities for rendering of HyperText Markup
- Language (HTML), Extensible HyperText Markup Language (XHTML) and Scalable
+ Language version 5 (HTML5), Extensible HyperText Markup Language (XHTML) and Scalable
Vector Graphics (SVG) documents, styled using Cascading Style Sheets (CSS)
and scripted with JavaScript.
@@ -66,6 +66,25 @@
Chromium itself can be found on the \l{http://www.chromium.org}
{Chromium Project} Web site.
+ \section1 Should I use Qt WebEngine or Qt WebKit?
+
+ Qt WebEngine supercedes the \l{Qt WebKit Widgets}{Qt WebKit} module, which
+ was based on the WebKit project, but isn't actively synchronized with the
+ upstream WebKit code since Qt 5.2.
+
+ Chromium provides its own network and painting engines and is developed
+ tightly together with its dependent modules, thus Qt WebEngine provides
+ better and more reliable support for the latest HTML5 specification.
+ For this reason Qt WebEngine is however heavier than Qt WebKit and doesn't
+ give direct access to the network stack and the HTML document through C++ APIs.
+
+ For new code we suggest using Qt WebEngine, but it makes sense to continue
+ using Qt WebKit for applications that are in need of a deeper C++ API than
+ having better and up-to-date support for HTML, CSS and JavaScript features.
+
+ For tips on how to change a Qt WebKit application to use Qt WebEngine, see
+ \l{Porting from Qt WebKit to Qt WebEngine}
+
\section1 Including In Your Project
To include the definitions of the module's classes, use the
@@ -78,16 +97,11 @@
\snippet snippets/qtwebengine_build_snippet.qdoc 0
- \section1 Notes
-
- \note Web site icons, also known as "FavIcons", are currently not supported
- on Windows. We plan to address this in a future release.
-
\section1 Architecture
The easiest way to render content is through the QWebEngineView class. As a
- widget it can be embedded into your forms or a graphics view, and it
- provides convenience functions for downloading and rendering web sites.
+ widget it can be embedded into your forms and it provides convenience functions
+ for downloading and rendering web sites.
\snippet snippets/simple/main.cpp Using QWebEngineView
@@ -97,21 +111,21 @@
customization of handlers for specific events such as showing custom authentication
dialogs.
- \section1 Examples
+ \section1 Reference Documentation
- There are several Qt WebEngine Widgets examples located in the
- \l{Qt WebEngine Widgets Examples} page.
+ \list
+ \li \l {Qt WebEngine Widgets C++ Classes}
+ \endlist
\section1 License Information
- This is a snapshot of the integration of Chromium into Qt. The exact version information
- can be found in the \c{VERSION} file supplied with Qt.
+ This is a snapshot of the integration of Chromium into Qt.
Qt Commercial Edition licensees that wish to distribute applications that
use the Qt WebEngine module need to be aware of their obligations under the
- GNU Library General Public License (LGPL).
+ GNU Library General Public License (LGPLv2).
Developers using the Open Source Edition can choose to redistribute
- the module under the appropriate version of the GNU LGPL.
+ the module under the GNU LGPLv3.
\legalese
diff --git a/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc b/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc
new file mode 100644
index 000000000..af99cb0c0
--- /dev/null
+++ b/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc
@@ -0,0 +1,275 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtwebenginewidgets-qtwebkitportingguide.html
+ \title Porting from Qt WebKit to Qt WebEngine
+ \brief This guide gives an overview of the differences between the Qt WebKit
+ and Qt WebEngine APIs in applications.
+
+ This provides rough steps to follow when porting an application using
+ Qt WebKit's QWebView API to use Qt WebEngine's QWebEngineView.
+
+
+ \section1 Class Names
+
+ The Qt WebEngine equivalent of Qt WebKit C++ classes are prefixed by
+ "\e QWebEngine" instead of "\e QWeb".
+
+ \b {Qt WebKit}
+ \code
+ #include <QWebHistory>
+ #include <QWebHistoryItem>
+ #include <QWebPage>
+ #include <QWebView>
+
+ QWebHistory
+ QWebHistoryItem
+ QWebPage
+ QWebView
+ \endcode
+ \b {Qt WebEngine}
+ \code
+ #include <QWebEngineHistory>
+ #include <QWebEngineHistoryItem>
+ #include <QWebEnginePage>
+ #include <QWebEngineView>
+
+ QWebEngineHistory
+ QWebEngineHistoryItem
+ QWebEnginePage
+ QWebEngineView
+ \endcode
+
+
+ \section1 Qt Module Name
+
+ \section2 In qmake Project Files
+
+ \b {Qt WebKit}
+ \code
+ QT += webkitwidgets
+ \endcode
+ \b {Qt WebEngine}
+ \code
+ QT += webenginewidgets
+ \endcode
+
+ \section2 Including the Module in Source Files
+
+ \b {Qt WebKit}
+ \code
+ #include <QtWebKit/QtWebKit>
+ #include <QtWebKitWidgets/QtWebKitWidgets> // With Qt >= 4.8
+ \endcode
+ \b {Qt WebEngine}
+ \code
+ #include <QtWebEngineWidgets/QtWebEngineWidgets>
+ \endcode
+
+
+ \section1 QWebFrame has been Merged into QWebEnginePage
+
+ It is not possible to access sub-frames. Methods of the main QWebFrame are
+ now available directly through the QWebEnginePage itself.
+
+ \b {Qt WebKit}
+ \code
+ QWebPage page;
+ connect(page.mainFrame(), SIGNAL(urlChanged(const QUrl&)), SLOT(mySlotName()));
+ page.mainFrame()->load(url);
+ \endcode
+ \b {Qt WebEngine}
+ \code
+ QWebEnginePage page;
+ connect(&page, SIGNAL(urlChanged(const QUrl&)), SLOT(mySlotName()));
+ page.load(url);
+ \endcode
+
+
+ \section1 Some methods now return their result asynchronously
+
+ Since Qt WebEngine uses a multi-process architecture, applications needs
+ to return to the event loop where the result will be received asynchronously
+ from Qt WebEngine's render process. A function pointer, a functor or a lambda
+ expression must be provided to handle the result when it is available.
+
+ \b {Qt WebKit}
+ \code
+ QWebPage *page = new QWebPage;
+ QTextEdit *textEdit = new QTextEdit;
+ // *textEdit is modified immediately.
+ textEdit->setPlainText(page->toHtml());
+ textEdit->setPlainText(page->toPlainText());
+ \endcode
+ \b {Qt WebEngine (with a lambda function in C++11)}
+ \code
+ QWebEnginePage *page = new QWebEnginePage;
+ QTextEdit *textEdit = new QTextEdit;
+ // *textEdit must remain valid until the lambda function is called.
+ page->toHtml([textEdit](const QString &result){ textEdit->setPlainText(result); });
+ page->toPlainText([textEdit](const QString &result){ textEdit->setPlainText(result); });
+ \endcode
+ \b {Qt WebEngine (with a functor template wrapping a member function)}
+ \code
+ template<typename Arg, typename R, typename C>
+ struct InvokeWrapper {
+ R *receiver;
+ void (C::*memberFun)(Arg);
+ void operator()(Arg result) {
+ (receiver->*memberFun)(result);
+ }
+ };
+
+ template<typename Arg, typename R, typename C>
+ InvokeWrapper<Arg, R, C> invoke(R *receiver, void (C::*memberFun)(Arg))
+ {
+ InvokeWrapper<Arg, R, C> wrapper = {receiver, memberFun};
+ return wrapper;
+ }
+
+ QWebEnginePage *page = new QWebEnginePage;
+ QTextEdit *textEdit = new QTextEdit;
+ // *textEdit must remain valid until the functor is called.
+ page->toHtml(invoke(textEdit, &QTextEdit::setPlainText));
+ page->toPlainText(invoke(textEdit, &QTextEdit::setPlainText));
+ \endcode
+ \b {Qt WebEngine (with a regular functor)}
+ \code
+ struct SetPlainTextFunctor {
+ QTextEdit *textEdit;
+ SetPlainTextFunctor(QTextEdit *textEdit) : textEdit(textEdit) { }
+ void operator()(const QString &result) {
+ textEdit->setPlainText(result);
+ }
+ };
+
+ QWebEnginePage *page = new QWebEnginePage;
+ QTextEdit *textEdit = new QTextEdit;
+ // *textEdit must remain valid until the functor is called.
+ page->toHtml(SetPlainTextFunctor(textEdit));
+ page->toPlainText(SetPlainTextFunctor(textEdit));
+ \endcode
+
+
+ \section1 Qt WebEngine does not Interact with QNetworkAccessManager
+
+ Some classes of Qt Network such as QAuthenticator were reused for their interface
+ but, unlike Qt WebKit, Qt WebEngine has its own HTTP implementation and can't
+ go through a QNetworkAccessManager.
+
+ Signals and methods of QNetworkAccessManager that are still supported were
+ moved to QWebEnginePage directly.
+
+ \b {Qt WebKit}
+ \code
+ QNetworkAccessManager qnam;
+ QWebPage page;
+ page.setNetworkAccessManager(&qnam);
+ connect(&qnam, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(authenticate(QNetworkReply*,QAuthenticator*)));
+ \endcode
+ \b {Qt WebEngine}
+ \code
+ QWebEnginePage page;
+ connect(&page, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(authenticate(QNetworkReply*,QAuthenticator*)));
+ \endcode
+
+
+ \section1 Notes about Individual Methods
+
+ \section2 evaluateJavaScript
+
+ QWebFrame::evaluateJavaScript was renamed and moved as QWebEnginePage::runJavaScript.
+ It is currently only possible to run JavaScript on the main frame of a page and the
+ result is returned asynchronously to the provided functor.
+
+ \b {Qt WebKit}
+ \code
+ QWebPage *page = new QWebPage;
+ qDebug() << page->mainFrame()->evaluateJavaScript("'Java' + 'Script'");
+ \endcode
+ \b {Qt WebEngine (with lambda expressions in C++11)}
+ \code
+ QWebEnginePage *page = new QWebEnginePage;
+ page->runJavaScript("'Java' + 'Script'", [](const QVariant &result){ qDebug() << result; });
+ \endcode
+
+ \section2 setHtml and setContent
+
+ QWebEnginePage::setHtml and QWebEnginePage::setContent perform asynchronously
+ the same way as a normal HTTP load would, unlike their QWebPage counterparts.
+
+ \section2 setContentEditable
+
+ QWebPage::setContentEditable has no equivalent since any document element can be made editable through
+ the contentEditable attribute in the latest HTML standard. Therefore, QWebEnginePage::runJavaScript
+ is all that is needed.
+
+ \b {Qt WebKit}
+ \code
+ QWebPage page;
+ page.setContentEditable(true);
+ \endcode
+ \b {Qt WebEngine}
+ \code
+ QWebEnginePage page;
+ page.runJavascript("document.documentElement.contentEditable = true");
+ \endcode
+
+
+ \section1 Unavailable Qt WebKit APIs
+
+ Qt WebKit classes and methods in this list will not be available in Qt WebEngine.
+
+ \table
+ \row
+ \li QGraphicsWebView
+ \li Qt WebEngine requires hardware acceleration. Since we couldn't support
+ a web view class in a QGraphicsView unless it is attached to a QGLWidget
+ viewport, this feature is out of scope.
+ \row
+ \li QWebElement
+ \li Qt WebEngine uses a multi-process architecture and this means that
+ any access to the internal structure of the page has to be done
+ asynchronously, any query result must be returned through callbacks.
+ The QWebElement API was designed for synchronous access and this
+ would require a complete redesign.
+ \row
+ \li QWebDatabase
+ \li The Web SQL Database feature that this API was wrapping in Qt WebKit
+ was dropped from the HTML5 standard.
+ \row
+ \li QWebPluginFactory, QWebPage::setPalette, QWebView::setRenderHints
+ \li Qt WebEngine renders web pages using Skia and isn't using QPainter
+ or Qt for this purpose. The HTML5 standard also now offers much
+ better alternatives that were not available when native controls
+ plugins were introduced in Qt WebKit.
+ \row
+ \li QWebHistoryInterface
+ \li Visited links are persisted automatically by Qt WebEngine.
+ \endtable
+*/
diff --git a/src/webenginewidgets/doc/src/qwebenginehistory_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginehistory_lgpl.qdoc
index 76a0a075d..1e791c03a 100644
--- a/src/webenginewidgets/doc/src/qwebenginehistory_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebenginehistory_lgpl.qdoc
@@ -26,7 +26,7 @@
\class QWebEngineHistoryItem
\brief The QWebEngineHistoryItem class represents one item in the history of a QWebEnginePage
- \inmodule QtWebEngine
+ \inmodule QtWebEngineWidgets
Each QWebEngineHistoryItem instance represents an entry in the history stack of a Web page,
containing information about the page, its location, and when it was last visited.
@@ -101,7 +101,7 @@
\class QWebEngineHistory
\brief The QWebEngineHistory class represents the history of a QWebEnginePage
- \inmodule QtWebEngine
+ \inmodule QtWebEngineWidgets
Each QWebEnginePage instance contains a history of visited pages that can be accessed
by QWebEnginePage::history(). QWebEngineHistory represents this history and makes it possible
diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
index 41dd0a31b..983b80d7e 100644
--- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
@@ -28,7 +28,7 @@
\class QWebEnginePage
\brief The QWebEnginePage class provides an object to view and edit web documents.
- \inmodule QtWebEngine
+ \inmodule QtWebEngineWidgets
QWebEnginePage holds a main frame responsible for web content, the history
of navigated links and actions.
@@ -296,12 +296,30 @@
*/
/*!
- \fn void QWebEnginePage::findText(const QString &subString, FindFlags options, const QWebEngineCallback<bool> &resultCallback)
+ \fn void QWebEnginePage::findText(const QString &subString, FindFlags options)
Finds the specified string, \a subString, in the page, using the given \a options.
To clear the selection, just pass an empty string.
+*/
+
+/*!
+ \fn void QWebEnginePage::findText(const QString &subString, FindFlags options, FunctorOrLambda resultCallback)
+ Finds the specified string, \a subString, in the page, using the given \a options.
+
+ To clear the selection, just pass an empty string.
+
+ The \a resultCallback must take a boolean parameter. It will be called with a value of true if the \a subString
+ was found; otherwise the callback value will be false.
- The \a resultCallback will be called with a value of true if the \a subString was found; otherwise the callback value will be false.
+ For example:
+ \snippet snippets/qtwebengine_qwebenginepage_snippet.cpp 0
+*/
+
+/*!
+ \fn QWebEngineSettings *QWebEnginePage::settings() const
+ Returns a pointer to the page's settings object.
+
+ \sa QWebEngineSettings::globalSettings()
*/
/*!
@@ -390,19 +408,23 @@
*/
/*!
- \fn void QWebEnginePage::toHtml(const QWebEngineCallback<const QString &> &resultCallback) const
+ \fn void QWebEnginePage::toHtml(FunctorOrLambda resultCallback) const
Asynchronous method to retrieve the page's content as HTML, enclosed in HTML and BODY tags.
Upon successful completion, \a resultCallback is called with the page's content.
+ \note \a resultCallback can be any of a function pointer, a functor or a lambda, and it is expected to take a QString parameter.
+
\sa setHtml(), toPlainText()
*/
/*!
- \fn void QWebEnginePage::toPlainText(const QWebEngineCallback<const QString &> &resultCallback) const
+ \fn void QWebEnginePage::toPlainText(FunctorOrLambda resultCallback) const
Asynchronous method to retrieve the page's content converted to plain text, completely stripped of all
HTML formatting.
Upon successful completion, \a resultCallback is called with the page's content.
+ \note \a resultCallback can be any of a function pointer, a functor or a lambda, and it is expected to take a QString parameter.
+
\sa toHtml()
*/
@@ -501,10 +523,12 @@
*/
/*!
- \fn void QWebEnginePage::runJavaScript(const QString& scriptSource, const QWebEngineCallback<const QVariant &> &resultCallback)
+ \fn void QWebEnginePage::runJavaScript(const QString& scriptSource, FunctorOrLambda resultCallback)
Runs the JavaScript code contained in \a scriptSource.
When the script has been executed, \a resultCallback is called with the result of the last executed statement.
+
+ \note \a resultCallback can be any of a function pointer, a functor or a lambda, and it is expected to take a QVariant parameter.
*/
/*!
diff --git a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc
new file mode 100644
index 000000000..3c420b805
--- /dev/null
+++ b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc
@@ -0,0 +1,198 @@
+/*
+ Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+ Copyright (C) 2008 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.
+*/
+
+// The documentation in this file was imported from QtWebKit and is thus constrained
+// by its LGPL license. Documentation written from scratch for new methods should be
+// placed inline in the code as usual.
+
+/*!
+ \fn static QWebEngineSettings *QWebEngineSettings::globalSettings()
+ Returns the global settings object.
+
+ Any setting changed on the default object is automatically applied to all
+ QWebEnginePage instances where the particular setting is not overridden already.
+*/
+
+/*!
+ \class QWebEngineSettings
+ \since QtWebEngine 1.0
+ \brief The QWebEngineSettings class provides an object to store the settings used
+ by QWebEnginePage
+
+ \inmodule QtWebEngineWidgets
+
+ Each QWebEnginePage object has its own QWebEngineSettings object, which configures the
+ settings for that page. If a setting is not configured, then it is looked
+ up in the global settings object, which can be accessed using
+ globalSettings().
+
+ QWebEngineSettings allows configuration of browser properties, such as font sizes and
+ families, the location of a custom style sheet, and generic attributes like
+ JavaScript and plugins. Individual attributes are set using the setAttribute()
+ function. The \l{QWebEngineSettings::WebAttribute}{WebAttribute} enum further describes
+ each attribute.
+
+ \sa QWebEnginePage::settings(), QWebEngineView::settings()
+*/
+
+/*!
+ \enum QWebEngineSettings::FontFamily
+
+ This enum describes the generic font families defined by CSS 2.
+ For more information see the
+ \l{http://www.w3.org/TR/REC-CSS2/fonts.html#generic-font-families}{CSS standard}.
+
+ \value StandardFont
+ \value FixedFont
+ \value SerifFont
+ \value SansSerifFont
+ \value CursiveFont
+ \value FantasyFont
+*/
+
+/*!
+ \enum QWebEngineSettings::FontSize
+
+ This enum describes the font sizes configurable through QWebEngineSettings.
+
+ \value MinimumFontSize The hard minimum font size.
+ \value MinimumLogicalFontSize The minimum logical font size that is applied
+ when zooming out with QWebEngineFrame::setTextSizeMultiplier().
+ \value DefaultFontSize The default font size for regular text.
+ \value DefaultFixedFontSize The default font size for fixed-pitch text.
+*/
+
+/*!
+ \enum QWebEngineSettings::WebAttribute
+
+ This enum describes various attributes that are configurable through QWebEngineSettings.
+
+ \value AutoLoadImages Specifies whether images are automatically loaded in
+ web pages. This is enabled by default.
+ \value JavascriptEnabled Enables or disables the running of JavaScript
+ programs. This is enabled by default
+ \value JavascriptCanOpenWindows Specifies whether JavaScript programs
+ can open new windows. This is enabled by default.
+ \value JavascriptCanAccessClipboard Specifies whether JavaScript programs
+ can read or write to the clipboard. This is disabled by default.
+ \value LinksIncludedInFocusChain Specifies whether hyperlinks should be
+ included in the keyboard focus chain. This is enabled by default.
+ \value LocalStorageEnabled Specifies whether support for the HTML 5
+ local storage feature is enabled or not. This is enabled by default.
+ \value LocalContentCanAccessRemoteUrls Specifies whether locally loaded documents are
+ allowed to access remote urls. This is disabled by default. For more information
+ about security origins and local vs. remote content see QWebEngineSecurityOrigin.
+ \value XSSAuditingEnabled Specifies whether load requests should be monitored for cross-site
+ scripting attempts. Suspicious scripts will be blocked and reported in the inspector's
+ JavaScript console. Enabling this feature might have an impact on performance
+ and it is disabled by default.
+ \value SpatialNavigationEnabled Enables or disables the Spatial Navigation
+ feature, which consists in the ability to navigate between focusable
+ elements in a Web page, such as hyperlinks and form controls, by using
+ Left, Right, Up and Down arrow keys. For example, if a user presses the
+ Right key, heuristics determine whether there is an element he might be
+ trying to reach towards the right and which element he probably wants.
+ This is disabled by default.
+ \value LocalContentCanAccessFileUrls Specifies whether locally loaded documents are
+ allowed to access other local urls. This is enabled by default. For more information
+ about security origins and local vs. remote content see QWebEngineSecurityOrigin.
+ \value HyperlinkAuditingEnabled This setting enables support for the ping attribute for hyperlinks. It is disabled by default.
+ \value ScrollAnimatorEnabled This setting enables animated scrolling. It is disabled by default.
+*/
+
+/*!
+ \fn void QWebEngineSettings::setFontSize(FontSize type, int size)
+ Sets the font size for \a type to \a size.
+*/
+
+/*!
+ \fn int QWebEngineSettings::fontSize(FontSize type) const
+ Returns the default font size for \a type.
+*/
+
+/*!
+ \fn void QWebEngineSettings::resetFontSize(FontSize type)
+ Resets the font size for \a type to the size specified in the global
+ settings object.
+
+ This function has no effect on the global QWebEngineSettings instance.
+*/
+
+/*!
+ \fn void QWebEngineSettings::setDefaultTextEncoding(const QString& encoding)
+ Specifies the default text encoding system.
+
+ The \a encoding, must be a string describing an encoding such as "utf-8",
+ "iso-8859-1", etc. If left empty a default value will be used. For a more
+ extensive list of encoding names see \l{QTextCodec}
+
+ \sa defaultTextEncoding()
+*/
+
+/*!
+ \fn QString QWebEngineSettings::defaultTextEncoding() const
+ Returns the default text encoding.
+
+ \sa setDefaultTextEncoding()
+*/
+
+/*!
+ \fn void QWebEngineSettings::setFontFamily(FontFamily which, const QString& family)
+ Sets the actual font family to \a family for the specified generic family,
+ \a which.
+*/
+
+/*!
+ \fn QString QWebEngineSettings::fontFamily(FontFamily which) const
+ Returns the actual font family for the specified generic font family,
+ \a which.
+*/
+
+/*!
+ \fn void QWebEngineSettings::resetFontFamily(FontFamily which)
+ Resets the actual font family specified by \a which to the one set
+ in the global QWebEngineSettings instance.
+
+ This function has no effect on the global QWebEngineSettings instance.
+*/
+
+/*!
+ \fn void QWebEngineSettings::setAttribute(WebAttribute attribute, bool on)
+
+ Enables or disables the specified \a attribute feature depending on the
+ value of \a on.
+*/
+
+/*!
+ \fn bool QWebEngineSettings::testAttribute(WebAttribute attribute) const
+
+ Returns true if \a attribute is enabled; otherwise returns false.
+*/
+
+/*!
+ \fn void QWebEngineSettings::resetAttribute(WebAttribute attribute)
+
+ Resets the setting of \a attribute to the value specified in the
+ global QWebEngineSettings instance.
+
+ This function has no effect on the global QWebEngineSettings instance.
+
+ \sa globalSettings()
+*/
diff --git a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
index 5c42d252b..57d537656 100644
--- a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
@@ -30,7 +30,7 @@
web documents.
\ingroup advanced
- \inmodule QtWebEngine
+ \inmodule QtWebEngineWidgets
QWebEngineView is the main widget component of the Qt WebEngine web browsing module.
It can be used in various applications to display web content live from the
@@ -241,12 +241,22 @@
*/
/*!
- \fn void QWebEngineView::findText(const QString &subString, QWebEnginePage::FindFlags options, const QWebEngineCallback<bool> &resultCallback)
+ \fn void QWebEngineView::findText(const QString &subString, QWebEnginePage::FindFlags options)
Finds the specified string, \a subString, in the page, using the given \a options.
To clear the selection, just pass an empty string.
- The \a resultCallback will be called with a value of true if the \a subString was found; otherwise the callback value will be false.
+ \sa selectedText(), selectionChanged()
+*/
+
+/*!
+ \fn void QWebEngineView::findText(const QString &subString, QWebEnginePage::FindFlags options, FunctorOrLambda resultCallback)
+ Finds the specified string, \a subString, in the page, using the given \a options.
+
+ To clear the selection, just pass an empty string.
+
+ The \a resultCallback must take a boolean parameter. It will be called with a value of true if the \a subString
+ was found; otherwise the callback value will be false.
\sa selectedText(), selectionChanged()
*/
@@ -367,3 +377,15 @@
\sa loadStarted(), loadFinished()
*/
+
+/*!
+ \fn QWebEngineSettings *QWebEngineView::settings() const
+
+ Returns a pointer to the view/page specific settings object.
+
+ It is equivalent to
+
+ \snippet snippets/qtwebengine_qwebengineview_snippet.cpp 6
+
+ \sa QWebEngineSettings::globalSettings()
+*/
diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
index d31af2506..c4a32d685 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
@@ -182,7 +182,7 @@ void RenderWidgetHostViewQtDelegateWidget::setTooltip(const QString &tooltip)
{
QString wrappedTip;
if (!tooltip.isEmpty())
- wrappedTip = QStringLiteral("<p>") % tooltip.toHtmlEscaped().left(MaxTooltipLength) % QStringLiteral("</p>");
+ wrappedTip = QLatin1String("<p>") % tooltip.toHtmlEscaped().left(MaxTooltipLength) % QLatin1String("</p>");
setToolTip(wrappedTip);
}
@@ -254,8 +254,9 @@ void RenderWidgetHostViewQtDelegateWidget::paintGL()
m_rootNode->appendChildNode(paintNode);
}
- m_sgRenderer->setDeviceRect(size());
- m_sgRenderer->setViewportRect(size());
+ QSize deviceSize = size() * devicePixelRatio();
+ m_sgRenderer->setDeviceRect(deviceSize);
+ m_sgRenderer->setViewportRect(deviceSize);
m_sgRenderer->setProjectionMatrixToRect(QRectF(QPointF(), size()));
m_sgRenderer->renderScene(defaultFramebufferObject());
diff --git a/src/webenginewidgets/webenginewidgets.pro b/src/webenginewidgets/webenginewidgets.pro
index 37a076307..71240cbaf 100644
--- a/src/webenginewidgets/webenginewidgets.pro
+++ b/src/webenginewidgets/webenginewidgets.pro
@@ -6,7 +6,7 @@ CMAKE_MODULE_TESTS = "-"
DEFINES += QT_BUILD_WEBENGINEWIDGETS_LIB
QT += webengine widgets network quick
-QT_PRIVATE += webenginecore widgets-private quick-private gui-private network-private core-private
+QT_PRIVATE += webenginecore
QMAKE_DOCS = $$PWD/doc/qtwebenginewidgets.qdocconf
diff --git a/tests/auto/quick/qmltests/data/tst_loadFail.qml b/tests/auto/quick/qmltests/data/tst_loadFail.qml
index e2282129f..7b0a1849e 100644
--- a/tests/auto/quick/qmltests/data/tst_loadFail.qml
+++ b/tests/auto/quick/qmltests/data/tst_loadFail.qml
@@ -50,6 +50,12 @@ TestWebEngineView {
property variant testUrl
+ SignalSpy {
+ id: spyIconChanged
+ target: webEngineView
+ signalName: "iconChanged"
+ }
+
TestCase {
id: test
name: "WebEngineViewLoadFail"
@@ -57,6 +63,11 @@ TestWebEngineView {
testUrl = Qt.resolvedUrl("file_that_does_not_exist.html")
webEngineView.url = testUrl
verify(webEngineView.waitForLoadFailed())
+ spyIconChanged.clear()
+
+ // If this testcase finishes too early, we can not handle the received replacement content.
+ // So we should wait to ignore this error page.
+ spyIconChanged.wait()
}
}
diff --git a/tests/auto/quick/qmltests/data/tst_loadUrl.qml b/tests/auto/quick/qmltests/data/tst_loadUrl.qml
index be7ede626..41faa6bc3 100644
--- a/tests/auto/quick/qmltests/data/tst_loadUrl.qml
+++ b/tests/auto/quick/qmltests/data/tst_loadUrl.qml
@@ -124,9 +124,9 @@ TestWebEngineView {
var handleLoadFailed = function(loadRequest) {
if (loadRequest.status == WebEngineView.LoadFailedStatus) {
+ webEngineView.loadHtml("load failed", bogusSite)
compare(webEngineView.url, bogusSite)
compare(loadRequest.url, bogusSite)
- webEngineView.loadHtml("load failed", bogusSite)
}
}
webEngineView.loadingChanged.connect(handleLoadFailed)
@@ -166,8 +166,7 @@ TestWebEngineView {
}
lastUrl = webEngineView.url
webEngineView.loadingChanged.connect(handleLoadRequest)
- webEngineView.forceActiveFocus()
- keyPress(Qt.Key_Return) // Link is focused
+ mouseClick(webEngineView, 10, 10, Qt.LeftButton, Qt.NoModifiers, 50)
verify(webEngineView.waitForLoadSucceeded())
compare(webEngineView.url, url)
webEngineView.loadingChanged.disconnect(handleLoadRequest)
diff --git a/tests/auto/quick/qmltests/qmltests.pro b/tests/auto/quick/qmltests/qmltests.pro
index b4514edc9..b25878dc9 100644
--- a/tests/auto/quick/qmltests/qmltests.pro
+++ b/tests/auto/quick/qmltests/qmltests.pro
@@ -34,4 +34,3 @@ OTHER_FILES += \
load(qt_build_paths)
DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD$${QMAKE_DIR_SEP}data\\\"\"
-DEFINES += QWP_PATH=\"\\\"$${MODULE_BASE_OUTDIR}$${QMAKE_DIR_SEP}libexec$${QMAKE_DIR_SEP}$${QTWEBENGINEPROCESS_NAME}\\\"\"
diff --git a/tests/auto/quick/shared/qt_webengine_quicktest.h b/tests/auto/quick/shared/qt_webengine_quicktest.h
index 2fd168e9d..4c4087ae6 100644
--- a/tests/auto/quick/shared/qt_webengine_quicktest.h
+++ b/tests/auto/quick/shared/qt_webengine_quicktest.h
@@ -69,7 +69,6 @@ QT_BEGIN_NAMESPACE
int main(int argc, char **argv) \
{ \
Application* app = 0; \
- qputenv("QTWEBENGINEPROCESS_PATH", QWP_PATH); \
if (!QCoreApplication::instance()) \
app = new Application(argc, argv); \
QtWebEngine::initialize(); \
diff --git a/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp b/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp
index 7668a12ab..2a92693e1 100644
--- a/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp
+++ b/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp
@@ -75,7 +75,7 @@ void tst_QWebEngineView::noPage()
QCOMPARE(view->role(), QAccessible::Client);
QCOMPARE(view->childCount(), 1);
QAccessibleInterface *document = view->child(0);
- QCOMPARE(document->role(), QAccessible::Document);
+ QCOMPARE(document->role(), QAccessible::WebDocument);
QCOMPARE(document->parent(), view);
QCOMPARE(document->childCount(), 0);
}
@@ -97,7 +97,7 @@ void tst_QWebEngineView::hierarchy()
// Wait for accessibility to be fully initialized
QTRY_VERIFY(view->child(0)->childCount() == 1);
QAccessibleInterface *document = view->child(0);
- QCOMPARE(document->role(), QAccessible::Document);
+ QCOMPARE(document->role(), QAccessible::WebDocument);
QCOMPARE(document->parent(), view);
QCOMPARE(view->indexOfChild(document), 0);
QCOMPARE(document->childCount(), 1);
@@ -144,33 +144,67 @@ void tst_QWebEngineView::text()
QWebEngineView webView;
webView.setHtml("<html><body>" \
"<input type='text' value='Good morning!'></input>" \
+ "<p id='labelName'>Enter your name here:</p>" \
+ "<input type='text' value='my name' aria-labelledby='labelName' aria-describedby='explanation'></input>" \
+ "<p id='explanation'>Provide both first and last name.</p>" \
+ "<input type='text' value='Good day!' placeholder='day'></input>" \
"</body></html>");
webView.show();
::waitForSignal(&webView, SIGNAL(loadFinished(bool)));
QAccessibleInterface *view = QAccessible::queryAccessibleInterface(&webView);
// Wait for accessibility to be fully initialized
- QTRY_VERIFY(view->child(0)->childCount() == 1);
- QAccessibleInterface *document = view->child(0);
- QAccessibleInterface *grouping = document->child(0);
- QVERIFY(grouping);
- QAccessibleInterface *input = grouping->child(0);
- QCOMPARE(input->role(), QAccessible::EditableText);
- QCOMPARE(input->text(QAccessible::Name), QString());
- QCOMPARE(input->text(QAccessible::Description), QString());
- QCOMPARE(input->text(QAccessible::Value), QStringLiteral("Good morning!"));
-
- QAccessibleTextInterface *textInterface = input->textInterface();
- QVERIFY(textInterface);
- QCOMPARE(textInterface->characterCount(), 13);
- QCOMPARE(textInterface->selectionCount(), 0);
- QCOMPARE(textInterface->text(2, 9), QStringLiteral("od morn"));
+ QTRY_VERIFY(view->child(0)->childCount() == 5);
+ QAccessibleInterface *document = view->child(0);
+ QVERIFY(document);
+
+ // Good morning! [edit]
+ QAccessibleInterface *grouping1 = document->child(0);
+ QAccessibleInterface *input1 = grouping1->child(0);
+ QCOMPARE(input1->role(), QAccessible::EditableText);
+ QCOMPARE(input1->text(QAccessible::Name), QString());
+ QCOMPARE(input1->text(QAccessible::Description), QString());
+ QCOMPARE(input1->text(QAccessible::Value), QStringLiteral("Good morning!"));
+
+ QAccessibleTextInterface *textInterface1 = input1->textInterface();
+ QVERIFY(textInterface1);
+ QCOMPARE(textInterface1->characterCount(), 13);
+ QCOMPARE(textInterface1->selectionCount(), 0);
+ QCOMPARE(textInterface1->text(2, 9), QStringLiteral("od morn"));
int start = -1;
int end = -1;
- QCOMPARE(textInterface->textAtOffset(8, QAccessible::WordBoundary, &start, &end), QStringLiteral("morning"));
- textInterface->setCursorPosition(3);
- QTRY_COMPARE(textInterface->cursorPosition(), 3);
+ QCOMPARE(textInterface1->textAtOffset(8, QAccessible::WordBoundary, &start, &end), QStringLiteral("morning"));
+
+ // Enter your name here:
+ // my name [edit]
+ // Provide both first and last name here.
+ QAccessibleInterface *grouping2 = document->child(1);
+ QAccessibleInterface *label1 = grouping2->child(0);
+ QCOMPARE(label1->role(), QAccessible::StaticText);
+ QCOMPARE(label1->text(QAccessible::Name), QString());
+ QCOMPARE(label1->text(QAccessible::Description), QString());
+ QCOMPARE(label1->text(QAccessible::Value), QStringLiteral("Enter your name here:"));
+ QAccessibleInterface *grouping3 = document->child(2);
+ QAccessibleInterface *input2 = grouping3->child(0);
+ QCOMPARE(input2->role(), QAccessible::EditableText);
+ QCOMPARE(input2->text(QAccessible::Name), QStringLiteral("Enter your name here:"));
+ QCOMPARE(input2->text(QAccessible::Description), QStringLiteral("Provide both first and last name."));
+ QCOMPARE(input2->text(QAccessible::Value), QStringLiteral("my name"));
+ QAccessibleInterface *grouping4 = document->child(3);
+ QAccessibleInterface *label2 = grouping4->child(0);
+ QCOMPARE(label2->role(), QAccessible::StaticText);
+ QCOMPARE(label2->text(QAccessible::Name), QString());
+ QCOMPARE(label2->text(QAccessible::Description), QString());
+ QCOMPARE(label2->text(QAccessible::Value), QStringLiteral("Provide both first and last name."));
+
+ // Good day! [edit]
+ QAccessibleInterface *grouping5 = document->child(4);
+ QAccessibleInterface *input3 = grouping5->child(0);
+ QCOMPARE(input3->role(), QAccessible::EditableText);
+ QCOMPARE(input3->text(QAccessible::Name), QStringLiteral("day"));
+ QCOMPARE(input3->text(QAccessible::Description), QString());
+ QCOMPARE(input3->text(QAccessible::Value), QStringLiteral("Good day!"));
}
void tst_QWebEngineView::value()
diff --git a/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp b/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp
index 1e979b3c5..4b18f8e7a 100644
--- a/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp
+++ b/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp
@@ -353,6 +353,7 @@ void tst_QWebEngineFrame::requestedUrlAfterSetAndLoadFailures()
const QUrl first("http://abcdef.abcdef/");
page.setUrl(first);
::waitForSignal(&page, SIGNAL(loadFinished(bool)));
+ QCOMPARE(spy.count(), 1);
QCOMPARE(page.url(), first);
QCOMPARE(page.requestedUrl(), first);
QVERIFY(!spy.at(0).first().toBool());
@@ -362,7 +363,9 @@ void tst_QWebEngineFrame::requestedUrlAfterSetAndLoadFailures()
page.load(second);
::waitForSignal(&page, SIGNAL(loadFinished(bool)));
+ QCOMPARE(spy.count(), 2);
QCOMPARE(page.url(), first);
+ QEXPECT_FAIL("", "Slight change: The requestedUrl() function catches the error page's entry here thus it results the error page's requested url.", Continue);
QCOMPARE(page.requestedUrl(), second);
QVERIFY(!spy.at(1).first().toBool());
}
@@ -442,9 +445,6 @@ void tst_QWebEngineFrame::setHtml()
void tst_QWebEngineFrame::setHtmlWithImageResource()
{
-#if !defined(QWEBENGINEPAGE_EVALUATEJAVASCRIPT)
- QSKIP("QWEBENGINEPAGE_EVALUATEJAVASCRIPT");
-#else
// By default, only security origins of local files can load local resources.
// So we should specify baseUrl to be a local file in order to get a proper origin and load the local image.
@@ -454,20 +454,19 @@ void tst_QWebEngineFrame::setHtmlWithImageResource()
page.setHtml(html, QUrl(QLatin1String("file:///path/to/file")));
waitForSignal(&page, SIGNAL(loadFinished(bool)), 200);
- QCOMPARE(page.evaluateJavaScript("document.images.length").toInt(), 1);
- QCOMPARE(page.evaluateJavaScript("document.images[0].width").toInt(), 128);
- QCOMPARE(page.evaluateJavaScript("document.images[0].height").toInt(), 128);
+ QCOMPARE(evaluateJavaScriptSync(&page, "document.images.length").toInt(), 1);
+ QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].width").toInt(), 128);
+ QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].height").toInt(), 128);
// Now we test the opposite: without a baseUrl as a local file, we cannot request local resources.
page.setHtml(html);
waitForSignal(&page, SIGNAL(loadFinished(bool)), 200);
- QCOMPARE(page.evaluateJavaScript("document.images.length").toInt(), 1);
+ QCOMPARE(evaluateJavaScriptSync(&page, "document.images.length").toInt(), 1);
QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=118659", Continue);
- QCOMPARE(page.evaluateJavaScript("document.images[0].width").toInt(), 0);
+ QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].width").toInt(), 0);
QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=118659", Continue);
- QCOMPARE(page.evaluateJavaScript("document.images[0].height").toInt(), 0);
-#endif
+ QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].height").toInt(), 0);
}
void tst_QWebEngineFrame::setHtmlWithStylesheetResource()
@@ -508,9 +507,6 @@ void tst_QWebEngineFrame::setHtmlWithStylesheetResource()
void tst_QWebEngineFrame::setHtmlWithBaseURL()
{
-#if !defined(QWEBENGINEPAGE_EVALUATEJAVASCRIPT)
- QSKIP("QWEBENGINEPAGE_EVALUATEJAVASCRIPT");
-#else
// This tests if baseUrl is indeed affecting the relative paths from resources.
// As we are using a local file as baseUrl, its security origin should be able to load local resources.
@@ -530,13 +526,12 @@ void tst_QWebEngineFrame::setHtmlWithBaseURL()
waitForSignal(&page, SIGNAL(loadFinished(bool)), 200);
QCOMPARE(spy.count(), 1);
- QCOMPARE(page.evaluateJavaScript("document.images.length").toInt(), 1);
- QCOMPARE(page.evaluateJavaScript("document.images[0].width").toInt(), 128);
- QCOMPARE(page.evaluateJavaScript("document.images[0].height").toInt(), 128);
+ QCOMPARE(evaluateJavaScriptSync(&page, "document.images.length").toInt(), 1);
+ QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].width").toInt(), 128);
+ QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].height").toInt(), 128);
// no history item has to be added.
QCOMPARE(m_view->page()->history()->count(), 0);
-#endif
}
class MyPage : public QWebEnginePage
@@ -1245,6 +1240,7 @@ void tst_QWebEngineFrame::setUrlWithFragment_data()
// Based on bug report https://bugs.webkit.org/show_bug.cgi?id=32723
void tst_QWebEngineFrame::setUrlWithFragment()
{
+ QSKIP("FIXME: https://trello.com/c/3L7F8VZJ/217-take-care-about-the-in-page-navigations-in-the-tests");
QFETCH(QUrl, previousUrl);
QWebEnginePage page;
@@ -1298,7 +1294,6 @@ void tst_QWebEngineFrame::setUrlToEmpty()
QTRY_COMPARE(spy.count(), expectedLoadFinishedCount);
QCOMPARE(page.url(), aboutBlank);
- QEXPECT_FAIL("", "Slight change: This information now comes from Chromium and the behavior of requestedUrl changed in this case.", Continue);
QCOMPARE(page.requestedUrl(), QUrl());
QCOMPARE(baseUrlSync(&page), aboutBlank);
@@ -1317,7 +1312,6 @@ void tst_QWebEngineFrame::setUrlToEmpty()
QTRY_COMPARE(spy.count(), expectedLoadFinishedCount);
QCOMPARE(page.url(), aboutBlank);
- QEXPECT_FAIL("", "Slight change: This information now comes from Chromium and the behavior of requestedUrl changed in this case.", Continue);
QCOMPARE(page.requestedUrl(), QUrl());
QCOMPARE(baseUrlSync(&page), aboutBlank);
}
@@ -1373,7 +1367,6 @@ void tst_QWebEngineFrame::setUrlHistory()
m_page->setUrl(QUrl());
expectedLoadFinishedCount++;
QTRY_COMPARE(spy.count(), expectedLoadFinishedCount);
- QEXPECT_FAIL("", "Slight change: QUrl() isn't replaced by about:blank.", Continue);
QCOMPARE(m_page->url(), aboutBlank);
QCOMPARE(m_page->requestedUrl(), QUrl());
QCOMPARE(collectHistoryUrls(m_page->history()), QStringList());
@@ -1398,7 +1391,6 @@ void tst_QWebEngineFrame::setUrlHistory()
expectedLoadFinishedCount++;
QTRY_COMPARE(spy.count(), expectedLoadFinishedCount);
QCOMPARE(m_page->url(), aboutBlank);
- QEXPECT_FAIL("", "Slight change: This information now comes from Chromium and the behavior of requestedUrl changed in this case.", Continue);
QCOMPARE(m_page->requestedUrl(), QUrl());
QEXPECT_FAIL("", "Slight change: load(QUrl()) currently loads about:blank and nothing prevents it from being added to the history.", Continue);
QCOMPARE(collectHistoryUrls(m_page->history()), QStringList() << QStringLiteral("qrc:/test1.html"));
@@ -1425,9 +1417,6 @@ void tst_QWebEngineFrame::setUrlHistory()
void tst_QWebEngineFrame::setUrlUsingStateObject()
{
-#if !defined(QWEBENGINEPAGE_EVALUATEJAVASCRIPT)
- QSKIP("QWEBENGINEPAGE_EVALUATEJAVASCRIPT");
-#else
const QUrl aboutBlank("about:blank");
QUrl url;
QSignalSpy urlChangedSpy(m_page, SIGNAL(urlChanged(QUrl)));
@@ -1443,14 +1432,14 @@ void tst_QWebEngineFrame::setUrlUsingStateObject()
QCOMPARE(m_page->url(), url);
QCOMPARE(m_page->history()->count(), 1);
- m_page->evaluateJavaScript("window.history.pushState(null,'push', 'navigate/to/here')");
+ evaluateJavaScriptSync(m_page, "window.history.pushState(null, 'push', 'navigate/to/here')");
expectedUrlChangeCount++;
QCOMPARE(urlChangedSpy.count(), expectedUrlChangeCount);
QCOMPARE(m_page->url(), QUrl("qrc:/navigate/to/here"));
QCOMPARE(m_page->history()->count(), 2);
QVERIFY(m_page->history()->canGoBack());
- m_page->evaluateJavaScript("window.history.replaceState(null,'replace', 'another/location')");
+ evaluateJavaScriptSync(m_page, "window.history.replaceState(null, 'replace', 'another/location')");
expectedUrlChangeCount++;
QCOMPARE(urlChangedSpy.count(), expectedUrlChangeCount);
QCOMPARE(m_page->url(), QUrl("qrc:/navigate/to/another/location"));
@@ -1458,14 +1447,13 @@ void tst_QWebEngineFrame::setUrlUsingStateObject()
QVERIFY(!m_page->history()->canGoForward());
QVERIFY(m_page->history()->canGoBack());
- m_page->evaluateJavaScript("window.history.back()");
+ evaluateJavaScriptSync(m_page, "window.history.back()");
QTest::qWait(100);
expectedUrlChangeCount++;
QCOMPARE(urlChangedSpy.count(), expectedUrlChangeCount);
QCOMPARE(m_page->url(), QUrl("qrc:/test1.html"));
QVERIFY(m_page->history()->canGoForward());
QVERIFY(!m_page->history()->canGoBack());
-#endif
}
void tst_QWebEngineFrame::setUrlSameUrl()
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 70fbba128..b6d3f14c5 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -39,6 +39,7 @@
#include <qpa/qplatforminputcontext.h>
#include <qwebenginehistory.h>
#include <qwebenginepage.h>
+#include <qwebenginesettings.h>
#include <qwebengineview.h>
#include <qimagewriter.h>
@@ -171,7 +172,6 @@ private Q_SLOTS:
void networkReplyParentDidntChange();
void destroyQNAMBeforeAbortDoesntCrash();
void testJSPrompt();
- void showModalDialog();
void testStopScheduledPageRefresh();
void findText();
void findTextResult();
@@ -471,9 +471,6 @@ private Q_SLOTS:
void tst_QWebEnginePage::popupFormSubmission()
{
-#if !defined(QWEBENGINEPAGE_SETTINGS)
- QSKIP("QWEBENGINEPAGE_SETTINGS");
-#else
TestPage page;
page.settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, true);
page.setHtml("<form name=form1 method=get action='' target=myNewWin>"\
@@ -490,7 +487,6 @@ void tst_QWebEnginePage::popupFormSubmission()
// Check if the form submission was OK.
QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=118597", Continue);
QVERIFY(url.contains("?foo=bar"));
-#endif
}
void tst_QWebEnginePage::acceptNavigationRequestWithNewWindow()
@@ -2710,29 +2706,27 @@ void tst_QWebEnginePage::testEnablePersistentStorage()
void tst_QWebEnginePage::defaultTextEncoding()
{
-#if !defined(QWEBENGINESETTINGS_SETDEFAULTTEXTENCODING)
- QSKIP("QWEBENGINESETTINGS_SETDEFAULTTEXTENCODING");
-#else
-
QString defaultCharset = evaluateJavaScriptSync(m_page, "document.defaultCharset").toString();
QVERIFY(!defaultCharset.isEmpty());
QCOMPARE(QWebEngineSettings::globalSettings()->defaultTextEncoding(), defaultCharset);
m_page->settings()->setDefaultTextEncoding(QString("utf-8"));
+ QCoreApplication::processEvents();
QString charset = evaluateJavaScriptSync(m_page, "document.defaultCharset").toString();
QCOMPARE(charset, QString("utf-8"));
QCOMPARE(m_page->settings()->defaultTextEncoding(), charset);
m_page->settings()->setDefaultTextEncoding(QString());
+ QCoreApplication::processEvents();
charset = evaluateJavaScriptSync(m_page, "document.defaultCharset").toString();
QVERIFY(!charset.isEmpty());
QCOMPARE(charset, defaultCharset);
QWebEngineSettings::globalSettings()->setDefaultTextEncoding(QString("utf-8"));
+ QCoreApplication::processEvents();
charset = evaluateJavaScriptSync(m_page, "document.defaultCharset").toString();
QCOMPARE(charset, QString("utf-8"));
QCOMPARE(QWebEngineSettings::globalSettings()->defaultTextEncoding(), charset);
-#endif
}
#if defined(QWEBENGINEPAGE_ERRORPAGEEXTENSION)
@@ -3148,32 +3142,6 @@ void tst_QWebEnginePage::testJSPrompt()
QVERIFY(res);
}
-class TestModalPage : public QWebEnginePage
-{
- Q_OBJECT
-public:
- TestModalPage(QObject* parent = 0) : QWebEnginePage(parent) {
- }
- virtual QWebEnginePage* createWindow(WebWindowType) {
- QWebEnginePage* page = new TestModalPage();
- connect(page, SIGNAL(windowCloseRequested()), page, SLOT(deleteLater()));
- return page;
- }
-};
-
-void tst_QWebEnginePage::showModalDialog()
-{
-#if !defined(QWEBENGINESETTINGS)
- QSKIP("QWEBENGINESETTINGS");
-#else
- TestModalPage page;
- page.settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, true);
- page.setHtml(QString("<html></html>"));
- QString res = evaluateJavaScriptSync(&page, "window.showModalDialog('javascript:window.returnValue=dialogArguments; window.close();', 'This is a test');").toString();
- QCOMPARE(res, QString("This is a test"));
-#endif
-}
-
void tst_QWebEnginePage::testStopScheduledPageRefresh()
{
#if !defined(QWEBENGINEPAGE_SETNETWORKACCESSMANAGER)
@@ -3680,10 +3648,11 @@ void tst_QWebEnginePage::getUserMediaRequest()
void tst_QWebEnginePage::openWindowDefaultSize()
{
-#if !defined(QWEBENGINEPAGE_SETTINGS)
- QSKIP("QWEBENGINEPAGE_SETTINGS");
-#else
TestPage page;
+ QWebEngineView view;
+ page.setView(&view);
+ view.show();
+
page.settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, true);
// Open a default window.
page.runJavaScript("window.open()");
@@ -3703,7 +3672,6 @@ void tst_QWebEnginePage::openWindowDefaultSize()
// Check minimum size has been requested.
QVERIFY(requestedGeometry.width() == 100);
QVERIFY(requestedGeometry.height() == 100);
-#endif
}
void tst_QWebEnginePage::cssMediaTypeGlobalSetting()
diff --git a/tests/quicktestbrowser/quickwindow.qml b/tests/quicktestbrowser/quickwindow.qml
index ca1f75c04..f24717b01 100644
--- a/tests/quicktestbrowser/quickwindow.qml
+++ b/tests/quicktestbrowser/quickwindow.qml
@@ -41,11 +41,14 @@
import QtQuick 2.1
import QtWebEngine 1.0
import QtWebEngine.experimental 1.0
+
import QtQuick.Controls 1.0
import QtQuick.Controls.Styles 1.0
import QtQuick.Layouts 1.0
import QtQuick.Window 2.1
import QtQuick.Controls.Private 1.0
+import Qt.labs.settings 1.0
+
ApplicationWindow {
id: browserWindow
@@ -64,6 +67,11 @@ ApplicationWindow {
visible: true
title: currentWebView && currentWebView.title
+ Settings {
+ property alias autoLoadImages: loadImages.checked;
+ property alias javaScriptEnabled: javaScriptEnabled.checked;
+ }
+
// Make sure the Qt.WindowFullscreenButtonHint is set on Mac.
Component.onCompleted: flags = flags | Qt.WindowFullscreenButtonHint
@@ -190,6 +198,25 @@ ApplicationWindow {
text: currentWebView && currentWebView.url
onAccepted: currentWebView.url = utils.fromUserInput(text)
}
+ ToolButton {
+ id: settingsMenuButton
+ menu: Menu {
+ MenuItem {
+ id: loadImages
+ text: "Autoload images"
+ checkable: true
+ checked: WebEngine.settings.autoLoadImages
+ onCheckedChanged: WebEngine.settings.autoLoadImages = checked
+ }
+ MenuItem {
+ id: javaScriptEnabled
+ text: "JavaScript On"
+ checkable: true
+ checked: WebEngine.settings.javascriptEnabled
+ onCheckedChanged: WebEngine.settings.javascriptEnabled = checked
+ }
+ }
+ }
}
ProgressBar {
id: progressBar
diff --git a/tools/buildscripts/gyp_qtwebengine b/tools/buildscripts/gyp_qtwebengine
index e3fb740cd..6f2bbc936 100755
--- a/tools/buildscripts/gyp_qtwebengine
+++ b/tools/buildscripts/gyp_qtwebengine
@@ -9,7 +9,6 @@ print 'using python: ' + sys.executable + ' version: ' + sys.version
if sys.platform == "darwin":
print 'xcode version: ' + subprocess.check_output(['xcodebuild', '-version']).replace('\n', ' ')
- print 'clang++ version: ' + subprocess.check_output(['clang++', '--version']).replace('\n', ' ')
qtwebengine_root = os.path.normcase(os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')))
import qtwebengine_utils as utils
@@ -21,6 +20,11 @@ if not os.path.isdir(script_dir):
sys.exit(1)
root_dir = os.path.normcase(os.path.abspath(os.path.join(os.getcwd(), os.pardir, os.pardir)))
+if sys.platform in ('cygwin', 'win32'):
+ gnuwin_tools_dir = os.path.normcase(os.path.abspath(os.path.join(qtwebengine_root, "../gnuwin32/bin")))
+ if os.path.isdir(gnuwin_tools_dir):
+ os.environ['PATH'] = gnuwin_tools_dir + os.pathsep + os.environ['PATH']
+
sys.path.insert(1, script_dir)
import gyp_helper
sys.path.insert(1, os.path.join(chrome_src, 'tools', 'gyp', 'pylib'))
@@ -82,12 +86,6 @@ if __name__ == '__main__':
if 'qt_cross_compile=1' in sys.argv:
os.environ['GYP_CROSSCOMPILE'] = '1'
- # On Mac we want to override CXX and CC that is provided with
- # the Chromium GYP environment.
- if sys.platform.startswith('darwin') and not 'GYP_CROSSCOMPILE' in os.environ:
- os.environ['CXX'] = 'clang++'
- os.environ['CC'] = 'clang'
-
gyp_helper.apply_chromium_gyp_env()
# This could give false positives since it doesn't actually do real option
diff --git a/tools/qmake/mkspecs/features/functions.prf b/tools/qmake/mkspecs/features/functions.prf
index 44ed4f9e6..80b64a653 100644
--- a/tools/qmake/mkspecs/features/functions.prf
+++ b/tools/qmake/mkspecs/features/functions.prf
@@ -1,12 +1,9 @@
defineTest(isPlatformSupported) {
static: return(false)
- osx:lessThan(QMAKE_XCODE_VERSION, 5): return(false)
- win32 {
- equals(QT_ARCH, x86_64): return(false)
- !contains(QT_CONFIG, angle): return(false)
- }
+ !equals(QMAKE_HOST.arch, "x86_64"): return(false)
+ osx:lessThan(QMAKE_XCODE_VERSION, 5.1): return(false)
- linux-g++|win32-msvc2013|macx-clang: return(true)
+ linux|win32-msvc2013|macx-clang: return(true)
return(false)
}
@@ -112,12 +109,6 @@ defineReplace(findOrBuildNinja) {
win32: out = $$system_path($${out}.exe)
# If we did not find ninja, then we bootstrap it.
- !exists($$out) {
- contains(DEFINES, WIN64) {
- system("python $$dirname(out)/bootstrap.py --x64")
- } else {
- system("python $$dirname(out)/bootstrap.py")
- }
- }
+ !exists($$out): system("python $$dirname(out)/bootstrap.py")
return($$out)
}
diff --git a/tools/qmake/mkspecs/features/gyp_generator.prf b/tools/qmake/mkspecs/features/gyp_generator.prf
index 0b950463e..5ef3110cc 100644
--- a/tools/qmake/mkspecs/features/gyp_generator.prf
+++ b/tools/qmake/mkspecs/features/gyp_generator.prf
@@ -6,6 +6,9 @@ load(functions)
load(moc)
load(resources)
+MOC_GEN_DIR = <(SHARED_INTERMEDIATE_DIR)/moc
+RCC_GEN_DIR = <(SHARED_INTERMEDIATE_DIR)/rcc
+
defineReplace(mocAction) {
INPUT_FILE = $$1
OUTPUT_NAME = $$mocOutput($$INPUT_FILE)
@@ -15,7 +18,7 @@ defineReplace(mocAction) {
MOC_COMMAND = $$replace(MOC_COMMAND, $$re_escape("$(DEFINES)"), $$DEFINES_LIST)
MOC_COMMAND = $$replace(MOC_COMMAND, $$re_escape("$(INCPATH)"), $$INCPATH)
MOC_COMMAND = $$split(MOC_COMMAND, " ")
- OUTPUT_FILE = $$absolute_path($$MOC_DIR, $$OUT_PWD)$${QMAKE_DIR_SEP}$${OUTPUT_NAME}
+ OUTPUT_FILE = $$MOC_GEN_DIR/$${OUTPUT_NAME}
contents = " {" \
" 'action_name':'$$OUTPUT_NAME'," \
" 'inputs': ['$$INPUT_FILE',]," \
@@ -35,7 +38,7 @@ defineReplace(rccAction) {
INPUT_FILE = $$1
OUTPUT_NAME = $$rccOutput($$INPUT_FILE)
EXTERN_FUNC = $$rccExternFunc($$INPUT_FILE)
- OUTPUT_FILE = $$absolute_path($$RCC_DIR, $$OUT_PWD)$${QMAKE_DIR_SEP}$${OUTPUT_NAME}
+ OUTPUT_FILE = $$RCC_GEN_DIR/$${OUTPUT_NAME}
contents = " {" \
" 'action_name':'$$OUTPUT_NAME'," \
" 'inputs': ['$$INPUT_FILE',]," \
@@ -74,7 +77,7 @@ GYP_CONTENTS += " ],"
!isEmpty(QMAKE_FRAMEWORKPATH) {
GYP_CONTENTS += " 'mac_framework_dirs': ["
- GYP_CONTENTS += " '$$QMAKE_FRAMEWORKPATH',"
+ for(path, QMAKE_FRAMEWORKPATH): GYP_CONTENTS += " '$$path',"
GYP_CONTENTS += " ],"
}
@@ -110,24 +113,23 @@ for (headerfile, HEADERS): GYP_CONTENTS += " '$$headerfile',"
for (resourcefile, RESOURCES) {
RCC_CPP = $$replace(resourcefile, .qrc, .cpp)
RCC_CPP = $$join(RCC_CPP, "qrc_", qrc_)
- RCC_CPP = $$absolute_path($$RCC_DIR, $$OUT_PWD)$${QMAKE_DIR_SEP}$${RCC_CPP}
+ RCC_CPP = $$RCC_GEN_DIR/$${RCC_CPP}
GYP_CONTENTS += " '$$RCC_CPP',"
}
# Add moc output files to compile that aren't included at the end of any other source
-MOC_OUT_PATH = $$absolute_path($$MOC_DIR, $$OUT_PWD)$${QMAKE_DIR_SEP}
for (mocable, MOCABLES) {
!contains(INCLUDED_MOC_FILES, $$mocOutput($$mocable)) {
- GYP_CONTENTS += " '$$MOC_OUT_PATH$$mocOutput($$mocable)',"
+ GYP_CONTENTS += " '$$MOC_GEN_DIR/$$mocOutput($$mocable)',"
}
}
GYP_CONTENTS += " ],"
-!isEmpty(INCLUDEPATH) {
- GYP_CONTENTS += " 'include_dirs': ["
- for (path, INCLUDEPATH): GYP_CONTENTS += " '$$path',"
- GYP_CONTENTS += " ],"
-}
+GYP_CONTENTS += " 'include_dirs': ["
+for (path, INCLUDEPATH): GYP_CONTENTS += " '$$path',"
+# qmake already added MOC_DIR to INCLUDEPATH, but we're telling gyp to use a different one.
+GYP_CONTENTS += " '$$MOC_GEN_DIR',"
+GYP_CONTENTS += " ],"
# Generate the actions for moc and rcc
GYP_CONTENTS += " 'actions': ["
diff --git a/tools/scripts/git_submodule.py b/tools/scripts/git_submodule.py
index a9002ffe8..bc311f97b 100644
--- a/tools/scripts/git_submodule.py
+++ b/tools/scripts/git_submodule.py
@@ -77,8 +77,9 @@ class DEPSParser:
subdir = dep
if subdir.startswith('src/'):
subdir = subdir[4:]
- if subdir.startswith('src'):
- # Ignore the information about chromium since we get that from git.
+ else:
+ # Ignore the information about chromium itself since we get that from git,
+ # also ignore anything outside src/ (e.g. depot_tools)
continue
submodule = Submodule(subdir, repo)
@@ -89,16 +90,9 @@ class DEPSParser:
continue
if len(rev) == 40: # Length of a git shasum
- submodule.shasum = rev
+ submodule.ref = rev
else:
- # Try to find out the git branch using the svn path.
- branchMatch = re.search('/branches/((chromium/)?[^/]+)', repo)
- trunkMatch = re.search('/(trunk|svn)/', repo)
- if branchMatch:
- submodule.ref = 'refs/branch-heads/' + branchMatch.group(1)
- elif trunkMatch:
- submodule.ref = 'refs/heads/master'
- submodule.revision = int(rev)
+ sys.exit("Invalid shasum: " + str(rev))
submodules.append(submodule)
return submodules
@@ -112,13 +106,11 @@ class DEPSParser:
return submodules
class Submodule:
- def __init__(self, path='', url='', shasum='', os=[], ref=''):
+ def __init__(self, path='', url='', ref='', os=[]):
self.path = path
self.url = url
- self.shasum = shasum
+ self.ref = ref
self.os = os
- self.ref = ''
- self.revision = None
def matchesOS(self):
if not self.os:
@@ -143,41 +135,34 @@ class Submodule:
def findShaAndCheckout(self):
oldCwd = os.getcwd()
os.chdir(self.path)
- error = 0
- if self.ref:
- # Fetch the ref we parsed from the DEPS file.
- error = subprocessCall(['git', 'fetch', 'origin', self.ref])
- if error != 0:
- print('ERROR: Could not fetch from upstream branch ' + self.ref)
- return error
- error = subprocessCall(['git', 'checkout', 'FETCH_HEAD']);
+ # Fetch the shasum we parsed from the DEPS file.
+ error = subprocessCall(['git', 'fetch', 'origin', self.ref])
+ if error != 0:
+ print('ERROR: Could not fetch ' + self.ref + ' from upstream origin.')
+ return error
- if self.revision:
- search_string = 'git-svn-id:.*@%d' % self.revision
- line = subprocessCheckOutput(['git', 'log', '-n1', '--pretty=oneline', r'--grep=%s' % search_string])
- if line:
- self.shasum = line.split()[0]
+ error = subprocessCall(['git', 'checkout', 'FETCH_HEAD']);
current_shasum = subprocessCheckOutput(['git', 'rev-parse', 'HEAD']).strip()
current_tag = subprocessCheckOutput(['git', 'name-rev', '--tags', '--name-only', current_shasum]).strip()
if current_tag == resolver.currentVersion():
# We checked out a tagged version of chromium.
- self.shasum = current_shasum
+ self.ref = current_shasum
- if not self.shasum:
+ if not self.ref:
# No shasum could be deduced, use the submodule shasum.
os.chdir(oldCwd)
line = subprocessCheckOutput(['git', 'submodule', 'status', self.path])
os.chdir(self.path)
line = line.lstrip(' -')
- self.shasum = line.split(' ')[0]
+ self.ref = line.split(' ')[0]
- if not self.shasum.startswith(current_shasum):
+ if not self.ref.startswith(current_shasum):
# In case HEAD differs check out the actual shasum we require.
subprocessCall(['git', 'fetch'])
- error = subprocessCall(['git', 'checkout', self.shasum])
+ error = subprocessCall(['git', 'checkout', self.ref])
os.chdir(oldCwd)
return error
@@ -217,10 +202,10 @@ class Submodule:
subprocessCall(['git', 'submodule', 'init', self.path])
subprocessCall(['git', 'submodule', 'update', self.path])
- if self.findShaAndCheckout() != 0:
- sys.exit("!!! initialization failed !!!")
-
if '3rdparty_upstream' in os.path.abspath(self.path):
+ if self.findShaAndCheckout() != 0:
+ sys.exit("!!! initialization failed !!!")
+
# Add baseline commit for upstream repository to be able to reset.
os.chdir(self.path)
commit = subprocessCheckOutput(['git', 'rev-list', '--max-count=1', 'HEAD'])
@@ -248,10 +233,7 @@ class Submodule:
submodules = resolver.readSubmodules()
print 'DEPS file provides the following submodules:'
for submodule in submodules:
- submodule_ref = submodule.shasum
- if submodule.revision:
- submodule_ref = submodule.ref + '@' + str(submodule.revision)
- print '{:<80}'.format(submodule.path) + '{:<120}'.format(submodule.url) + submodule_ref
+ print '{:<80}'.format(submodule.path) + '{:<120}'.format(submodule.url) + submodule.ref
else: # Try .gitmodules since no ref has been specified
if not os.path.isfile('.gitmodules'):
return []
@@ -286,6 +268,5 @@ class Submodule:
submodules = self.readSubmodules()
for submodule in submodules:
submodule.initialize()
- if self.ref:
- subprocessCall(['git', 'commit', '-a', '--amend', '--no-edit'])
+ subprocessCall(['git', 'commit', '-a', '--amend', '--no-edit'])
os.chdir(oldCwd)
diff --git a/init-repository.py b/tools/scripts/init-repository.py
index 4e5452b64..3425649ff 100755
--- a/init-repository.py
+++ b/tools/scripts/init-repository.py
@@ -48,25 +48,8 @@ import sys
import string
import argparse
-qtwebengine_root = os.path.abspath(os.path.join(os.path.dirname(__file__)))
+qtwebengine_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
-def sanityCheckRepo():
- os.chdir(qtwebengine_root)
- if not '.git' in os.listdir('.'):
- print ''
- print 'This source tree cannot be initialized with init-repository.py.'
- print ''
- print 'If you downloaded an archive containing these sources,'
- print 'you do not need to run the init-repository.py script.'
- print ''
- print 'If you want to use git for working with qtwebengine,'
- print 'use git to clone: git@gitorious.org:qt/qtwebengine.git'
- print ''
- sys.exit(0)
-
-sanityCheckRepo()
-
-sys.path.append(os.path.join(qtwebengine_root, 'tools', 'scripts'))
import git_submodule as GitSubmodule
import version_resolver as resolver
@@ -75,7 +58,6 @@ ninja_src = os.path.join(qtwebengine_root, 'src/3rdparty_upstream/ninja')
use_external_chromium = False
parser = argparse.ArgumentParser(description='Initialize QtWebEngine repository.')
-parser.add_argument('--no-gerrit', action='store_true', help='skip adding the upstream Gerrit remote and commit hook')
parser.add_argument('--baseline-upstream', action='store_true', help='initialize using upstream Chromium submodule w/o applying patches (for maintenance purposes only)')
group = parser.add_mutually_exclusive_group()
group.add_argument('-u', '--upstream', action='store_true', help='initialize using upstream Chromium submodule')
@@ -97,18 +79,11 @@ if not chromium_src or not os.path.isdir(chromium_src):
args.snapshot = True
print 'CHROMIUM_SRC_DIR not set, using Chromium in' + chromium_src
-# Write our chromium sources directory into git config.
-relative_chromium_src = os.path.relpath(chromium_src, qtwebengine_root)
-subprocess.call(['git', 'config', 'qtwebengine.chromiumsrcdir', relative_chromium_src])
-
+if not args.baseline_upstream:
+ # Write our chromium sources directory into git config.
+ relative_chromium_src = os.path.relpath(chromium_src, qtwebengine_root)
+ subprocess.call(['git', 'config', 'qtwebengine.chromiumsrcdir', relative_chromium_src])
-def which(tool_name):
- path = os.environ.get('PATH')
- for entry in path.split(os.pathsep):
- entry = os.path.join(entry, tool_name)
- if os.access(entry, os.X_OK):
- return entry
- return ''
def updateLastChange():
if use_external_chromium:
@@ -120,19 +95,6 @@ def updateLastChange():
subprocess.call(['python', 'build/util/lastchange.py', '-s', 'third_party/WebKit', '-o', 'build/util/LASTCHANGE.blink'])
os.chdir(currentDir)
-def addGerritRemote():
- os.chdir(qtwebengine_root)
- remotes = subprocess.check_output(['git', 'remote'])
- if not 'gerrit' in remotes:
- subprocess.call(['git', 'remote', 'add', 'gerrit', 'ssh://codereview.qt-project.org:29418/qt/qtwebengine.git'])
-
-def installGitHooks():
- os.chdir(qtwebengine_root)
- if sys.platform == 'win32':
- subprocess.call(['pscp', '-p', '-P', '29418', 'codereview.qt-project.org:hooks/commit-msg', '.git/hooks'])
- else:
- subprocess.call(['scp', '-p', '-P', '29418', 'codereview.qt-project.org:hooks/commit-msg', '.git/hooks'])
-
def initUpstreamSubmodules():
ninja_url = 'https://github.com/martine/ninja.git'
chromium_url = 'https://chromium.googlesource.com/chromium/src.git'
@@ -148,7 +110,7 @@ def initUpstreamSubmodules():
ninjaSubmodule = GitSubmodule.Submodule()
ninjaSubmodule.path = 'src/3rdparty_upstream/ninja'
- ninjaSubmodule.shasum = ninja_shasum
+ ninjaSubmodule.ref = ninja_shasum
ninjaSubmodule.url = ninja_url
ninjaSubmodule.os = 'all'
ninjaSubmodule.initialize()
@@ -174,14 +136,6 @@ def initSnapshot():
os.chdir(qtwebengine_root)
-if not args.no_gerrit:
- addGerritRemote()
- installGitHooks()
-
-print 'Configuring git to ignore all submodules. Submodule changes will not show up in "git diff"!'
-subprocess.call(['git', 'config', 'diff.ignoreSubmodules', 'all'])
-subprocess.call(['git', 'update-index', '--assume-unchanged', '.gitmodules'])
-
if args.upstream:
initUpstreamSubmodules()
updateLastChange()
diff --git a/tools/scripts/take_snapshot.py b/tools/scripts/take_snapshot.py
index a2608fb1d..3696b9a7a 100755
--- a/tools/scripts/take_snapshot.py
+++ b/tools/scripts/take_snapshot.py
@@ -49,6 +49,7 @@ import imp
import errno
import shutil
+from distutils.version import StrictVersion
import git_submodule as GitSubmodule
qtwebengine_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
@@ -214,7 +215,11 @@ def isInChromiumBlacklist(file_path):
return True
return False
-def createHardLinkForFile(src, dst):
+def printProgress(current, total):
+ sys.stdout.write("\r{} of {}".format(current, total))
+ sys.stdout.flush()
+
+def copyFile(src, dst):
src = os.path.abspath(src)
dst = os.path.abspath(dst)
dst_dir = os.path.dirname(dst)
@@ -227,6 +232,8 @@ def createHardLinkForFile(src, dst):
try:
os.link(src, dst)
+ # Qt uses LF-only but Chromium isn't.
+ subprocess.call(['dos2unix', '--keep-bom', '--quiet', dst])
except OSError as exception:
if exception.errno == errno.ENOENT:
print 'file does not exist:' + src
@@ -263,10 +270,13 @@ def exportNinja():
print 'exporting contents of:' + third_party_upstream_ninja
os.chdir(third_party_upstream_ninja)
files = listFilesInCurrentRepository()
- print 'creating hardlinks in ' + third_party_ninja
- for f in files:
+ print 'copying files to ' + third_party_ninja
+ for i in xrange(len(files)):
+ printProgress(i+1, len(files))
+ f = files[i]
if not isInGitBlacklist(f):
- createHardLinkForFile(f, os.path.join(third_party_ninja, f))
+ copyFile(f, os.path.join(third_party_ninja, f))
+ print("")
def exportChromium():
third_party_upstream_chromium = os.path.join(third_party_upstream, 'chromium')
@@ -278,10 +288,21 @@ def exportChromium():
# Add LASTCHANGE files which are not tracked by git.
files.append('build/util/LASTCHANGE')
files.append('build/util/LASTCHANGE.blink')
- print 'creating hardlinks in ' + third_party_chromium
- for f in files:
+ print 'copying files to ' + third_party_chromium
+ for i in xrange(len(files)):
+ printProgress(i+1, len(files))
+ f = files[i]
if not isInChromiumBlacklist(f) and not isInGitBlacklist(f):
- createHardLinkForFile(f, os.path.join(third_party_chromium, f))
+ copyFile(f, os.path.join(third_party_chromium, f))
+ print("")
+
+commandNotFound = subprocess.call(['which', 'dos2unix'])
+
+if not commandNotFound:
+ dos2unixVersion = StrictVersion(subprocess.Popen(['dos2unix', '-V', '| true'], stdout=subprocess.PIPE).communicate()[0].splitlines()[0].split()[1])
+
+if commandNotFound or dos2unixVersion < StrictVersion('6.0.6'):
+ raise Exception("You need dos2unix version 6.0.6 minimum.")
clearDirectory(third_party)
diff --git a/tools/scripts/version_resolver.py b/tools/scripts/version_resolver.py
index 0a9ed813b..2430555d9 100644
--- a/tools/scripts/version_resolver.py
+++ b/tools/scripts/version_resolver.py
@@ -51,12 +51,10 @@ import json
import urllib2
import git_submodule as GitSubmodule
-chromium_version = '37.0.2062.68'
+chromium_version = '37.0.2062.103'
chromium_branch = '2062'
json_url = 'http://omahaproxy.appspot.com/all.json'
-git_deps_url = 'http://src.chromium.org/chrome/branches/' + chromium_branch + '/src/.DEPS.git'
-base_deps_url = 'http://src.chromium.org/chrome/releases/'
qtwebengine_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
snapshot_src_dir = os.path.abspath(os.path.join(qtwebengine_root, 'src/3rdparty'))
@@ -88,80 +86,23 @@ def readReleaseChannels():
channels[os].append({ 'channel': ver['channel'], 'version': ver['version'], 'branch': ver['true_branch'] })
return channels
-def repositoryUrlFix(submodule):
- # The git repository info for webrtc is outdated in the 1750
- # branch's .DEPS.git file, so we have to update the url.
- # We should be able to remove this with a branch post 1750.
- repository_url = submodule.url
- if 'external/webrtc/stable' in repository_url:
- submodule.url = repository_url.replace('external/webrtc/stable', 'external/webrtc/trunk')
-
-def sanityCheckModules(submodules):
- submodule_dict = {}
- sys.stdout.write('\nverifying submodule refs.')
- for submodule in submodules:
- sys.stdout.flush()
- if submodule.path in submodule_dict:
- prev_module = submodule_dict[submodule.path]
- # We might have to create our own DEPS file if different platforms use different branches,
- # but for now it should be safe to select the latest revision from the requirements.
- if submodule.shasum or prev_module.revision >= submodule.revision:
- continue
- if prev_module.ref != submodule.ref:
- # Ignore for Android which might lag behind.
- if submodule.os == 'android':
- continue
- sys.exit('ERROR: branch mismatch for ' + submodule.path + '(' + prev_module.ref + ' vs ' + submodule.ref + ')')
- print('Duplicate submodule ' + submodule.path + '. Using latest revison ' + str(submodule.revision) + '.')
- if submodule.ref:
- repositoryUrlFix(submodule)
- sys.stdout.write('.')
- result = subprocess.check_output(['git', 'ls-remote', submodule.url, submodule.ref])
- if submodule.ref not in result:
- # We could fall back to the git shasum if the parsed remote ref does not exist in
- # the git repository but that would most certainly be outdated, so bail out here.
- sys.exit('\nERROR: No valid remote found!')
- sys.stdout.flush()
- submodule_dict[submodule.path] = submodule
- print('done.\n')
- return list(submodule_dict.values())
-
def readSubmodules():
- response = urllib2.urlopen(base_deps_url + chromium_version + '/DEPS')
- svn_deps = response.read().strip()
-
- response = urllib2.urlopen(git_deps_url)
- git_deps = response.read().strip()
+ git_deps = subprocess.check_output(['git', 'show', chromium_version +':.DEPS.git'])
parser = GitSubmodule.DEPSParser()
- svn_submodules = parser.parse(svn_deps)
git_submodules = parser.parse(git_deps)
submodule_dict = {}
- git_dict = {}
for sub in git_submodules:
- git_dict[sub.path] = sub
-
- for sub in svn_submodules:
- if (sub.revision or sub.shasum) and sub.path in git_dict:
- submodule_dict[sub.path] = sub
-
- for git in git_submodules:
- if git.path in submodule_dict:
- # We'll use the git repository instead of svn.
- module = submodule_dict[git.path]
- module.url = git.url
- if not module.shasum:
- # We use the git shasum as fallback.
- module.shasum = git.shasum
+ submodule_dict[sub.path] = sub
# Remove unwanted upstream submodules
for path in submodule_blacklist:
if path in submodule_dict:
del submodule_dict[path]
- return sanityCheckModules(submodule_dict.values())
+ return submodule_dict.values()
def findSnapshotBaselineSha1():
if not os.path.isdir(snapshot_src_dir):