[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 15:25:34 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 83c6c2ee8bddb40d154b9a8879652300649938db
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 3 04:16:58 2010 +0000

    2010-11-02  Al Patrick  <apatrick at chromium.org>
    
            Reviewed by Kenneth Russell.
    
            Added PluginLayerChromium, which composites plugin instances that have an associated OpenGL backing texture.
    
            https://bugs.webkit.org/show_bug.cgi?id=48032
    
            * WebCore.gypi:
            * loader/SubframeLoader.cpp
            (WebCore::SubframeLoader::loadPlugin):
            * platform/graphics/chromium/LayerChromium.cpp:
            (WebCore::LayerChromium::setNeedsDisplay):
            * platform/graphics/chromium/LayerRendererChromium.cpp:
            (WebCore::LayerRendererChromium::initializeSharedObjects):
            (WebCore::LayerRendererChromium::cleanupSharedObjects):
            * platform/graphics/chromium/LayerRendererChromium.h:
            (WebCore::LayerRendererChromium::pluginLayerSharedValues):
            * platform/graphics/chromium/PluginLayerChromium.cpp: Added.
            (WebCore::PluginLayerChromium::SharedValues::SharedValues):
            (WebCore::PluginLayerChromium::SharedValues::~SharedValues):
            (WebCore::PluginLayerChromium::create):
            (WebCore::PluginLayerChromium::PluginLayerChromium):
            (WebCore::PluginLayerChromium::updateContents):
            (WebCore::PluginLayerChromium::draw):
            * platform/graphics/chromium/PluginLayerChromium.h: Added.
            (WebCore::PluginLayerChromium::drawsContent):
            (WebCore::PluginLayerChromium::setTextureId):
            (WebCore::PluginLayerChromium::SharedValues::shaderProgram):
            (WebCore::PluginLayerChromium::SharedValues::shaderSamplerLocation):
            (WebCore::PluginLayerChromium::SharedValues::shaderMatrixLocation):
            (WebCore::PluginLayerChromium::SharedValues::shaderAlphaLocation):
            (WebCore::PluginLayerChromium::SharedValues::initialized):
    2010-11-02  Al Patrick  <apatrick at chromium.org>
    
            Reviewed by Kenneth Russell.
    
            [chromium] Plugin instances can propagate the ID of the OpenGL texture they render to.
    
            https://bugs.webkit.org/show_bug.cgi?id=48032
    
            * public/WebPlugin.h:
            (WebKit::WebPlugin::getBackingTextureId):
            * public/WebPluginContainer.h:
            (WebKit::WebPluginContainer::commitBackingTexture):
            * src/WebPluginContainerImpl.cpp:
            (WebKit::WebPluginContainerImpl::commitBackingTexture):
            (WebKit::WebPluginContainerImpl::platformLayer):
            (WebKit::WebPluginContainerImpl::WebPluginContainerImpl):
            * src/WebPluginContainerImpl.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71210 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4f10a74..fbc58bc 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,37 @@
+2010-11-02  Al Patrick  <apatrick at chromium.org>
+
+        Reviewed by Kenneth Russell.
+
+        Added PluginLayerChromium, which composites plugin instances that have an associated OpenGL backing texture.
+
+        https://bugs.webkit.org/show_bug.cgi?id=48032
+
+        * WebCore.gypi:
+        * loader/SubframeLoader.cpp
+        (WebCore::SubframeLoader::loadPlugin):
+        * platform/graphics/chromium/LayerChromium.cpp:
+        (WebCore::LayerChromium::setNeedsDisplay):
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        (WebCore::LayerRendererChromium::initializeSharedObjects):
+        (WebCore::LayerRendererChromium::cleanupSharedObjects):
+        * platform/graphics/chromium/LayerRendererChromium.h:
+        (WebCore::LayerRendererChromium::pluginLayerSharedValues):
+        * platform/graphics/chromium/PluginLayerChromium.cpp: Added.
+        (WebCore::PluginLayerChromium::SharedValues::SharedValues):
+        (WebCore::PluginLayerChromium::SharedValues::~SharedValues):
+        (WebCore::PluginLayerChromium::create):
+        (WebCore::PluginLayerChromium::PluginLayerChromium):
+        (WebCore::PluginLayerChromium::updateContents):
+        (WebCore::PluginLayerChromium::draw):
+        * platform/graphics/chromium/PluginLayerChromium.h: Added.
+        (WebCore::PluginLayerChromium::drawsContent):
+        (WebCore::PluginLayerChromium::setTextureId):
+        (WebCore::PluginLayerChromium::SharedValues::shaderProgram):
+        (WebCore::PluginLayerChromium::SharedValues::shaderSamplerLocation):
+        (WebCore::PluginLayerChromium::SharedValues::shaderMatrixLocation):
+        (WebCore::PluginLayerChromium::SharedValues::shaderAlphaLocation):
+        (WebCore::PluginLayerChromium::SharedValues::initialized):
+
 2010-11-02  James Simonsen  <simonjam at chromium.org>
 
         Reviewed by Adam Barth.
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index b04052b..e7ff438 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -2455,6 +2455,8 @@
             'platform/graphics/chromium/LayerRendererChromium.h',
             'platform/graphics/chromium/MediaPlayerPrivateChromium.h',
             'platform/graphics/chromium/PlatformIcon.h',
+            'platform/graphics/chromium/PluginLayerChromium.cpp',
+            'platform/graphics/chromium/PluginLayerChromium.h',
             'platform/graphics/chromium/SimpleFontDataChromiumWin.cpp',
             'platform/graphics/chromium/SimpleFontDataLinux.cpp',
             'platform/graphics/chromium/TransparencyWin.cpp',
diff --git a/WebCore/loader/SubframeLoader.cpp b/WebCore/loader/SubframeLoader.cpp
index f73646b..d486de0 100644
--- a/WebCore/loader/SubframeLoader.cpp
+++ b/WebCore/loader/SubframeLoader.cpp
@@ -366,8 +366,8 @@ bool SubframeLoader::loadPlugin(HTMLPlugInImageElement* pluginElement, const KUR
 
     renderer->setWidget(widget);
     m_containsPlugins = true;
-
-#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+ 
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) || ENABLE(3D_PLUGIN)
     pluginElement->setNeedsStyleRecalc(SyntheticStyleChange);
 #endif
     return true;
diff --git a/WebCore/platform/graphics/chromium/LayerChromium.cpp b/WebCore/platform/graphics/chromium/LayerChromium.cpp
index f668bbf..23e54e5 100644
--- a/WebCore/platform/graphics/chromium/LayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/LayerChromium.cpp
@@ -370,6 +370,7 @@ void LayerChromium::setNeedsDisplay()
 {
     m_dirtyRect.setSize(m_bounds);
     m_contentsDirty = true;
+    setNeedsCommit();
 }
 
 void LayerChromium::resetNeedsDisplay()
diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
index e93e296..e1b525b 100644
--- a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
+++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
@@ -730,7 +730,10 @@ bool LayerRendererChromium::initializeSharedObjects()
     m_contentLayerSharedValues = adoptPtr(new ContentLayerChromium::SharedValues(m_context.get()));
     m_canvasLayerSharedValues = adoptPtr(new CanvasLayerChromium::SharedValues(m_context.get()));
     m_videoLayerSharedValues = adoptPtr(new VideoLayerChromium::SharedValues(m_context.get()));
-    if (!m_layerSharedValues->initialized() || !m_contentLayerSharedValues->initialized() || !m_canvasLayerSharedValues->initialized() || !m_videoLayerSharedValues->initialized()) {
+    m_pluginLayerSharedValues = adoptPtr(new PluginLayerChromium::SharedValues(m_context.get()));
+
+    if (!m_layerSharedValues->initialized() || !m_contentLayerSharedValues->initialized() || !m_canvasLayerSharedValues->initialized()
+        || !m_videoLayerSharedValues->initialized() || !m_pluginLayerSharedValues->initialized()) {
         cleanupSharedObjects();
         return false;
     }
@@ -746,6 +749,7 @@ void LayerRendererChromium::cleanupSharedObjects()
     m_contentLayerSharedValues.clear();
     m_canvasLayerSharedValues.clear();
     m_videoLayerSharedValues.clear();
+    m_pluginLayerSharedValues.clear();
 
     if (m_scrollShaderProgram) {
         GLC(m_context, m_context->deleteProgram(m_scrollShaderProgram));
diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/WebCore/platform/graphics/chromium/LayerRendererChromium.h
index b2a32ee..52fbe36 100644
--- a/WebCore/platform/graphics/chromium/LayerRendererChromium.h
+++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.h
@@ -38,6 +38,7 @@
 #include "ContentLayerChromium.h"
 #include "IntRect.h"
 #include "LayerChromium.h"
+#include "PluginLayerChromium.h"
 #include "SkBitmap.h"
 #include "VideoLayerChromium.h"
 #include <wtf/HashMap.h>
@@ -107,6 +108,7 @@ public:
     const ContentLayerChromium::SharedValues* contentLayerSharedValues() const { return m_contentLayerSharedValues.get(); }
     const CanvasLayerChromium::SharedValues* canvasLayerSharedValues() const { return m_canvasLayerSharedValues.get(); }
     const VideoLayerChromium::SharedValues* videoLayerSharedValues() const { return m_videoLayerSharedValues.get(); }
+    const PluginLayerChromium::SharedValues* pluginLayerSharedValues() const { return m_pluginLayerSharedValues.get(); }
 
     void resizeOnscreenContent(const IntSize&);
 
@@ -180,6 +182,7 @@ private:
     OwnPtr<ContentLayerChromium::SharedValues> m_contentLayerSharedValues;
     OwnPtr<CanvasLayerChromium::SharedValues> m_canvasLayerSharedValues;
     OwnPtr<VideoLayerChromium::SharedValues> m_videoLayerSharedValues;
+    OwnPtr<PluginLayerChromium::SharedValues> m_pluginLayerSharedValues;
 
     RefPtr<GraphicsContext3D> m_context;
 };
diff --git a/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp b/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp
new file mode 100644
index 0000000..2d1852f
--- /dev/null
+++ b/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2010 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"
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "PluginLayerChromium.h"
+
+#include "GraphicsContext3D.h"
+#include "LayerRendererChromium.h"
+#include <GLES2/gl2.h>
+
+namespace WebCore {
+
+PluginLayerChromium::SharedValues::SharedValues(GraphicsContext3D* context)
+    : m_context(context)
+    , m_shaderProgram(0)
+    , m_shaderSamplerLocation(-1)
+    , m_shaderMatrixLocation(-1)
+    , m_shaderAlphaLocation(-1)
+    , m_initialized(false)
+{
+    char vertexShaderString[] =
+        "attribute vec4 a_position;   \n"
+        "attribute vec2 a_texCoord;   \n"
+        "uniform mat4 matrix;         \n"
+        "varying vec2 v_texCoord;     \n"
+        "void main()                  \n"
+        "{                            \n"
+        "  gl_Position = matrix * a_position; \n"
+        "  v_texCoord = a_texCoord;   \n"
+        "}                            \n";
+
+    char fragmentShaderString[] =
+        "precision mediump float;                            \n"
+        "varying vec2 v_texCoord;                            \n"
+        "uniform sampler2D s_texture;                        \n"
+        "uniform float alpha;                                \n"
+        "void main()                                         \n"
+        "{                                                   \n"
+        "  vec4 texColor = texture2D(s_texture, vec2(v_texCoord.x, v_texCoord.y)); \n"
+        "  gl_FragColor = vec4(texColor.x, texColor.y, texColor.z, texColor.w) * alpha; \n"
+        "}                                                   \n";
+
+    m_shaderProgram = createShaderProgram(m_context, vertexShaderString, fragmentShaderString);
+    if (!m_shaderProgram) {
+        LOG_ERROR("PluginLayerChromium: Failed to create shader program");
+        return;
+    }
+
+    m_shaderSamplerLocation = m_context->getUniformLocation(m_shaderProgram, "s_texture");
+    m_shaderMatrixLocation = m_context->getUniformLocation(m_shaderProgram, "matrix");
+    m_shaderAlphaLocation = m_context->getUniformLocation(m_shaderProgram, "alpha");
+    ASSERT(m_shaderSamplerLocation != -1);
+    ASSERT(m_shaderMatrixLocation != -1);
+    ASSERT(m_shaderAlphaLocation != -1);
+
+    m_initialized = true;
+}
+
+PluginLayerChromium::SharedValues::~SharedValues()
+{
+    if (m_shaderProgram)
+        GLC(m_context, m_context->deleteProgram(m_shaderProgram));
+}
+
+PassRefPtr<PluginLayerChromium> PluginLayerChromium::create(GraphicsLayerChromium* owner)
+{
+    return adoptRef(new PluginLayerChromium(owner));
+}
+
+PluginLayerChromium::PluginLayerChromium(GraphicsLayerChromium* owner)
+    : LayerChromium(owner)
+{
+}
+
+void PluginLayerChromium::setTextureId(unsigned id)
+{
+    m_textureId = id;
+}
+
+void PluginLayerChromium::updateContents()
+{
+}
+
+void PluginLayerChromium::draw()
+{
+    ASSERT(layerRenderer());
+    const PluginLayerChromium::SharedValues* sv = layerRenderer()->pluginLayerSharedValues();
+    ASSERT(sv && sv->initialized());
+    GraphicsContext3D* context = layerRendererContext();
+    GLC(context, context->activeTexture(GL_TEXTURE0));
+    GLC(context, context->bindTexture(GL_TEXTURE_2D, m_textureId));
+    
+    // FIXME: setting the texture parameters every time is redundant. Move this code somewhere
+    // where it will only happen once per texture.
+    GLC(context, context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
+    GLC(context, context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
+    GLC(context, context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
+    GLC(context, context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
+    
+    layerRenderer()->useShader(sv->shaderProgram());
+    GLC(context, context->uniform1i(sv->shaderSamplerLocation(), 0));
+    drawTexturedQuad(context, layerRenderer()->projectionMatrix(), drawTransform(),
+                     bounds().width(), bounds().height(), drawOpacity(),
+                     sv->shaderMatrixLocation(), sv->shaderAlphaLocation());
+}
+
+}
+#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/WebCore/platform/graphics/chromium/PluginLayerChromium.h b/WebCore/platform/graphics/chromium/PluginLayerChromium.h
new file mode 100644
index 0000000..44a6cc9
--- /dev/null
+++ b/WebCore/platform/graphics/chromium/PluginLayerChromium.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2010 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 PluginLayerChromium_h
+#define PluginLayerChromium_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "LayerChromium.h"
+
+namespace WebCore {
+
+// A Layer containing a the rendered output of a plugin instance.
+class PluginLayerChromium : public LayerChromium {
+public:
+    static PassRefPtr<PluginLayerChromium> create(GraphicsLayerChromium* owner = 0);
+    virtual bool drawsContent() { return true; }
+    virtual void updateContents();
+    virtual void draw();
+    
+    void setTextureId(unsigned textureId);
+        
+    class SharedValues {
+    public:
+        SharedValues(GraphicsContext3D* context);
+        ~SharedValues();
+
+        unsigned shaderProgram() const { return m_shaderProgram; }
+        int shaderSamplerLocation() const { return m_shaderSamplerLocation; }
+        int shaderMatrixLocation() const { return m_shaderMatrixLocation; }
+        int shaderAlphaLocation() const { return m_shaderAlphaLocation; }
+        bool initialized() const { return m_initialized; }
+
+    private:
+        GraphicsContext3D* m_context;
+        unsigned m_shaderProgram;
+        int m_shaderSamplerLocation;
+        int m_shaderMatrixLocation;
+        int m_shaderAlphaLocation;
+        bool m_initialized;
+    };
+
+private:
+    PluginLayerChromium(GraphicsLayerChromium* owner);
+    unsigned m_textureId;
+};
+
+}
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 1623bc0..dd358e3 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,21 @@
+2010-11-02  Al Patrick  <apatrick at chromium.org>
+
+        Reviewed by Kenneth Russell.
+
+        [chromium] Plugin instances can propagate the ID of the OpenGL texture they render to.
+
+        https://bugs.webkit.org/show_bug.cgi?id=48032
+
+        * public/WebPlugin.h:
+        (WebKit::WebPlugin::getBackingTextureId):
+        * public/WebPluginContainer.h:
+        (WebKit::WebPluginContainer::commitBackingTexture):
+        * src/WebPluginContainerImpl.cpp:
+        (WebKit::WebPluginContainerImpl::commitBackingTexture):
+        (WebKit::WebPluginContainerImpl::platformLayer):
+        (WebKit::WebPluginContainerImpl::WebPluginContainerImpl):
+        * src/WebPluginContainerImpl.h:
+
 2010-11-02  Kavita Kanetkar  <kkanetkar at chromium.org>
 
         Reviewed by Dumitru Daniliuc.
diff --git a/WebKit/chromium/public/WebPlugin.h b/WebKit/chromium/public/WebPlugin.h
index 17e29e2..4a6f081 100644
--- a/WebKit/chromium/public/WebPlugin.h
+++ b/WebKit/chromium/public/WebPlugin.h
@@ -64,6 +64,10 @@ public:
     virtual void updateGeometry(
         const WebRect& frameRect, const WebRect& clipRect,
         const WebVector<WebRect>& cutOutsRects, bool isVisible) = 0;
+    
+    // If the plugin instance is backed by an OpenGL texture, return its ID in the
+    // compositors namespace. Otherwise return 0. Returns 0 by default.
+    virtual unsigned getBackingTextureId() { return 0; }
 
     virtual void updateFocus(bool) = 0;
     virtual void updateVisibility(bool) = 0;
diff --git a/WebKit/chromium/public/WebPluginContainer.h b/WebKit/chromium/public/WebPluginContainer.h
index f2db0bd..c580f81 100644
--- a/WebKit/chromium/public/WebPluginContainer.h
+++ b/WebKit/chromium/public/WebPluginContainer.h
@@ -54,7 +54,10 @@ public:
     // Causes the container to report its current geometry via
     // WebPlugin::updateGeometry.
     virtual void reportGeometry() = 0;
-
+    
+    // Called when the backing texture is ready to be composited.
+    virtual void commitBackingTexture() {}
+    
     // Drop any references to script objects allocated by the plugin.
     // These are objects derived from WebPlugin::scriptableObject.  This is
     // called when the plugin is being destroyed or if it needs to be
diff --git a/WebKit/chromium/src/WebPluginContainerImpl.cpp b/WebKit/chromium/src/WebPluginContainerImpl.cpp
index 55a7867..43d9757 100644
--- a/WebKit/chromium/src/WebPluginContainerImpl.cpp
+++ b/WebKit/chromium/src/WebPluginContainerImpl.cpp
@@ -33,6 +33,7 @@
 
 #include "Chrome.h"
 #include "ChromeClientImpl.h"
+#include "PluginLayerChromium.h"
 #include "WebClipboard.h"
 #include "WebCursorInfo.h"
 #include "WebDataSourceImpl.h"
@@ -306,6 +307,14 @@ void WebPluginContainerImpl::reportGeometry()
     m_webPlugin->updateGeometry(windowRect, clipRect, cutOutRects, isVisible());
 }
 
+void WebPluginContainerImpl::commitBackingTexture()
+{
+#if USE(ACCELERATED_COMPOSITING)
+    if (platformLayer())
+        platformLayer()->setNeedsDisplay();
+#endif
+}
+
 void WebPluginContainerImpl::clearScriptObjects()
 {
     Frame* frame = m_element->document()->frame();
@@ -412,8 +421,33 @@ void WebPluginContainerImpl::willDestroyPluginLoadObserver(WebPluginLoadObserver
     m_pluginLoadObservers.remove(pos);
 }
 
+#if USE(ACCELERATED_COMPOSITING)
+WebCore::LayerChromium* WebPluginContainerImpl::platformLayer() const
+{
+    // FIXME: In the event of a context lost, the texture needs to be recreated on the compositor's
+    // context and rebound to the platform layer here.
+    unsigned backingTextureId = m_webPlugin->getBackingTextureId();
+    if (!backingTextureId)
+        return 0;
+
+    m_platformLayer->setTextureId(backingTextureId);
+
+    return m_platformLayer.get();
+}
+#endif
+
 // Private methods -------------------------------------------------------------
 
+WebPluginContainerImpl::WebPluginContainerImpl(WebCore::HTMLPlugInElement* element, WebPlugin* webPlugin)
+    : WebCore::PluginViewBase(0)
+    , m_element(element)
+    , m_webPlugin(webPlugin)
+#if USE(ACCELERATED_COMPOSITING)
+    , m_platformLayer(PluginLayerChromium::create(0))
+#endif
+{
+}
+
 WebPluginContainerImpl::~WebPluginContainerImpl()
 {
     for (size_t i = 0; i < m_pluginLoadObservers.size(); ++i)
diff --git a/WebKit/chromium/src/WebPluginContainerImpl.h b/WebKit/chromium/src/WebPluginContainerImpl.h
index a770529..ebe6983 100644
--- a/WebKit/chromium/src/WebPluginContainerImpl.h
+++ b/WebKit/chromium/src/WebPluginContainerImpl.h
@@ -31,9 +31,10 @@
 #ifndef WebPluginContainerImpl_h
 #define WebPluginContainerImpl_h
 
+#include "PluginViewBase.h"
 #include "WebPluginContainer.h"
-
 #include "Widget.h"
+
 #include <wtf/PassRefPtr.h>
 #include <wtf/Vector.h>
 
@@ -43,7 +44,9 @@ namespace WebCore {
 class HTMLPlugInElement;
 class IntRect;
 class KeyboardEvent;
+class LayerChromium;
 class MouseEvent;
+class PluginLayerChromium;
 class ResourceError;
 class ResourceResponse;
 class WheelEvent;
@@ -54,7 +57,7 @@ namespace WebKit {
 class WebPlugin;
 class WebPluginLoadObserver;
 
-class WebPluginContainerImpl : public WebCore::Widget, public WebPluginContainer {
+class WebPluginContainerImpl : public WebCore::PluginViewBase, public WebPluginContainer {
 public:
     static PassRefPtr<WebPluginContainerImpl> create(WebCore::HTMLPlugInElement* element, WebPlugin* webPlugin)
     {
@@ -81,11 +84,12 @@ public:
     virtual void invalidateRect(const WebRect&);
     virtual void scrollRect(int dx, int dy, const WebRect&);
     virtual void reportGeometry();
+    virtual void commitBackingTexture();
     virtual void clearScriptObjects();
     virtual NPObject* scriptableObjectForElement();
     virtual WebString executeScriptURL(const WebURL&, bool popupsAllowed);
     virtual void loadFrameRequest(const WebURLRequest&, const WebString& target, bool notifyNeeded, void* notifyData);
-    virtual void zoomLevelChanged(double zoomLevel);
+    virtual void zoomLevelChanged(double zoomLevel);    
 
     // This cannot be null.
     WebPlugin* plugin() { return m_webPlugin; }
@@ -118,10 +122,12 @@ public:
 
     void willDestroyPluginLoadObserver(WebPluginLoadObserver*);
 
+#if USE(ACCELERATED_COMPOSITING)
+    virtual WebCore::LayerChromium* platformLayer() const;
+#endif
+
 private:
-    WebPluginContainerImpl(WebCore::HTMLPlugInElement* element, WebPlugin* webPlugin)
-        : m_element(element)
-        , m_webPlugin(webPlugin) { }
+    WebPluginContainerImpl(WebCore::HTMLPlugInElement* element, WebPlugin* webPlugin);
     ~WebPluginContainerImpl();
 
     void handleMouseEvent(WebCore::MouseEvent*);
@@ -139,6 +145,10 @@ private:
     WebCore::HTMLPlugInElement* m_element;
     WebPlugin* m_webPlugin;
     Vector<WebPluginLoadObserver*> m_pluginLoadObservers;
+
+#if USE(ACCELERATED_COMPOSITING)
+    RefPtr<WebCore::PluginLayerChromium> m_platformLayer;
+#endif
 };
 
 } // namespace WebKit

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list