Title: [110368] trunk/Source/WebKit2
- Revision
- 110368
- Author
- [email protected]
- Date
- 2012-03-09 20:50:20 -0800 (Fri, 09 Mar 2012)
Log Message
[Qt] [WK2] Shouldn't use item for clipping rect calculation in paint node.
https://bugs.webkit.org/show_bug.cgi?id=80714
Reviewed by Noam Rosenthal.
Replace item based clip-rect calculation with clipping-nodes based calculation.
This is required for threaded rendering, since we don't have access to the QSGItems
from the render thread.
* UIProcess/API/qt/qquickwebpage.cpp:
(QQuickWebPage::QQuickWebPage):
(QQuickWebPagePrivate::paintToCurrentGLContext):
(PageProxyNode::render):
(PageProxyNode::clipRect):
(PageProxyNode):
* UIProcess/API/qt/qquickwebpage_p_p.h:
(QQuickWebPagePrivate):
* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebView::QQuickWebView):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (110367 => 110368)
--- trunk/Source/WebKit2/ChangeLog 2012-03-10 04:35:51 UTC (rev 110367)
+++ trunk/Source/WebKit2/ChangeLog 2012-03-10 04:50:20 UTC (rev 110368)
@@ -1,3 +1,25 @@
+2012-03-09 Viatcheslav Ostapenko <[email protected]>
+
+ [Qt] [WK2] Shouldn't use item for clipping rect calculation in paint node.
+ https://bugs.webkit.org/show_bug.cgi?id=80714
+
+ Reviewed by Noam Rosenthal.
+
+ Replace item based clip-rect calculation with clipping-nodes based calculation.
+ This is required for threaded rendering, since we don't have access to the QSGItems
+ from the render thread.
+
+ * UIProcess/API/qt/qquickwebpage.cpp:
+ (QQuickWebPage::QQuickWebPage):
+ (QQuickWebPagePrivate::paintToCurrentGLContext):
+ (PageProxyNode::render):
+ (PageProxyNode::clipRect):
+ (PageProxyNode):
+ * UIProcess/API/qt/qquickwebpage_p_p.h:
+ (QQuickWebPagePrivate):
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebView::QQuickWebView):
+
2012-03-09 Enrica Casucci <[email protected]>
Move WebNSURLExtras code down to WebCore.
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp (110367 => 110368)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp 2012-03-10 04:35:51 UTC (rev 110367)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp 2012-03-10 04:50:20 UTC (rev 110368)
@@ -26,6 +26,7 @@
#include "TransformationMatrix.h"
#include "qquickwebpage_p_p.h"
#include "qquickwebview_p.h"
+#include <QPolygonF>
#include <QtQuick/QQuickCanvas>
#include <QtQuick/QSGGeometryNode>
#include <QtQuick/QSGMaterial>
@@ -36,6 +37,7 @@
, d(new QQuickWebPagePrivate(this, viewportItem))
{
setFlag(ItemHasContents);
+ setClip(true);
// We do the transform from the top left so the viewport can assume the position 0, 0
// is always where rendering starts.
@@ -77,13 +79,11 @@
webPageProxy->drawingArea()->paintLayerTree(painter);
}
-void QQuickWebPagePrivate::paintToCurrentGLContext(const QTransform& transform, float opacity)
+void QQuickWebPagePrivate::paintToCurrentGLContext(const QTransform& transform, float opacity, const QRectF& clipRect)
{
if (!q->isVisible())
return;
- QRectF clipRect = viewportItem->mapRectToScene(viewportItem->boundingRect());
-
if (!clipRect.isValid())
return;
@@ -110,7 +110,9 @@
if (!m_pagePrivate)
return;
QTransform transform = matrix() ? matrix()->toTransform() : QTransform();
- m_pagePrivate->paintToCurrentGLContext(transform, inheritedOpacity());
+
+ // FIXME: Support non-rectangular clippings.
+ m_pagePrivate->paintToCurrentGLContext(transform, inheritedOpacity(), clipRect());
}
~PageProxyNode()
@@ -119,6 +121,47 @@
m_pagePrivate->resetPaintNode();
}
+ QRectF clipRect() const
+ {
+ // Start with an invalid rect.
+ QRectF resultRect(0, 0, -1, -1);
+
+ for (const QSGClipNode* clip = clipList(); clip; clip = clip->clipList()) {
+ QMatrix4x4 clipMatrix;
+ if (clip->matrix())
+ clipMatrix = *clip->matrix();
+ QRectF currentClip;
+
+ if (clip->isRectangular())
+ currentClip = clipMatrix.mapRect(clip->clipRect());
+ else {
+ const QSGGeometry* geometry = clip->geometry();
+ // Assume here that clipNode has only coordinate data.
+ const QSGGeometry::Point2D* geometryPoints = geometry->vertexDataAsPoint2D();
+
+ // Clip region should be at least triangle to make valid clip.
+ if (geometry->vertexCount() < 3)
+ continue;
+
+ QPolygonF polygon;
+
+ for (int i = 0; i < geometry->vertexCount(); i++)
+ polygon.append(clipMatrix.map(QPoint(geometryPoints[i].x, geometryPoints[i].y)));
+ currentClip = polygon.boundingRect();
+ }
+
+ if (currentClip.isEmpty())
+ continue;
+
+ if (resultRect.isValid())
+ resultRect &= currentClip;
+ else
+ resultRect = currentClip;
+ }
+
+ return resultRect;
+ }
+
QQuickWebPagePrivate* m_pagePrivate;
};
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h (110367 => 110368)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h 2012-03-10 04:35:51 UTC (rev 110367)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h 2012-03-10 04:50:20 UTC (rev 110368)
@@ -41,7 +41,7 @@
void updateSize();
- void paintToCurrentGLContext(const QTransform&, float opacity);
+ void paintToCurrentGLContext(const QTransform&, float opacity, const QRectF& clipRect);
void paint(QPainter*);
void resetPaintNode();
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp (110367 => 110368)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp 2012-03-10 04:35:51 UTC (rev 110367)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp 2012-03-10 04:50:20 UTC (rev 110368)
@@ -1140,6 +1140,7 @@
{
Q_D(QQuickWebView);
d->initialize(contextRef, pageGroupRef);
+ setClip(true);
}
QQuickWebView::~QQuickWebView()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes