Lines 517-522
Link Here
|
517 |
d->m_bPluginsEnabled = KHTMLFactory::defaultHTMLSettings()->isPluginsEnabled(url.host()); |
517 |
d->m_bPluginsEnabled = KHTMLFactory::defaultHTMLSettings()->isPluginsEnabled(url.host()); |
518 |
|
518 |
|
519 |
m_url = url; |
519 |
m_url = url; |
|
|
520 |
|
521 |
d->m_restoreScrollPosition = true; |
522 |
disconnect(d->m_view, SIGNAL(finishedLayout()), this, SLOT(restoreScrollPosition())); |
523 |
connect(d->m_view, SIGNAL(finishedLayout()), this, SLOT(restoreScrollPosition())); |
520 |
|
524 |
|
521 |
KHTMLPageCache::self()->fetchData( d->m_cacheId, this, SLOT(slotRestoreData(const QByteArray &))); |
525 |
KHTMLPageCache::self()->fetchData( d->m_cacheId, this, SLOT(slotRestoreData(const QByteArray &))); |
522 |
|
526 |
|
Lines 602-626
Link Here
|
602 |
return true; |
606 |
return true; |
603 |
} |
607 |
} |
604 |
} |
608 |
} |
605 |
|
609 |
|
606 |
//jump to the anchor AFTER layouting is done, otherwise the position of the |
|
|
607 |
//anchor is not known and we have no clue to which coordinates to jump |
608 |
disconnect(d->m_view, SIGNAL(finishedLayout()), this, SLOT(gotoAnchor())); |
609 |
connect(d->m_view, SIGNAL(finishedLayout()), this, SLOT(gotoAnchor())); |
610 |
|
611 |
// Save offset of viewport when page is reloaded to be compliant |
610 |
// Save offset of viewport when page is reloaded to be compliant |
612 |
// to every other capable browser out there. |
611 |
// to every other capable browser out there. |
613 |
if (args.reload) { |
612 |
if (args.reload) { |
614 |
args.xOffset = d->m_view->contentsX(); |
613 |
args.xOffset = d->m_view->contentsX(); |
615 |
args.yOffset = d->m_view->contentsY(); |
614 |
args.yOffset = d->m_view->contentsY(); |
616 |
d->m_extension->setURLArgs(args); |
615 |
d->m_extension->setURLArgs(args); |
617 |
disconnect(d->m_view, SIGNAL(finishedLayout()), this, SLOT(gotoAnchor())); |
616 |
} |
618 |
connect(d->m_view, SIGNAL(finishedLayout()), this, SLOT(restoreScrollPosition())); |
|
|
619 |
} |
620 |
|
617 |
|
621 |
if (!d->m_restored) |
618 |
if (!d->m_restored) |
622 |
closeURL(); |
619 |
closeURL(); |
623 |
|
620 |
|
|
|
621 |
d->m_restoreScrollPosition = d->m_restored; |
622 |
disconnect(d->m_view, SIGNAL(finishedLayout()), this, SLOT(restoreScrollPosition())); |
623 |
connect(d->m_view, SIGNAL(finishedLayout()), this, SLOT(restoreScrollPosition())); |
624 |
|
624 |
// initializing m_url to the new url breaks relative links when opening such a link after this call and _before_ begin() is called (when the first |
625 |
// initializing m_url to the new url breaks relative links when opening such a link after this call and _before_ begin() is called (when the first |
625 |
// data arrives) (Simon) |
626 |
// data arrives) (Simon) |
626 |
m_url = url; |
627 |
m_url = url; |
Lines 1526-1540
Link Here
|
1526 |
if (!baseURL.isEmpty()) |
1527 |
if (!baseURL.isEmpty()) |
1527 |
d->m_doc->setBaseURL(KURL( d->m_doc->completeURL(baseURL) )); |
1528 |
d->m_doc->setBaseURL(KURL( d->m_doc->completeURL(baseURL) )); |
1528 |
|
1529 |
|
1529 |
|
|
|
1530 |
if ( !m_url.isLocalFile() ) { |
1530 |
if ( !m_url.isLocalFile() ) { |
1531 |
// Support for http last-modified |
1531 |
// Support for http last-modified |
1532 |
d->m_lastModified = d->m_job->queryMetaData("modified"); |
1532 |
d->m_lastModified = d->m_job->queryMetaData("modified"); |
1533 |
} else |
1533 |
} else |
1534 |
d->m_lastModified = QString::null; // done on-demand by lastModified() |
1534 |
d->m_lastModified = QString::null; // done on-demand by lastModified() |
1535 |
|
|
|
1536 |
// Reset contents position |
1537 |
connect(d->m_view, SIGNAL(finishedLayout()), this, SLOT(restoreScrollPosition())); |
1538 |
} |
1535 |
} |
1539 |
|
1536 |
|
1540 |
KHTMLPageCache::self()->addData(d->m_cacheId, data); |
1537 |
KHTMLPageCache::self()->addData(d->m_cacheId, data); |
Lines 2115-2126
Link Here
|
2115 |
|
2112 |
|
2116 |
checkEmitLoadEvent(); // if we didn't do it before |
2113 |
checkEmitLoadEvent(); // if we didn't do it before |
2117 |
|
2114 |
|
2118 |
// check that the view has not been moved by the user |
|
|
2119 |
|
2120 |
if ( m_url.encodedHtmlRef().isEmpty() && d->m_view->contentsY() == 0 ) |
2121 |
d->m_view->setContentsPos( d->m_extension->urlArgs().xOffset, |
2122 |
d->m_extension->urlArgs().yOffset ); |
2123 |
|
2124 |
bool pendingAction = false; |
2115 |
bool pendingAction = false; |
2125 |
|
2116 |
|
2126 |
if ( !d->m_redirectURL.isEmpty() ) |
2117 |
if ( !d->m_redirectURL.isEmpty() ) |
Lines 2359-2375
Link Here
|
2359 |
d->m_doc->setUserStyleSheet( styleSheet ); |
2350 |
d->m_doc->setUserStyleSheet( styleSheet ); |
2360 |
} |
2351 |
} |
2361 |
|
2352 |
|
2362 |
void KHTMLPart::gotoAnchor() |
|
|
2363 |
{ |
2364 |
if ( !d->m_doc || !d->m_doc->parsing() ) { |
2365 |
disconnect(d->m_view, SIGNAL(finishedLayout()), this, SLOT(gotoAnchor())); |
2366 |
} |
2367 |
|
2368 |
if ( m_url.hasRef() ) |
2369 |
if ( !gotoAnchor(m_url.encodedHtmlRef()) ) |
2370 |
gotoAnchor(m_url.htmlRef()); |
2371 |
} |
2372 |
|
2373 |
bool KHTMLPart::gotoAnchor( const QString &name ) |
2353 |
bool KHTMLPart::gotoAnchor( const QString &name ) |
2374 |
{ |
2354 |
{ |
2375 |
if (!d->m_doc) |
2355 |
if (!d->m_doc) |
Lines 5154-5161
Link Here
|
5154 |
args.yOffset = yOffset; |
5137 |
args.yOffset = yOffset; |
5155 |
args.docState = docState; |
5138 |
args.docState = docState; |
5156 |
|
5139 |
|
5157 |
connect(d->m_view, SIGNAL(finishedLayout()), this, SLOT(restoreScrollPosition())); |
|
|
5158 |
|
5159 |
d->m_extension->setURLArgs( args ); |
5140 |
d->m_extension->setURLArgs( args ); |
5160 |
if (!KHTMLPageCache::self()->isComplete(d->m_cacheId)) |
5141 |
if (!KHTMLPageCache::self()->isComplete(d->m_cacheId)) |
5161 |
{ |
5142 |
{ |
Lines 6604-6609
Link Here
|
6604 |
{ |
6585 |
{ |
6605 |
KParts::URLArgs args = d->m_extension->urlArgs(); |
6586 |
KParts::URLArgs args = d->m_extension->urlArgs(); |
6606 |
|
6587 |
|
|
|
6588 |
if ( m_url.hasRef() && !d->m_restoreScrollPosition && !args.reload) { |
6589 |
if ( !d->m_doc || !d->m_doc->parsing() ) |
6590 |
disconnect(d->m_view, SIGNAL(finishedLayout()), this, SLOT(restoreScrollPosition())); |
6591 |
if ( !gotoAnchor(m_url.encodedHtmlRef()) ) |
6592 |
gotoAnchor(m_url.htmlRef()); |
6593 |
return; |
6594 |
} |
6595 |
|
6607 |
// Check whether the viewport has become large enough to encompass the stored |
6596 |
// Check whether the viewport has become large enough to encompass the stored |
6608 |
// offsets. If the document has been fully loaded, force the new coordinates, |
6597 |
// offsets. If the document has been fully loaded, force the new coordinates, |
6609 |
// even if the canvas is too short (can happen when user resizes the window |
6598 |
// even if the canvas is too short (can happen when user resizes the window |
Lines 6612-6618
Link Here
|
6612 |
|| d->m_bComplete) { |
6601 |
|| d->m_bComplete) { |
6613 |
d->m_view->setContentsPos(args.xOffset, args.yOffset); |
6602 |
d->m_view->setContentsPos(args.xOffset, args.yOffset); |
6614 |
disconnect(d->m_view, SIGNAL(finishedLayout()), this, SLOT(restoreScrollPosition())); |
6603 |
disconnect(d->m_view, SIGNAL(finishedLayout()), this, SLOT(restoreScrollPosition())); |
6615 |
} |
6604 |
} |
6616 |
} |
6605 |
} |
6617 |
|
6606 |
|
6618 |
|
6607 |
|