(*** This bug was imported into bugs.kde.org ***) Package: khtml Version: 2.2.1 Severity: wishlist Installed from: suse 7.2 rpms Compiler: gcc version 2.95.3 OS: Linux 2.4.9-ac10 OS/Compiler notes: / Hello when you load a page that takes more than one screen (in length) and hit "Reload" it would be great when konqueror would jump to the place where you've been and not stay on top of the page. thank you yves
*** Bug 40573 has been marked as a duplicate of this bug. ***
As of KDE 3.2.0, this still holds true. Even Netscape Navigator 3 does remember the scroll position on reload, so it's an old feature that people have had lots of time to become accustomed to.
Replaced y.glodt@vo.lu with sean@digitalspinner.com due to bounces by reporter
CVS commit by savernik: Remember scroll position when reloading a page. Currently works only on toplevel pages, but it was about time that *something* was done. CCMAIL: 32639-done@bugs.kde.org M +28 -0 khtml_part.cpp 1.1009 M +5 -2 khtml_part.h 1.259 M +2 -2 khtmlview.cpp 1.639 --- kdelibs/khtml/khtml_part.cpp #1.1008:1.1009 @@ -569,4 +569,13 @@ bool KHTMLPart::openURL( const KURL &url } + // Save offset of viewport when page is reloaded to be compliant + // to every other capable browser out there. + if (args.reload) { + args.xOffset = d->m_view->contentsX(); + args.yOffset = d->m_view->contentsY(); + d->m_extension->setURLArgs(args); + connect(d->m_view, SIGNAL(finishedLayout()), this, SLOT(restoreScrollPosition())); + } + if (!d->m_restored) closeURL(); @@ -6327,4 +6336,23 @@ void KHTMLPart::emitCaretPositionChanged } +void KHTMLPart::restoreScrollPosition() +{ + KParts::URLArgs args = d->m_extension->urlArgs(); + if (!args.reload) { + disconnect(d->m_view, SIGNAL(finishedLayout()), this, SLOT(restoreScrollPosition())); + return; // should not happen + } + + // Check whether the viewport has become large enough to encompass the stored + // offsets. If the document has been fully loaded, force the new coordinates, + // even if the canvas is too short (can happen when user resizes the window + // during loading). + if (d->m_view->contentsHeight() - d->m_view->visibleHeight() >= args.yOffset + || d->m_bComplete) { + d->m_view->setContentsPos(args.xOffset, args.yOffset); + disconnect(d->m_view, SIGNAL(finishedLayout()), this, SLOT(restoreScrollPosition())); + } +} + KWallet::Wallet* KHTMLPart::wallet() { --- kdelibs/khtml/khtml_part.h #1.258:1.259 @@ -1420,5 +1420,8 @@ private slots: void jsErrorDialogContextMenu(); - + /** + * @internal + */ + void restoreScrollPosition(); private: --- kdelibs/khtml/khtmlview.cpp #1.638:1.639 @@ -631,4 +631,6 @@ void KHTMLView::layout() root->setLayouted(false); root->layout(); + + emit finishedLayout(); #if 0 ElementImpl *listitem = m_part->xmlDocImpl()->getElementById("__test_element__"); @@ -656,6 +658,4 @@ void KHTMLView::layout() d->layoutTimerId = 0; d->layoutSchedulingEnabled=true; - - emit finishedLayout(); }
*** Bug 79025 has been marked as a duplicate of this bug. ***
KDE 3.5. I still see the same bug when reloading a page. The position is not kept. It's occurs in www.barrapunto.com for example (the 90% of times). When I press F5 sometimes Konqueror goes to the beginning of the page, sometimes to a previous but not last position...
*** Bug 70217 has been marked as a duplicate of this bug. ***