summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebCore/page/FrameView.cpp57
-rw-r--r--WebCore/page/FrameView.h7
-rw-r--r--WebCore/rendering/RenderIFrame.cpp7
3 files changed, 39 insertions, 32 deletions
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index 3154a67..5314a32 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -143,6 +143,9 @@ FrameView::FrameView(Frame* frame)
, m_deferSetNeedsLayouts(0)
, m_setNeedsLayoutWasDeferred(false)
, m_scrollCorner(0)
+#if ENABLE(ANDROID_OVERFLOW_SCROLL)
+ , m_hasOverflowScroll(false)
+#endif
{
init();
}
@@ -553,11 +556,6 @@ void FrameView::updateCompositingLayers()
RenderView* view = m_frame->contentRenderer();
if (!view)
return;
-#if ENABLE(ANDROID_OVERFLOW_SCROLL)
- // Enter compositing mode for child frames that have layout dimensions.
- if (hasOverflowScroll())
- enterCompositingMode();
-#endif
// This call will make sure the cached hasAcceleratedCompositing is updated from the pref
view->compositor()->cacheAcceleratedCompositingFlags();
@@ -571,31 +569,6 @@ void FrameView::setNeedsOneShotDrawingSynchronization()
page->chrome()->client()->setNeedsOneShotDrawingSynchronization();
}
-#if ENABLE(ANDROID_OVERFLOW_SCROLL)
-bool FrameView::hasOverflowScroll() const
-{
-#ifndef ANDROID_FLATTEN_IFRAME
- RenderObject* ownerRenderer = m_frame->ownerRenderer();
- if (!ownerRenderer || !ownerRenderer->isRenderIFrame())
- return false;
- RenderLayer* layer = ownerRenderer->enclosingLayer();
- // Make sure the layer has visible content or descendants.
- if (!layer->hasVisibleContent() && !layer->hasVisibleDescendant())
- return false;
- // If either layout dimension is 0, return false.
- if (!layoutWidth() || !layoutHeight())
- return false;
- ScrollbarMode h, v;
- scrollbarModes(h, v);
- if (h == ScrollbarAlwaysOff || v == ScrollbarAlwaysOff)
- return false;
- if (contentsWidth() <= layoutWidth() && contentsHeight() <= layoutHeight())
- return false;
- return true;
-#endif
- return false;
-}
-#endif
#endif // USE(ACCELERATED_COMPOSITING)
bool FrameView::hasCompositedContent() const
@@ -955,6 +928,30 @@ void FrameView::layout(bool allowSubtree)
InspectorInstrumentation::didLayout(cookie);
m_nestedLayoutCount--;
+#if ENABLE(ANDROID_OVERFLOW_SCROLL) && !defined(ANDROID_FLATTEN_IFRAME)
+ // Reset to false each time we layout in case the overflow status changed.
+ bool hasOverflowScroll = false;
+ RenderObject* ownerRenderer = m_frame->ownerRenderer();
+ if (ownerRenderer && ownerRenderer->isRenderIFrame()) {
+ RenderLayer* layer = ownerRenderer->enclosingLayer();
+ if (layer) {
+ // Some sites use tiny iframes for loading so don't composite those.
+ if (canHaveScrollbars() && layoutWidth() > 1 && layoutHeight() > 1)
+ hasOverflowScroll = layoutWidth() < contentsWidth() || layoutHeight() < contentsHeight();
+ }
+ }
+ if (RenderView* view = m_frame->contentRenderer()) {
+ if (hasOverflowScroll != m_hasOverflowScroll) {
+ if (hasOverflowScroll)
+ enterCompositingMode();
+ else
+ // We are leaving overflow mode so we need to update the layer
+ // tree in case that is the reason we were composited.
+ view->compositor()->scheduleCompositingLayerUpdate();
+ }
+ }
+ m_hasOverflowScroll = hasOverflowScroll;
+#endif
}
void FrameView::addWidgetToUpdate(RenderEmbeddedObject* object)
diff --git a/WebCore/page/FrameView.h b/WebCore/page/FrameView.h
index d56b1ef..1b5b322 100644
--- a/WebCore/page/FrameView.h
+++ b/WebCore/page/FrameView.h
@@ -103,9 +103,9 @@ public:
// Called when changes to the GraphicsLayer hierarchy have to be synchronized with
// content rendered via the normal painting path.
void setNeedsOneShotDrawingSynchronization();
-#if ENABLE(ANDROID_OVERFLOW_SCROLL)
- bool hasOverflowScroll() const;
#endif
+#if ENABLE(ANDROID_OVERFLOW_SCROLL)
+ bool hasOverflowScroll() const { return m_hasOverflowScroll; }
#endif
bool hasCompositedContent() const;
@@ -390,6 +390,9 @@ private:
static double s_initialDeferredRepaintDelayDuringLoading;
static double s_maxDeferredRepaintDelayDuringLoading;
static double s_deferredRepaintDelayIncrementDuringLoading;
+#if ENABLE(ANDROID_OVERFLOW_SCROLL)
+ bool m_hasOverflowScroll;
+#endif
};
} // namespace WebCore
diff --git a/WebCore/rendering/RenderIFrame.cpp b/WebCore/rendering/RenderIFrame.cpp
index a2cf66c..36d2449 100644
--- a/WebCore/rendering/RenderIFrame.cpp
+++ b/WebCore/rendering/RenderIFrame.cpp
@@ -266,6 +266,13 @@ bool RenderIFrame::requiresAcceleratedCompositing() const
if (!node() || !node()->hasTagName(iframeTag))
return false;
+#if PLATFORM(ANDROID)
+ // XXX: Bug submitted to webkit.org
+ // https://bugs.webkit.org/show_bug.cgi?id=52655
+ if (style()->visibility() != VISIBLE)
+ return false;
+#endif
+
// If the contents of the iframe are composited, then we have to be as well.
HTMLIFrameElement* element = static_cast<HTMLIFrameElement*>(node());
if (Document* contentDocument = element->contentDocument()) {