diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2013-06-19 13:26:13 +0200 |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2013-06-19 13:26:13 +0200 |
commit | eb530b3752e1af68956feaa833e5b86b1e49e2e1 (patch) | |
tree | 650a6b8acac3c7d484467cffdc9cdb1701bd6ecc | |
parent | ddc65ad9a8462321279024ec1ae6931e11f8fa23 (diff) |
Move symbols that we left out from the Chromium build in a separate file.
-rw-r--r-- | shared/render_widget_host_view_qt.cpp | 33 | ||||
-rw-r--r-- | shared/shared.pro | 2 | ||||
-rw-r--r-- | shared/shared_globals.cpp | 79 | ||||
-rw-r--r-- | shared/shared_globals.h | 55 |
4 files changed, 138 insertions, 31 deletions
diff --git a/shared/render_widget_host_view_qt.cpp b/shared/render_widget_host_view_qt.cpp index 305a4f6b8..9be9d6f35 100644 --- a/shared/render_widget_host_view_qt.cpp +++ b/shared/render_widget_host_view_qt.cpp @@ -43,50 +43,21 @@ #include "backing_store_qt.h" #include "render_widget_host_view_qt_delegate.h" +#include "shared_globals.h" #include "web_event_factory.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/common/gpu/gpu_messages.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" #include <QEvent> #include <QFocusEvent> #include <QKeyEvent> #include <QMouseEvent> #include <QWheelEvent> -#include <QScreen> -#include <QQuickWindow> - -static void GetScreenInfoFromNativeWindow(QWindow* window, WebKit::WebScreenInfo* results) -{ - QScreen* screen = window->screen(); - - WebKit::WebScreenInfo r; - r.deviceScaleFactor = screen->devicePixelRatio(); - r.depthPerComponent = 8; - r.depth = screen->depth(); - r.isMonochrome = (r.depth == 1); - - QRect virtualGeometry = screen->virtualGeometry(); - r.rect = WebKit::WebRect(virtualGeometry.x(), virtualGeometry.y(), virtualGeometry.width(), virtualGeometry.height()); - QRect available = screen->availableGeometry(); - r.availableRect = WebKit::WebRect(available.x(), available.y(), available.width(), available.height()); - *results = r; -} +#include <QWindow> namespace content { -RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost*) { - // WebContentsViewQt should take care of this directly. - Q_ASSERT(false); -} - -// static -void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebKit::WebScreenInfo* results) { - QWindow dummy; - GetScreenInfoFromNativeWindow(&dummy, results); -} - RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget) : m_host(content::RenderWidgetHostImpl::From(widget)) , m_delegate(0) diff --git a/shared/shared.pro b/shared/shared.pro index 053dacc4b..f51032417 100644 --- a/shared/shared.pro +++ b/shared/shared.pro @@ -23,11 +23,13 @@ QT += widgets quick SOURCES = \ backing_store_qt.cpp \ render_widget_host_view_qt.cpp \ + shared_globals.cpp \ web_event_factory.cpp HEADERS = \ backing_store_qt.h \ render_widget_host_view_qt.h \ render_widget_host_view_qt_delegate.h \ + shared_globals.h \ web_event_factory.h diff --git a/shared/shared_globals.cpp b/shared/shared_globals.cpp new file mode 100644 index 000000000..9a23c8db1 --- /dev/null +++ b/shared/shared_globals.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "shared_globals.h" + +#include "content/browser/renderer_host/render_widget_host_view_base.h" + +#include <QScreen> +#include <QQuickWindow> + +namespace content { + +void GetScreenInfoFromNativeWindow(QWindow* window, WebKit::WebScreenInfo* results) +{ + QScreen* screen = window->screen(); + + WebKit::WebScreenInfo r; + r.deviceScaleFactor = screen->devicePixelRatio(); + r.depthPerComponent = 8; + r.depth = screen->depth(); + r.isMonochrome = (r.depth == 1); + + QRect virtualGeometry = screen->virtualGeometry(); + r.rect = WebKit::WebRect(virtualGeometry.x(), virtualGeometry.y(), virtualGeometry.width(), virtualGeometry.height()); + QRect available = screen->availableGeometry(); + r.availableRect = WebKit::WebRect(available.x(), available.y(), available.width(), available.height()); + *results = r; +} + +RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost*) { + // WebContentsViewQt should take care of this directly. + Q_ASSERT(false); +} + +// static +void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebKit::WebScreenInfo* results) { + QWindow dummy; + GetScreenInfoFromNativeWindow(&dummy, results); +} + +} diff --git a/shared/shared_globals.h b/shared/shared_globals.h new file mode 100644 index 000000000..a42efd6a2 --- /dev/null +++ b/shared/shared_globals.h @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SHARED_GLOBALS_H +#define SHARED_GLOBALS_H + +#include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" + +class QWindow; + +namespace content { + +void GetScreenInfoFromNativeWindow(QWindow* window, WebKit::WebScreenInfo* results); + +} + +#endif |