diff options
author | Patrick Scott <phanna@android.com> | 2011-02-22 11:20:56 -0500 |
---|---|---|
committer | Patrick Scott <phanna@android.com> | 2011-02-22 11:20:56 -0500 |
commit | b0c9a2b4033eca931163e8223d7eaa8889337144 (patch) | |
tree | 41b25d823cd2bad82c86882e1c0fe5d252ec6d6e /WebCore | |
parent | e248a68aa5529c1e5faba09893cf079b0657d898 (diff) | |
download | external_webkit-b0c9a2b4033eca931163e8223d7eaa8889337144.zip external_webkit-b0c9a2b4033eca931163e8223d7eaa8889337144.tar.gz external_webkit-b0c9a2b4033eca931163e8223d7eaa8889337144.tar.bz2 |
Scroll the RenderLayer during touch events.
Keep track of the owning layer for each LayerAndroid. No longer need to unadjust
the node bounds since the node will be scrolled into view.
Bug: 3442108
Change-Id: I7c9604d347af326ccfb86e6d3f2b95b7ce1b97c1
Diffstat (limited to 'WebCore')
4 files changed, 18 insertions, 10 deletions
diff --git a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp index ccc872a..f2163cc 100644 --- a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp +++ b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp @@ -122,8 +122,8 @@ GraphicsLayerAndroid::GraphicsLayerAndroid(GraphicsLayerClient* client) : m_foregroundLayer(0), m_foregroundClipLayer(0) { - m_contentLayer = new LayerAndroid(true); RenderLayer* renderLayer = renderLayerFromClient(m_client); + m_contentLayer = new LayerAndroid(renderLayer, true); if (renderLayer) { m_contentLayer->setIsRootLayer(renderLayer->isRootLayer() && !(renderLayer->renderer()->frame()->ownerElement())); @@ -487,8 +487,8 @@ void GraphicsLayerAndroid::updateScrollingLayers() ASSERT(!hasOverflowScroll); if (layerNeedsOverflow) { ASSERT(!m_foregroundLayer && !m_foregroundClipLayer); - m_foregroundLayer = new ScrollableLayerAndroid(); - m_foregroundClipLayer = new LayerAndroid(false); + m_foregroundLayer = new ScrollableLayerAndroid(layer); + m_foregroundClipLayer = new LayerAndroid(layer, false); m_foregroundClipLayer->setMasksToBounds(true); m_foregroundClipLayer->addChild(m_foregroundLayer); m_contentLayer->addChild(m_foregroundClipLayer); diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp index 35979f6..66a62e1 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.cpp +++ b/WebCore/platform/graphics/android/LayerAndroid.cpp @@ -61,7 +61,7 @@ class OpacityDrawFilter : public SkDrawFilter { /////////////////////////////////////////////////////////////////////////////// -LayerAndroid::LayerAndroid(bool isRootLayer) : SkLayer(), +LayerAndroid::LayerAndroid(RenderLayer* owner, bool isRootLayer) : SkLayer(), m_isRootLayer(isRootLayer), m_haveClip(false), m_isFixed(false), @@ -76,7 +76,8 @@ LayerAndroid::LayerAndroid(bool isRootLayer) : SkLayer(), m_pictureUsed(0), m_requestSent(false), m_scale(1), - m_lastComputeTextureSize(0) + m_lastComputeTextureSize(0), + m_owningLayer(owner) { m_backgroundColor = 0; @@ -95,7 +96,8 @@ LayerAndroid::LayerAndroid(const LayerAndroid& layer) : SkLayer(layer), m_uniqueId(layer.m_uniqueId), m_drawingTexture(0), m_reservedTexture(0), - m_requestSent(false) + m_requestSent(false), + m_owningLayer(layer.m_owningLayer) { m_isFixed = layer.m_isFixed; m_contentsImage = layer.m_contentsImage; @@ -150,7 +152,8 @@ LayerAndroid::LayerAndroid(SkPicture* picture) : SkLayer(), m_reservedTexture(0), m_requestSent(false), m_scale(1), - m_lastComputeTextureSize(0) + m_lastComputeTextureSize(0), + m_owningLayer(0) { m_backgroundColor = 0; m_dirty = false; diff --git a/WebCore/platform/graphics/android/LayerAndroid.h b/WebCore/platform/graphics/android/LayerAndroid.h index 0d5a878..7d4eac9 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.h +++ b/WebCore/platform/graphics/android/LayerAndroid.h @@ -83,12 +83,13 @@ namespace WebCore { class AndroidAnimation; class BackedDoubleBufferedTexture; class LayerAndroidFindState; +class RenderLayer; class TiledPage; class LayerAndroid : public SkLayer, public TextureOwner { public: - LayerAndroid(bool isRootLayer); + LayerAndroid(RenderLayer* owner, bool isRootLayer); LayerAndroid(const LayerAndroid& layer); LayerAndroid(SkPicture*); virtual ~LayerAndroid(); @@ -245,6 +246,8 @@ public: virtual bool isMedia() const { return false; } + RenderLayer* owningLayer() const { return m_owningLayer; } + protected: virtual void onDraw(SkCanvas*, SkScalar opacity); @@ -334,6 +337,8 @@ private: // across all threads and cores. android::Mutex m_atomicSync; + RenderLayer* m_owningLayer; + typedef SkLayer INHERITED; }; diff --git a/WebCore/platform/graphics/android/ScrollableLayerAndroid.h b/WebCore/platform/graphics/android/ScrollableLayerAndroid.h index 697fe74..68fba77 100644 --- a/WebCore/platform/graphics/android/ScrollableLayerAndroid.h +++ b/WebCore/platform/graphics/android/ScrollableLayerAndroid.h @@ -26,8 +26,8 @@ namespace WebCore { class ScrollableLayerAndroid : public LayerAndroid { public: - ScrollableLayerAndroid() - : LayerAndroid(false) {} + ScrollableLayerAndroid(RenderLayer* owner) + : LayerAndroid(owner, false) {} ScrollableLayerAndroid(const ScrollableLayerAndroid& layer) : LayerAndroid(layer) , m_scrollLimits(layer.m_scrollLimits) {} |