Example #1
0
QWebHistory* QWebPageProto::history() const
{
  QWebPage *item = qscriptvalue_cast<QWebPage*>(thisObject());
  if (item)
    return item->history();
  return 0;
}
Example #2
0
void KWebKitPart::slotRestoreFrameState(QWebFrame *frame)
{
    QWebPage* page = (frame ? frame->page() : 0);
    QWebHistory* history = (page ? page->history() : 0);

    // No history item...
    if (!history || history->count() < 1)
        return;

    QWebHistoryItem currentHistoryItem (history->currentItem());

    // Update the scroll position if needed. See comment in slotSaveFrameState above.
    if (frame->baseUrl().resolved(frame->url()) == currentHistoryItem.url()) {
        const QPoint currentPos (frame->scrollPosition());
        const QPoint desiredPos (currentHistoryItem.userData().toPoint());
        if (currentPos.isNull() && !desiredPos.isNull()) {
            frame->setScrollPosition(desiredPos);
        }
    }
}