Title: [102397] trunk/Source
Revision
102397
Author
[email protected]
Date
2011-12-08 16:42:00 -0800 (Thu, 08 Dec 2011)

Log Message

[chromium] Move NonCompositedContentHost to WebKit
https://bugs.webkit.org/show_bug.cgi?id=74047

Patch by James Robinson <[email protected]> on 2011-12-08
Reviewed by Kenneth Russell.

Source/WebCore:

Updates WebCore.gypi to remove files no longer within WebCore and removes unused forward declaration and include
from LayerRendererChromium.

* WebCore.gypi:
* platform/graphics/chromium/LayerRendererChromium.cpp:
* platform/graphics/chromium/LayerRendererChromium.h:

Source/WebKit/chromium:

Moves NonCompositedContentHost into WebKit/chromium/src. This class is a helper class designed to make it easier
for WebViewImpl to interface with the compositor. The compositor proper should not depend on this class, and
other clients of the compositor do not need this functionality.

Follow-up patches will transition this code from using compositor-internal interfaces directly to using
higher-level interfaces like the WebKit platform APIs. This patch simply does a file mv and updates namespaces
to keep things simpler.

Refactor only and covered by several unit tests.

* WebKit.gyp:
* src/NonCompositedContentHost.cpp: Renamed from Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.cpp.
(WebKit::NonCompositedContentHost::NonCompositedContentHost):
(WebKit::NonCompositedContentHost::~NonCompositedContentHost):
(WebKit::NonCompositedContentHost::setBackgroundColor):
(WebKit::NonCompositedContentHost::setScrollLayer):
(WebKit::NonCompositedContentHost::setViewport):
(WebKit::NonCompositedContentHost::scrollLayer):
(WebKit::NonCompositedContentHost::protectVisibleTileTextures):
(WebKit::NonCompositedContentHost::invalidateRect):
(WebKit::NonCompositedContentHost::notifyAnimationStarted):
(WebKit::NonCompositedContentHost::notifySyncRequired):
(WebKit::NonCompositedContentHost::paintContents):
(WebKit::NonCompositedContentHost::showDebugBorders):
(WebKit::NonCompositedContentHost::showRepaintCounter):
* src/NonCompositedContentHost.h: Renamed from Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.h.
(WebKit::NonCompositedContentHost::create):
(WebKit::NonCompositedContentHost::topLevelRootLayer):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::nonCompositedContentHost):
* src/WebViewImpl.h:
* tests/LayerChromiumTest.cpp:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102396 => 102397)


--- trunk/Source/WebCore/ChangeLog	2011-12-09 00:41:55 UTC (rev 102396)
+++ trunk/Source/WebCore/ChangeLog	2011-12-09 00:42:00 UTC (rev 102397)
@@ -1,3 +1,17 @@
+2011-12-08  James Robinson  <[email protected]>
+
+        [chromium] Move NonCompositedContentHost to WebKit
+        https://bugs.webkit.org/show_bug.cgi?id=74047
+
+        Reviewed by Kenneth Russell.
+
+        Updates WebCore.gypi to remove files no longer within WebCore and removes unused forward declaration and include
+        from LayerRendererChromium.
+
+        * WebCore.gypi:
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        * platform/graphics/chromium/LayerRendererChromium.h:
+
 2011-12-08  Sami Kyostila  <[email protected]>
 
         [chromium] Layer contents scale change should trigger invalidation

Modified: trunk/Source/WebCore/WebCore.gypi (102396 => 102397)


--- trunk/Source/WebCore/WebCore.gypi	2011-12-09 00:41:55 UTC (rev 102396)
+++ trunk/Source/WebCore/WebCore.gypi	2011-12-09 00:42:00 UTC (rev 102397)
@@ -3544,8 +3544,6 @@
             'platform/graphics/chromium/LayerTextureSubImage.cpp',
             'platform/graphics/chromium/LayerTextureSubImage.h',
             'platform/graphics/chromium/LayerTextureUpdater.h',
-            'platform/graphics/chromium/NonCompositedContentHost.cpp',
-            'platform/graphics/chromium/NonCompositedContentHost.h',
             'platform/graphics/chromium/MediaPlayerPrivateChromium.h',
             'platform/graphics/chromium/PlatformCanvas.cpp',
             'platform/graphics/chromium/PlatformCanvas.h',

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp (102396 => 102397)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2011-12-09 00:41:55 UTC (rev 102396)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2011-12-09 00:42:00 UTC (rev 102397)
@@ -43,7 +43,6 @@
 #include "LayerChromium.h"
 #include "LayerPainterChromium.h"
 #include "ManagedTexture.h"
-#include "NonCompositedContentHost.h"
 #include "NotImplemented.h"
 #include "PlatformColor.h"
 #include "RenderSurfaceChromium.h"

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h (102396 => 102397)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h	2011-12-09 00:41:55 UTC (rev 102396)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h	2011-12-09 00:42:00 UTC (rev 102397)
@@ -68,7 +68,6 @@
 class CCLayerTreeHostImpl;
 class GeometryBinding;
 class GraphicsContext3D;
-class NonCompositedContentHost;
 class TrackingTextureAllocator;
 class LayerRendererSwapBuffersCompleteCallbackAdapter;
 

Deleted: trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.cpp (102396 => 102397)


--- trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.cpp	2011-12-09 00:41:55 UTC (rev 102396)
+++ trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.cpp	2011-12-09 00:42:00 UTC (rev 102397)
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 2011 Google 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 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 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 "NonCompositedContentHost.h"
-
-#include "FloatRect.h"
-#include "GraphicsLayer.h"
-#include "LayerChromium.h"
-#include "LayerPainterChromium.h"
-#include "cc/CCLayerTreeHost.h"
-
-namespace WebCore {
-
-NonCompositedContentHost::NonCompositedContentHost(PassOwnPtr<LayerPainterChromium> contentPaint)
-    : m_contentPaint(contentPaint)
-{
-    m_graphicsLayer = GraphicsLayer::create(this);
-#ifndef NDEBUG
-    m_graphicsLayer->setName("non-composited content");
-#endif
-    m_graphicsLayer->setDrawsContent(true);
-    m_graphicsLayer->platformLayer()->setIsNonCompositedContent(true);
-    m_graphicsLayer->platformLayer()->setOpaque(true);
-}
-
-NonCompositedContentHost::~NonCompositedContentHost()
-{
-}
-
-void NonCompositedContentHost::setBackgroundColor(const Color& color)
-{
-    if (color.isValid())
-        m_graphicsLayer->platformLayer()->setBackgroundColor(color);
-    else
-        m_graphicsLayer->platformLayer()->setBackgroundColor(Color::white);
-}
-
-void NonCompositedContentHost::setScrollLayer(GraphicsLayer* layer)
-{
-    m_graphicsLayer->setNeedsDisplay();
-
-    if (!layer) {
-        m_graphicsLayer->removeFromParent();
-        m_graphicsLayer->platformLayer()->setLayerTreeHost(0);
-        return;
-    }
-
-    if (layer->platformLayer() == scrollLayer())
-        return;
-
-    layer->addChildAtIndex(m_graphicsLayer.get(), 0);
-    ASSERT(scrollLayer());
-}
-
-void NonCompositedContentHost::setViewport(const IntSize& viewportSize, const IntSize& contentsSize, const IntPoint& scrollPosition, float pageScale)
-{
-    if (!scrollLayer())
-        return;
-
-    bool visibleRectChanged = m_viewportSize != viewportSize;
-
-    m_viewportSize = viewportSize;
-    scrollLayer()->setScrollPosition(scrollPosition);
-    // Due to the possibility of pinch zoom, the noncomposited layer is always
-    // assumed to be scrollable.
-    scrollLayer()->setScrollable(true);
-    m_graphicsLayer->setSize(contentsSize);
-
-    if (visibleRectChanged)
-        m_graphicsLayer->setNeedsDisplay();
-
-    if (m_graphicsLayer->pageScaleFactor() != pageScale)
-        m_graphicsLayer->deviceOrPageScaleFactorChanged();
-}
-
-LayerChromium* NonCompositedContentHost::scrollLayer()
-{
-    if (!m_graphicsLayer->parent())
-        return 0;
-    return m_graphicsLayer->parent()->platformLayer();
-}
-
-void NonCompositedContentHost::protectVisibleTileTextures()
-{
-    m_graphicsLayer->platformLayer()->protectVisibleTileTextures();
-}
-
-void NonCompositedContentHost::invalidateRect(const IntRect& rect)
-{
-    m_graphicsLayer->setNeedsDisplayInRect(FloatRect(rect));
-}
-
-void NonCompositedContentHost::notifyAnimationStarted(const GraphicsLayer*, double /* time */)
-{
-    // Intentionally left empty since we don't support animations on the non-composited content.
-}
-
-void NonCompositedContentHost::notifySyncRequired(const GraphicsLayer*)
-{
-    CCLayerTreeHost* layerTreeHost = m_graphicsLayer->platformLayer()->layerTreeHost();
-    if (layerTreeHost)
-        layerTreeHost->setNeedsCommit();
-}
-
-void NonCompositedContentHost::paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase, const IntRect& clipRect)
-{
-    m_contentPaint->paint(context, clipRect);
-}
-
-bool NonCompositedContentHost::showDebugBorders() const
-{
-    return false;
-}
-
-bool NonCompositedContentHost::showRepaintCounter() const
-{
-    return false;
-}
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.h (102396 => 102397)


--- trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.h	2011-12-09 00:41:55 UTC (rev 102396)
+++ trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.h	2011-12-09 00:42:00 UTC (rev 102397)
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2011 Google 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 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 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 NonCompositedContentHost_h
-#define NonCompositedContentHost_h
-
-#include "GraphicsLayerClient.h"
-#include "IntSize.h"
-
-#include <wtf/Noncopyable.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-
-namespace WebCore {
-
-class Color;
-class GraphicsLayer;
-class GraphicsContext;
-class IntPoint;
-class IntRect;
-class LayerChromium;
-class LayerPainterChromium;
-
-class NonCompositedContentHost : public GraphicsLayerClient {
-WTF_MAKE_NONCOPYABLE(NonCompositedContentHost);
-public:
-    static PassOwnPtr<NonCompositedContentHost> create(PassOwnPtr<LayerPainterChromium> contentPaint)
-    {
-        return adoptPtr(new NonCompositedContentHost(contentPaint));
-    }
-    virtual ~NonCompositedContentHost();
-
-    void invalidateRect(const IntRect&);
-    void setBackgroundColor(const Color&);
-    void setScrollLayer(GraphicsLayer*);
-    void setViewport(const IntSize& viewportSize, const IntSize& contentsSize, const IntPoint& scrollPosition, float pageScale);
-    void protectVisibleTileTextures();
-    GraphicsLayer* topLevelRootLayer() const { return m_graphicsLayer.get(); }
-
-protected:
-    explicit NonCompositedContentHost(PassOwnPtr<LayerPainterChromium> contentPaint);
-
-private:
-    // GraphicsLayerClient
-    virtual void notifyAnimationStarted(const GraphicsLayer*, double time);
-    virtual void notifySyncRequired(const GraphicsLayer*);
-    virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& clipRect);
-    virtual bool showDebugBorders() const;
-    virtual bool showRepaintCounter() const;
-
-    LayerChromium* scrollLayer();
-
-    OwnPtr<GraphicsLayer> m_graphicsLayer;
-    OwnPtr<LayerPainterChromium> m_contentPaint;
-    IntSize m_viewportSize;
-};
-
-} // namespace WebCore
-
-#endif // NonCompositedContentHost_h

Modified: trunk/Source/WebKit/chromium/ChangeLog (102396 => 102397)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-12-09 00:41:55 UTC (rev 102396)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-12-09 00:42:00 UTC (rev 102397)
@@ -1,3 +1,43 @@
+2011-12-08  James Robinson  <[email protected]>
+
+        [chromium] Move NonCompositedContentHost to WebKit
+        https://bugs.webkit.org/show_bug.cgi?id=74047
+
+        Reviewed by Kenneth Russell.
+
+        Moves NonCompositedContentHost into WebKit/chromium/src. This class is a helper class designed to make it easier
+        for WebViewImpl to interface with the compositor. The compositor proper should not depend on this class, and
+        other clients of the compositor do not need this functionality.
+
+        Follow-up patches will transition this code from using compositor-internal interfaces directly to using
+        higher-level interfaces like the WebKit platform APIs. This patch simply does a file mv and updates namespaces
+        to keep things simpler.
+
+        Refactor only and covered by several unit tests.
+
+        * WebKit.gyp:
+        * src/NonCompositedContentHost.cpp: Renamed from Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.cpp.
+        (WebKit::NonCompositedContentHost::NonCompositedContentHost):
+        (WebKit::NonCompositedContentHost::~NonCompositedContentHost):
+        (WebKit::NonCompositedContentHost::setBackgroundColor):
+        (WebKit::NonCompositedContentHost::setScrollLayer):
+        (WebKit::NonCompositedContentHost::setViewport):
+        (WebKit::NonCompositedContentHost::scrollLayer):
+        (WebKit::NonCompositedContentHost::protectVisibleTileTextures):
+        (WebKit::NonCompositedContentHost::invalidateRect):
+        (WebKit::NonCompositedContentHost::notifyAnimationStarted):
+        (WebKit::NonCompositedContentHost::notifySyncRequired):
+        (WebKit::NonCompositedContentHost::paintContents):
+        (WebKit::NonCompositedContentHost::showDebugBorders):
+        (WebKit::NonCompositedContentHost::showRepaintCounter):
+        * src/NonCompositedContentHost.h: Renamed from Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.h.
+        (WebKit::NonCompositedContentHost::create):
+        (WebKit::NonCompositedContentHost::topLevelRootLayer):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::nonCompositedContentHost):
+        * src/WebViewImpl.h:
+        * tests/LayerChromiumTest.cpp:
+
 2011-12-08  Sami Kyostila  <[email protected]>
 
         [chromium] Layer contents scale change should trigger invalidation

Modified: trunk/Source/WebKit/chromium/WebKit.gyp (102396 => 102397)


--- trunk/Source/WebKit/chromium/WebKit.gyp	2011-12-09 00:41:55 UTC (rev 102396)
+++ trunk/Source/WebKit/chromium/WebKit.gyp	2011-12-09 00:42:00 UTC (rev 102397)
@@ -431,6 +431,8 @@
                 'src/InspectorClientImpl.h',
                 'src/InspectorFrontendClientImpl.cpp',
                 'src/InspectorFrontendClientImpl.h',
+                'src/NonCompositedContentHost.cpp',
+                'src/NonCompositedContentHost.h',
                 'src/android/WebInputEventFactory.cpp',
                 'src/linux/WebFontInfo.cpp',
                 'src/linux/WebFontRendering.cpp',

Copied: trunk/Source/WebKit/chromium/src/NonCompositedContentHost.cpp (from rev 102395, trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.cpp) (0 => 102397)


--- trunk/Source/WebKit/chromium/src/NonCompositedContentHost.cpp	                        (rev 0)
+++ trunk/Source/WebKit/chromium/src/NonCompositedContentHost.cpp	2011-12-09 00:42:00 UTC (rev 102397)
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2011 Google 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 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 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 "NonCompositedContentHost.h"
+
+#include "FloatRect.h"
+#include "GraphicsLayer.h"
+#include "LayerChromium.h"
+#include "LayerPainterChromium.h"
+#include "cc/CCLayerTreeHost.h"
+
+namespace WebKit {
+
+NonCompositedContentHost::NonCompositedContentHost(PassOwnPtr<WebCore::LayerPainterChromium> contentPaint)
+    : m_contentPaint(contentPaint)
+{
+    m_graphicsLayer = WebCore::GraphicsLayer::create(this);
+#ifndef NDEBUG
+    m_graphicsLayer->setName("non-composited content");
+#endif
+    m_graphicsLayer->setDrawsContent(true);
+    m_graphicsLayer->platformLayer()->setIsNonCompositedContent(true);
+    m_graphicsLayer->platformLayer()->setOpaque(true);
+}
+
+NonCompositedContentHost::~NonCompositedContentHost()
+{
+}
+
+void NonCompositedContentHost::setBackgroundColor(const WebCore::Color& color)
+{
+    if (color.isValid())
+        m_graphicsLayer->platformLayer()->setBackgroundColor(color);
+    else
+        m_graphicsLayer->platformLayer()->setBackgroundColor(WebCore::Color::white);
+}
+
+void NonCompositedContentHost::setScrollLayer(WebCore::GraphicsLayer* layer)
+{
+    m_graphicsLayer->setNeedsDisplay();
+
+    if (!layer) {
+        m_graphicsLayer->removeFromParent();
+        m_graphicsLayer->platformLayer()->setLayerTreeHost(0);
+        return;
+    }
+
+    if (layer->platformLayer() == scrollLayer())
+        return;
+
+    layer->addChildAtIndex(m_graphicsLayer.get(), 0);
+    ASSERT(scrollLayer());
+}
+
+void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, float pageScale)
+{
+    if (!scrollLayer())
+        return;
+
+    bool visibleRectChanged = m_viewportSize != viewportSize;
+
+    m_viewportSize = viewportSize;
+    scrollLayer()->setScrollPosition(scrollPosition);
+    // Due to the possibility of pinch zoom, the noncomposited layer is always
+    // assumed to be scrollable.
+    scrollLayer()->setScrollable(true);
+    m_graphicsLayer->setSize(contentsSize);
+
+    if (visibleRectChanged)
+        m_graphicsLayer->setNeedsDisplay();
+
+    if (m_graphicsLayer->pageScaleFactor() != pageScale)
+        m_graphicsLayer->deviceOrPageScaleFactorChanged();
+}
+
+WebCore::LayerChromium* NonCompositedContentHost::scrollLayer()
+{
+    if (!m_graphicsLayer->parent())
+        return 0;
+    return m_graphicsLayer->parent()->platformLayer();
+}
+
+void NonCompositedContentHost::protectVisibleTileTextures()
+{
+    m_graphicsLayer->platformLayer()->protectVisibleTileTextures();
+}
+
+void NonCompositedContentHost::invalidateRect(const WebCore::IntRect& rect)
+{
+    m_graphicsLayer->setNeedsDisplayInRect(WebCore::FloatRect(rect));
+}
+
+void NonCompositedContentHost::notifyAnimationStarted(const WebCore::GraphicsLayer*, double /* time */)
+{
+    // Intentionally left empty since we don't support animations on the non-composited content.
+}
+
+void NonCompositedContentHost::notifySyncRequired(const WebCore::GraphicsLayer*)
+{
+    WebCore::CCLayerTreeHost* layerTreeHost = m_graphicsLayer->platformLayer()->layerTreeHost();
+    if (layerTreeHost)
+        layerTreeHost->setNeedsCommit();
+}
+
+void NonCompositedContentHost::paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext& context, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect)
+{
+    m_contentPaint->paint(context, clipRect);
+}
+
+bool NonCompositedContentHost::showDebugBorders() const
+{
+    return false;
+}
+
+bool NonCompositedContentHost::showRepaintCounter() const
+{
+    return false;
+}
+
+} // namespace WebKit

Copied: trunk/Source/WebKit/chromium/src/NonCompositedContentHost.h (from rev 102395, trunk/Source/WebCore/platform/graphics/chromium/NonCompositedContentHost.h) (0 => 102397)


--- trunk/Source/WebKit/chromium/src/NonCompositedContentHost.h	                        (rev 0)
+++ trunk/Source/WebKit/chromium/src/NonCompositedContentHost.h	2011-12-09 00:42:00 UTC (rev 102397)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2011 Google 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 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 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 NonCompositedContentHost_h
+#define NonCompositedContentHost_h
+
+#include "GraphicsLayerClient.h"
+#include "IntSize.h"
+
+#include <wtf/Noncopyable.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+class Color;
+class GraphicsLayer;
+class GraphicsContext;
+class IntPoint;
+class IntRect;
+class LayerChromium;
+class LayerPainterChromium;
+}
+
+namespace WebKit {
+
+class NonCompositedContentHost : public WebCore::GraphicsLayerClient {
+WTF_MAKE_NONCOPYABLE(NonCompositedContentHost);
+public:
+    static PassOwnPtr<NonCompositedContentHost> create(PassOwnPtr<WebCore::LayerPainterChromium> contentPaint)
+    {
+        return adoptPtr(new NonCompositedContentHost(contentPaint));
+    }
+    virtual ~NonCompositedContentHost();
+
+    void invalidateRect(const WebCore::IntRect&);
+    void setBackgroundColor(const WebCore::Color&);
+    void setScrollLayer(WebCore::GraphicsLayer*);
+    void setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, float pageScale);
+    void protectVisibleTileTextures();
+    WebCore::GraphicsLayer* topLevelRootLayer() const { return m_graphicsLayer.get(); }
+
+protected:
+    explicit NonCompositedContentHost(PassOwnPtr<WebCore::LayerPainterChromium> contentPaint);
+
+private:
+    // GraphicsLayerClient
+    virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time);
+    virtual void notifySyncRequired(const WebCore::GraphicsLayer*);
+    virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect);
+    virtual bool showDebugBorders() const;
+    virtual bool showRepaintCounter() const;
+
+    WebCore::LayerChromium* scrollLayer();
+
+    OwnPtr<WebCore::GraphicsLayer> m_graphicsLayer;
+    OwnPtr<WebCore::LayerPainterChromium> m_contentPaint;
+    WebCore::IntSize m_viewportSize;
+};
+
+} // namespace WebKit
+
+#endif // NonCompositedContentHost_h

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (102396 => 102397)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2011-12-09 00:41:55 UTC (rev 102396)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2011-12-09 00:42:00 UTC (rev 102397)
@@ -2851,7 +2851,7 @@
     setRootLayerNeedsDisplay();
 }
 
-WebCore::NonCompositedContentHost* WebViewImpl::nonCompositedContentHost()
+NonCompositedContentHost* WebViewImpl::nonCompositedContentHost()
 {
     return m_nonCompositedContentHost.get();
 }

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.h (102396 => 102397)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.h	2011-12-09 00:41:55 UTC (rev 102396)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.h	2011-12-09 00:42:00 UTC (rev 102397)
@@ -61,7 +61,6 @@
 class HistoryItem;
 class HitTestResult;
 class KeyboardEvent;
-class NonCompositedContentHost;
 class Page;
 class PlatformKeyboardEvent;
 class PopupContainer;
@@ -81,6 +80,7 @@
 class DeviceOrientationClientProxy;
 class DragScrollTimer;
 class GeolocationClientProxy;
+class NonCompositedContentHost;
 class SpeechInputClientImpl;
 class UserMediaClientImpl;
 class WebAccessibilityObject;
@@ -422,7 +422,7 @@
     void setRootLayerNeedsDisplay();
     void scrollRootLayerRect(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& clipRect);
     void invalidateRootLayerRect(const WebCore::IntRect&);
-    WebCore::NonCompositedContentHost* nonCompositedContentHost();
+    NonCompositedContentHost* nonCompositedContentHost();
 #endif
 #if ENABLE(REQUEST_ANIMATION_FRAME)
     void scheduleAnimation();
@@ -646,7 +646,7 @@
 
 #if USE(ACCELERATED_COMPOSITING)
     WebCore::IntRect m_rootLayerScrollDamage;
-    OwnPtr<WebCore::NonCompositedContentHost> m_nonCompositedContentHost;
+    OwnPtr<NonCompositedContentHost> m_nonCompositedContentHost;
     RefPtr<WebCore::CCLayerTreeHost> m_layerTreeHost;
     WebCore::GraphicsLayer* m_rootGraphicsLayer;
     bool m_isAcceleratedCompositingActive;

Modified: trunk/Source/WebKit/chromium/tests/LayerChromiumTest.cpp (102396 => 102397)


--- trunk/Source/WebKit/chromium/tests/LayerChromiumTest.cpp	2011-12-09 00:41:55 UTC (rev 102396)
+++ trunk/Source/WebKit/chromium/tests/LayerChromiumTest.cpp	2011-12-09 00:42:00 UTC (rev 102397)
@@ -33,6 +33,7 @@
 #include <gtest/gtest.h>
 
 using namespace WebCore;
+using namespace WebKit;
 using namespace WebKitTests;
 using ::testing::Mock;
 using ::testing::_;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to