2011-02-18 Anders Carlsson <andersca@apple.com>
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Feb 2011 20:55:25 +0000 (20:55 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Feb 2011 20:55:25 +0000 (20:55 +0000)
commit48c97871ee532691e6047c1adc45d1830d75aaa0
treef7cb3bdd368f8361d75a108066c596f07b6ef976
parent895b5c4ef4ae7f55660b73a9974bb0bdc9f7f77f
2011-02-18  Anders Carlsson  <andersca@apple.com>

        Reviewed by Simon Fraser.

        WKView flashes when entering/exiting compositing mode
        https://bugs.webkit.org/show_bug.cgi?id=54695
        <rdar://problem/9011554>

        * UIProcess/API/mac/WKView.mm:
        (-[WKView _exitAcceleratedCompositingMode]):
        Remove the layer hosting view before clearing out its layer, otherwise we can get
        white flashes when exiting accelerated compositing mode.

        * WebProcess/WebPage/DrawingAreaImpl.cpp:
        When entering accelerated compositing mode, we want to defer sending the message
        until we've actually committed the layer tree and pushed all changes over to the
        UI process.

        (WebKit::DrawingAreaImpl::layerHostDidFlushLayers):
        Tell the layer tree host to force a repaint. This will ensure that all layer tree
        changes are pushed over to the UI process. When that is done, send the new layer tree
        context over to the UI process.

        (WebKit::DrawingAreaImpl::setRootCompositingLayer):
        When exiting compositing mode in response to a didSetSize, we want to exit accelerated
        compositing mode right away to avoid flashes. This is safe since we've laid out the page
        already so we won't end up reentering setRootCompositingLayer.

        (WebKit::DrawingAreaImpl::enterAcceleratedCompositingMode):
        Tell the layer tree host to notify us when the next layer tree flush happened, so we can
        let the UI process know. If we're entering accelerated compositing mode in response to a
        SetSize message, the new layer tree context will be passed in the DidSetSize message.

        * WebProcess/WebPage/DrawingAreaImpl.h:
        Add layerHostDidFlushLayers.

        * WebProcess/WebPage/LayerTreeHost.h:
        Add setShouldNotifyAfterNextScheduledLayerFlush.

        * WebProcess/WebPage/mac/LayerTreeHostMac.h:
        Add a m_notifyAfterScheduledLayerFlush flag.

        * WebProcess/WebPage/mac/LayerTreeHostMac.mm:
        (WebKit::LayerTreeHostMac::LayerTreeHostMac):
        Initialize m_notifyAfterScheduledLayerFlush to false.

        (WebKit::LayerTreeHostMac::setShouldNotifyAfterNextScheduledLayerFlush):
        Set m_notifyAfterScheduledLayerFlush to true.

        (WebKit::LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback):
        If m_notifyAfterScheduledLayerFlush is true, call DrawingAreaImpl::layerHostDidFlushLayers.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@79020 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/WKView.mm
Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h
Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h
Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm