Hi I've been investigating a problem related to the contentsSize of main frames of QWebPages. After some digging and testing I've come to the conclusion that the main frame contentsSize is not being updated properly.
I've attached the test case I have, it's simply a QGraphicsWebView with resizesToContents, tiled backing store and frame flattening enabled. The page loaded (inline) to it has a longish "fullscreen" iframe in it. The expectation I have is that the main frame contentsSize would (due to frame flattening) be expanded to include the iframe too. However, this doesn't happen and the main frame reports the original geometry set to the QGraphicsWebView. However, if I toggle zoomFactor to 1.1 and back to 1.0 the contentsSize *is* updated to include the iframe too. This leads me to believe that the frame flattening isn't resulting in initial notify of the change in contentsSize. I tried to see where that notification is usually sent but got lost quickly after FrameView... If someone could try reproducing this and maybe comment on whether my expectation is correct or not, I would greatly appreciate that. -- Kalle Vahlman, z...@iki.fi Powered by http://movial.com Interesting stuff at http://sandbox.movial.com See also http://syslog.movial.fi
#include <QtWebKit> class CFFBugView : public QGraphicsWebView { Q_OBJECT public: CFFBugView(QGraphicsItem *parent = 0); protected: void mousePressEvent(QGraphicsSceneMouseEvent*); void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*); private slots: void frameContentsSizeChanged(const QSize&); };
#include <QDebug> #include <QApplication> #include <QGraphicsView> #include <QGraphicsScene> #include <QGraphicsSceneMouseEvent> #include "cffbugview.h" CFFBugView::CFFBugView(QGraphicsItem *parent) : QGraphicsWebView(parent) { setResizesToContents(true); settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, true); settings()->setAttribute(QWebSettings::FrameFlatteningEnabled, true); connect(page()->mainFrame(), SIGNAL(contentsSizeChanged(const QSize&)), this, SLOT(frameContentsSizeChanged(const QSize&))); } void CFFBugView::mousePressEvent(QGraphicsSceneMouseEvent *event) { qDebug(); qDebug() << page()->viewportSize(); qDebug() << page()->mainFrame() << page()->mainFrame()->geometry() << page()->mainFrame()->contentsSize(); qDebug() << page()->currentFrame() << page()->currentFrame()->geometry() << page()->currentFrame()->contentsSize(); qDebug() << page()->frameAt(event->pos().toPoint()) << page()->frameAt(event->pos().toPoint())->geometry() << page()->frameAt(event->pos().toPoint())->contentsSize(); qDebug(); QGraphicsWebView::mousePressEvent(event); } void CFFBugView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) { qDebug() << "Toggling zoom"; setZoomFactor(1.1); setZoomFactor(1.0); } void CFFBugView::frameContentsSizeChanged(const QSize &size) { qDebug() << __FUNCTION__ << size; } int main(int argc, char **argv) { QApplication app(argc, argv); QGraphicsScene scene; QGraphicsView view(&scene); CFFBugView cffbug; scene.setBackgroundBrush(Qt::black); scene.addItem(&cffbug); #define TESTPAGE "<html><head><title>Panning fullscreen iframe test</title><style>body { margin:0; padding:0; background-color: #fff; } iframe { height:100%; width: 100%; border: none; padding: 0; margin: 0; } </style></head><body><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMC8vRU4iPg0KPGh0bWwgbGFuZz0iZW4iPg0KIDxoZWFkPg0KICA8dGl0bGU%2BVGVzdDwvdGl0bGU%2BDQogIDxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI%2BDQpwIHtmb250LXNpemU6IDJlbTt9DQogIDwvc3R5bGU%2BDQogPC9oZWFkPg0KIDxib2R5Pg0KICA8cD5JdCBzaG91bGQgYmUgcG9zc2libGUgdG8gcGFuIHRoaXMgaWZyYW1lIGV2ZW4gaWYgdGhlIGlmcmFtZXMgYXJlIGV4cGVuZGVkIGJ5IGJyb3dzZXIgZW5naW5lPC9wPg0KICA8cD50ZXh0PC9wPg0KICA8cD50ZXh0PC9wPg0KICA8cD50ZXh0PC9wPg0KICA8cD50ZXh0PC9wPg0KICA8cD50ZXh0PC9wPg0KICA8cD50ZXh0PC9wPg0KICA8cD50ZXh0PC9wPg0KICA8cD50ZXh0PC9wPg0KICA8cD50ZXh0PC9wPg0KICA8cD50ZXh0PC9wPg0KICA8cD50ZXh0PC9wPg0KICA8cD50ZXh0PC9wPg0KICA8cD50ZXh0PC9wPg0KICA8cD50ZXh0PC9wP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wPg0KICA8cD50ZXh0PC9wPg0KICA8cD50ZXh0PC9wPg0KICA8cD50ZXh0PC9wPg0KICA8cD50ZXh0PC9wPg0KICA8cD50ZXh0PC9wPg0KICA8cD50ZXh0PC9wPg0KICA8cD50ZXh0PC9wPg0KICA8cD50ZXh0PC9wPg0KICA8cD50ZXh0PC9wPg0KIDwvYm9keT4NCjwvaHRtbD4NCg%3D%3D\"></iframe></body></html>" cffbug.setGeometry(QRectF(0, 0, 800, 600)); cffbug.setContent(TESTPAGE); view.resize(800, 600); view.show(); view.update(); return app.exec(); }
_______________________________________________ webkit-qt mailing list webkit-qt@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt