summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-02-12 00:36:26 +0100
committerAndrea Diamantini <adjam7@gmail.com>2012-02-12 00:36:26 +0100
commit6ffab6cc65eeafe8466b2b1728be89cf8e0f88dc (patch)
tree639d3a0f76419e26a660977fbdc553c319d13275
parentLet "Manually load Plugins" work again (diff)
downloadrekonq-6ffab6cc65eeafe8466b2b1728be89cf8e0f88dc.tar.xz
Ensure renderWidth is no more than 2000.
I saw some sites with strange CMS and with absurd content size width (eg: my school's site has 8584553) This usually leads setViewportSize to crash :(
-rw-r--r--src/websnap.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/websnap.cpp b/src/websnap.cpp
index f077db84..830d37e1 100644
--- a/src/websnap.cpp
+++ b/src/websnap.cpp
@@ -102,7 +102,12 @@ QPixmap WebSnap::renderPagePreview(const QWebPage &page, int w, int h)
QSize oldSize = page.viewportSize();
// prepare page
+ // NOTE: I saw some sites with strange CMS and with absurd content size width (eg: 8584553)
+ // This usually leads setViewportSize to crash :(
+ // So, ensure renderWidth is no more than 2000.
int renderWidth = page.mainFrame()->contentsSize().width();
+ if (renderWidth > 2000)
+ renderWidth = 2000;
int renderHeight = renderWidth * ((0.0 + h) / w);
page.setViewportSize(QSize(renderWidth, renderHeight));