Modified: trunk/Source/WebCore/ChangeLog (183942 => 183943)
--- trunk/Source/WebCore/ChangeLog 2015-05-07 20:13:47 UTC (rev 183942)
+++ trunk/Source/WebCore/ChangeLog 2015-05-07 20:45:42 UTC (rev 183943)
@@ -1,3 +1,70 @@
+2015-05-07 Simon Fraser <simon.fra...@apple.com>
+
+ Remove the WK1-only code path for independently composited iframes
+ https://bugs.webkit.org/show_bug.cgi?id=144722
+
+ Reviewed by Dean Jackson.
+
+ In WebKit1 on Mac, we allowed iframes to be composited independently of their
+ parent document, relying on the fact that the frame's platform view can host
+ a layer-backed view. However, this ran into bugs (rdar://problem/18862298),
+ and triggers the assertion at the end of FrameView::updateLayoutAndStyleIfNeededRecursive(),
+ because the compositing update after a layout can dirty style in notifyIFramesOfCompositingChange().
+
+ Removing the WK1-only code path solves these problems. It also eliminates the need
+ to do compositing-specific frame overlap testing.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::setIsOverlapped): No need to do compositing-related things here.
+ Any iframe that gets composited will participate in the normal compositing overlap
+ testing in its parent frame.
+ (WebCore::FrameView::hasCompositedContentIncludingDescendants): Deleted.
+ (WebCore::FrameView::hasCompositingAncestor): Deleted.
+ * page/FrameView.h:
+ * rendering/RenderLayerCompositor.cpp: Replace ownerElement() checks in this file
+ with an isMainFrameCompositor() for readability. Some 0->nullptr.
+ (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags):
+ (WebCore::RenderLayerCompositor::chromeClient):
+ (WebCore::RenderLayerCompositor::enclosingCompositorFlushingLayers):
+ (WebCore::RenderLayerCompositor::updateCompositingLayers):
+ (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
+ (WebCore::RenderLayerCompositor::updateBacking):
+ (WebCore::RenderLayerCompositor::layerTreeAsText):
+ (WebCore::RenderLayerCompositor::frameContentsCompositor):
+ (WebCore::RenderLayerCompositor::setIsInWindow):
+ (WebCore::RenderLayerCompositor::requiresCompositingForScrollableFrame):
+ (WebCore::RenderLayerCompositor::requiresCompositingForFrame): frameRenderer.requiresAcceleratedCompositing()
+ already bails on no content RenderView, so the shouldPropagateCompositingToEnclosingFrame() check does
+ nothing and is removed.
+ (WebCore::RenderLayerCompositor::isAsyncScrollableStickyLayer):
+ (WebCore::RenderLayerCompositor::requiresScrollLayer):
+ (WebCore::RenderLayerCompositor::documentUsesTiledBacking):
+ (WebCore::RenderLayerCompositor::isMainFrameCompositor):
+ (WebCore::RenderLayerCompositor::shouldCompositeOverflowControls):
+ (WebCore::RenderLayerCompositor::requiresOverhangAreasLayer):
+ (WebCore::RenderLayerCompositor::requiresContentShadowLayer):
+ (WebCore::RenderLayerCompositor::updateLayerForTopOverhangArea):
+ (WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea):
+ (WebCore::RenderLayerCompositor::updateLayerForHeader):
+ (WebCore::RenderLayerCompositor::updateLayerForFooter):
+ (WebCore::RenderLayerCompositor::ensureRootLayer): Main frame attaches via ChromeClient,
+ all other frames attach via parent frame.
+ (WebCore::RenderLayerCompositor::notifyIFramesOfCompositingChange): This call to
+ scheduleSetNeedsStyleRecalc(SyntheticStyleChange) was the source of dirtying style after
+ layout, but is no longer needed so remove it.
+ (WebCore::RenderLayerCompositor::registerAllViewportConstrainedLayers):
+ (WebCore::RenderLayerCompositor::unregisterAllViewportConstrainedLayers):
+ (WebCore::RenderLayerCompositor::scrollingCoordinator):
+ (WebCore::RenderLayerCompositor::graphicsLayerFactory):
+ (WebCore::RenderLayerCompositor::allowsIndependentlyCompositedFrames): Deleted.
+ (WebCore::RenderLayerCompositor::shouldPropagateCompositingToEnclosingFrame): Deleted.
+ (WebCore::RenderLayerCompositor::mainFrameBackingIsTiled): Deleted. This was mis-named;
+ it really asks whether the document uses tiled backing, but does not check for main frame.
+ * rendering/RenderLayerCompositor.h:
+ * rendering/RenderWidget.cpp:
+ (WebCore::RenderWidget::paintContents): No need to do frame overlap testing for
+ compositing now.
+
2015-05-06 Dean Jackson <d...@apple.com>
Handle backdrop views that have to tile
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (183942 => 183943)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2015-05-07 20:13:47 UTC (rev 183942)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2015-05-07 20:45:42 UTC (rev 183943)
@@ -346,7 +346,7 @@
showRepaintCounter = settings.showRepaintCounter();
forceCompositingMode = settings.forceCompositingMode() && hasAcceleratedCompositing;
- if (forceCompositingMode && m_renderView.document().ownerElement())
+ if (forceCompositingMode && !isMainFrameCompositor())
forceCompositingMode = requiresCompositingForScrollableFrame();
acceleratedDrawingEnabled = settings.acceleratedDrawingEnabled();
@@ -442,7 +442,7 @@
{
Page* page = m_renderView.frameView().frame().page();
if (!page)
- return 0;
+ return nullptr;
return &page->chrome().client();
}
#endif
@@ -643,7 +643,7 @@
return compositor;
}
- return 0;
+ return nullptr;
}
void RenderLayerCompositor::scheduleCompositingLayerUpdate()
@@ -759,7 +759,7 @@
m_secondaryBackingStoreBytes = 0;
Frame& frame = m_renderView.frameView().frame();
- bool isMainFrame = !m_renderView.document().ownerElement();
+ bool isMainFrame = isMainFrameCompositor();
LOG(Compositing, "\nUpdate %d of %s.\n", m_rootLayerUpdateCount, isMainFrame ? "main frame" : frame.tree().uniqueName().string().utf8().data());
}
#endif
@@ -809,10 +809,10 @@
void RenderLayerCompositor::appendDocumentOverlayLayers(Vector<GraphicsLayer*>& childList)
{
- Frame& frame = m_renderView.frameView().frame();
- if (!frame.isMainFrame())
+ if (!isMainFrameCompositor())
return;
+ Frame& frame = m_renderView.frameView().frame();
Page* page = frame.page();
if (!page)
return;
@@ -998,7 +998,7 @@
layer.ensureBacking();
// At this time, the ScrollingCoordinator only supports the top-level frame.
- if (layer.isRootLayer() && !m_renderView.document().ownerElement()) {
+ if (layer.isRootLayer() && isMainFrameCompositor()) {
updateScrollCoordinatedStatus(layer);
if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.frameView());
@@ -1821,7 +1821,7 @@
// Dump an empty layer tree only if the only composited layer is the main frame's tiled backing,
// so that tests expecting us to drop out of accelerated compositing when there are no layers succeed.
- if (!hasAnyAdditionalCompositedLayers(rootRenderLayer()) && mainFrameBackingIsTiled() && !(layerTreeBehavior & LayerTreeAsTextIncludeTileCaches))
+ if (!hasAnyAdditionalCompositedLayers(rootRenderLayer()) && documentUsesTiledBacking() && !(layerTreeBehavior & LayerTreeAsTextIncludeTileCaches))
layerTreeText = "";
// The true root layer is not included in the dump, so if we want to report
@@ -1838,7 +1838,7 @@
if (RenderView* view = contentDocument->renderView())
return &view->compositor();
}
- return 0;
+ return nullptr;
}
bool RenderLayerCompositor::parentFrameContentLayers(RenderWidget* renderer)
@@ -2064,7 +2064,7 @@
if (m_rootLayerAttachment != RootLayerUnattached)
return;
- RootLayerAttachment attachment = shouldPropagateCompositingToEnclosingFrame() ? RootLayerAttachedViaEnclosingFrame : RootLayerAttachedViaChromeClient;
+ RootLayerAttachment attachment = isMainFrameCompositor() ? RootLayerAttachedViaChromeClient : RootLayerAttachedViaEnclosingFrame;
attachRootLayer(attachment);
#if PLATFORM(IOS)
registerAllViewportConstrainedLayers();
@@ -2129,51 +2129,6 @@
return layerHas3DContent(rootRenderLayer());
}
-bool RenderLayerCompositor::allowsIndependentlyCompositedFrames(const FrameView* view)
-{
-#if PLATFORM(MAC)
- // frames are only independently composited in Mac pre-WebKit2.
- return view->platformWidget();
-#else
- UNUSED_PARAM(view);
-#endif
- return false;
-}
-
-bool RenderLayerCompositor::shouldPropagateCompositingToEnclosingFrame() const
-{
- // Parent document content needs to be able to render on top of a composited frame, so correct behavior
- // is to have the parent document become composited too. However, this can cause problems on platforms that
- // use native views for frames (like Mac), so disable that behavior on those platforms for now.
- HTMLFrameOwnerElement* ownerElement = m_renderView.document().ownerElement();
-
- // If we are the top-level frame, don't propagate.
- if (!ownerElement)
- return false;
-
- if (!allowsIndependentlyCompositedFrames(&m_renderView.frameView()))
- return true;
-
- RenderElement* renderer = ownerElement->renderer();
- if (!is<RenderWidget>(renderer))
- return false;
-
- // On Mac, only propagate compositing if the frame is overlapped in the parent
- // document, or the parent is already compositing, or the main frame is scaled.
- Page* page = this->page();
- if (page && page->pageScaleFactor() != 1)
- return true;
-
- RenderWidget& frameRenderer = downcast<RenderWidget>(*renderer);
- if (frameRenderer.widget()) {
- FrameView& view = downcast<FrameView>(*frameRenderer.widget());
- if (view.isOverlappedIncludingAncestors() || view.hasCompositingAncestor())
- return true;
- }
-
- return false;
-}
-
bool RenderLayerCompositor::needsToBeComposited(const RenderLayer& layer, RenderLayer::ViewportConstrainedNotCompositedReason* viewportConstrainedNotCompositedReason) const
{
if (!canBeComposited(layer))
@@ -2497,8 +2452,7 @@
{
// Need this done first to determine overflow.
ASSERT(!m_renderView.needsLayout());
- HTMLFrameOwnerElement* ownerElement = m_renderView.document().ownerElement();
- if (!ownerElement)
+ if (isMainFrameCompositor())
return false;
if (!(m_compositingTriggers & ChromeClient::ScrollableInnerFrameTrigger))
@@ -2597,16 +2551,11 @@
return false;
auto& frameRenderer = downcast<RenderWidget>(renderer);
-
if (!frameRenderer.requiresAcceleratedCompositing())
return false;
m_reevaluateCompositingAfterLayout = true;
- RenderLayerCompositor* innerCompositor = frameContentsCompositor(&frameRenderer);
- if (!innerCompositor || !innerCompositor->shouldPropagateCompositingToEnclosingFrame())
- return false;
-
// If we can't reliably know the size of the iframe yet, don't change compositing state.
if (!frameRenderer.parent() || frameRenderer.needsLayout())
return frameRenderer.hasLayer() && frameRenderer.layer()->isComposited();
@@ -2695,7 +2644,7 @@
#if PLATFORM(IOS)
// iOS WK1 has fixed/sticky support in the main frame via WebFixedPositionContent.
- return m_renderView.frameView().frame().isMainFrame();
+ return isMainFrameCompositor();
#else
return false;
#endif
@@ -2839,7 +2788,7 @@
FrameView& frameView = m_renderView.frameView();
// This applies when the application UI handles scrolling, in which case RenderLayerCompositor doesn't need to manage it.
- if (frameView.delegatesScrolling() && frameView.frame().isMainFrame())
+ if (frameView.delegatesScrolling() && isMainFrameCompositor())
return false;
// We need to handle our own scrolling if we're:
@@ -2979,7 +2928,7 @@
// Nothing to do here yet.
}
-bool RenderLayerCompositor::mainFrameBackingIsTiled() const
+bool RenderLayerCompositor::documentUsesTiledBacking() const
{
RenderLayer* layer = m_renderView.layer();
if (!layer)
@@ -2992,6 +2941,11 @@
return backing->usingTiledBacking();
}
+bool RenderLayerCompositor::isMainFrameCompositor() const
+{
+ return m_renderView.frameView().frame().isMainFrame();
+}
+
bool RenderLayerCompositor::shouldCompositeOverflowControls() const
{
FrameView& frameView = m_renderView.frameView();
@@ -3002,7 +2956,7 @@
if (frameView.delegatesScrolling())
return false;
- if (mainFrameBackingIsTiled())
+ if (documentUsesTiledBacking())
return true;
if (!frameView.hasOverlayScrollbars())
@@ -3029,12 +2983,11 @@
#if ENABLE(RUBBER_BANDING)
bool RenderLayerCompositor::requiresOverhangAreasLayer() const
{
- // We don't want a layer if this is a subframe.
- if (m_renderView.document().ownerElement())
+ if (!isMainFrameCompositor())
return false;
// We do want a layer if we're using tiled drawing and can scroll.
- if (mainFrameBackingIsTiled() && m_renderView.frameView().hasOpaqueBackground() && !m_renderView.frameView().prohibitsScrolling())
+ if (documentUsesTiledBacking() && m_renderView.frameView().hasOpaqueBackground() && !m_renderView.frameView().prohibitsScrolling())
return true;
return false;
@@ -3042,8 +2995,7 @@
bool RenderLayerCompositor::requiresContentShadowLayer() const
{
- // We don't want a layer if this is a subframe.
- if (m_renderView.document().ownerElement())
+ if (!isMainFrameCompositor())
return false;
#if PLATFORM(COCOA)
@@ -3055,7 +3007,7 @@
return false;
// On Mac, we want a content shadow layer if we're using tiled drawing and can scroll.
- if (mainFrameBackingIsTiled() && !m_renderView.frameView().prohibitsScrolling())
+ if (documentUsesTiledBacking() && !m_renderView.frameView().prohibitsScrolling())
return true;
#endif
@@ -3064,15 +3016,15 @@
GraphicsLayer* RenderLayerCompositor::updateLayerForTopOverhangArea(bool wantsLayer)
{
- if (m_renderView.document().ownerElement())
- return 0;
+ if (!isMainFrameCompositor())
+ return nullptr;
if (!wantsLayer) {
if (m_layerForTopOverhangArea) {
m_layerForTopOverhangArea->removeFromParent();
m_layerForTopOverhangArea = nullptr;
}
- return 0;
+ return nullptr;
}
if (!m_layerForTopOverhangArea) {
@@ -3088,15 +3040,15 @@
GraphicsLayer* RenderLayerCompositor::updateLayerForBottomOverhangArea(bool wantsLayer)
{
- if (m_renderView.document().ownerElement())
- return 0;
+ if (!isMainFrameCompositor())
+ return nullptr;
if (!wantsLayer) {
if (m_layerForBottomOverhangArea) {
m_layerForBottomOverhangArea->removeFromParent();
m_layerForBottomOverhangArea = nullptr;
}
- return 0;
+ return nullptr;
}
if (!m_layerForBottomOverhangArea) {
@@ -3114,8 +3066,8 @@
GraphicsLayer* RenderLayerCompositor::updateLayerForHeader(bool wantsLayer)
{
- if (m_renderView.document().ownerElement())
- return 0;
+ if (!isMainFrameCompositor())
+ return nullptr;
if (!wantsLayer) {
if (m_layerForHeader) {
@@ -3127,7 +3079,7 @@
if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.frameView());
}
- return 0;
+ return nullptr;
}
if (!m_layerForHeader) {
@@ -3155,8 +3107,8 @@
GraphicsLayer* RenderLayerCompositor::updateLayerForFooter(bool wantsLayer)
{
- if (m_renderView.document().ownerElement())
- return 0;
+ if (!isMainFrameCompositor())
+ return nullptr;
if (!wantsLayer) {
if (m_layerForFooter) {
@@ -3168,7 +3120,7 @@
if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.frameView());
}
- return 0;
+ return nullptr;
}
if (!m_layerForFooter) {
@@ -3371,7 +3323,7 @@
void RenderLayerCompositor::ensureRootLayer()
{
- RootLayerAttachment expectedAttachment = shouldPropagateCompositingToEnclosingFrame() ? RootLayerAttachedViaEnclosingFrame : RootLayerAttachedViaChromeClient;
+ RootLayerAttachment expectedAttachment = isMainFrameCompositor() ? RootLayerAttachedViaChromeClient : RootLayerAttachedViaEnclosingFrame;
if (expectedAttachment == m_rootLayerAttachment)
return;
@@ -3605,18 +3557,9 @@
m_rootContentLayer->addChild(&pageOverlayController.documentOverlayRootLayer());
}
-// IFrames are special, because we hook compositing layers together across iframe boundaries
-// when both parent and iframe content are composited. So when this frame becomes composited, we have
-// to use a synthetic style change to get the iframes into RenderLayers in order to allow them to composite.
void RenderLayerCompositor::notifyIFramesOfCompositingChange()
{
- Frame& frame = m_renderView.frameView().frame();
- for (Frame* child = frame.tree().firstChild(); child; child = child->tree().traverseNext(&frame)) {
- if (child->document() && child->document()->ownerElement())
- child->document()->ownerElement()->scheduleSetNeedsStyleRecalc(SyntheticStyleChange);
- }
-
- // Compositing also affects the answer to RenderIFrame::requiresAcceleratedCompositing(), so
+ // Compositing affects the answer to RenderIFrame::requiresAcceleratedCompositing(), so
// we need to schedule a style recalc in our parent document.
if (HTMLFrameOwnerElement* ownerElement = m_renderView.document().ownerElement())
ownerElement->scheduleSetNeedsStyleRecalc(SyntheticStyleChange);
@@ -3991,7 +3934,7 @@
void RenderLayerCompositor::registerAllViewportConstrainedLayers()
{
// Only the main frame should register fixed/sticky layers.
- if (m_renderView.document().ownerElement())
+ if (!isMainFrameCompositor())
return;
if (scrollingCoordinator())
@@ -4026,7 +3969,7 @@
void RenderLayerCompositor::unregisterAllViewportConstrainedLayers()
{
// Only the main frame should register fixed/sticky layers.
- if (m_renderView.document().ownerElement())
+ if (!isMainFrameCompositor())
return;
if (scrollingCoordinator())
@@ -4115,7 +4058,7 @@
if (Page* page = this->page())
return page->scrollingCoordinator();
- return 0;
+ return nullptr;
}
GraphicsLayerFactory* RenderLayerCompositor::graphicsLayerFactory() const
@@ -4123,7 +4066,7 @@
if (Page* page = this->page())
return page->chrome().client().graphicsLayerFactory();
- return 0;
+ return nullptr;
}
Page* RenderLayerCompositor::page() const