Source

Target

Commits (11)
Showing with 117 additions and 66 deletions
......@@ -339,7 +339,6 @@ void BrowserMainWindow::setupMenu()
QAction *m_find = editMenu->addAction(tr("&Find"));
m_find->setShortcuts(QKeySequence::Find);
connect(m_find, SIGNAL(triggered()), this, SLOT(slotEditFind()));
new QShortcut(QKeySequence(Qt::Key_Slash), this, SLOT(slotEditFind()));
QAction *m_findNext = editMenu->addAction(tr("&Find Next"));
m_findNext->setShortcuts(QKeySequence::FindNext);
......
......@@ -84,6 +84,7 @@ void* g_display;
const char* g_extensions = NULL;
bool g_egl_surfaceless_context_supported = false;
} // namespace
......@@ -106,6 +107,26 @@ private:
DISALLOW_COPY_AND_ASSIGN(GLSurfaceQtEGL);
};
// The following comment is cited from chromium/ui/gl/gl_surface_egl.cc:
// SurfacelessEGL is used as Offscreen surface when platform supports
// KHR_surfaceless_context and GL_OES_surfaceless_context. This would avoid the
// need to create a dummy EGLsurface in case we render to client API targets.
class GLSurfacelessQtEGL : public GLSurfaceQt {
public:
explicit GLSurfacelessQtEGL(const gfx::Size& size);
public:
bool Initialize() Q_DECL_OVERRIDE;
void Destroy() Q_DECL_OVERRIDE;
bool IsSurfaceless() const Q_DECL_OVERRIDE;
bool Resize(const gfx::Size& size) Q_DECL_OVERRIDE;
EGLSurface GetHandle() Q_DECL_OVERRIDE;
void* GetShareHandle() Q_DECL_OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(GLSurfacelessQtEGL);
};
GLSurfaceQt::~GLSurfaceQt()
{
......@@ -339,6 +360,23 @@ bool GLSurfaceQtEGL::InitializeOneOff()
return false;
}
g_egl_surfaceless_context_supported = ExtensionsContain(g_extensions, "EGL_KHR_surfaceless_context");
if (g_egl_surfaceless_context_supported) {
scoped_refptr<GLSurface> surface = new GLSurfacelessQtEGL(Size(1, 1));
scoped_refptr<GLContext> context = GLContext::CreateGLContext(
NULL, surface.get(), PreferIntegratedGpu);
if (!context->MakeCurrent(surface.get()))
g_egl_surfaceless_context_supported = false;
// Ensure context supports GL_OES_surfaceless_context.
if (g_egl_surfaceless_context_supported) {
g_egl_surfaceless_context_supported = context->HasExtension(
"GL_OES_surfaceless_context");
context->ReleaseCurrent(surface.get());
}
}
initialized = true;
return true;
}
......@@ -413,7 +451,7 @@ bool GLSurfaceQtEGL::Initialize()
g_config,
pbuffer_attributes);
if (!m_surfaceBuffer) {
LOG(ERROR) << "eglCreatePbufferSurface failed with error ", GetLastEGLErrorString();
LOG(ERROR) << "eglCreatePbufferSurface failed with error " << GetLastEGLErrorString();
Destroy();
return false;
}
......@@ -488,6 +526,41 @@ void* GLSurfaceQt::GetConfig()
return g_config;
}
GLSurfacelessQtEGL::GLSurfacelessQtEGL(const gfx::Size& size)
: GLSurfaceQt(size)
{
}
bool GLSurfacelessQtEGL::Initialize()
{
return true;
}
void GLSurfacelessQtEGL::Destroy()
{
}
bool GLSurfacelessQtEGL::IsSurfaceless() const
{
return true;
}
bool GLSurfacelessQtEGL::Resize(const gfx::Size& size)
{
m_size = size;
return true;
}
EGLSurface GLSurfacelessQtEGL::GetHandle()
{
return EGL_NO_SURFACE;
}
void* GLSurfacelessQtEGL::GetShareHandle()
{
return NULL;
}
// static
scoped_refptr<GLSurface>
GLSurface::CreateOffscreenGLSurface(const gfx::Size& size)
......@@ -511,7 +584,12 @@ GLSurface::CreateOffscreenGLSurface(const gfx::Size& size)
#endif
}
case kGLImplementationEGLGLES2: {
scoped_refptr<GLSurface> surface = new GLSurfaceQtEGL(size);
scoped_refptr<GLSurface> surface;
if (g_egl_surfaceless_context_supported)
surface = new GLSurfacelessQtEGL(size);
else
surface = new GLSurfaceQtEGL(size);
if (!surface->Initialize())
return NULL;
return surface;
......
......@@ -81,6 +81,7 @@ contains(QT_ARCH, "arm") {
else: GYP_CONFIG += arm_fpu=\"$$MFPU\" arm_neon=0 arm_neon_optional=0
}
contains(QMAKE_CFLAGS, "-marm"): GYP_CONFIG += arm_thumb=0
contains(QMAKE_CFLAGS, "-mthumb"): GYP_CONFIG += arm_thumb=1
}
......
......@@ -115,6 +115,8 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate()
, m_dpiScale(1.0)
, m_backgroundColor(Qt::white)
, m_defaultZoomFactor(1.0)
// QTBUG-53467
, m_menuEnabled(true)
{
// The gold standard for mobile web content is 160 dpi, and the devicePixelRatio expected
// is the (possibly quantized) ratio of device dpi to 160 dpi.
......@@ -132,6 +134,8 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate()
// 1x, 2x, 3x etc assets that fit an integral number of pixels.
setDevicePixelRatio(qMax(1, qRound(webPixelRatio)));
}
if (platform == QLatin1Literal("eglfs"))
m_menuEnabled = false;
#ifndef QT_NO_ACCESSIBILITY
QAccessible::installFactory(&webAccessibleFactory);
#endif // QT_NO_ACCESSIBILITY
......@@ -182,6 +186,12 @@ bool QQuickWebEngineViewPrivate::contextMenuRequested(const WebEngineContextMenu
{
Q_Q(QQuickWebEngineView);
if (!m_menuEnabled) {
qWarning("You are trying to open context menu on eglfs backend, which is not currently supported\n"
"See QTBUG-53467.");
return false;
}
// Assign the WebEngineView as the parent of the menu, so mouse events are properly propagated
// on OSX.
QObject *menu = ui()->addMenu(q, QString(), data.pos);
......
......@@ -215,6 +215,8 @@ private:
qreal m_dpiScale;
QColor m_backgroundColor;
qreal m_defaultZoomFactor;
// QTBUG-53467
bool m_menuEnabled;
};
#ifndef QT_NO_ACCESSIBILITY
......
......@@ -104,6 +104,8 @@
the user. Note that on Windows an external GPS receiver must be connected to
the application. For more information, see \l{Qt Positioning}.
Support for this feature was added in Qt 5.5.0.
\section1 Pepper Plugin API
Qt WebEngine supports loading Pepper Plugin API (PPAPI) plugins if
......
......@@ -60,16 +60,16 @@
The functionality in Qt WebEngine is divided into the following modules:
\list
\li \l{Qt WebEngine Widgets} for creating widget-based web applications
\li \l{Qt WebEngine} for creating Qt Quick based web applications
\li \l{Qt WebEngine Core} for interacting with Chromium
\li \l{Qt WebEngine Widgets Module} for creating widget-based web applications
\li \l{Qt WebEngine Module} for creating Qt Quick based web applications
\li \l{Qt WebEngine Core Module} for interacting with Chromium
\endlist
Page rendering and JavaScript execution are separated from the GUI process into the Qt WebEngine
Process. It is a library that must be shipped with the application if the Qt libraries are
bundled into the application.
\section2 Qt WebEngine Widgets
\section2 Qt WebEngine Widgets Module
\image qtwebenginewidgets-model.png
......@@ -82,7 +82,7 @@
\e cookies. Profiles can be used to isolate pages from each other. A typical use case is a
dedicated profile for a \e {private browsing} mode, where no information is permanently saved.
\section2 Qt WebEngine
\section2 Qt WebEngine Module
\image qtwebengine-model.png
......@@ -90,7 +90,7 @@
except that there is no separately accessible web engine page. The supported page functionality
is integrated into the web engine view.
\section2 Qt WebEngine Core
\section2 Qt WebEngine Core Module
The Qt WebEngine core is based on the \l {Chromium Project}. Chromium provides its own network
and painting engines and is developed tightly together with its dependent modules, and
......
......@@ -87,6 +87,7 @@
\section2 Linux
On Linux, Clang or GCC version 4.7 or later is required.
Supported configurations are \c linux-g++ and \c{linux-clang}.
Qt WebEngine requires \c pkg-config to detect most of its dependencies. The
following \c pkg-config files are required:
......
......@@ -20,7 +20,7 @@
%dependencies = (
"qtbase" => "",
"qtdeclarative" => "",
"qtxmlpatterns" => "",
"qtlocation" => "",
"qttools" => "",
# FIXME: take examples out into their own module to avoid a potential circular dependency later ?
"qtquickcontrols" => "",
......
......@@ -202,9 +202,6 @@ private Q_SLOTS:
void progressSignal();
void urlChange();
void requestedUrlAfterSetAndLoadFailures();
void javaScriptWindowObjectCleared_data();
void javaScriptWindowObjectCleared();
void javaScriptWindowObjectClearedOnEvaluate();
void asyncAndDelete();
void earlyToHtml();
void setHtml();
......@@ -3918,48 +3915,6 @@ void tst_QWebEnginePage::requestedUrlAfterSetAndLoadFailures()
QVERIFY(!spy.at(1).first().toBool());
}
void tst_QWebEnginePage::javaScriptWindowObjectCleared_data()
{
QTest::addColumn<QString>("html");
QTest::addColumn<int>("signalCount");
QTest::newRow("with <script>") << "<html><body><script>i=0</script><p>hello world</p></body></html>" << 1;
// NOTE: Empty scripts no longer cause this signal to be emitted.
QTest::newRow("with empty <script>") << "<html><body><script></script><p>hello world</p></body></html>" << 0;
QTest::newRow("without <script>") << "<html><body><p>hello world</p></body></html>" << 0;
}
void tst_QWebEnginePage::javaScriptWindowObjectCleared()
{
#if !defined(QWEBENGINEPAGE_JAVASCRIPTWINDOWOBJECTCLEARED)
QSKIP("QWEBENGINEPAGE_JAVASCRIPTWINDOWOBJECTCLEARED");
#else
QWebEnginePage page;
QSignalSpy spy(&page, SIGNAL(javaScriptWindowObjectCleared()));
QFETCH(QString, html);
page.setHtml(html);
QFETCH(int, signalCount);
QCOMPARE(spy.count(), signalCount);
#endif
}
void tst_QWebEnginePage::javaScriptWindowObjectClearedOnEvaluate()
{
#if !defined(QWEBENGINEPAGE_EVALUATEJAVASCRIPT)
QSKIP("QWEBENGINEPAGE_EVALUATEJAVASCRIPT");
#else
QWebEnginePage page;
QSignalSpy spy(&page, SIGNAL(javaScriptWindowObjectCleared()));
page.setHtml("<html></html>");
QCOMPARE(spy.count(), 0);
page.evaluateJavaScript("var a = 'a';");
QCOMPARE(spy.count(), 1);
// no new clear for a new script:
page.evaluateJavaScript("var a = 1;");
QCOMPARE(spy.count(), 1);
#endif
}
void tst_QWebEnginePage::asyncAndDelete()
{
QWebEnginePage *page = new QWebEnginePage;
......
......@@ -3,7 +3,9 @@
import re, sys, os
includedMocs = set()
for f in filter(os.path.isfile, sys.argv[1:]):
dir = sys.argv[1]
files = sys.argv[2:]
for f in filter(os.path.isfile, [os.path.join(dir, f) for f in files]):
inBlockComment = False
for line in open(f).readlines():
m = re.search('#include "(moc_\w+.cpp)"', line)
......
......@@ -3,7 +3,9 @@
import re, sys, os
mocables = set()
for f in filter(os.path.isfile, sys.argv[1:]):
dir = sys.argv[1]
files = sys.argv[2:]
for f in filter(os.path.isfile, [os.path.join(dir, f) for f in files]):
inBlockComment = False
for line in open(f).readlines():
# Block comments handling
......
......@@ -107,5 +107,10 @@ defineTest(finalizeConfigure) {
} else {
log("Proprietary codecs (H264, MP3).... Not enabled (Default, enable with WEBENGINE_CONFIG+=use_proprietary_codecs)$${EOL}")
}
qtHaveModule(positioning): {
log("Geolocation....................... Enabled$${EOL}")
} else {
log("Geolocation....................... Not enabled (Requires Qt Positioning module)$${EOL}")
}
}
......@@ -112,19 +112,13 @@ defineReplace(extractCFlag) {
}
defineReplace(findMocables) {
input = $$1
for (file, input): \
infiles += $$absolute_path($$file, $$_PRO_FILE_PWD_)
mocables = $$system("python $$QTWEBENGINE_ROOT/tools/buildscripts/find-mocables $$infiles")
mocables = $$replace(mocables, $$re_escape($${_PRO_FILE_PWD_}/), '')
mocables = $$system("$$system_path(python $$QTWEBENGINE_ROOT/tools/buildscripts/find-mocables $$_PRO_FILE_PWD_ $$1)")
mocables = $$replace(mocables, $$re_escape($$system_path($${_PRO_FILE_PWD_}/)), '')
return($$mocables)
}
defineReplace(findIncludedMocFiles) {
input = $$1
for (file, input): \
infiles += $$absolute_path($$file, $$_PRO_FILE_PWD_)
return($$system("python $$QTWEBENGINE_ROOT/tools/buildscripts/find-included-moc-files $$infiles"))
return($$system("$$system_path(python $$QTWEBENGINE_ROOT/tools/buildscripts/find-included-moc-files $$_PRO_FILE_PWD_ $$1)"))
}
defineReplace(mocOutput) {
......