2010-05-10 Simon Fraser <simon.fraser@apple.com>
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 May 2010 05:44:06 +0000 (05:44 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 May 2010 05:44:06 +0000 (05:44 +0000)
commit9b9753d5d56b0c24991cb2dfd152bd654a14d392
treeb6ee6c2f2c7a9f95a5ca0a0ed2ee4a890a2cfecb
parent44136eff9dcaad97d2013a820a19f0d7b922f9fc
2010-05-10  Simon Fraser  <simon.fraser@apple.com>

        Reviewed by Anders Carlsson

        Allow compositing layers to be connected across iframe boundaries on Mac
        https://bugs.webkit.org/show_bug.cgi?id=38856

        Changes to allow compositing layers for iframes to switch between being hosted
        by the iframe's layer-backed NSView, and parented in the GraphicsLayer tree of the
        enclosing document.

        Tests: compositing/iframes/connect-compositing-iframe.html
               compositing/iframes/connect-compositing-iframe2.html
               compositing/iframes/connect-compositing-iframe3.html

        * page/FrameView.h:
        * page/FrameView.cpp:
        (WebCore::FrameView::hasCompositedContent): New convenience method.
        (WebCore::FrameView::setIsOverlapped): If we're composited, poke the owner document in case it
            wants to re-evaluate compositing decisions.
        (WebCore::FrameView::isOverlapped): Just expose the existing flag.

        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::shouldBeNormalFlowOnly):
        (WebCore::RenderLayer::isSelfPaintingLayer):

        * rendering/RenderLayerBacking.cpp:
        (WebCore::RenderLayerBacking::updateGraphicsLayerConfiguration): If this is an iframe, we need
            to ensure that the layers for the iframe content are hooked up.
        (WebCore::RenderLayerBacking::updateDrawsContent): When an iframe toggles between different
            attachments, the 'drawsContent' behavior of its root layer changes, so needs to be updated.

        * rendering/RenderLayerCompositor.h:
        (WebCore::RenderLayerCompositor::updateCompositingLayers): Call destroyRootPlatformLayer()
            instead of detachRootPlatformLayer() and manually zeroing out the OwnPtrs.
        (WebCore::RenderLayerCompositor::updateBacking): If a RenderIFrame changes compositing mode,
            we need to ensure that its content compositor attachment is updated.
        (WebCore::RenderLayerCompositor::repaintOnCompositingChange): The existing code had a bug
            that caused repaints for RenderViews (which have no parent) to bail. We only want to bail
            for non-RenderViews that are not attached.
        (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree): Factored the iframe-connecting
            code into a new method, parentIFrameContentLayers().
        (WebCore::RenderLayerCompositor::parentIFrameContentLayers): New method to share the code that hooks
            up the iframe's compositing layers to the parent.
        (WebCore::RenderLayerCompositor::shouldPropagateCompositingToEnclosingIFrame): Add logic to propagate
            compositing out of iframes on Mac in two situations: 1) when the FrameView is overlapped, and 2)
            if the parent document is already composited.
        (WebCore::RenderLayerCompositor::ensureRootPlatformLayer): Clean up the logic here to better deal
            with dynamic changes of the attachment type.
        (WebCore::RenderLayerCompositor::destroyRootPlatformLayer): Clean up and null out the clipping layer here.
        (WebCore::RenderLayerCompositor::attachRootPlatformLayer): Call rootLayerAttachmentChanged().
        (WebCore::RenderLayerCompositor::detachRootPlatformLayer): Ditto. Also unparent the clipping and platform layers.
        (WebCore::RenderLayerCompositor::updateRootLayerAttachment): Call ensureRootPlatformLayer() to re-evaluate
            the layer attachment.
        (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged): We need to update the drawsContent() status
            of the RenderView's layer's backing, because it changes depending on the attachment.

        * rendering/RenderWidget.cpp:
        (WebCore::RenderWidget::paint): Do overlap testing if the frameView can do fast repaints (as before),
            but also now when the frameView has composited content.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@59136 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
LayoutTests/ChangeLog
LayoutTests/compositing/iframes/composited-parent-iframe-expected.txt [new file with mode: 0644]
LayoutTests/compositing/iframes/composited-parent-iframe.html
LayoutTests/compositing/iframes/connect-compositing-iframe-expected.txt [new file with mode: 0644]
LayoutTests/compositing/iframes/connect-compositing-iframe.html [new file with mode: 0644]
LayoutTests/compositing/iframes/connect-compositing-iframe2-expected.txt [new file with mode: 0644]
LayoutTests/compositing/iframes/connect-compositing-iframe2.html [new file with mode: 0644]
LayoutTests/compositing/iframes/connect-compositing-iframe3-expected.txt [new file with mode: 0644]
LayoutTests/compositing/iframes/connect-compositing-iframe3.html [new file with mode: 0644]
LayoutTests/compositing/iframes/enter-compositing-iframe-expected.txt
LayoutTests/compositing/iframes/enter-compositing-iframe.html
LayoutTests/compositing/iframes/iframe-resize-expected.txt
LayoutTests/compositing/iframes/leave-compositing-iframe.html
LayoutTests/compositing/iframes/overlapped-iframe-expected.txt
LayoutTests/platform/mac/compositing/iframes/composited-parent-iframe-expected.txt [deleted file]
WebCore/ChangeLog
WebCore/page/FrameView.cpp
WebCore/page/FrameView.h
WebCore/rendering/RenderLayer.cpp
WebCore/rendering/RenderLayerBacking.cpp
WebCore/rendering/RenderLayerBacking.h
WebCore/rendering/RenderLayerCompositor.cpp
WebCore/rendering/RenderLayerCompositor.h
WebCore/rendering/RenderWidget.cpp