summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm')
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm29
1 files changed, 26 insertions, 3 deletions
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm
index 9734aec..494f5e6 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm
@@ -26,6 +26,7 @@
#import "config.h"
#import "LayerTreeHostMac.h"
+#import "DrawingAreaImpl.h"
#import "WebPage.h"
#import "WebProcess.h"
#import <QuartzCore/CATransaction.h>
@@ -51,6 +52,7 @@ PassRefPtr<LayerTreeHostMac> LayerTreeHostMac::create(WebPage* webPage)
LayerTreeHostMac::LayerTreeHostMac(WebPage* webPage)
: LayerTreeHost(webPage)
, m_isValid(true)
+ , m_notifyAfterScheduledLayerFlush(false)
{
mach_port_t serverPort = WebProcess::shared().compositingRenderServerPort();
m_remoteLayerClient = WKCARemoteLayerClientMakeWithServerPort(serverPort);
@@ -72,6 +74,8 @@ LayerTreeHostMac::LayerTreeHostMac(WebPage* webPage)
m_nonCompositedContentLayer->setDrawsContent(true);
m_nonCompositedContentLayer->setContentsOpaque(m_webPage->drawsBackground() && !m_webPage->drawsTransparentBackground());
m_nonCompositedContentLayer->setSize(webPage->size());
+ if (m_webPage->corePage()->settings()->acceleratedDrawingEnabled())
+ m_nonCompositedContentLayer->setAcceleratesDrawing(true);
m_rootLayer->addChild(m_nonCompositedContentLayer.get());
@@ -116,14 +120,18 @@ void LayerTreeHostMac::scheduleLayerFlush()
CFRunLoopAddObserver(currentRunLoop, m_flushPendingLayerChangesRunLoopObserver.get(), kCFRunLoopCommonModes);
}
-void LayerTreeHostMac::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
+void LayerTreeHostMac::setShouldNotifyAfterNextScheduledLayerFlush(bool notifyAfterScheduledLayerFlush)
{
- ASSERT(graphicsLayer);
+ m_notifyAfterScheduledLayerFlush = notifyAfterScheduledLayerFlush;
+}
+void LayerTreeHostMac::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
+{
m_nonCompositedContentLayer->removeAllChildren();
// Add the accelerated layer tree hierarchy.
- m_nonCompositedContentLayer->addChild(graphicsLayer);
+ if (graphicsLayer)
+ m_nonCompositedContentLayer->addChild(graphicsLayer);
}
void LayerTreeHostMac::invalidate()
@@ -170,6 +178,15 @@ void LayerTreeHostMac::sizeDidChange(const IntSize& newSize)
[CATransaction synchronize];
}
+void LayerTreeHostMac::forceRepaint()
+{
+ scheduleLayerFlush();
+ flushPendingLayerChanges();
+
+ [CATransaction flush];
+ [CATransaction synchronize];
+}
+
void LayerTreeHostMac::didInstallPageOverlay()
{
createPageOverlayLayer();
@@ -242,6 +259,12 @@ void LayerTreeHostMac::flushPendingLayerChangesRunLoopObserverCallback()
ASSERT(m_flushPendingLayerChangesRunLoopObserver);
CFRunLoopObserverInvalidate(m_flushPendingLayerChangesRunLoopObserver.get());
m_flushPendingLayerChangesRunLoopObserver = 0;
+
+ if (m_notifyAfterScheduledLayerFlush) {
+ // Let the drawing area know that we've done a flush of the layer changes.
+ static_cast<DrawingAreaImpl*>(m_webPage->drawingArea())->layerHostDidFlushLayers();
+ m_notifyAfterScheduledLayerFlush = false;
+ }
}
bool LayerTreeHostMac::flushPendingLayerChanges()