summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrace Kloba <klobag@google.com>2010-07-07 10:28:13 -0700
committerGrace Kloba <klobag@google.com>2010-07-07 10:28:13 -0700
commit899f518a7f2682c900252ca03d93f83095a43d52 (patch)
tree1a18b7f774571884e40e374a4a0a9ee6d0b3d54f
parentfcc4a0b80dc057862783fba22081954b6569a4b3 (diff)
downloadexternal_webkit-899f518a7f2682c900252ca03d93f83095a43d52.zip
external_webkit-899f518a7f2682c900252ca03d93f83095a43d52.tar.gz
external_webkit-899f518a7f2682c900252ca03d93f83095a43d52.tar.bz2
Enable composite layers for the sub frame.
Fix the visibleContentRect for iframe. It should be relative to its parent instead of the viewport. For fixed position, we still check for the top frame as the current logic positions the object relative to the screen which only applied to the top frame. For plugin, it depends on PluginWidget's platformLayer(). The default is 0. For video, it depends on MediaPlayer's supportsAcceleratedRendering(). The default is false. Fix the crash in the GraphicsLayerAndroid. The root layer is a container layer, there is no need to draw them. As LayerAndroid doesn't create Picture for them, we should ensure to skip draw. Fix http://b/issue?id=2733947
-rw-r--r--WebCore/platform/android/ScrollViewAndroid.cpp21
-rw-r--r--WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp6
-rw-r--r--WebCore/platform/graphics/android/LayerAndroid.h1
-rw-r--r--WebCore/rendering/RenderLayerCompositor.cpp21
4 files changed, 15 insertions, 34 deletions
diff --git a/WebCore/platform/android/ScrollViewAndroid.cpp b/WebCore/platform/android/ScrollViewAndroid.cpp
index 74f9d6b..dec3183 100644
--- a/WebCore/platform/android/ScrollViewAndroid.cpp
+++ b/WebCore/platform/android/ScrollViewAndroid.cpp
@@ -54,21 +54,12 @@ namespace WebCore {
IntRect ScrollView::platformVisibleContentRect(bool includeScrollbars) const
{
- if (parent()) {
- const ScrollView* sv = this;
- int offsetX = 0;
- int offsetY = 0;
- while (sv->parent()) {
- offsetX += sv->x();
- offsetY += sv->y();
- sv = sv->parent();
- }
- IntRect rect = sv->platformWidget()->getVisibleBounds();
- rect.move(-offsetX, -offsetY);
- rect.intersect(IntRect(0, 0, width(), height()));
- return rect;
- }
- return platformWidget()->getVisibleBounds();
+ // iframe's visible content rect is relative to its parent, not the viewport.
+ // As we auto expand the iframe, the frame rect is the content rect.
+ if (parent())
+ return IntRect(0, 0, width(), height());
+ else
+ return platformWidget()->getVisibleBounds();
}
IntSize ScrollView::platformContentsSize() const
diff --git a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
index 8403a03..1fb36ec 100644
--- a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
@@ -125,7 +125,8 @@ GraphicsLayerAndroid::GraphicsLayerAndroid(GraphicsLayerClient* client) :
if (m_client) {
RenderLayerBacking* backing = static_cast<RenderLayerBacking*>(m_client);
RenderLayer* renderLayer = backing->owningLayer();
- m_contentLayer->setIsRootLayer(renderLayer->isRootLayer());
+ m_contentLayer->setIsRootLayer(renderLayer->isRootLayer() &&
+ !(renderLayer->renderer()->frame()->ownerElement()));
}
gDebugGraphicsLayerAndroidInstances++;
}
@@ -350,7 +351,8 @@ void GraphicsLayerAndroid::setMasksToBounds(bool masksToBounds)
void GraphicsLayerAndroid::setDrawsContent(bool drawsContent)
{
GraphicsLayer::setDrawsContent(drawsContent);
-
+ if (m_contentLayer->isRootLayer())
+ return;
if (m_drawsContent) {
m_haveContents = true;
setNeedsDisplay();
diff --git a/WebCore/platform/graphics/android/LayerAndroid.h b/WebCore/platform/graphics/android/LayerAndroid.h
index b6b6f70..b98d4dd 100644
--- a/WebCore/platform/graphics/android/LayerAndroid.h
+++ b/WebCore/platform/graphics/android/LayerAndroid.h
@@ -123,6 +123,7 @@ public:
void setMasksToBounds(bool);
void setIsRootLayer(bool isRootLayer) { m_isRootLayer = isRootLayer; }
+ bool isRootLayer() const { return m_isRootLayer; }
SkPicture* recordContext();
diff --git a/WebCore/rendering/RenderLayerCompositor.cpp b/WebCore/rendering/RenderLayerCompositor.cpp
index f2c0dc4..d9a8bf1 100644
--- a/WebCore/rendering/RenderLayerCompositor.cpp
+++ b/WebCore/rendering/RenderLayerCompositor.cpp
@@ -1122,20 +1122,11 @@ bool RenderLayerCompositor::needsToBeComposited(const RenderLayer* layer) const
#if PLATFORM(ANDROID)
bool RenderLayerCompositor::requiresCompositingForMobileSites(const RenderLayer* layer) const
{
+#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
// First, check if we are in an iframe, and if so bail out
if (m_renderView->document()->frame()->tree()->parent())
return false;
- RenderObject* renderer = layer->renderer();
- // Check for transforms
- if (requiresCompositingForTransform(renderer))
- return true;
-
- // Check for animations
- if (requiresCompositingForAnimation(renderer))
- return true;
-
-#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
// For the moment, we want to only enable fixed composited layers on mobile websites.
// We can consider a website as being a 'mobile' site if all the
// following checks are true:
@@ -1152,7 +1143,6 @@ bool RenderLayerCompositor::requiresCompositingForMobileSites(const RenderLayer*
!settings->viewportUserScalable())
return true;
#endif
-
return false;
}
#endif
@@ -1168,12 +1158,10 @@ bool RenderLayerCompositor::requiresCompositingLayer(const RenderLayer* layer) c
renderer = renderer->parent(); // The RenderReplica's parent is the object being reflected.
layer = toRenderBoxModelObject(renderer)->layer();
}
-#if PLATFORM(ANDROID)
- return requiresCompositingForMobileSites(layer)
- || renderer->style()->backfaceVisibility() == BackfaceVisibilityHidden
- || clipsCompositingDescendants(layer);
-#else
return requiresCompositingForTransform(renderer)
+#if PLATFORM(ANDROID)
+ || requiresCompositingForMobileSites(layer)
+#endif
|| requiresCompositingForVideo(renderer)
|| requiresCompositingForCanvas(renderer)
|| requiresCompositingForPlugin(renderer)
@@ -1181,7 +1169,6 @@ bool RenderLayerCompositor::requiresCompositingLayer(const RenderLayer* layer) c
|| renderer->style()->backfaceVisibility() == BackfaceVisibilityHidden
|| clipsCompositingDescendants(layer)
|| requiresCompositingForAnimation(renderer);
-#endif
}
bool RenderLayerCompositor::canBeComposited(const RenderLayer* layer) const