summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp')
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp
index 1efae16..75a23d9 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp
@@ -82,7 +82,6 @@ public:
, page(0)
, resizesToContents(false)
#if USE(ACCELERATED_COMPOSITING)
- , rootGraphicsLayer(0)
, shouldSync(false)
#endif
{
@@ -158,7 +157,7 @@ public:
enum { RootGraphicsLayerZValue, OverlayZValue };
#if USE(ACCELERATED_COMPOSITING)
- QGraphicsItem* rootGraphicsLayer;
+ QWeakPointer<QGraphicsObject> rootGraphicsLayer;
// we need to sync the layers if we get a special call from the WebCore
// compositor telling us to do so. We'll get that call from ChromeClientQt
bool shouldSync;
@@ -171,12 +170,11 @@ public:
QGraphicsWebViewPrivate::~QGraphicsWebViewPrivate()
{
#if USE(ACCELERATED_COMPOSITING)
- if (rootGraphicsLayer) {
- // we don't need to delete the root graphics layer
- // The lifecycle is managed in GraphicsLayerQt.cpp
- rootGraphicsLayer->setParentItem(0);
- q->scene()->removeItem(rootGraphicsLayer);
- }
+ if (!rootGraphicsLayer)
+ return;
+ // we don't need to delete the root graphics layer. The lifecycle is managed in GraphicsLayerQt.cpp.
+ rootGraphicsLayer.data()->setParentItem(0);
+ q->scene()->removeItem(rootGraphicsLayer.data());
#endif
}
@@ -204,12 +202,12 @@ void QGraphicsWebViewPrivate::createOrDeleteOverlay()
void QGraphicsWebViewPrivate::setRootGraphicsLayer(QGraphicsItem* layer)
{
if (rootGraphicsLayer) {
- rootGraphicsLayer->setParentItem(0);
- q->scene()->removeItem(rootGraphicsLayer);
+ rootGraphicsLayer.data()->setParentItem(0);
+ q->scene()->removeItem(rootGraphicsLayer.data());
QWebFramePrivate::core(q->page()->mainFrame())->view()->syncCompositingStateRecursive();
}
- rootGraphicsLayer = layer;
+ rootGraphicsLayer = layer ? layer->toGraphicsObject() : 0;
if (layer) {
layer->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
@@ -231,7 +229,7 @@ void QGraphicsWebViewPrivate::updateCompositingScrollPosition()
{
if (rootGraphicsLayer && q->page() && q->page()->mainFrame()) {
const QPoint scrollPosition = q->page()->mainFrame()->scrollPosition();
- rootGraphicsLayer->setPos(-scrollPosition);
+ rootGraphicsLayer.data()->setPos(-scrollPosition);
}
}
#endif
@@ -428,7 +426,9 @@ QRectF QGraphicsWebViewPrivate::graphicsItemVisibleRect() const
return QRectF();
QList<QGraphicsView*> views = q->scene()->views();
if (views.size() > 1) {
+#ifndef QT_NO_DEBUG_STREAM
qDebug() << "QGraphicsWebView is in more than one graphics views, unable to compute the visible rect";
+#endif
return QRectF();
}
if (views.size() < 1)