WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
106077
[Qt] When frame flattening,drag scrollbar, then click link to goto next frame, the page scroll offset is preserved
https://bugs.webkit.org/show_bug.cgi?id=106077
Summary
[Qt] When frame flattening,drag scrollbar, then click link to goto next frame...
Chen Zhixiang
Reported
2013-01-04 00:40:09 PST
Created
attachment 181280
[details]
Simple test case for this bug Use QtWebKit's demos/browser to test: Enable frame flattening, Then drag scrollbar, then click link in frame to change its src to jump to new frame (The whole frameset/URL is not changed) However, the page's scroll offset is prerved It should be reset If disable frame flattening, The behavor is right: (1) When click to navigate to new frame, the page scroll offset is reset to 0 (2) Use History's go back, the prevous frame's page scroll offset is still preserved.
Attachments
Simple test case for this bug
(1.12 KB, application/octet-stream)
2013-01-04 00:40 PST
,
Chen Zhixiang
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Chen Zhixiang
Comment 1
2013-01-04 01:40:27 PST
Could any one work on QtWebKit give some hints or help? 3x
Chen Zhixiang
Comment 2
2013-01-04 01:43:59 PST
I've tried set ScrollView::setScrollOffset( IntPoint() ), or use ScrollView::setScrollPosition( IntPoint() ) But nothing happened I'm not familiar with WebKit's layout mechanism, So, .... Please help!
Chen Zhixiang
Comment 3
2013-01-06 21:59:10 PST
Seems related to
Bug 57898
.
Chen Zhixiang
Comment 4
2013-01-06 22:02:11 PST
I've tried add code in void MainResourceLoader::didFinishLoading(double finishTime) , but it doesn't work. + frameLoader()->frame()->view()->setScrollPosition( IntPoint() ); + frameLoader()->frame()->view()->updateScrollbars(); ASSERT(!documentLoader()->timing()->responseEnd); documentLoader()->timing()->responseEnd = finishTime ? finishTime : (m_timeOfLastDataReceived ? m_timeOfLastDataReceived : currentTime()); frameLoader()->finishedLoading(); ResourceLoader::didFinishLoading(finishTime); I'm not customed to webcore's internal layout/painting mechanism, please help!
Chen Zhixiang
Comment 5
2013-01-06 23:49:09 PST
Try to patch FrameLoader::checkLoadCompleteForThisFrame()( which calls history()->restoreScrollPositionAndViewState() )also failed: (Doesn't know why not works): // If the user had a scroll point, scroll to it, overriding the anchor point if any. if (m_frame->page()) { if (isBackForwardLoadType(m_loadType) || m_loadType == FrameLoadTypeReload || m_loadType == FrameLoadTypeReloadFromOrigin) history()->restoreScrollPositionAndViewState(); + else{ + if (FrameView* view = m_frame->view()) { + if (!view->wasScrolledByUser()) { + view->setScrollPosition( IntPoint() ); + } + } + } }
Chen Zhixiang
Comment 6
2013-01-07 04:02:15 PST
However, if i use the below code, the scrollposition can be reset: in WebView::loadFinished(): QWebFrame* pMainFrame = m_page->mainFrame(); pMainFrame->scroll(0, -2000); Then why does setScrollPosition( IntPoint() ) NOT effect?
Chen Zhixiang
Comment 7
2013-01-07 18:28:32 PST
Hey, I've found the reason why setScrollPosition doesn't effect: The reason is setScrollPosition should be called on main frame ( when do frame flattening, ONLY main frame has the scroll bar) The fix based on qt-4.8.4: d:\qt-everywhere-opensource-src-4.8.4\src\3rdparty\webkit\Source\WebKit\qt\WebCoreSupport\FrameLoaderClientQt.cpp //This function is called back after a frame's load & layout is done, adjust the main frame's scroll position if load type is standard; void FrameLoaderClientQt::dispatchDidLoadMainResource(DocumentLoader* documentLoader) { Frame* frame = documentLoader->frame(); FrameLoader* frameLoader = documentLoader->frameLoader(); if( frame && frameLoader ){ Frame* mainFrame = frame->page()->mainFrame(); if( FrameView* view = mainFrame->view() ){ FrameLoadType loadType = frameLoader->loadType(); if( loadType==FrameLoadTypeStandard ){ //no matter whether frame flattening is enabled, reset scroll position as soon as loadType is standard; view->setScrollPosition( IntPoint() ); } } } }
Chen Zhixiang
Comment 8
2013-01-07 19:17:30 PST
Considering new frame may contain fragment( f.html#anchorNode ), then reset to zero may be not correct), new fix: void FrameLoaderClientQt::dispatchDidLoadMainResource(DocumentLoader* documentLoader) { Frame* frame = documentLoader->frame(); if( frame->settings() && frame->settings()->frameFlatteningEnabled() ){ FrameLoader* frameLoader = documentLoader->frameLoader(); FrameLoadType loadType = FrameLoadTypeStandard;//default as normal load; if( frameLoader ) loadType = frameLoader->loadType(); if( Frame* mainFrame = frame->page()->mainFrame() ){ if( FrameView* mainFrameView = mainFrame->view() ){ IntPoint scrollPosition;//default as zero; if( FrameView* frameView = frame->view() ){ scrollPosition = frameView->scrollPosition(); //get this new frame's scroll position as it may have fragment( a.html#anchorNode ); } if( loadType==FrameLoadTypeStandard ){ //no matter whether frame flattening is enable, reset scroll position as soon as loadType is standard; mainFrameView->setScrollPosition( scrollPosition ); } } } } }
Chen Zhixiang
Comment 9
2013-01-07 20:47:34 PST
The final fix: void FrameLoaderClientQt::dispatchDidLoadMainResource(DocumentLoader* documentLoader) { Frame* frame = documentLoader->frame(); if( frame && frame->settings() && frame->settings()->frameFlatteningEnabled() ){ FrameLoader* frameLoader = documentLoader->frameLoader(); if( frameLoader && frameLoader->loadType()== FrameLoadTypeStandard ){ if( Frame* mainFrame = frame->page()->mainFrame() ){ FrameView* mainFrameView = mainFrame->view(); if( mainFrameView ) mainFrameView->setScrollPosition( IntPoint() ); } } } } The case that frame has fragment works OK, so i dont need to consider it. Thanks giving day!
Jocelyn Turcotte
Comment 10
2014-02-03 03:24:14 PST
=== Bulk closing of Qt bugs === If you believe that this bug report is still relevant for a non-Qt port of webkit.org, please re-open it and remove [Qt] from the summary. If you believe that this is still an important QtWebKit bug, please fill a new report at
https://bugreports.qt-project.org
and add a link to this issue. See
http://qt-project.org/wiki/ReportingBugsInQt
for additional guidelines.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug