Diff
Modified: trunk/Source/WebKit2/ChangeLog (139824 => 139825)
--- trunk/Source/WebKit2/ChangeLog 2013-01-16 03:02:58 UTC (rev 139824)
+++ trunk/Source/WebKit2/ChangeLog 2013-01-16 03:12:01 UTC (rev 139825)
@@ -1,3 +1,47 @@
+2013-01-15 Anders Carlsson <[email protected]>
+
+ Merge LayerTreeHostCA and LayerTreeHostMac
+ https://bugs.webkit.org/show_bug.cgi?id=106967
+
+ Reviewed by Sam Weinig.
+
+ There's no need to have a LayerTreeHostCA base class anymore, just merge it into LayerTreeHostMac.
+
+ * WebKit2.xcodeproj/project.pbxproj:
+ * WebProcess/WebPage/ca/LayerTreeHostCA.cpp: Removed.
+ * WebProcess/WebPage/ca/LayerTreeHostCA.h: Removed.
+ * WebProcess/WebPage/mac/LayerTreeHostMac.h:
+ (LayerTreeHostMac):
+ * WebProcess/WebPage/mac/LayerTreeHostMac.mm:
+ (WebKit::LayerTreeHostMac::LayerTreeHostMac):
+ (WebKit::LayerTreeHostMac::~LayerTreeHostMac):
+ (WebKit::LayerTreeHostMac::layerTreeContext):
+ (WebKit::LayerTreeHostMac::setShouldNotifyAfterNextScheduledLayerFlush):
+ (WebKit):
+ (WebKit::LayerTreeHostMac::setRootCompositingLayer):
+ (WebKit::LayerTreeHostMac::invalidate):
+ (WebKit::LayerTreeHostMac::setNonCompositedContentsNeedDisplay):
+ (WebKit::LayerTreeHostMac::scrollNonCompositedContents):
+ (WebKit::LayerTreeHostMac::forceRepaint):
+ (WebKit::LayerTreeHostMac::sizeDidChange):
+ (WebKit::LayerTreeHostMac::deviceScaleFactorDidChange):
+ (WebKit::LayerTreeHostMac::didInstallPageOverlay):
+ (WebKit::LayerTreeHostMac::didUninstallPageOverlay):
+ (WebKit::LayerTreeHostMac::setPageOverlayNeedsDisplay):
+ (WebKit::LayerTreeHostMac::pauseRendering):
+ (WebKit::LayerTreeHostMac::resumeRendering):
+ (WebKit::LayerTreeHostMac::setLayerHostingMode):
+ (WebKit::LayerTreeHostMac::notifyAnimationStarted):
+ (WebKit::LayerTreeHostMac::notifyFlushRequired):
+ (WebKit::LayerTreeHostMac::paintContents):
+ (WebKit::LayerTreeHostMac::deviceScaleFactor):
+ (WebKit::LayerTreeHostMac::flushLayers):
+ (WebKit::LayerTreeHostMac::initialize):
+ (WebKit::LayerTreeHostMac::performScheduledLayerFlush):
+ (WebKit::LayerTreeHostMac::flushPendingLayerChanges):
+ (WebKit::LayerTreeHostMac::createPageOverlayLayer):
+ (WebKit::LayerTreeHostMac::destroyPageOverlayLayer):
+
2013-01-15 Tim Horton <[email protected]>
Clamp TileCache visibleRect to WKView's visibleRect
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (139824 => 139825)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2013-01-16 03:02:58 UTC (rev 139824)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2013-01-16 03:12:01 UTC (rev 139825)
@@ -988,13 +988,11 @@
C0337DD3127A2A0E008FF4F4 /* WebKeyboardEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0337DD2127A2A0E008FF4F4 /* WebKeyboardEvent.cpp */; };
C0337DD8127A51B6008FF4F4 /* WebTouchEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0337DD7127A51B6008FF4F4 /* WebTouchEvent.cpp */; };
C0337DDD127A521C008FF4F4 /* WebPlatformTouchPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0337DDC127A521C008FF4F4 /* WebPlatformTouchPoint.cpp */; };
- C064504A133BE709003470E2 /* LayerTreeHostCA.h in Headers */ = {isa = PBXBuildFile; fileRef = C098A053133BE1C500B199A4 /* LayerTreeHostCA.h */; };
C06C6095124C144B0001682F /* WebPageCreationParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C06C6093124C14430001682F /* WebPageCreationParameters.cpp */; };
C09AE5E9125257C20025825D /* WKNativeEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C09AE5E8125257C20025825D /* WKNativeEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };
C0CE72A01247E71D00BC0EC4 /* WebPageMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0CE729E1247E71D00BC0EC4 /* WebPageMessageReceiver.cpp */; };
C0CE72A11247E71D00BC0EC4 /* WebPageMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = C0CE729F1247E71D00BC0EC4 /* WebPageMessages.h */; };
C0CE72AD1247E78D00BC0EC4 /* HandleMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = C0CE72AC1247E78D00BC0EC4 /* HandleMessage.h */; };
- C0D74DDE133BE2D90089CD44 /* LayerTreeHostCA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C098A054133BE1C500B199A4 /* LayerTreeHostCA.cpp */; };
C0E3AA7A1209E83000A49D01 /* ModuleMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0E3AA481209E45000A49D01 /* ModuleMac.mm */; };
C0E3AA7B1209E83500A49D01 /* Module.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0E3AA451209E2BA00A49D01 /* Module.cpp */; };
C0E3AA7C1209E83C00A49D01 /* Module.h in Headers */ = {isa = PBXBuildFile; fileRef = C0E3AA441209E2BA00A49D01 /* Module.h */; };
@@ -2288,8 +2286,6 @@
C0337DDC127A521C008FF4F4 /* WebPlatformTouchPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPlatformTouchPoint.cpp; sourceTree = "<group>"; };
C06C6093124C14430001682F /* WebPageCreationParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageCreationParameters.cpp; sourceTree = "<group>"; };
C06C6094124C14430001682F /* WebPageCreationParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageCreationParameters.h; sourceTree = "<group>"; };
- C098A053133BE1C500B199A4 /* LayerTreeHostCA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerTreeHostCA.h; sourceTree = "<group>"; };
- C098A054133BE1C500B199A4 /* LayerTreeHostCA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LayerTreeHostCA.cpp; sourceTree = "<group>"; };
C09AE5E8125257C20025825D /* WKNativeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNativeEvent.h; sourceTree = "<group>"; };
C0CE72581247E4DA00BC0EC4 /* WebPage.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebPage.messages.in; sourceTree = "<group>"; };
C0CE729E1247E71D00BC0EC4 /* WebPageMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageMessageReceiver.cpp; sourceTree = "<group>"; };
@@ -3461,7 +3457,6 @@
BC032D5E10F4372B0058C15A /* WebPage */ = {
isa = PBXGroup;
children = (
- C098A052133BE1C500B199A4 /* ca */,
BC963D6C113DD19500574BE2 /* mac */,
93FC679D12D3CC7400A60610 /* DecoderAdapter.cpp */,
93FC679E12D3CC7400A60610 /* DecoderAdapter.h */,
@@ -4280,23 +4275,6 @@
path = cg;
sourceTree = "<group>";
};
- C03A136A133BEBF900D767D1 /* mac */ = {
- isa = PBXGroup;
- children = (
- );
- path = mac;
- sourceTree = "<group>";
- };
- C098A052133BE1C500B199A4 /* ca */ = {
- isa = PBXGroup;
- children = (
- C03A136A133BEBF900D767D1 /* mac */,
- C098A054133BE1C500B199A4 /* LayerTreeHostCA.cpp */,
- C098A053133BE1C500B199A4 /* LayerTreeHostCA.h */,
- );
- path = ca;
- sourceTree = "<group>";
- };
C0CE729D1247E71D00BC0EC4 /* Derived Sources */ = {
isa = PBXGroup;
children = (
@@ -4650,7 +4628,6 @@
BCE0937814FB128C001138D9 /* LayerHostingContext.h in Headers */,
1A92DC1112F8BA460017AF65 /* LayerTreeContext.h in Headers */,
1A186EEA12EF7618008E5F37 /* LayerTreeHost.h in Headers */,
- C064504A133BE709003470E2 /* LayerTreeHostCA.h in Headers */,
51A7F2F3125BF820008AEB1D /* Logging.h in Headers */,
BCC56F791159957D001CCAF9 /* MachPort.h in Headers */,
1A24B5F311F531E800C38269 /* MachUtilities.h in Headers */,
@@ -5628,7 +5605,6 @@
BCE0937714FB128C001138D9 /* LayerHostingContext.mm in Sources */,
1A92DC1312F8BAB90017AF65 /* LayerTreeContextMac.mm in Sources */,
1A186EEB12EF7618008E5F37 /* LayerTreeHost.cpp in Sources */,
- C0D74DDE133BE2D90089CD44 /* LayerTreeHostCA.cpp in Sources */,
51A7F2F5125BF8D4008AEB1D /* Logging.cpp in Sources */,
5160BFE113381DF900918999 /* Logging.mac.mm in Sources */,
1A24B5F211F531E800C38269 /* MachUtilities.cpp in Sources */,
Deleted: trunk/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp (139824 => 139825)
--- trunk/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp 2013-01-16 03:02:58 UTC (rev 139824)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp 2013-01-16 03:12:01 UTC (rev 139825)
@@ -1,267 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "LayerTreeHostCA.h"
-
-#include "DrawingAreaImpl.h"
-#include "WebPage.h"
-#include <WebCore/Frame.h>
-#include <WebCore/FrameView.h>
-#include <WebCore/GraphicsLayerCA.h>
-#include <WebCore/Page.h>
-#include <WebCore/PlatformCALayer.h>
-#include <WebCore/Settings.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-LayerTreeHostCA::LayerTreeHostCA(WebPage* webPage)
- : LayerTreeHost(webPage)
- , m_layerFlushSchedulingEnabled(true)
- , m_isValid(true)
- , m_notifyAfterScheduledLayerFlush(false)
-{
-}
-
-void LayerTreeHostCA::initialize()
-{
- // Create a root layer.
- m_rootLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
-#ifndef NDEBUG
- m_rootLayer->setName("LayerTreeHost root layer");
-#endif
- m_rootLayer->setDrawsContent(false);
- m_rootLayer->setSize(m_webPage->size());
- static_cast<GraphicsLayerCA*>(m_rootLayer.get())->platformCALayer()->setGeometryFlipped(true);
-
- m_nonCompositedContentLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
- static_cast<GraphicsLayerCA*>(m_nonCompositedContentLayer.get())->setAllowTiledLayer(false);
-#ifndef NDEBUG
- m_nonCompositedContentLayer->setName("LayerTreeHost non-composited content");
-#endif
- m_nonCompositedContentLayer->setDrawsContent(true);
- m_nonCompositedContentLayer->setContentsOpaque(m_webPage->drawsBackground() && !m_webPage->drawsTransparentBackground());
- m_nonCompositedContentLayer->setSize(m_webPage->size());
- if (m_webPage->corePage()->settings()->acceleratedDrawingEnabled())
- m_nonCompositedContentLayer->setAcceleratesDrawing(true);
-
- m_rootLayer->addChild(m_nonCompositedContentLayer.get());
-
- if (m_webPage->hasPageOverlay())
- createPageOverlayLayer();
-
- platformInitialize();
-
- setLayerFlushSchedulingEnabled(!m_webPage->drawingArea() || !m_webPage->drawingArea()->layerTreeStateIsFrozen());
- scheduleLayerFlush();
-}
-
-LayerTreeHostCA::~LayerTreeHostCA()
-{
- ASSERT(!m_isValid);
- ASSERT(!m_rootLayer);
-}
-
-const LayerTreeContext& LayerTreeHostCA::layerTreeContext()
-{
- return m_layerTreeContext;
-}
-
-void LayerTreeHostCA::setShouldNotifyAfterNextScheduledLayerFlush(bool notifyAfterScheduledLayerFlush)
-{
- m_notifyAfterScheduledLayerFlush = notifyAfterScheduledLayerFlush;
-}
-
-void LayerTreeHostCA::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
-{
- m_nonCompositedContentLayer->removeAllChildren();
-
- // Add the accelerated layer tree hierarchy.
- if (graphicsLayer)
- m_nonCompositedContentLayer->addChild(graphicsLayer);
-}
-
-void LayerTreeHostCA::invalidate()
-{
- ASSERT(m_isValid);
- m_rootLayer = nullptr;
- m_isValid = false;
-}
-
-void LayerTreeHostCA::setNonCompositedContentsNeedDisplay(const IntRect& rect)
-{
- m_nonCompositedContentLayer->setNeedsDisplayInRect(rect);
- if (m_pageOverlayLayer)
- m_pageOverlayLayer->setNeedsDisplayInRect(rect);
-
- scheduleLayerFlush();
-}
-
-void LayerTreeHostCA::scrollNonCompositedContents(const IntRect& scrollRect, const IntSize& scrollOffset)
-{
- setNonCompositedContentsNeedDisplay(scrollRect);
-}
-
-void LayerTreeHostCA::sizeDidChange(const IntSize& newSize)
-{
- m_rootLayer->setSize(newSize);
-
- // If the newSize exposes new areas of the non-composited content a setNeedsDisplay is needed
- // for those newly exposed areas.
- FloatSize oldSize = m_nonCompositedContentLayer->size();
- m_nonCompositedContentLayer->setSize(newSize);
-
- if (newSize.width() > oldSize.width()) {
- float height = std::min(static_cast<float>(newSize.height()), oldSize.height());
- m_nonCompositedContentLayer->setNeedsDisplayInRect(FloatRect(oldSize.width(), 0, newSize.width() - oldSize.width(), height));
- }
-
- if (newSize.height() > oldSize.height())
- m_nonCompositedContentLayer->setNeedsDisplayInRect(FloatRect(0, oldSize.height(), newSize.width(), newSize.height() - oldSize.height()));
-
- if (m_pageOverlayLayer)
- m_pageOverlayLayer->setSize(newSize);
-
- scheduleLayerFlush();
- flushPendingLayerChanges();
-}
-
-void LayerTreeHostCA::deviceScaleFactorDidChange()
-{
- // Other layers learn of the scale factor change via WebPage::setDeviceScaleFactor.
- m_nonCompositedContentLayer->deviceOrPageScaleFactorChanged();
-}
-
-void LayerTreeHostCA::forceRepaint()
-{
- scheduleLayerFlush();
- flushPendingLayerChanges();
-}
-
-void LayerTreeHostCA::didInstallPageOverlay()
-{
- createPageOverlayLayer();
- scheduleLayerFlush();
-}
-
-void LayerTreeHostCA::didUninstallPageOverlay()
-{
- destroyPageOverlayLayer();
- scheduleLayerFlush();
-}
-
-void LayerTreeHostCA::setPageOverlayNeedsDisplay(const IntRect& rect)
-{
- ASSERT(m_pageOverlayLayer);
- m_pageOverlayLayer->setNeedsDisplayInRect(rect);
- scheduleLayerFlush();
-}
-
-void LayerTreeHostCA::notifyAnimationStarted(const WebCore::GraphicsLayer*, double time)
-{
-}
-
-void LayerTreeHostCA::notifyFlushRequired(const WebCore::GraphicsLayer*)
-{
-}
-
-void LayerTreeHostCA::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& graphicsContext, GraphicsLayerPaintingPhase, const IntRect& clipRect)
-{
- if (graphicsLayer == m_nonCompositedContentLayer) {
- m_webPage->drawRect(graphicsContext, clipRect);
- return;
- }
-
- if (graphicsLayer == m_pageOverlayLayer) {
- m_webPage->drawPageOverlay(graphicsContext, clipRect);
- return;
- }
-}
-
-float LayerTreeHostCA::deviceScaleFactor() const
-{
- return m_webPage->corePage()->deviceScaleFactor();
-}
-
-void LayerTreeHostCA::performScheduledLayerFlush()
-{
- {
- RefPtr<LayerTreeHostCA> protect(this);
- m_webPage->layoutIfNeeded();
-
- if (!m_isValid)
- return;
- }
-
- if (!flushPendingLayerChanges())
- return;
-
- didPerformScheduledLayerFlush();
-}
-
-void LayerTreeHostCA::didPerformScheduledLayerFlush()
-{
- 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 LayerTreeHostCA::flushPendingLayerChanges()
-{
- m_rootLayer->flushCompositingStateForThisLayerOnly();
- m_nonCompositedContentLayer->flushCompositingStateForThisLayerOnly();
- if (m_pageOverlayLayer)
- m_pageOverlayLayer->flushCompositingStateForThisLayerOnly();
-
- return m_webPage->corePage()->mainFrame()->view()->flushCompositingStateIncludingSubframes();
-}
-
-void LayerTreeHostCA::createPageOverlayLayer()
-{
- ASSERT(!m_pageOverlayLayer);
-
- m_pageOverlayLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
-#ifndef NDEBUG
- m_pageOverlayLayer->setName("LayerTreeHost page overlay content");
-#endif
-
- m_pageOverlayLayer->setDrawsContent(true);
- m_pageOverlayLayer->setSize(m_webPage->size());
-
- m_rootLayer->addChild(m_pageOverlayLayer.get());
-}
-
-void LayerTreeHostCA::destroyPageOverlayLayer()
-{
- ASSERT(m_pageOverlayLayer);
- m_pageOverlayLayer->removeFromParent();
- m_pageOverlayLayer = nullptr;
-}
-
-} // namespace WebKit
Deleted: trunk/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h (139824 => 139825)
--- trunk/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h 2013-01-16 03:02:58 UTC (rev 139824)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h 2013-01-16 03:12:01 UTC (rev 139825)
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LayerTreeHostCA_h
-#define LayerTreeHostCA_h
-
-#include "LayerTreeContext.h"
-#include "LayerTreeHost.h"
-#include <WebCore/GraphicsLayerClient.h>
-#include <wtf/OwnPtr.h>
-
-namespace WebKit {
-
-class LayerTreeHostCA : public LayerTreeHost, WebCore::GraphicsLayerClient {
-public:
- virtual ~LayerTreeHostCA();
-
-protected:
- explicit LayerTreeHostCA(WebPage*);
-
- WebCore::GraphicsLayer* rootLayer() const { return m_rootLayer.get(); }
-
- void initialize();
- void performScheduledLayerFlush();
-
- // LayerTreeHost.
- virtual void invalidate();
- virtual void sizeDidChange(const WebCore::IntSize& newSize);
- virtual void deviceScaleFactorDidChange();
- virtual void forceRepaint();
- virtual void setRootCompositingLayer(WebCore::GraphicsLayer*);
-
- // LayerTreeHostCA
- virtual void didPerformScheduledLayerFlush();
- virtual bool flushPendingLayerChanges();
-
- bool m_layerFlushSchedulingEnabled;
-
- LayerTreeContext m_layerTreeContext;
-
-private:
- // LayerTreeHost.
- virtual const LayerTreeContext& layerTreeContext();
- virtual void setShouldNotifyAfterNextScheduledLayerFlush(bool);
-
- virtual void setNonCompositedContentsNeedDisplay(const WebCore::IntRect&);
- virtual void scrollNonCompositedContents(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
-
- virtual void didInstallPageOverlay();
- virtual void didUninstallPageOverlay();
- virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&);
-
- // GraphicsLayerClient
- virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time);
- virtual void notifyFlushRequired(const WebCore::GraphicsLayer*);
- virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect);
- virtual float deviceScaleFactor() const;
- virtual void didCommitChangesForLayer(const WebCore::GraphicsLayer*) const { }
-
- // LayerTreeHostCA
- virtual void platformInitialize() = 0;
-
- void createPageOverlayLayer();
- void destroyPageOverlayLayer();
-
- // Whether the layer tree host is valid or not.
- bool m_isValid;
-
- // Whether we should let the drawing area know the next time we've flushed
- // layer tree changes.
- bool m_notifyAfterScheduledLayerFlush;
-
- // The root layer.
- OwnPtr<WebCore::GraphicsLayer> m_rootLayer;
-
- // The layer which contains all non-composited content.
- OwnPtr<WebCore::GraphicsLayer> m_nonCompositedContentLayer;
-
- // The page overlay layer. Will be null if there's no page overlay.
- OwnPtr<WebCore::GraphicsLayer> m_pageOverlayLayer;
-};
-
-} // namespace WebKit
-
-#endif // LayerTreeHostCA_h
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h (139824 => 139825)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h 2013-01-16 03:02:58 UTC (rev 139824)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h 2013-01-16 03:12:01 UTC (rev 139825)
@@ -26,7 +26,8 @@
#ifndef LayerTreeHostMac_h
#define LayerTreeHostMac_h
-#include "LayerTreeHostCA.h"
+#include "LayerTreeHost.h"
+#include <WebCore/GraphicsLayerClient.h>
#include <WebCore/LayerFlushScheduler.h>
#include <WebCore/LayerFlushSchedulerClient.h>
@@ -34,7 +35,7 @@
class LayerHostingContext;
-class LayerTreeHostMac : public LayerTreeHostCA, public WebCore::LayerFlushSchedulerClient {
+class LayerTreeHostMac : public LayerTreeHost, private WebCore::GraphicsLayerClient, private WebCore::LayerFlushSchedulerClient {
public:
static PassRefPtr<LayerTreeHostMac> create(WebPage*);
virtual ~LayerTreeHostMac();
@@ -43,25 +44,53 @@
explicit LayerTreeHostMac(WebPage*);
// LayerTreeHost.
- virtual void scheduleLayerFlush();
- virtual void setLayerFlushSchedulingEnabled(bool);
- virtual void invalidate();
- virtual void sizeDidChange(const WebCore::IntSize& newSize);
- virtual void forceRepaint();
- virtual void pauseRendering();
- virtual void resumeRendering();
+ virtual const LayerTreeContext& layerTreeContext() OVERRIDE;
+ virtual void scheduleLayerFlush() OVERRIDE;
+ virtual void setLayerFlushSchedulingEnabled(bool) OVERRIDE;
+ virtual void setShouldNotifyAfterNextScheduledLayerFlush(bool) OVERRIDE;
+ virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) OVERRIDE;
+ virtual void invalidate() OVERRIDE;
+ virtual void setNonCompositedContentsNeedDisplay(const WebCore::IntRect&) OVERRIDE;
+ virtual void scrollNonCompositedContents(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) OVERRIDE;
+ virtual void forceRepaint() OVERRIDE;
+ virtual void sizeDidChange(const WebCore::IntSize& newSize) OVERRIDE;
+ virtual void deviceScaleFactorDidChange() OVERRIDE;
+ virtual void didInstallPageOverlay() OVERRIDE;
+ virtual void didUninstallPageOverlay() OVERRIDE;
+ virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&) OVERRIDE;
+
+ virtual void pauseRendering() OVERRIDE;
+ virtual void resumeRendering() OVERRIDE;
+
virtual void setLayerHostingMode(LayerHostingMode) OVERRIDE;
- // LayerTreeHostCA
- virtual void platformInitialize();
- virtual void didPerformScheduledLayerFlush();
+ // GraphicsLayerClient
+ virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) OVERRIDE;
+ virtual void notifyFlushRequired(const WebCore::GraphicsLayer*) OVERRIDE;
+ virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect) OVERRIDE;
+ virtual float deviceScaleFactor() const OVERRIDE;
+ virtual void didCommitChangesForLayer(const WebCore::GraphicsLayer*) const OVERRIDE { }
- virtual bool flushPendingLayerChanges();
-
// LayerFlushSchedulerClient
virtual bool flushLayers();
+ void initialize();
+ void performScheduledLayerFlush();
+ bool flushPendingLayerChanges();
+
+ void createPageOverlayLayer();
+ void destroyPageOverlayLayer();
+
+ bool m_isValid;
+ bool m_notifyAfterScheduledLayerFlush;
+
+ LayerTreeContext m_layerTreeContext;
+
+ OwnPtr<WebCore::GraphicsLayer> m_rootLayer;
+ OwnPtr<WebCore::GraphicsLayer> m_nonCompositedContentLayer;
+ OwnPtr<WebCore::GraphicsLayer> m_pageOverlayLayer;
+
OwnPtr<LayerHostingContext> m_layerHostingContext;
WebCore::LayerFlushScheduler m_layerFlushScheduler;
};
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm (139824 => 139825)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm 2013-01-16 03:02:58 UTC (rev 139824)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm 2013-01-16 03:12:01 UTC (rev 139825)
@@ -26,11 +26,16 @@
#import "config.h"
#import "LayerTreeHostMac.h"
+#import "DrawingAreaImpl.h"
#import "LayerHostingContext.h"
#import "WebPage.h"
#import "WebProcess.h"
#import <QuartzCore/CATransaction.h>
-#import <WebCore/GraphicsLayer.h>
+#import <WebCore/Frame.h>
+#import <WebCore/FrameView.h>
+#import <WebCore/GraphicsLayerCA.h>
+#import <WebCore/PlatformCALayer.h>
+#import <WebCore/Settings.h>
using namespace WebCore;
@@ -48,31 +53,23 @@
}
LayerTreeHostMac::LayerTreeHostMac(WebPage* webPage)
- : LayerTreeHostCA(webPage)
+ : LayerTreeHost(webPage)
+ , m_isValid(true)
+ , m_notifyAfterScheduledLayerFlush(false)
, m_layerFlushScheduler(this)
{
}
LayerTreeHostMac::~LayerTreeHostMac()
{
+ ASSERT(!m_isValid);
+ ASSERT(!m_rootLayer);
ASSERT(!m_layerHostingContext);
}
-void LayerTreeHostMac::platformInitialize()
+const LayerTreeContext& LayerTreeHostMac::layerTreeContext()
{
- switch (m_webPage->layerHostingMode()) {
- case LayerHostingModeDefault:
- m_layerHostingContext = LayerHostingContext::createForPort(WebProcess::shared().compositingRenderServerPort());
- break;
-#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
- case LayerHostingModeInWindowServer:
- m_layerHostingContext = LayerHostingContext::createForWindowServer();
- break;
-#endif
- }
-
- m_layerHostingContext->setRootLayer(rootLayer()->platformLayer());
- m_layerTreeContext.contextID = m_layerHostingContext->contextID();
+ return m_layerTreeContext;
}
void LayerTreeHostMac::scheduleLayerFlush()
@@ -88,61 +85,120 @@
m_layerFlushScheduler.suspend();
}
+void LayerTreeHostMac::setShouldNotifyAfterNextScheduledLayerFlush(bool notifyAfterScheduledLayerFlush)
+{
+ m_notifyAfterScheduledLayerFlush = notifyAfterScheduledLayerFlush;
+}
+
+void LayerTreeHostMac::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
+{
+ m_nonCompositedContentLayer->removeAllChildren();
+
+ // Add the accelerated layer tree hierarchy.
+ if (graphicsLayer)
+ m_nonCompositedContentLayer->addChild(graphicsLayer);
+}
+
void LayerTreeHostMac::invalidate()
{
- m_layerFlushScheduler.invalidate();
+ ASSERT(m_isValid);
+ m_isValid = false;
+
+ m_rootLayer = nullptr;
+
m_layerHostingContext->invalidate();
m_layerHostingContext = nullptr;
+ m_layerFlushScheduler.invalidate();
+}
- LayerTreeHostCA::invalidate();
+void LayerTreeHostMac::setNonCompositedContentsNeedDisplay(const IntRect& rect)
+{
+ m_nonCompositedContentLayer->setNeedsDisplayInRect(rect);
+ if (m_pageOverlayLayer)
+ m_pageOverlayLayer->setNeedsDisplayInRect(rect);
+
+ scheduleLayerFlush();
}
-void LayerTreeHostMac::sizeDidChange(const IntSize& newSize)
+void LayerTreeHostMac::scrollNonCompositedContents(const IntRect& scrollRect, const IntSize& scrollOffset)
{
- LayerTreeHostCA::sizeDidChange(newSize);
+ setNonCompositedContentsNeedDisplay(scrollRect);
+}
+
+void LayerTreeHostMac::forceRepaint()
+{
+ scheduleLayerFlush();
+ flushPendingLayerChanges();
+
[CATransaction flush];
[CATransaction synchronize];
}
-void LayerTreeHostMac::forceRepaint()
+void LayerTreeHostMac::sizeDidChange(const IntSize& newSize)
{
- LayerTreeHostCA::forceRepaint();
+ m_rootLayer->setSize(newSize);
+
+ // If the newSize exposes new areas of the non-composited content a setNeedsDisplay is needed
+ // for those newly exposed areas.
+ FloatSize oldSize = m_nonCompositedContentLayer->size();
+ m_nonCompositedContentLayer->setSize(newSize);
+
+ if (newSize.width() > oldSize.width()) {
+ float height = std::min(static_cast<float>(newSize.height()), oldSize.height());
+ m_nonCompositedContentLayer->setNeedsDisplayInRect(FloatRect(oldSize.width(), 0, newSize.width() - oldSize.width(), height));
+ }
+
+ if (newSize.height() > oldSize.height())
+ m_nonCompositedContentLayer->setNeedsDisplayInRect(FloatRect(0, oldSize.height(), newSize.width(), newSize.height() - oldSize.height()));
+
+ if (m_pageOverlayLayer)
+ m_pageOverlayLayer->setSize(newSize);
+
+ scheduleLayerFlush();
+ flushPendingLayerChanges();
+
[CATransaction flush];
[CATransaction synchronize];
}
-void LayerTreeHostMac::pauseRendering()
+void LayerTreeHostMac::deviceScaleFactorDidChange()
{
- CALayer* root = rootLayer()->platformLayer();
- [root setValue:(id)kCFBooleanTrue forKey:@"NSCAViewRenderPaused"];
- [[NSNotificationCenter defaultCenter] postNotificationName:@"NSCAViewRenderDidPauseNotification" object:nil userInfo:[NSDictionary dictionaryWithObject:root forKey:@"layer"]];
+ // Other layers learn of the scale factor change via WebPage::setDeviceScaleFactor.
+ m_nonCompositedContentLayer->deviceOrPageScaleFactorChanged();
}
-void LayerTreeHostMac::resumeRendering()
+void LayerTreeHostMac::didInstallPageOverlay()
{
- CALayer* root = rootLayer()->platformLayer();
- [root setValue:(id)kCFBooleanFalse forKey:@"NSCAViewRenderPaused"];
- [[NSNotificationCenter defaultCenter] postNotificationName:@"NSCAViewRenderDidResumeNotification" object:nil userInfo:[NSDictionary dictionaryWithObject:root forKey:@"layer"]];
+ createPageOverlayLayer();
+ scheduleLayerFlush();
}
-bool LayerTreeHostMac::flushLayers()
+void LayerTreeHostMac::didUninstallPageOverlay()
{
- performScheduledLayerFlush();
- return true;
+ destroyPageOverlayLayer();
+ scheduleLayerFlush();
}
-void LayerTreeHostMac::didPerformScheduledLayerFlush()
+void LayerTreeHostMac::setPageOverlayNeedsDisplay(const IntRect& rect)
{
- LayerTreeHostCA::didPerformScheduledLayerFlush();
+ ASSERT(m_pageOverlayLayer);
+ m_pageOverlayLayer->setNeedsDisplayInRect(rect);
+ scheduleLayerFlush();
}
-bool LayerTreeHostMac::flushPendingLayerChanges()
+void LayerTreeHostMac::pauseRendering()
{
- if (m_layerFlushScheduler.isSuspended())
- return false;
+ CALayer* root = m_rootLayer->platformLayer();
+ [root setValue:(id)kCFBooleanTrue forKey:@"NSCAViewRenderPaused"];
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"NSCAViewRenderDidPauseNotification" object:nil userInfo:[NSDictionary dictionaryWithObject:root forKey:@"layer"]];
+}
- return LayerTreeHostCA::flushPendingLayerChanges();
+void LayerTreeHostMac::resumeRendering()
+{
+ CALayer* root = m_rootLayer->platformLayer();
+ [root setValue:(id)kCFBooleanFalse forKey:@"NSCAViewRenderPaused"];
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"NSCAViewRenderDidResumeNotification" object:nil userInfo:[NSDictionary dictionaryWithObject:root forKey:@"layer"]];
}
void LayerTreeHostMac::setLayerHostingMode(LayerHostingMode layerHostingMode)
@@ -168,10 +224,142 @@
#endif
}
- m_layerHostingContext->setRootLayer(rootLayer()->platformLayer());
+ m_layerHostingContext->setRootLayer(m_rootLayer->platformLayer());
m_layerTreeContext.contextID = m_layerHostingContext->contextID();
scheduleLayerFlush();
}
+void LayerTreeHostMac::notifyAnimationStarted(const WebCore::GraphicsLayer*, double time)
+{
+}
+
+void LayerTreeHostMac::notifyFlushRequired(const WebCore::GraphicsLayer*)
+{
+}
+
+void LayerTreeHostMac::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& graphicsContext, GraphicsLayerPaintingPhase, const IntRect& clipRect)
+{
+ if (graphicsLayer == m_nonCompositedContentLayer) {
+ m_webPage->drawRect(graphicsContext, clipRect);
+ return;
+ }
+
+ if (graphicsLayer == m_pageOverlayLayer) {
+ m_webPage->drawPageOverlay(graphicsContext, clipRect);
+ return;
+ }
+}
+
+float LayerTreeHostMac::deviceScaleFactor() const
+{
+ return m_webPage->corePage()->deviceScaleFactor();
+}
+
+bool LayerTreeHostMac::flushLayers()
+{
+ performScheduledLayerFlush();
+ return true;
+}
+
+void LayerTreeHostMac::initialize()
+{
+ // Create a root layer.
+ m_rootLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
+#ifndef NDEBUG
+ m_rootLayer->setName("LayerTreeHost root layer");
+#endif
+ m_rootLayer->setDrawsContent(false);
+ m_rootLayer->setSize(m_webPage->size());
+ static_cast<GraphicsLayerCA*>(m_rootLayer.get())->platformCALayer()->setGeometryFlipped(true);
+
+ m_nonCompositedContentLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
+ static_cast<GraphicsLayerCA*>(m_nonCompositedContentLayer.get())->setAllowTiledLayer(false);
+#ifndef NDEBUG
+ m_nonCompositedContentLayer->setName("LayerTreeHost non-composited content");
+#endif
+ m_nonCompositedContentLayer->setDrawsContent(true);
+ m_nonCompositedContentLayer->setContentsOpaque(m_webPage->drawsBackground() && !m_webPage->drawsTransparentBackground());
+ m_nonCompositedContentLayer->setSize(m_webPage->size());
+ if (m_webPage->corePage()->settings()->acceleratedDrawingEnabled())
+ m_nonCompositedContentLayer->setAcceleratesDrawing(true);
+
+ m_rootLayer->addChild(m_nonCompositedContentLayer.get());
+
+ if (m_webPage->hasPageOverlay())
+ createPageOverlayLayer();
+
+ switch (m_webPage->layerHostingMode()) {
+ case LayerHostingModeDefault:
+ m_layerHostingContext = LayerHostingContext::createForPort(WebProcess::shared().compositingRenderServerPort());
+ break;
+#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
+ case LayerHostingModeInWindowServer:
+ m_layerHostingContext = LayerHostingContext::createForWindowServer();
+ break;
+#endif
+ }
+
+ m_layerHostingContext->setRootLayer(m_rootLayer->platformLayer());
+ m_layerTreeContext.contextID = m_layerHostingContext->contextID();
+
+ setLayerFlushSchedulingEnabled(!m_webPage->drawingArea() || !m_webPage->drawingArea()->layerTreeStateIsFrozen());
+ scheduleLayerFlush();
+}
+
+void LayerTreeHostMac::performScheduledLayerFlush()
+{
+ {
+ RefPtr<LayerTreeHostMac> protect(this);
+ m_webPage->layoutIfNeeded();
+
+ if (!m_isValid)
+ return;
+ }
+
+ if (!flushPendingLayerChanges())
+ return;
+
+ 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()
+{
+ if (m_layerFlushScheduler.isSuspended())
+ return false;
+
+ m_rootLayer->flushCompositingStateForThisLayerOnly();
+ m_nonCompositedContentLayer->flushCompositingStateForThisLayerOnly();
+ if (m_pageOverlayLayer)
+ m_pageOverlayLayer->flushCompositingStateForThisLayerOnly();
+
+ return m_webPage->corePage()->mainFrame()->view()->flushCompositingStateIncludingSubframes();
+}
+
+void LayerTreeHostMac::createPageOverlayLayer()
+{
+ ASSERT(!m_pageOverlayLayer);
+
+ m_pageOverlayLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
+#ifndef NDEBUG
+ m_pageOverlayLayer->setName("LayerTreeHost page overlay content");
+#endif
+
+ m_pageOverlayLayer->setDrawsContent(true);
+ m_pageOverlayLayer->setSize(m_webPage->size());
+
+ m_rootLayer->addChild(m_pageOverlayLayer.get());
+}
+
+void LayerTreeHostMac::destroyPageOverlayLayer()
+{
+ ASSERT(m_pageOverlayLayer);
+ m_pageOverlayLayer->removeFromParent();
+ m_pageOverlayLayer = nullptr;
+}
+
} // namespace WebKit