summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
diff options
context:
space:
mode:
authorNicolas Roard <nicolasroard@google.com>2012-05-12 17:12:36 -0700
committerNicolas Roard <nicolasroard@google.com>2012-05-18 19:40:01 -0700
commit6baa213e1806af132b1f0b1170343c5ac2bf75d3 (patch)
tree69be21336fb942f1b9d8660e40c927acf5e22caf /Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
parent8156b6674402608e0304803380ef0e5e2845588d (diff)
downloadexternal_webkit-6baa213e1806af132b1f0b1170343c5ac2bf75d3.zip
external_webkit-6baa213e1806af132b1f0b1170343c5ac2bf75d3.tar.gz
external_webkit-6baa213e1806af132b1f0b1170343c5ac2bf75d3.tar.bz2
Fix memory leak and repaint issues with fixed background elements
bug:6522485 bug:6486951 Change-Id: Ia707efed9311e4352eed3ab005ec7ca93b8444e4
Diffstat (limited to 'Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp35
1 files changed, 21 insertions, 14 deletions
diff --git a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
index 3975545..ef355c7 100644
--- a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
@@ -124,7 +124,7 @@ GraphicsLayerAndroid::~GraphicsLayerAndroid()
if (m_image)
m_image->deref();
- m_contentLayer->unref();
+ SkSafeUnref(m_contentLayer);
SkSafeUnref(m_fixedBackgroundLayer);
SkSafeUnref(m_foregroundLayer);
SkSafeUnref(m_foregroundClipLayer);
@@ -591,10 +591,10 @@ void GraphicsLayerAndroid::updateFixedBackgroundLayers() {
return;
if (!view->style()->hasFixedBackgroundImage())
return;
- if (m_contentLayer->isFixedBackground())
- return;
- if (m_fixedBackgroundLayer) // already created
- return;
+
+ SkSafeUnref(m_foregroundClipLayer);
+ SkSafeUnref(m_fixedBackgroundLayer);
+ SkSafeUnref(m_foregroundLayer);
// we will have:
// m_contentLayer
@@ -602,11 +602,10 @@ void GraphicsLayerAndroid::updateFixedBackgroundLayers() {
// \- m_fixedBackgroundLayer
// \- m_foregroundLayer
- // Grab the background image and create a layer for it
+ // use the background image and create a layer for it
// the layer will be fixed positioned.
Image* image = FixedBackgroundImageLayerAndroid::GetCachedImage(view->style());
-
if (!image)
return;
@@ -634,15 +633,23 @@ void GraphicsLayerAndroid::updateFixedBackgroundLayers() {
m_foregroundLayer->setIntrinsicallyComposited(true);
// Finally, let's assemble all the layers under a FixedBackgroundLayerAndroid layer
- LayerAndroid* layer = new FixedBackgroundLayerAndroid(*m_contentLayer);
- m_contentLayer->unref();
- m_contentLayer = layer;
-
- m_contentLayer->addChild(m_foregroundClipLayer);
- m_contentLayer->addChild(m_foregroundLayer);
+ if (!m_contentLayer->isFixedBackground()) {
+ m_contentLayer->removeChildren();
+ LayerAndroid* layer = new FixedBackgroundLayerAndroid(*m_contentLayer);
+ m_contentLayer->unref();
+ m_contentLayer = layer;
+ }
- m_needsRepaint = true;
+ if (m_parent) {
+ // The content layer has changed so the parent needs to sync
+ // children.
+ static_cast<GraphicsLayerAndroid*>(m_parent)->m_needsSyncChildren = true;
+ }
+ // Children are all re-parented.
m_needsSyncChildren = true;
+
+ setNeedsDisplay();
+ askForSync();
}
void GraphicsLayerAndroid::updateScrollOffset() {