From kde-commits Tue Jul 08 14:55:40 2008 From: David Faure Date: Tue, 08 Jul 2008 14:55:40 +0000 To: kde-commits Subject: KDE/kdelibs/khtml Message-Id: <1215528940.669761.11829.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=121552894928813 SVN commit 829463 by dfaure: Fix the 100x30 white rectangle that appears when khtmlview isn't given any HTML to parse. E.g. in konqueror when using MMB to open something that ends up firing an application. Approved by Germain Garand. M +5 -2 khtmlview.cpp M +5 -5 khtmlview.h --- trunk/KDE/kdelibs/khtml/khtmlview.cpp #829462:829463 @@ -543,7 +543,6 @@ init(); widget()->setMouseTracking(true); - QTimer::singleShot(0, this, SLOT(delayedInit())); } KHTMLView::~KHTMLView() @@ -587,7 +586,7 @@ connect(&d->smoothScrollTimer, SIGNAL(timeout()), this, SLOT(scrollTick())); } -void KHTMLView::delayedInit() +void KHTMLView::resizeContentsToViewport() { QSize s = viewport()->size(); resizeContents(s.width(), s.height()); @@ -826,6 +825,10 @@ { updateScrollBars(); + // If we didn't load anything, make white area as big as the view + if (!m_part->xmlDocImpl()) + resizeContentsToViewport(); + // Viewport-dependent media queries may cause us to need completely different style information. if (m_part->xmlDocImpl() && m_part->xmlDocImpl()->styleSelector()->affectedByViewportChange()) { m_part->xmlDocImpl()->updateStyleSelector(); --- trunk/KDE/kdelibs/khtml/khtmlview.h #829462:829463 @@ -155,7 +155,7 @@ int marginHeight() { return _marginHeight; } /** - * Sets vertical scrollbar mode. + * Sets vertical scrollbar mode. * * WARNING: do not call this method on a base class pointer unless you * specifically want QAbstractScrollArea's variant (not recommended). @@ -312,7 +312,7 @@ * Retrieve the current smooth scrolling mode * * @since 4.1 - */ + */ SmoothScrollingMode smoothScrollingMode() const; public Q_SLOTS: @@ -371,7 +371,7 @@ void keyReleaseEvent ( QKeyEvent *_ke ); void doAutoScroll(); void timerEvent ( QTimerEvent * ); - + void setSmoothScrollingModeDefault( SmoothScrollingMode m ); protected Q_SLOTS: @@ -381,7 +381,6 @@ void tripleClickTimeout(); void findTimeout(); void accessKeysTimeout(); - void delayedInit(); void scrollTick(); /** @@ -391,6 +390,7 @@ void slotMouseScrollTimer(); private: + void resizeContentsToViewport(); void scheduleRelayout(khtml::RenderObject* clippedObj=0); void unscheduleRelayout(); @@ -408,7 +408,7 @@ QStack* clipHolder() const; void setClipHolder( QStack* ch ); - + void setPart(KHTMLPart *part); /**