Title: [111136] trunk/Source/WebKit2
Revision
111136
Author
[email protected]
Date
2012-03-18 12:28:16 -0700 (Sun, 18 Mar 2012)

Log Message

[Qt] The background is visible for tiles inside the contents area which are not ready
https://bugs.webkit.org/show_bug.cgi?id=81349

Reviewed by Simon Hausmann.

Split PageProxyNode to BackgroundSGNode and ContentsSGNode.
BackgroundSGNode paints a solid background, either white or transparent
(depending on drawsTransparentBackground flag).

* UIProcess/API/qt/qquickwebpage.cpp:
(ContentsSGNode):
(ContentsSGNode::ContentsSGNode):
(ContentsSGNode::changedStates):
(ContentsSGNode::~ContentsSGNode):
(BackgroundSGNode):
(BackgroundSGNode::BackgroundSGNode):
(BackgroundSGNode::contentsNode):
(QQuickWebPage::updatePaintNode):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (111135 => 111136)


--- trunk/Source/WebKit2/ChangeLog	2012-03-18 19:17:21 UTC (rev 111135)
+++ trunk/Source/WebKit2/ChangeLog	2012-03-18 19:28:16 UTC (rev 111136)
@@ -1,3 +1,24 @@
+2012-03-18  No'am Rosenthal  <[email protected]>
+
+        [Qt] The background is visible for tiles inside the contents area which are not ready
+        https://bugs.webkit.org/show_bug.cgi?id=81349
+
+        Reviewed by Simon Hausmann.
+
+        Split PageProxyNode to BackgroundSGNode and ContentsSGNode.
+        BackgroundSGNode paints a solid background, either white or transparent
+        (depending on drawsTransparentBackground flag).
+
+        * UIProcess/API/qt/qquickwebpage.cpp:
+        (ContentsSGNode):
+        (ContentsSGNode::ContentsSGNode):
+        (ContentsSGNode::changedStates):
+        (ContentsSGNode::~ContentsSGNode):
+        (BackgroundSGNode):
+        (BackgroundSGNode::BackgroundSGNode):
+        (BackgroundSGNode::contentsNode):
+        (QQuickWebPage::updatePaintNode):
+
 2012-03-17  Joe Thomas  <[email protected]>
 
         move calc*Value functions out from Length (and platform)

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


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp	2012-03-18 19:17:21 UTC (rev 111135)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp	2012-03-18 19:28:16 UTC (rev 111136)
@@ -31,6 +31,7 @@
 #include <QtQuick/QQuickCanvas>
 #include <QtQuick/QSGGeometryNode>
 #include <QtQuick/QSGMaterial>
+#include <QtQuick/QSGSimpleRectNode>
 #include <private/qsgrendernode_p.h>
 
 QQuickWebPage::QQuickWebPage(QQuickWebView* viewportItem)
@@ -80,8 +81,9 @@
         webPageProxy->drawingArea()->paintLayerTree(painter);
 }
 
-struct PageProxyNode : public QSGRenderNode {
-    PageProxyNode(PassRefPtr<WebLayerTreeRenderer> renderer)
+class ContentsSGNode : public QSGRenderNode {
+public:
+    ContentsSGNode(PassRefPtr<WebLayerTreeRenderer> renderer)
         : m_renderer(renderer)
         , m_scale(1)
     {
@@ -104,7 +106,7 @@
         layerTreeRenderer()->paintToCurrentGLContext(renderMatrix, inheritedOpacity(), clipRect());
     }
 
-    ~PageProxyNode()
+    ~ContentsSGNode()
     {
         layerTreeRenderer()->purgeGLResources();
     }
@@ -158,6 +160,29 @@
     float m_scale;
 };
 
+class BackgroundSGNode : public QSGSimpleRectNode {
+public:
+    BackgroundSGNode()
+        : m_contentsNode(0)
+    {
+    }
+
+    ContentsSGNode* contentsNode(PassRefPtr<WebLayerTreeRenderer> renderer)
+    {
+        if (m_contentsNode && m_contentsNode->layerTreeRenderer() == renderer)
+            return m_contentsNode;
+
+        delete m_contentsNode;
+
+        m_contentsNode = new ContentsSGNode(renderer);
+        appendChildNode(m_contentsNode);
+        return m_contentsNode;
+    }
+
+private:
+    ContentsSGNode* m_contentsNode;
+};
+
 QSGNode* QQuickWebPage::updatePaintNode(QSGNode* oldNode, UpdatePaintNodeData*)
 {
     if (!d->webPageProxy->drawingArea())
@@ -166,23 +191,20 @@
     LayerTreeHostProxy* layerTreeHostProxy = d->webPageProxy->drawingArea()->layerTreeHostProxy();
     WebLayerTreeRenderer* renderer = layerTreeHostProxy->layerTreeRenderer();
 
-    PageProxyNode* node = static_cast<PageProxyNode*>(oldNode);
-
-    if (node && node->layerTreeRenderer() != renderer) {
-        // This means that LayerTreeHostProxy was deleted and recreated while old paint node survived.
-        // This could happen if web process have crashed. In this case we have to recreate paint node.
-        delete node;
-        node = 0;
-    }
-
+    BackgroundSGNode* backgroundNode = static_cast<BackgroundSGNode*>(oldNode);
+    if (!backgroundNode)
+        backgroundNode = new BackgroundSGNode();
+    ContentsSGNode* contentsNode = backgroundNode->contentsNode(renderer);
     renderer->syncRemoteContent();
 
-    if (!node)
-        node = new PageProxyNode(renderer);
+    contentsNode->setScale(d->contentsScale);
 
-    node->setScale(d->contentsScale);
+    QColor backgroundColor = d->webPageProxy->drawsTransparentBackground() ? Qt::transparent : Qt::white;
+    QRectF backgroundRect(0, 0, d->contentsSize.width() * d->contentsScale, d->contentsSize.height() * d->contentsScale);
+    backgroundNode->setColor(backgroundColor);
+    backgroundNode->setRect(backgroundRect);
 
-    return node;
+    return backgroundNode;
 }
 
 QtWebPageEventHandler* QQuickWebPage::eventHandler() const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to