From: hausmann@webkit.org Date: Wed, 2 Apr 2008 13:50:19 +0000 (+0000) Subject: Holger Hans Peter Freyther X-Git-Url: http://git.webkit.org/?p=WebKit-https.git;a=commitdiff_plain;h=f89af356a149eb8ea4539db57988fe912f3e23ef Holger Hans Peter Freyther Prepapre everything for enabling the PageCache for the Qt Platform: * Claim that we can cache pages * Create the FrameView FrameLoaderClientQt::transitionToCommittedForNewPage using the initial size of the viewport and stop creating it in the QWebFramePrivate::init Differences to the Windows port: * attachToWindow/detachFromWindow is not called and is not (yet) part of Widget/ScrollView of the Qt platform. We might need that for plugin support in the future. * We store the margin's and scrolling flag inside QWebFrame and use it when creating the FrameView. What is missing: * API to call pageCache()->setCapacity(XYZ); git-svn-id: https://svn.webkit.org/repository/webkit/trunk@31568 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp index 333d53b..6ed8107 100644 --- a/WebKit/qt/Api/qwebframe.cpp +++ b/WebKit/qt/Api/qwebframe.cpp @@ -79,21 +79,14 @@ void QWebFramePrivate::init(QWebFrame *qframe, WebCore::Page *webcorePage, QWebF { q = qframe; + allowsScrolling = frameData->allowsScrolling; + marginWidth = frameData->marginWidth; + marginHeight = frameData->marginHeight; + frameLoaderClient = new FrameLoaderClientQt(); frame = new Frame(webcorePage, frameData->ownerElement, frameLoaderClient); frameLoaderClient->setFrame(qframe, frame); - - FrameView* frameView = new FrameView(frame); - if (!frameData->allowsScrolling) - frameView->setScrollbarsMode(ScrollbarAlwaysOff); - if (frameData->marginWidth != -1) - frameView->setMarginWidth(frameData->marginWidth); - if (frameData->marginHeight != -1) - frameView->setMarginHeight(frameData->marginHeight); - - frame->setView(frameView); frame->init(); - frameView->deref(); QObject::connect(q, SIGNAL(hoveringOverLink(const QString&, const QString&, const QString&)), page, SIGNAL(hoveringOverLink(const QString&, const QString&, const QString&))); diff --git a/WebKit/qt/Api/qwebframe_p.h b/WebKit/qt/Api/qwebframe_p.h index 63c8c33..6f38427 100644 --- a/WebKit/qt/Api/qwebframe_p.h +++ b/WebKit/qt/Api/qwebframe_p.h @@ -65,6 +65,9 @@ public: , frameLoaderClient(0) , frame(0) , page(0) + , allowsScrolling(true) + , marginWidth(-1) + , marginHeight(-1) {} void init(QWebFrame *qframe, WebCore::Page *page, QWebFrameData *frameData); @@ -84,6 +87,10 @@ public: WebCore::FrameLoaderClientQt *frameLoaderClient; WebCore::Frame *frame; QWebPage *page; + + bool allowsScrolling; + int marginWidth; + int marginHeight; }; #endif diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp index 0fcabfe..0d3d310 100644 --- a/WebKit/qt/Api/qwebpage.cpp +++ b/WebKit/qt/Api/qwebpage.cpp @@ -176,7 +176,6 @@ void QWebPagePrivate::createMainFrame() frameData.marginWidth = 0; frameData.marginHeight = 0; mainFrame = new QWebFrame(q, &frameData); - mainFrame->d->frame->view()->setFrameGeometry(IntRect(IntPoint(0,0), q->viewportSize())); emit q->frameCreated(mainFrame); } diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog index 8cafb6e..8cc9003 100644 --- a/WebKit/qt/ChangeLog +++ b/WebKit/qt/ChangeLog @@ -2,6 +2,36 @@ Reviewed by Simon. + Prepapre everything for enabling the PageCache for the Qt Platform: + * Claim that we can cache pages + * Create the FrameView FrameLoaderClientQt::transitionToCommittedForNewPage using + the initial size of the viewport and stop creating it in the QWebFramePrivate::init + + Differences to the Windows port: + * attachToWindow/detachFromWindow is not called and is not (yet) part + of Widget/ScrollView of the Qt platform. We might need that for plugin + support in the future. + * We store the margin's and scrolling flag inside QWebFrame and use it when + creating the FrameView. + + What is missing: + * API to call pageCache()->setCapacity(XYZ); + + + * Api/qwebframe.cpp: + (QWebFramePrivate::init): + * Api/qwebframe_p.h: + (QWebFramePrivate::QWebFramePrivate): + * Api/qwebpage.cpp: + (QWebPagePrivate::createMainFrame): + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::transitionToCommittedForNewPage): + (WebCore::FrameLoaderClientQt::blockedError): + +2008-04-02 Holger Hans Peter Freyther + + Reviewed by Simon. + * For the PageCache support we do not want to create a FrameView in the constructor of QWebFrame. In QWegPage::viewportSize() we currently call mainFrame() and that will create a QWebFrame if no mainFrame is present and this gets called when we try to diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 252c15b..1f8bbdf 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -39,6 +39,7 @@ #include "Page.h" #include "PluginData.h" #include "ProgressTracker.h" +#include "RenderPart.h" #include "ResourceRequest.h" #include "HistoryItem.h" #include "HTMLFormElement.h" @@ -143,15 +144,43 @@ void FrameLoaderClientQt::savePlatformDataToCachedPage(CachedPage*) void FrameLoaderClientQt::transitionToCommittedFromCachedPage(CachedPage*) { - notImplemented(); } void FrameLoaderClientQt::transitionToCommittedForNewPage() { -// qDebug() << "FrameLoaderClientQt::makeDocumentView" << m_frame->document(); + ASSERT(m_frame); + ASSERT(m_webFrame); + + Page* page = m_frame->page(); + ASSERT(page); + + bool isMainFrame = m_frame == page->mainFrame(); + + m_frame->setView(0); + + FrameView* frameView; + if (isMainFrame) + frameView = new FrameView(m_frame, m_webFrame->page()->viewportSize()); + else + frameView = new FrameView(m_frame); -// if (!m_frame->document()) -// m_frame->loader()->createEmptyDocument(); + if (!m_webFrame->d->allowsScrolling) + frameView->setScrollbarsMode(ScrollbarAlwaysOff); + if (m_webFrame->d->marginWidth != -1) + frameView->setMarginWidth(m_webFrame->d->marginWidth); + if (m_webFrame->d->marginHeight != -1) + frameView->setMarginHeight(m_webFrame->d->marginHeight); + if (m_webFrame->d->horizontalScrollBarPolicy != Qt::ScrollBarAsNeeded) + frameView->setHScrollbarMode((ScrollbarMode)m_webFrame->d->horizontalScrollBarPolicy); + if (m_webFrame->d->verticalScrollBarPolicy != Qt::ScrollBarAsNeeded) + frameView->setVScrollbarMode((ScrollbarMode)m_webFrame->d->verticalScrollBarPolicy); + + m_frame->setView(frameView); + // FrameViews are created with a ref count of 1. Release this ref since we've assigned it to frame. + frameView->deref(); + + if (m_frame->ownerRenderer()) + m_frame->ownerRenderer()->setWidget(frameView); } @@ -486,13 +515,11 @@ bool FrameLoaderClientQt::shouldGoToHistoryItem(WebCore::HistoryItem *item) cons void FrameLoaderClientQt::saveViewStateToItem(WebCore::HistoryItem*) { - notImplemented(); } bool FrameLoaderClientQt::canCachePage() const { - // don't do any caching for now - return false; + return true; } void FrameLoaderClientQt::setMainDocumentError(WebCore::DocumentLoader* loader, const WebCore::ResourceError& error)