[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.0/kdelibs/khtml
From: Germain Garand <germain () ebooksfrance ! org>
Date: 2008-03-12 8:38:07
Message-ID: 1205311087.579140.798.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 784723 by ggarand:
automatically merged revision 783806:
fix flicker at scroll position restoration from cache
which I noticed thanks to discussion with Roman.
I considered generalizing Roman's bypassing of QScrollArea and
doing the bliting using QWidget::scroll instead but it proved slower
than native QWidget::move for whatever reason.
M +20 -13 khtmlview.cpp
--- branches/KDE/4.0/kdelibs/khtml/khtmlview.cpp #784722:784723
@@ -237,7 +237,8 @@
scrollSuspended = false;
scrollSuspendPreActivate = false;
complete = false;
- firstLayout = true;
+ firstLayoutPending = true;
+ firstRepaintPending = true;
needsFullRepaint = true;
dirtyLayout = false;
layoutSchedulingEnabled = true;
@@ -369,7 +370,8 @@
bool scrollSuspended :1;
bool scrollSuspendPreActivate :1;
bool complete :1;
- bool firstLayout :1;
+ bool firstLayoutPending :1;
+ bool firstRepaintPending :1;
bool layoutSchedulingEnabled :1;
bool needsFullRepaint :1;
bool painting :1;
@@ -913,6 +915,7 @@
}
d->painting = false;
+ d->firstRepaintPending = false;
}
void KHTMLView::setMarginWidth(int w)
@@ -970,7 +973,7 @@
QScrollArea::setVerticalScrollBarPolicy(d->vpolicy);
}
}
- d->needsFullRepaint = d->firstLayout;
+ d->needsFullRepaint = d->firstLayoutPending;
if (_height != visibleHeight() || _width != visibleWidth()) {;
d->needsFullRepaint = true;
_height = visibleHeight();
@@ -980,10 +983,10 @@
canvas->layout();
emit finishedLayout();
- if (d->firstLayout) {
- // make sure firstLayout is set to false now in case this layout
+ if (d->firstLayoutPending) {
+ // make sure firstLayoutPending is set to false now in case this layout
// wasn't scheduled
- d->firstLayout = false;
+ d->firstLayoutPending = false;
verticalScrollBar()->setEnabled( true );
horizontalScrollBar()->setEnabled( true );
}
@@ -3616,7 +3619,7 @@
emit zoomView( - e->delta() );
e->accept();
}
- else if (d->firstLayout)
+ else if (d->firstLayoutPending)
{
e->accept();
}
@@ -3770,7 +3773,7 @@
void KHTMLView::scrollContentsBy( int dx, int dy )
{
- if ( !d->firstLayout && !d->complete && m_part->xmlDocImpl() &&
+ if ( !d->firstLayoutPending && !d->complete && m_part->xmlDocImpl() &&
d->layoutSchedulingEnabled) {
// contents scroll while we are not complete: we need to check our layout *now*
khtml::RenderCanvas* root = static_cast<khtml::RenderCanvas *>( m_part->xmlDocImpl()->renderer() );
@@ -3799,7 +3802,11 @@
widget()->update();
return;
}
+ if (d->firstRepaintPending)
+ widget()->setUpdatesEnabled( false );
QScrollArea::scrollContentsBy(dx, dy);
+ if (d->firstRepaintPending)
+ widget()->setUpdatesEnabled( true );
}
void KHTMLView::addChild(QWidget * child, int x, int y)
@@ -3856,7 +3863,7 @@
killTimer( d->scrollingFromWheelTimerId );
d->scrollingFromWheelTimerId = 0;
} else if ( e->timerId() == d->layoutTimerId ) {
- if (d->firstLayout && d->layoutAttemptCounter < 4
+ if (d->firstLayoutPending && d->layoutAttemptCounter < 4
&& (!m_part->xmlDocImpl() || !m_part->xmlDocImpl()->readyForLayout())) {
d->layoutAttemptCounter++;
killTimer(d->layoutTimerId);
@@ -3866,8 +3873,8 @@
}
layout();
d->scheduledLayoutCounter++;
- if (d->firstLayout) {
- d->firstLayout = false;
+ if (d->firstLayoutPending) {
+ d->firstLayoutPending = false;
verticalScrollBar()->setEnabled( true );
horizontalScrollBar()->setEnabled( true );
}
@@ -3972,7 +3979,7 @@
return;
int time = 0;
- if (d->firstLayout) {
+ if (d->firstLayoutPending) {
// Any repaint happening while we have no content blanks the viewport ("white flash").
// Hence the need to delay the first layout as much as we can.
// Only if the document gets stuck for too long in incomplete state will we allow the blanking.
@@ -4011,7 +4018,7 @@
// kDebug() << "parsing " << parsing;
// kDebug() << "complete " << d->complete;
- int time = parsing && !d->firstLayout ? 150 : (!asap ? ( !d->complete ? 80 : 20 ) : 0);
+ int time = parsing && !d->firstLayoutPending ? 150 : (!asap ? ( !d->complete ? 80 : 20 ) : 0);
#ifdef DEBUG_FLICKER
QPainter p;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic