summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/qt
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-06-27 09:28:46 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-06-27 09:28:46 +0200
commit6668b07fcd51f86be243b9e08e667224e30c0cf8 (patch)
tree64f466e09b68a77ae1156c0d35cd5b95e18a34ca /Source/WebKit2/UIProcess/qt
parente7923d9de38974f0c6fb7646c898a6ea618261e8 (diff)
downloadqtwebkit-6668b07fcd51f86be243b9e08e667224e30c0cf8.tar.gz
Imported WebKit commit 26cd9bd8ab0471ffe987c9b60368f63dc0f1f31b (http://svn.webkit.org/repository/webkit/trunk@121325)
New snapshot with more Windows build fixes
Diffstat (limited to 'Source/WebKit2/UIProcess/qt')
-rw-r--r--Source/WebKit2/UIProcess/qt/LayerBackingStore.cpp141
-rw-r--r--Source/WebKit2/UIProcess/qt/LayerBackingStore.h75
-rw-r--r--Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp14
3 files changed, 7 insertions, 223 deletions
diff --git a/Source/WebKit2/UIProcess/qt/LayerBackingStore.cpp b/Source/WebKit2/UIProcess/qt/LayerBackingStore.cpp
deleted file mode 100644
index caaffe9e5..000000000
--- a/Source/WebKit2/UIProcess/qt/LayerBackingStore.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- Copyright (C) 2012 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.
- */
-
-#include "config.h"
-#include "LayerBackingStore.h"
-
-#if USE(UI_SIDE_COMPOSITING)
-#include "GraphicsLayer.h"
-#include "ShareableSurface.h"
-#include "TextureMapper.h"
-#include "TextureMapperGL.h"
-
-using namespace WebCore;
-
-namespace WebKit {
-
-void LayerBackingStoreTile::swapBuffers(WebCore::TextureMapper* textureMapper)
-{
- if (!m_surface)
- return;
-
- FloatRect targetRect(m_targetRect);
- targetRect.scale(1. / m_scale);
- bool shouldReset = false;
- if (targetRect != rect()) {
- setRect(targetRect);
- shouldReset = true;
- }
- RefPtr<BitmapTexture> texture = this->texture();
- if (!texture) {
- texture = textureMapper->createTexture();
- setTexture(texture.get());
- shouldReset = true;
- }
-
- if (shouldReset)
- texture->reset(m_targetRect.size(), m_surface->flags() & ShareableBitmap::SupportsAlpha ? BitmapTexture::SupportsAlpha : 0);
-
- m_surface->copyToTexture(texture, m_sourceRect, m_surfaceOffset);
- m_surface.clear();
-}
-
-void LayerBackingStoreTile::setBackBuffer(const IntRect& targetRect, const IntRect& sourceRect, PassRefPtr<ShareableSurface> buffer, const IntPoint& offset)
-{
- m_sourceRect = sourceRect;
- m_targetRect = targetRect;
- m_surfaceOffset = offset;
- m_surface = buffer;
-}
-
-void LayerBackingStore::createTile(int id, float scale)
-{
- m_tiles.add(id, LayerBackingStoreTile(scale));
- m_scale = scale;
-}
-
-void LayerBackingStore::removeTile(int id)
-{
- m_tilesToRemove.append(id);
-}
-
-
-void LayerBackingStore::updateTile(int id, const IntRect& sourceRect, const IntRect& targetRect, PassRefPtr<ShareableSurface> backBuffer, const IntPoint& offset)
-{
- HashMap<int, LayerBackingStoreTile>::iterator it = m_tiles.find(id);
- ASSERT(it != m_tiles.end());
- it->second.setBackBuffer(targetRect, sourceRect, backBuffer, offset);
-}
-
-PassRefPtr<BitmapTexture> LayerBackingStore::texture() const
-{
- HashMap<int, LayerBackingStoreTile>::const_iterator end = m_tiles.end();
- for (HashMap<int, LayerBackingStoreTile>::const_iterator it = m_tiles.begin(); it != end; ++it) {
- RefPtr<BitmapTexture> texture = it->second.texture();
- if (texture)
- return texture;
- }
-
- return PassRefPtr<BitmapTexture>();
-}
-
-void LayerBackingStore::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity, BitmapTexture* mask)
-{
- Vector<TextureMapperTile*> tilesToPaint;
-
- // We have to do this every time we paint, in case the opacity has changed.
- HashMap<int, LayerBackingStoreTile>::iterator end = m_tiles.end();
- FloatRect coveredRect;
- for (HashMap<int, LayerBackingStoreTile>::iterator it = m_tiles.begin(); it != end; ++it) {
- LayerBackingStoreTile& tile = it->second;
- if (!tile.texture())
- continue;
-
- if (tile.scale() == m_scale) {
- tilesToPaint.append(&tile);
- coveredRect.unite(tile.rect());
- continue;
- }
-
- // Only show the previous tile if the opacity is high, otherwise effect looks like a bug.
- // We show the previous-scale tile anyway if it doesn't intersect with any current-scale tile.
- if (opacity < 0.95 && coveredRect.intersects(tile.rect()))
- continue;
-
- tilesToPaint.prepend(&tile);
- }
-
- for (size_t i = 0; i < tilesToPaint.size(); ++i)
- tilesToPaint[i]->paint(textureMapper, transform, opacity, mask);
-}
-
-void LayerBackingStore::commitTileOperations(TextureMapper* textureMapper)
-{
- Vector<int>::iterator tilesToRemoveEnd = m_tilesToRemove.end();
- for (Vector<int>::iterator it = m_tilesToRemove.begin(); it != tilesToRemoveEnd; ++it)
- m_tiles.remove(*it);
- m_tilesToRemove.clear();
-
- HashMap<int, LayerBackingStoreTile>::iterator tilesEnd = m_tiles.end();
- for (HashMap<int, LayerBackingStoreTile>::iterator it = m_tiles.begin(); it != tilesEnd; ++it)
- it->second.swapBuffers(textureMapper);
-}
-
-} // namespace WebKit
-#endif
diff --git a/Source/WebKit2/UIProcess/qt/LayerBackingStore.h b/Source/WebKit2/UIProcess/qt/LayerBackingStore.h
deleted file mode 100644
index a3e219b04..000000000
--- a/Source/WebKit2/UIProcess/qt/LayerBackingStore.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- Copyright (C) 2012 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.
- */
-
-#ifndef LayerBackingStore_h
-#define LayerBackingStore_h
-
-#if USE(UI_SIDE_COMPOSITING)
-
-#include "TextureMapper.h"
-#include "TextureMapperBackingStore.h"
-#include <wtf/HashMap.h>
-
-namespace WebKit {
-
-class ShareableSurface;
-
-class LayerBackingStoreTile : public WebCore::TextureMapperTile {
-public:
- LayerBackingStoreTile(float scale = 1)
- : TextureMapperTile(WebCore::FloatRect())
- , m_scale(scale)
- {
- }
-
- inline float scale() const { return m_scale; }
- void swapBuffers(WebCore::TextureMapper*);
- void setBackBuffer(const WebCore::IntRect&, const WebCore::IntRect&, PassRefPtr<ShareableSurface> buffer, const WebCore::IntPoint&);
-
-private:
- RefPtr<ShareableSurface> m_surface;
- WebCore::IntRect m_sourceRect;
- WebCore::IntRect m_targetRect;
- WebCore::IntPoint m_surfaceOffset;
- float m_scale;
-};
-
-class LayerBackingStore : public WebCore::TextureMapperBackingStore {
-public:
- void createTile(int, float);
- void removeTile(int);
- void updateTile(int, const WebCore::IntRect&, const WebCore::IntRect&, PassRefPtr<ShareableSurface>, const WebCore::IntPoint&);
- static PassRefPtr<LayerBackingStore> create() { return adoptRef(new LayerBackingStore); }
- void commitTileOperations(WebCore::TextureMapper*);
- PassRefPtr<WebCore::BitmapTexture> texture() const;
- virtual void paintToTextureMapper(WebCore::TextureMapper*, const WebCore::FloatRect&, const WebCore::TransformationMatrix&, float, WebCore::BitmapTexture*);
-
-private:
- LayerBackingStore()
- : m_scale(1.)
- { }
- HashMap<int, LayerBackingStoreTile> m_tiles;
- Vector<int> m_tilesToRemove;
- float m_scale;
-};
-
-} // namespace WebKit
-#endif
-
-#endif // LayerBackingStore_h
diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
index 4f131ccdf..648119486 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
@@ -31,7 +31,7 @@
#include <QCursor>
#include <QDrag>
#include <QGuiApplication>
-#include <QInputPanel>
+#include <QInputMethod>
#include <QMimeData>
#include <QtQuick/QQuickCanvas>
#include <QStyleHints>
@@ -100,12 +100,12 @@ QtWebPageEventHandler::QtWebPageEventHandler(WKPageRef pageRef, QQuickWebPage* q
, m_postponeTextInputStateChanged(false)
, m_isTapHighlightActive(false)
{
- connect(qApp->inputPanel(), SIGNAL(visibleChanged()), this, SLOT(inputPanelVisibleChanged()));
+ connect(qApp->inputMethod(), SIGNAL(visibleChanged()), this, SLOT(inputPanelVisibleChanged()));
}
QtWebPageEventHandler::~QtWebPageEventHandler()
{
- disconnect(qApp->inputPanel(), SIGNAL(visibleChanged()), this, SLOT(inputPanelVisibleChanged()));
+ disconnect(qApp->inputMethod(), SIGNAL(visibleChanged()), this, SLOT(inputPanelVisibleChanged()));
}
void QtWebPageEventHandler::handleMouseMoveEvent(QMouseEvent* ev)
@@ -390,10 +390,10 @@ void QtWebPageEventHandler::resetGestureRecognizers()
static void setInputPanelVisible(bool visible)
{
- if (qApp->inputPanel()->visible() == visible)
+ if (qApp->inputMethod()->visible() == visible)
return;
- qApp->inputPanel()->setVisible(visible);
+ qApp->inputMethod()->setVisible(visible);
}
void QtWebPageEventHandler::inputPanelVisibleChanged()
@@ -402,7 +402,7 @@ void QtWebPageEventHandler::inputPanelVisibleChanged()
return;
// We only respond to the input panel becoming visible.
- if (!m_webView->hasActiveFocus() || !qApp->inputPanel()->visible())
+ if (!m_webView->hasActiveFocus() || !qApp->inputMethod()->visible())
return;
const EditorState& editor = m_webPageProxy->editorState();
@@ -422,7 +422,7 @@ void QtWebPageEventHandler::updateTextInputState()
if (!m_webView->hasActiveFocus())
return;
- qApp->inputPanel()->update(Qt::ImQueryInput | Qt::ImEnabled);
+ qApp->inputMethod()->update(Qt::ImQueryInput | Qt::ImEnabled);
setInputPanelVisible(editor.isContentEditable);
}