Diff
Modified: trunk/Source/WebKit2/ChangeLog (121150 => 121151)
--- trunk/Source/WebKit2/ChangeLog 2012-06-25 12:41:44 UTC (rev 121150)
+++ trunk/Source/WebKit2/ChangeLog 2012-06-25 13:16:24 UTC (rev 121151)
@@ -1,3 +1,32 @@
+2012-06-25 YoungTaeck Song <[email protected]>
+
+ [WK2][Qt][EFL] Move LayerBackingStore into common directory
+ https://bugs.webkit.org/show_bug.cgi?id=89838
+
+ Reviewed by Noam Rosenthal.
+
+ Move LayerBackingStore into 'Source/WebKit2/UIProcess/texmap' to be used by both Qt and Efl.
+
+ * Target.pri:
+ * UIProcess/texmap/LayerBackingStore.cpp: Renamed from Source/WebKit2/UIProcess/qt/LayerBackingStore.cpp.
+ (WebKit):
+ (WebKit::LayerBackingStoreTile::swapBuffers):
+ (WebKit::LayerBackingStoreTile::setBackBuffer):
+ (WebKit::LayerBackingStore::createTile):
+ (WebKit::LayerBackingStore::removeTile):
+ (WebKit::LayerBackingStore::updateTile):
+ (WebKit::LayerBackingStore::texture):
+ (WebKit::LayerBackingStore::paintToTextureMapper):
+ (WebKit::LayerBackingStore::commitTileOperations):
+ * UIProcess/texmap/LayerBackingStore.h: Renamed from Source/WebKit2/UIProcess/qt/LayerBackingStore.h.
+ (WebKit):
+ (LayerBackingStoreTile):
+ (WebKit::LayerBackingStoreTile::LayerBackingStoreTile):
+ (WebKit::LayerBackingStoreTile::scale):
+ (LayerBackingStore):
+ (WebKit::LayerBackingStore::create):
+ (WebKit::LayerBackingStore::LayerBackingStore):
+
2012-06-25 Carlos Garcia Campos <[email protected]>
[GTK] Test /webkit2/WebKitWebView/permission-requests fails due to a runtime warning
Modified: trunk/Source/WebKit2/Target.pri (121150 => 121151)
--- trunk/Source/WebKit2/Target.pri 2012-06-25 12:41:44 UTC (rev 121150)
+++ trunk/Source/WebKit2/Target.pri 2012-06-25 13:16:24 UTC (rev 121151)
@@ -273,7 +273,6 @@
UIProcess/WebResourceCacheManagerProxy.h \
UIProcess/WebResourceLoadClient.h \
UIProcess/WebUIClient.h \
- UIProcess/qt/LayerBackingStore.h \
UIProcess/qt/QtWebContext.h \
UIProcess/qt/QtWebPageEventHandler.h \
UIProcess/qt/QtGestureRecognizer.h \
@@ -294,6 +293,7 @@
UIProcess/qt/WebContextMenuProxyQt.h \
UIProcess/qt/WebGeolocationProviderQt.h \
UIProcess/qt/WebPopupMenuProxyQt.h \
+ UIProcess/texmap/LayerBackingStore.h \
WebProcess/ApplicationCache/WebApplicationCacheManager.h \
WebProcess/Authentication/AuthenticationManager.h \
WebProcess/Cookies/WebCookieManager.h \
@@ -624,7 +624,6 @@
UIProcess/WebResourceLoadClient.cpp \
UIProcess/WebUIClient.cpp \
UIProcess/qt/QtWebContext.cpp \
- UIProcess/qt/LayerBackingStore.cpp \
UIProcess/qt/QtWebPageEventHandler.cpp \
UIProcess/qt/QtGestureRecognizer.cpp \
UIProcess/qt/QtPanGestureRecognizer.cpp \
@@ -649,6 +648,7 @@
UIProcess/qt/WebPopupMenuProxyQt.cpp \
UIProcess/qt/WebPreferencesQt.cpp \
UIProcess/qt/QtWebIconDatabaseClient.cpp \
+ UIProcess/texmap/LayerBackingStore.cpp \
WebProcess/ApplicationCache/WebApplicationCacheManager.cpp \
WebProcess/Authentication/AuthenticationManager.cpp \
WebProcess/Cookies/WebCookieManager.cpp \
Deleted: trunk/Source/WebKit2/UIProcess/qt/LayerBackingStore.cpp (121150 => 121151)
--- trunk/Source/WebKit2/UIProcess/qt/LayerBackingStore.cpp 2012-06-25 12:41:44 UTC (rev 121150)
+++ trunk/Source/WebKit2/UIProcess/qt/LayerBackingStore.cpp 2012-06-25 13:16:24 UTC (rev 121151)
@@ -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
Deleted: trunk/Source/WebKit2/UIProcess/qt/LayerBackingStore.h (121150 => 121151)
--- trunk/Source/WebKit2/UIProcess/qt/LayerBackingStore.h 2012-06-25 12:41:44 UTC (rev 121150)
+++ trunk/Source/WebKit2/UIProcess/qt/LayerBackingStore.h 2012-06-25 13:16:24 UTC (rev 121151)
@@ -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
Copied: trunk/Source/WebKit2/UIProcess/texmap/LayerBackingStore.cpp (from rev 121150, trunk/Source/WebKit2/UIProcess/qt/LayerBackingStore.cpp) (0 => 121151)
--- trunk/Source/WebKit2/UIProcess/texmap/LayerBackingStore.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/texmap/LayerBackingStore.cpp 2012-06-25 13:16:24 UTC (rev 121151)
@@ -0,0 +1,141 @@
+/*
+ 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
Copied: trunk/Source/WebKit2/UIProcess/texmap/LayerBackingStore.h (from rev 121150, trunk/Source/WebKit2/UIProcess/qt/LayerBackingStore.h) (0 => 121151)
--- trunk/Source/WebKit2/UIProcess/texmap/LayerBackingStore.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/texmap/LayerBackingStore.h 2012-06-25 13:16:24 UTC (rev 121151)
@@ -0,0 +1,75 @@
+/*
+ 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
Modified: trunk/Source/WebKit2/WebKit2.pri (121150 => 121151)
--- trunk/Source/WebKit2/WebKit2.pri 2012-06-25 12:41:44 UTC (rev 121150)
+++ trunk/Source/WebKit2/WebKit2.pri 2012-06-25 13:16:24 UTC (rev 121151)
@@ -33,6 +33,7 @@
$$SOURCE_DIR/UIProcess/Notifications \
$$SOURCE_DIR/UIProcess/Plugins \
$$SOURCE_DIR/UIProcess/qt \
+ $$SOURCE_DIR/UIProcess/texmap \
$$SOURCE_DIR/WebProcess \
$$SOURCE_DIR/WebProcess/ApplicationCache \
$$SOURCE_DIR/WebProcess/Authentication \