summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-11-16 11:47:08 +0000
committerBen Murdoch <benm@google.com>2011-11-16 17:55:18 +0000
commit9b381fdf13b6f448ab78bdd052c4a744233626e4 (patch)
tree5918f4d4ffc0db90edb38eda972724b4bdda0b97 /Source
parent73a306c4d2dd650b9a083deb6362fc6ba3cf9032 (diff)
downloadexternal_webkit-9b381fdf13b6f448ab78bdd052c4a744233626e4.zip
external_webkit-9b381fdf13b6f448ab78bdd052c4a744233626e4.tar.gz
external_webkit-9b381fdf13b6f448ab78bdd052c4a744233626e4.tar.bz2
Promote -ve z-index fixed/scrollable elements to layers
We normally do not necessarily promote fixed or scrollable elements to compositing layers to try and reduce the number of layers that get created. However in the case that such an element appears in the negative z-order, we must do the promotion to ensure that the layer is painted at the correct z-index in the hierarchy (i.e not too high - sites like to use a fixed image with z-index:-1 to implement a fixed background -- without this patch we end up painting the background over the main page content). Bug: 5152567 Change-Id: I36bfe14660a33d45ad54552ae41b9d7157f8dabf
Diffstat (limited to 'Source')
-rw-r--r--Source/WebCore/rendering/RenderLayerCompositor.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp
index 4f4f553..598926d 100644
--- a/Source/WebCore/rendering/RenderLayerCompositor.cpp
+++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp
@@ -764,7 +764,18 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O
// If we have to make a layer for this child, make one now so we can have a contents layer
// (since we need to ensure that the -ve z-order child renders underneath our contents).
+#ifdef ANDROID
+ // Normally we try to reduce the number of layers by not promoting all fixed
+ // or scrollable elements to their own compositing layer. But in the case that
+ // we have such an element in the negative z-order, we must make it a layer
+ // otherwise the content will be painted at a higher z-index. This breaks pages
+ // that set a large image with a z-index of -1 to implement a background image,
+ // for example.
+ bool childRequiresCompositing = childState.m_hasFixedElement || childState.m_hasScrollableElement;
+ if (!willBeComposited && (childState.m_subtreeIsCompositing || childRequiresCompositing)) {
+#else
if (!willBeComposited && childState.m_subtreeIsCompositing) {
+#endif
// make layer compositing
layer->setMustOverlapCompositedLayers(true);
childState.m_compositingAncestor = layer;