Title: [108789] trunk/Source/WebKit2
Revision
108789
Author
[email protected]
Date
2012-02-24 06:41:51 -0800 (Fri, 24 Feb 2012)

Log Message

[Qt] Use private QSGRenderNode in QQuickWebView for improved Qt Scene Graph integration
https://bugs.webkit.org/show_bug.cgi?id=79022

Patch by Simon Hausmann <[email protected]> on 2012-02-24
Reviewed by Csaba Osztrogonác.

* Target.pri:
* UIProcess/API/qt/qquickwebpage.cpp:
(PageProxyNode::PageProxyNode):
(PageProxyNode::changedStates):
(PageProxyNode::render):
(PageProxyNode):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (108788 => 108789)


--- trunk/Source/WebKit2/ChangeLog	2012-02-24 14:39:38 UTC (rev 108788)
+++ trunk/Source/WebKit2/ChangeLog	2012-02-24 14:41:51 UTC (rev 108789)
@@ -1,3 +1,17 @@
+2012-02-24  Simon Hausmann  <[email protected]>
+
+        [Qt] Use private QSGRenderNode in QQuickWebView for improved Qt Scene Graph integration
+        https://bugs.webkit.org/show_bug.cgi?id=79022
+
+        Reviewed by Csaba Osztrogonác.
+
+        * Target.pri:
+        * UIProcess/API/qt/qquickwebpage.cpp:
+        (PageProxyNode::PageProxyNode):
+        (PageProxyNode::changedStates):
+        (PageProxyNode::render):
+        (PageProxyNode):
+
 2012-02-24  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Encode/decode Null ResourceResponse objects in WebKit2

Modified: trunk/Source/WebKit2/Target.pri (108788 => 108789)


--- trunk/Source/WebKit2/Target.pri	2012-02-24 14:39:38 UTC (rev 108788)
+++ trunk/Source/WebKit2/Target.pri	2012-02-24 14:41:51 UTC (rev 108789)
@@ -12,7 +12,7 @@
 include(WebKit2.pri)
 
 WEBKIT += wtf _javascript_core webcore
-QT += declarative quick
+QT += declarative quick quick-private
 
 CONFIG += staticlib
 

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp (108788 => 108789)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp	2012-02-24 14:39:38 UTC (rev 108788)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp	2012-02-24 14:41:51 UTC (rev 108789)
@@ -29,6 +29,7 @@
 #include <QtQuick/QQuickCanvas>
 #include <QtQuick/QSGGeometryNode>
 #include <QtQuick/QSGMaterial>
+#include <private/qsgrendernode_p.h>
 
 QQuickWebPage::QQuickWebPage(QQuickWebView* viewportItem)
     : QQuickItem(viewportItem)
@@ -109,59 +110,24 @@
     drawingArea->paintToCurrentGLContext(transform, opacity, clipRect);
 }
 
-struct PageProxyMaterial;
-struct PageProxyNode;
-
-// FIXME: temporary until Qt Scenegraph will support custom painting.
-struct PageProxyMaterialShader : public QSGMaterialShader {
-    virtual void updateState(const RenderState& state, QSGMaterial* newMaterial, QSGMaterial* oldMaterial);
-    virtual char const* const* attributeNames() const
+struct PageProxyNode : public QSGRenderNode {
+    PageProxyNode(QQuickWebPagePrivate* page)
+        : m_pagePrivate(page)
     {
-        static char const* const attr[] = { "vertex", 0 };
-        return attr;
     }
 
-    // vertexShader and fragmentShader are no-op shaders.
-    // All real painting is gone by TextureMapper through LayerTreeHostProxy.
-    virtual const char* vertexShader() const
+    virtual StateFlags changedStates()
     {
-        return "attribute highp vec4 vertex; \n"
-               "void main() { gl_Position = vertex; }";
+        return StateFlags(DepthState) | StencilState | ScissorState | ColorState | BlendState
+               | CullState | ViewportState;
     }
 
-    virtual const char* fragmentShader() const
+    virtual void render(const RenderState &)
     {
-        return "void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); }";
+        if (m_pagePrivate)
+            m_pagePrivate->paintToCurrentGLContext();
     }
-};
 
-struct PageProxyMaterial : public QSGMaterial {
-    PageProxyMaterial(PageProxyNode* node) : m_node(node) { }
-
-    QSGMaterialType* type() const
-    {
-        static QSGMaterialType type;
-        return &type;
-    }
-
-    QSGMaterialShader* createShader() const
-    {
-        return new PageProxyMaterialShader;
-    }
-
-    PageProxyNode* m_node;
-};
-
-struct PageProxyNode : public QSGGeometryNode {
-    PageProxyNode(QQuickWebPagePrivate* page) :
-        m_pagePrivate(page)
-      , m_material(this)
-      , m_geometry(QSGGeometry::defaultAttributes_Point2D(), 4)
-    {
-        setGeometry(&m_geometry);
-        setMaterial(&m_material);
-    }
-
     ~PageProxyNode()
     {
         if (m_pagePrivate)
@@ -169,22 +135,8 @@
     }
 
     QQuickWebPagePrivate* m_pagePrivate;
-    PageProxyMaterial m_material;
-    QSGGeometry m_geometry;
 };
 
-void PageProxyMaterialShader::updateState(const RenderState& state, QSGMaterial* newMaterial, QSGMaterial* oldMaterial)
-{
-    if (!newMaterial)
-        return;
-
-    PageProxyNode* node = static_cast<PageProxyMaterial*>(newMaterial)->m_node;
-    // FIXME: Normally we wouldn't paint inside QSGMaterialShader::updateState,
-    // but this is a temporary hack until custom paint nodes are available.
-    if (node->m_pagePrivate)
-        node->m_pagePrivate->paintToCurrentGLContext();
-}
-
 QSGNode* QQuickWebPage::updatePaintNode(QSGNode* oldNode, UpdatePaintNodeData*)
 {
     if (!(flags() & ItemHasContents)) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to