summaryrefslogtreecommitdiffstats
path: root/WebCore/rendering
diff options
context:
space:
mode:
authorNicolas Roard <nicolas@android.com>2010-03-05 14:41:28 +0000
committerNicolas Roard <nicolas@android.com>2010-03-09 19:13:10 +0000
commitfa26a8dd531dff44d6cad0700ff32c0bb949392c (patch)
tree2984a63001721ee4143e4ad88797fa0dbd1a4b1d /WebCore/rendering
parent7332bc6f7a4d9ccd11185104fb0aa1a0c9b84ac0 (diff)
downloadexternal_webkit-fa26a8dd531dff44d6cad0700ff32c0bb949392c.zip
external_webkit-fa26a8dd531dff44d6cad0700ff32c0bb949392c.tar.gz
external_webkit-fa26a8dd531dff44d6cad0700ff32c0bb949392c.tar.bz2
Fix bug 'Children of fixed elements do not always remain fixed themselves'
The problem was twofold: - webkit didn't create composited layers of the children div unless they were intersecting with the fixed layer - the children divs layers are siblings, not children of the fixed layer The solution is to: 1/ mark layers as needed to be composited if their ancestor is a fixed element (in RenderLayerCompositor) 2/ as the GraphicsLayer/LayerAndroid hierarchy is based on the RenderLayer hierarchy (z-order..) and not the display hierarchy, we need to a way of updating the position of the contained layers when a fixed layer move. We do that by: - marking layers contained in a fixed layer as being linked to the fixed layer (GraphicsLayerAndroid::syncFixedDescendants), and set the offset between the layer and the fixed layer. - when pushing the layers tree to the UI side, we ensure that such layers are linked to their corresponding fixed layer (LayerAndroid::ensureFixedLayersForDescendants) - when we draw, we do a first pass to update the fixed layers position (LayerAndroid::updateFixedLayersPositions) then update the rest of the layers (LayerAndroid::updatePositions). The layers that are linked to the fixed layers will then update their position relative to it, using the original offset between the fixed layer and the layer. Bug:2470701 Change-Id: I512966df94de6a5f84aff335c5d09b3f027bc2c3
Diffstat (limited to 'WebCore/rendering')
-rw-r--r--WebCore/rendering/RenderLayerCompositor.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/WebCore/rendering/RenderLayerCompositor.cpp b/WebCore/rendering/RenderLayerCompositor.cpp
index dc9b94d..a831a8b 100644
--- a/WebCore/rendering/RenderLayerCompositor.cpp
+++ b/WebCore/rendering/RenderLayerCompositor.cpp
@@ -702,7 +702,7 @@ void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, cons
rebuildCompositingLayerTree(curLayer, childState, childList);
}
}
-
+
if (layer->isStackingContext()) {
if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) {
size_t listSize = posZOrderList->size();
@@ -712,7 +712,7 @@ void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, cons
}
}
}
-
+
if (layerBacking) {
layerBacking->parentForSublayers()->setChildren(layerChildren);
childLayersOfEnclosingLayer.append(layerBacking->childForSuperlayers());
@@ -927,6 +927,17 @@ bool RenderLayerCompositor::needsToBeComposited(const RenderLayer* layer) const
if (!m_hasAcceleratedCompositing || !layer->isSelfPaintingLayer())
return false;
+#if PLATFORM(ANDROID)
+ // if an ancestor is fixed positionned, we need to be composited...
+ RenderObject* renderer = layer->renderer();
+ RenderObject* parent = renderer->parent();
+ while (parent && (parent = renderer->parent())) {
+ if (parent->isPositioned() && parent->style()->position() == FixedPosition)
+ return true;
+ renderer = parent;
+ }
+#endif
+
return requiresCompositingLayer(layer) || layer->mustOverlapCompositedLayers();
}
@@ -944,13 +955,14 @@ bool RenderLayerCompositor::requiresCompositingLayer(const RenderLayer* layer) c
// The root layer always has a compositing layer, but it may not have backing.
return (inCompositingMode() && layer->isRootLayer()) ||
requiresCompositingForTransform(renderer) ||
+#if PLATFORM(ANDROID)
+ (renderer->isPositioned() && renderer->style()->position() == FixedPosition) ||
+#else
requiresCompositingForVideo(renderer) ||
requiresCompositingForCanvas(renderer) ||
requiresCompositingForPlugin(renderer) ||
- renderer->style()->backfaceVisibility() == BackfaceVisibilityHidden ||
-#if PLATFORM(ANDROID)
- (renderer->isPositioned() && renderer->style()->position() == FixedPosition) ||
#endif
+ renderer->style()->backfaceVisibility() == BackfaceVisibilityHidden ||
clipsCompositingDescendants(layer) ||
requiresCompositingForAnimation(renderer);
}