[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

weinig at apple.com weinig at apple.com
Fri Jan 21 14:38:32 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit e3043f4559b0dd6bda36155de9abac9db97aa6c4
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Dec 23 20:10:01 2010 +0000

    WebKit2 needs to mirror the frame tree in the UIProcess
    https://bugs.webkit.org/show_bug.cgi?id=51546
    
    Reviewed by Darin Adler.
    
    WebCore:
    
    - Add client functions to notify that a frame has been added or
      removed from the page cache.
    
    * history/CachedFrame.cpp:
    (WebCore::CachedFrameBase::restore):
    (WebCore::CachedFrame::CachedFrame):
    * history/CachedFrame.h:
    * loader/EmptyClients.h:
    (WebCore::EmptyFrameLoaderClient::didSaveToPageCache):
    (WebCore::EmptyFrameLoaderClient::didRestoreFromPageCache):
    * loader/FrameLoaderClient.h:
    
    WebKit/chromium:
    
    - Add client functions to notify that a frame has been added or
      removed from the page cache.
    
    * src/FrameLoaderClientImpl.cpp:
    (WebKit::WebFrameLoaderClientImpl::didSaveToPageCache):
    (WebKit::WebFrameLoaderClientImpl::didRestoreFromPageCache):
    * src/FrameLoaderClientImpl.h:
    
    WebKit/efl:
    
    - Add client functions to notify that a frame has been added or
      removed from the page cache.
    
    * WebCoreSupport/FrameLoaderClientEfl.cpp:
    (WebCore::FrameLoaderClientEfl::didSaveToPageCache):
    (WebCore::FrameLoaderClientEfl::didRestoreFromPageCache):
    * WebCoreSupport/FrameLoaderClientEfl.h:
    
    WebKit/gtk:
    
    - Add client functions to notify that a frame has been added or
      removed from the page cache.
    
    * WebCoreSupport/FrameLoaderClientGtk.cpp:
    (WebKit::FrameLoaderClient::didSaveToPageCache):
    (WebKit::FrameLoaderClient::didRestoreFromPageCache):
    * WebCoreSupport/FrameLoaderClientGtk.h:
    
    WebKit/haiku:
    
    - Add client functions to notify that a frame has been added or
      removed from the page cache.
    
    * WebCoreSupport/FrameLoaderClientHaiku.cpp:
    (WebCore::FrameLoaderClientHaiku::didSaveToPageCache):
    (WebCore::FrameLoaderClientHaiku::didRestoreFromPageCache):
    * WebCoreSupport/FrameLoaderClientHaiku.h:
    
    WebKit/mac:
    
    - Add client functions to notify that a frame has been added or
      removed from the page cache.
    
    * WebCoreSupport/WebFrameLoaderClient.h:
    * WebCoreSupport/WebFrameLoaderClient.mm:
    (WebFrameLoaderClient::didSaveToPageCache):
    (WebFrameLoaderClient::didRestoreFromPageCache):
    
    WebKit/qt:
    
    - Add client functions to notify that a frame has been added or
      removed from the page cache.
    
    * WebCoreSupport/FrameLoaderClientQt.cpp:
    (WebCore::FrameLoaderClientQt::didSaveToPageCache):
    (WebCore::FrameLoaderClientQt::didRestoreFromPageCache):
    * WebCoreSupport/FrameLoaderClientQt.h:
    
    WebKit/win:
    
    - Add client functions to notify that a frame has been added or
      removed from the page cache.
    
    * WebCoreSupport/WebFrameLoaderClient.cpp:
    (WebFrameLoaderClient::didSaveToPageCache):
    (WebFrameLoaderClient::didRestoreFromPageCache):
    * WebCoreSupport/WebFrameLoaderClient.h:
    
    WebKit/wince:
    
    - Add client functions to notify that a frame has been added or
      removed from the page cache.
    
    * WebCoreSupport/FrameLoaderClientWinCE.cpp:
    (WebKit::FrameLoaderClientWinCE::didSaveToPageCache):
    (WebKit::FrameLoaderClientWinCE::didRestoreFromPageCache):
    * WebCoreSupport/FrameLoaderClientWinCE.h:
    
    WebKit/wx:
    
    - Add client functions to notify that a frame has been added or
      removed from the page cache.
    
    * WebKitSupport/FrameLoaderClientWx.cpp:
    (WebCore::FrameLoaderClientWx::didSaveToPageCache):
    (WebCore::FrameLoaderClientWx::didRestoreFromPageCache):
    * WebKitSupport/FrameLoaderClientWx.h:
    
    WebKit2:
    
    * UIProcess/API/C/WKFrame.cpp:
    (WKFrameCopyChildFrames):
    * UIProcess/API/C/WKFrame.h:
    Add API to get the child frames of a frame.
    
    * UIProcess/WebFrameProxy.cpp:
    (WebKit::WebFrameProxy::WebFrameProxy):
    (WebKit::WebFrameProxy::disconnect):
    (WebKit::WebFrameProxy::appendChild):
    (WebKit::WebFrameProxy::removeChild):
    (WebKit::WebFrameProxy::isDescendantOf):
    (WebKit::WebFrameProxy::dumpFrameTree):
    (WebKit::WebFrameProxy::didRemoveFromHierarchy):
    (WebKit::WebFrameProxy::childFrames):
    * UIProcess/WebFrameProxy.h:
    (WebKit::WebFrameProxy::parentFrame): Add getter.
    (WebKit::WebFrameProxy::nextSibling): Add getter.
    (WebKit::WebFrameProxy::previousSibling): Add getter.
    (WebKit::WebFrameProxy::firstChild): Add getter.
    (WebKit::WebFrameProxy::lastChild): Add getter.
    Make frames keep track of their subframes.
    
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::didCreateSubframe):
    Use the now passed parentID to insert the frame into the hierarchy
    
    (WebKit::WebPageProxy::didSaveFrameToPageCache):
    When a frame is added to the page cache, remove it from the hierarchy.
    
    (WebKit::WebPageProxy::didRestoreFrameFromPageCache):
    When a frame is restored from the page cache, add it back to the hierarchy.
    
    (WebKit::WebPageProxy::didRemoveFrameFromHierarchy):
    Detached frames should also be removed from the hierarchy.
    
    * UIProcess/WebPageProxy.h:
    Add new declarations for didSaveFrameToPageCache and didRestoreFrameFromPageCache.
    
    * UIProcess/WebPageProxy.messages.in:
    Add messages for DidSaveFrameToPageCache and DidRestoreFrameFromPageCache.
    
    * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
    (WebKit::WebFrameLoaderClient::savePlatformDataToCachedFrame):
    (WebKit::WebFrameLoaderClient::transitionToCommittedFromCachedFrame):
    Remove notImplemented, there is no work we need to do here.
    
    (WebKit::WebFrameLoaderClient::didSaveToPageCache):
    (WebKit::WebFrameLoaderClient::didRestoreFromPageCache):
    Send message to UIProcess to indicate this happened.
    * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
    
    * WebProcess/WebPage/WebFrame.cpp:
    (WebKit::WebFrame::createSubframe):
    Send parent frameID in addition to our own in the message to UIProcess.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74571 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 50bda84..5e36032 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-12-22  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        WebKit2 needs to mirror the frame tree in the UIProcess
+        https://bugs.webkit.org/show_bug.cgi?id=51546
+
+        - Add client functions to notify that a frame has been added or
+          removed from the page cache.
+
+        * history/CachedFrame.cpp:
+        (WebCore::CachedFrameBase::restore):
+        (WebCore::CachedFrame::CachedFrame):
+        * history/CachedFrame.h:
+        * loader/EmptyClients.h:
+        (WebCore::EmptyFrameLoaderClient::didSaveToPageCache):
+        (WebCore::EmptyFrameLoaderClient::didRestoreFromPageCache):
+        * loader/FrameLoaderClient.h:
+
 2010-12-22  Matthew Delaney  <mdelaney at apple.com>
 
         Reviewed by Simon Fraser.
diff --git a/WebCore/history/CachedFrame.cpp b/WebCore/history/CachedFrame.cpp
index f2ce27d..d21f958 100644
--- a/WebCore/history/CachedFrame.cpp
+++ b/WebCore/history/CachedFrame.cpp
@@ -98,6 +98,8 @@ void CachedFrameBase::restore()
     // cached page.
     frame->script()->updatePlatformScriptObjects();
 
+    frame->loader()->client()->didRestoreFromPageCache();
+
     // Reconstruct the FrameTree
     for (unsigned i = 0; i < m_childFrames.size(); ++i)
         frame->tree()->appendChild(m_childFrames[i]->view()->frame());
@@ -157,6 +159,8 @@ CachedFrame::CachedFrame(Frame* frame)
     if (!m_isMainFrame)
         frame->page()->decrementFrameCount();
 
+    frame->loader()->client()->didSaveToPageCache();
+
 #ifndef NDEBUG
     if (m_isMainFrame)
         LOG(PageCache, "Finished creating CachedFrame for main frame url '%s' and DocumentLoader %p\n", m_url.string().utf8().data(), m_documentLoader.get());
diff --git a/WebCore/history/CachedFrame.h b/WebCore/history/CachedFrame.h
index 884a601..b0d0d29 100644
--- a/WebCore/history/CachedFrame.h
+++ b/WebCore/history/CachedFrame.h
@@ -81,6 +81,7 @@ public:
 
     using CachedFrameBase::document;
     using CachedFrameBase::view;
+    using CachedFrameBase::url;
     DocumentLoader* documentLoader() const { return m_documentLoader.get(); }
     Node* mousePressNode() const { return m_mousePressNode.get(); }
 
diff --git a/WebCore/loader/EmptyClients.h b/WebCore/loader/EmptyClients.h
index b0f18fa..560ea91 100644
--- a/WebCore/loader/EmptyClients.h
+++ b/WebCore/loader/EmptyClients.h
@@ -333,6 +333,9 @@ public:
     virtual void transitionToCommittedFromCachedFrame(CachedFrame*) { }
     virtual void transitionToCommittedForNewPage() { }    
 
+    virtual void didSaveToPageCache() { }
+    virtual void didRestoreFromPageCache() { }
+
     virtual void dispatchDidBecomeFrameset(bool) { }
 
     virtual void updateGlobalHistory() { }
diff --git a/WebCore/loader/FrameLoaderClient.h b/WebCore/loader/FrameLoaderClient.h
index c8fc715..cfec872 100644
--- a/WebCore/loader/FrameLoaderClient.h
+++ b/WebCore/loader/FrameLoaderClient.h
@@ -224,6 +224,9 @@ namespace WebCore {
         virtual void transitionToCommittedFromCachedFrame(CachedFrame*) = 0;
         virtual void transitionToCommittedForNewPage() = 0;
 
+        virtual void didSaveToPageCache() = 0;
+        virtual void didRestoreFromPageCache() = 0;
+
         virtual void dispatchDidBecomeFrameset(bool) = 0; // Can change due to navigation or DOM modification.
 
         virtual bool canCachePage() const = 0;
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 2a61a5e..0244418 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,18 @@
+2010-12-22  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        WebKit2 needs to mirror the frame tree in the UIProcess
+        https://bugs.webkit.org/show_bug.cgi?id=51546
+
+        - Add client functions to notify that a frame has been added or
+          removed from the page cache.
+
+        * src/FrameLoaderClientImpl.cpp:
+        (WebKit::WebFrameLoaderClientImpl::didSaveToPageCache):
+        (WebKit::WebFrameLoaderClientImpl::didRestoreFromPageCache):
+        * src/FrameLoaderClientImpl.h:
+
 2010-12-20  Adrienne Walker  <enne at google.com>
 
         Reviewed by Kenneth Russell.
diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/WebKit/chromium/src/FrameLoaderClientImpl.cpp
index 9beef26..781b7f4 100644
--- a/WebKit/chromium/src/FrameLoaderClientImpl.cpp
+++ b/WebKit/chromium/src/FrameLoaderClientImpl.cpp
@@ -1349,6 +1349,14 @@ void FrameLoaderClientImpl::transitionToCommittedForNewPage()
     makeDocumentView();
 }
 
+void WebFrameLoaderClientImpl::didSaveToPageCache()
+{
+}
+
+void WebFrameLoaderClientImpl::didRestoreFromPageCache()
+{
+}
+
 void FrameLoaderClientImpl::dispatchDidBecomeFrameset(bool)
 {
 }
diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.h b/WebKit/chromium/src/FrameLoaderClientImpl.h
index ef00ed3..1d7a741 100644
--- a/WebKit/chromium/src/FrameLoaderClientImpl.h
+++ b/WebKit/chromium/src/FrameLoaderClientImpl.h
@@ -169,6 +169,8 @@ public:
     virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*);
     virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*);
     virtual void transitionToCommittedForNewPage();
+    virtual void didSaveToPageCache();
+    virtual void didRestoreFromPageCache();
     virtual void dispatchDidBecomeFrameset(bool);
     virtual bool canCachePage() const;
     virtual void download(
diff --git a/WebKit/efl/ChangeLog b/WebKit/efl/ChangeLog
index 6f59f0f..f60f64e 100644
--- a/WebKit/efl/ChangeLog
+++ b/WebKit/efl/ChangeLog
@@ -1,3 +1,18 @@
+2010-12-22  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        WebKit2 needs to mirror the frame tree in the UIProcess
+        https://bugs.webkit.org/show_bug.cgi?id=51546
+
+        - Add client functions to notify that a frame has been added or
+          removed from the page cache.
+
+        * WebCoreSupport/FrameLoaderClientEfl.cpp:
+        (WebCore::FrameLoaderClientEfl::didSaveToPageCache):
+        (WebCore::FrameLoaderClientEfl::didRestoreFromPageCache):
+        * WebCoreSupport/FrameLoaderClientEfl.h:
+
 2010-12-22  Ryosuke Niwa  <rniwa at webkit.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp b/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp
index 627c1b9..929b269 100644
--- a/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp
+++ b/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp
@@ -923,6 +923,14 @@ void FrameLoaderClientEfl::transitionToCommittedForNewPage()
         ewk_view_frame_main_cleared(m_view);
 }
 
+void FrameLoaderClientEfl::didSaveToPageCache()
+{
+}
+
+void FrameLoaderClientEfl::didRestoreFromPageCache()
+{
+}
+
 void FrameLoaderClientEfl::dispatchDidBecomeFrameset(bool)
 {
 }
diff --git a/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h b/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h
index e138139..cf7bdf0 100644
--- a/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h
+++ b/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h
@@ -200,6 +200,9 @@ class FrameLoaderClientEfl : public FrameLoaderClient {
     virtual void transitionToCommittedFromCachedFrame(CachedFrame*);
     virtual void transitionToCommittedForNewPage();
 
+    virtual void didSaveToPageCache();
+    virtual void didRestoreFromPageCache();
+
     virtual void dispatchDidBecomeFrameset(bool);
 
     virtual bool canCachePage() const;
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index 59f09af..2bded53 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,18 @@
+2010-12-22  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        WebKit2 needs to mirror the frame tree in the UIProcess
+        https://bugs.webkit.org/show_bug.cgi?id=51546
+
+        - Add client functions to notify that a frame has been added or
+          removed from the page cache.
+
+        * WebCoreSupport/FrameLoaderClientGtk.cpp:
+        (WebKit::FrameLoaderClient::didSaveToPageCache):
+        (WebKit::FrameLoaderClient::didRestoreFromPageCache):
+        * WebCoreSupport/FrameLoaderClientGtk.h:
+
 2010-12-22  Xan Lopez  <xlopez at igalia.com>
 
         Reviewed by Gustavo Noronha.
diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
index 9bac2d0..895e64e 100644
--- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
@@ -1341,6 +1341,14 @@ void FrameLoaderClient::transitionToCommittedForNewPage()
     postCommitFrameViewSetup(m_frame, frame->view(), true);
 }
 
+void FrameLoaderClient::didSaveToPageCache()
+{
+}
+
+void FrameLoaderClient::didRestoreFromPageCache()
+{
+}
+
 void FrameLoaderClient::dispatchDidBecomeFrameset(bool)
 {
 }
diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h
index ffb3c56..d8d3684 100644
--- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h
+++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h
@@ -181,6 +181,9 @@ namespace WebKit {
         virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*);
         virtual void transitionToCommittedForNewPage();
 
+        virtual void didSaveToPageCache();
+        virtual void didRestoreFromPageCache();
+
         virtual void dispatchDidBecomeFrameset(bool);
 
         virtual bool canCachePage() const;
diff --git a/WebKit/haiku/ChangeLog b/WebKit/haiku/ChangeLog
index f4f6801..4315bb5 100644
--- a/WebKit/haiku/ChangeLog
+++ b/WebKit/haiku/ChangeLog
@@ -1,3 +1,18 @@
+2010-12-22  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        WebKit2 needs to mirror the frame tree in the UIProcess
+        https://bugs.webkit.org/show_bug.cgi?id=51546
+
+        - Add client functions to notify that a frame has been added or
+          removed from the page cache.
+
+        * WebCoreSupport/FrameLoaderClientHaiku.cpp:
+        (WebCore::FrameLoaderClientHaiku::didSaveToPageCache):
+        (WebCore::FrameLoaderClientHaiku::didRestoreFromPageCache):
+        * WebCoreSupport/FrameLoaderClientHaiku.h:
+
 2010-12-22  Ryosuke Niwa  <rniwa at webkit.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp b/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp
index 74625c5..48c65a1 100644
--- a/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp
+++ b/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp
@@ -857,6 +857,14 @@ void FrameLoaderClientHaiku::transitionToCommittedForNewPage()
         m_frame->view()->setScrollbarModes(owner->scrollingMode(), owner->scrollingMode());
 }
 
+void FrameLoaderClientHaiku::didSaveToPageCache()
+{
+}
+
+void FrameLoaderClientHaiku::didRestoreFromPageCache()
+{
+}
+
 void FrameLoaderClientHaiku::dispatchDidBecomeFrameset(bool)
 {
 }
diff --git a/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.h b/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.h
index dcdb1a0..e54ba03 100644
--- a/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.h
+++ b/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.h
@@ -151,6 +151,9 @@ namespace WebCore {
         virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*);
         virtual void transitionToCommittedForNewPage();
 
+        virtual void didSaveToPageCache();
+        virtual void didRestoreFromPageCache();
+
         virtual void dispatchDidBecomeFrameset(bool);
 
         virtual void updateGlobalHistory();
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index ac4abdb..329743b 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,18 @@
+2010-12-22  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        WebKit2 needs to mirror the frame tree in the UIProcess
+        https://bugs.webkit.org/show_bug.cgi?id=51546
+
+        - Add client functions to notify that a frame has been added or
+          removed from the page cache.
+
+        * WebCoreSupport/WebFrameLoaderClient.h:
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (WebFrameLoaderClient::didSaveToPageCache):
+        (WebFrameLoaderClient::didRestoreFromPageCache):
+
 2010-12-22  Ryosuke Niwa  <rniwa at webkit.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
index 2b3b2cc..b9980a4 100644
--- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
+++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
@@ -175,6 +175,9 @@ private:
     virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*);
     virtual void transitionToCommittedForNewPage();
 
+    virtual void didSaveToPageCache();
+    virtual void didRestoreFromPageCache();
+
     virtual void dispatchDidBecomeFrameset(bool);
 
     virtual bool canHandleRequest(const WebCore::ResourceRequest&) const;
diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
index c8285dc..3198a30 100644
--- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
@@ -1253,6 +1253,14 @@ void WebFrameLoaderClient::transitionToCommittedForNewPage()
     }
 }
 
+void WebFrameLoaderClient::didSaveToPageCache()
+{
+}
+
+void WebFrameLoaderClient::didRestoreFromPageCache()
+{
+}
+
 void WebFrameLoaderClient::dispatchDidBecomeFrameset(bool)
 {
 }
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index f4d8747..e96bdbc 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,18 @@
+2010-12-22  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        WebKit2 needs to mirror the frame tree in the UIProcess
+        https://bugs.webkit.org/show_bug.cgi?id=51546
+
+        - Add client functions to notify that a frame has been added or
+          removed from the page cache.
+
+        * WebCoreSupport/FrameLoaderClientQt.cpp:
+        (WebCore::FrameLoaderClientQt::didSaveToPageCache):
+        (WebCore::FrameLoaderClientQt::didRestoreFromPageCache):
+        * WebCoreSupport/FrameLoaderClientQt.h:
+
 2010-12-22  Ryosuke Niwa  <rniwa at webkit.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index 849958f..fbf3e89 100644
--- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
@@ -295,6 +295,14 @@ void FrameLoaderClientQt::transitionToCommittedForNewPage()
     m_frame->view()->setActualVisibleContentRect(IntRect(IntPoint::zero(), currentVisibleContentSize));
 }
 
+void FrameLoaderClientQt::didSaveToPageCache()
+{
+}
+
+void FrameLoaderClientQt::didRestoreFromPageCache()
+{
+}
+
 void FrameLoaderClientQt::dispatchDidBecomeFrameset(bool)
 {
 }
diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
index 275b0e8..3d93eaf 100644
--- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
+++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
@@ -193,6 +193,9 @@ public:
     virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*);
     virtual void transitionToCommittedForNewPage();
 
+    virtual void didSaveToPageCache();
+    virtual void didRestoreFromPageCache();
+
     virtual void dispatchDidBecomeFrameset(bool);
 
     virtual bool canCachePage() const;
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 57fbf08..5e586d3 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,18 @@
+2010-12-22  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        WebKit2 needs to mirror the frame tree in the UIProcess
+        https://bugs.webkit.org/show_bug.cgi?id=51546
+
+        - Add client functions to notify that a frame has been added or
+          removed from the page cache.
+
+        * WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebFrameLoaderClient::didSaveToPageCache):
+        (WebFrameLoaderClient::didRestoreFromPageCache):
+        * WebCoreSupport/WebFrameLoaderClient.h:
+
 2010-12-22  Dan Bernstein  <mitz at apple.com>
 
         Changed WebKitTools to Tools.
diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
index 24f97ca..7fd2b98 100644
--- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -720,6 +720,14 @@ void WebFrameLoaderClient::transitionToCommittedForNewPage()
     core(m_webFrame)->createView(IntRect(rect).size(), backgroundColor, transparent, IntSize(), false);
 }
 
+void WebFrameLoaderClient::didSaveToPageCache()
+{
+}
+
+void WebFrameLoaderClient::didRestoreFromPageCache()
+{
+}
+
 void WebFrameLoaderClient::dispatchDidBecomeFrameset(bool)
 {
 }
diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h
index 981daec..573b58f 100644
--- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h
+++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h
@@ -108,6 +108,9 @@ public:
     virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*);
     virtual void transitionToCommittedForNewPage();
 
+    virtual void didSaveToPageCache();
+    virtual void didRestoreFromPageCache();
+
     virtual void dispatchDidBecomeFrameset(bool);
 
     virtual bool canCachePage() const;
diff --git a/WebKit/wince/ChangeLog b/WebKit/wince/ChangeLog
index bccf658..436e9e6 100644
--- a/WebKit/wince/ChangeLog
+++ b/WebKit/wince/ChangeLog
@@ -1,3 +1,18 @@
+2010-12-22  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        WebKit2 needs to mirror the frame tree in the UIProcess
+        https://bugs.webkit.org/show_bug.cgi?id=51546
+
+        - Add client functions to notify that a frame has been added or
+          removed from the page cache.
+
+        * WebCoreSupport/FrameLoaderClientWinCE.cpp:
+        (WebKit::FrameLoaderClientWinCE::didSaveToPageCache):
+        (WebKit::FrameLoaderClientWinCE::didRestoreFromPageCache):
+        * WebCoreSupport/FrameLoaderClientWinCE.h:
+
 2010-12-22  Ryosuke Niwa  <rniwa at webkit.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.cpp b/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.cpp
index f3643b2..6a8fb74 100644
--- a/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.cpp
+++ b/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.cpp
@@ -630,6 +630,14 @@ void FrameLoaderClientWinCE::transitionToCommittedForNewPage()
         m_frame->ownerRenderer()->setWidget(frameView);
 }
 
+void FrameLoaderClientWinCE::didSaveToPageCache()
+{
+}
+
+void FrameLoaderClientWinCE::didRestoreFromPageCache()
+{
+}
+
 void FrameLoaderClientWinCE::dispatchDidBecomeFrameset(bool)
 {
 }
diff --git a/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.h b/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.h
index 46b3a19..c4dcf6d 100644
--- a/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.h
+++ b/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.h
@@ -175,6 +175,9 @@ public:
     virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*);
     virtual void transitionToCommittedForNewPage();
 
+    virtual void didSaveToPageCache();
+    virtual void didRestoreFromPageCache();
+
     virtual void dispatchDidBecomeFrameset(bool);
 
     virtual bool canCachePage() const;
diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog
index a40fc5c..2e596bd 100644
--- a/WebKit/wx/ChangeLog
+++ b/WebKit/wx/ChangeLog
@@ -1,3 +1,18 @@
+2010-12-22  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        WebKit2 needs to mirror the frame tree in the UIProcess
+        https://bugs.webkit.org/show_bug.cgi?id=51546
+
+        - Add client functions to notify that a frame has been added or
+          removed from the page cache.
+
+        * WebKitSupport/FrameLoaderClientWx.cpp:
+        (WebCore::FrameLoaderClientWx::didSaveToPageCache):
+        (WebCore::FrameLoaderClientWx::didRestoreFromPageCache):
+        * WebKitSupport/FrameLoaderClientWx.h:
+
 2010-12-20  Eric Seidel  <eric at webkit.org>
 
         Unreviewed.
diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp
index 8748a98..362c726 100644
--- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp
+++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp
@@ -966,6 +966,14 @@ void FrameLoaderClientWx::transitionToCommittedForNewPage()
         m_frame->createView(size, backgroundColor, transparent, IntSize(), false); 
 }
 
+void FrameLoaderClientWx::didSaveToPageCache()
+{
+}
+
+void FrameLoaderClientWx::didRestoreFromPageCache()
+{
+}
+
 void FrameLoaderClientWx::dispatchDidBecomeFrameset(bool)
 {
 }
diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h
index cb34b0f..b56a900 100644
--- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h
+++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h
@@ -151,7 +151,10 @@ namespace WebCore {
         virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*);
         virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*);
         virtual void transitionToCommittedForNewPage();
-        
+
+        virtual void didSaveToPageCache();
+        virtual void didRestoreFromPageCache();
+
         virtual void dispatchDidBecomeFrameset(bool);
 
         virtual void updateGlobalHistory();
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 5fb9677..ec159cc 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,65 @@
+2010-12-22  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        WebKit2 needs to mirror the frame tree in the UIProcess
+        https://bugs.webkit.org/show_bug.cgi?id=51546
+
+        * UIProcess/API/C/WKFrame.cpp:
+        (WKFrameCopyChildFrames):
+        * UIProcess/API/C/WKFrame.h:
+        Add API to get the child frames of a frame.
+
+        * UIProcess/WebFrameProxy.cpp:
+        (WebKit::WebFrameProxy::WebFrameProxy):
+        (WebKit::WebFrameProxy::disconnect):
+        (WebKit::WebFrameProxy::appendChild):
+        (WebKit::WebFrameProxy::removeChild):
+        (WebKit::WebFrameProxy::isDescendantOf):
+        (WebKit::WebFrameProxy::dumpFrameTree):
+        (WebKit::WebFrameProxy::didRemoveFromHierarchy):
+        (WebKit::WebFrameProxy::childFrames):
+        * UIProcess/WebFrameProxy.h:
+        (WebKit::WebFrameProxy::parentFrame): Add getter.
+        (WebKit::WebFrameProxy::nextSibling): Add getter.
+        (WebKit::WebFrameProxy::previousSibling): Add getter.
+        (WebKit::WebFrameProxy::firstChild): Add getter.
+        (WebKit::WebFrameProxy::lastChild): Add getter.
+        Make frames keep track of their subframes.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didCreateSubframe):
+        Use the now passed parentID to insert the frame into the hierarchy
+
+        (WebKit::WebPageProxy::didSaveFrameToPageCache):
+        When a frame is added to the page cache, remove it from the hierarchy.
+
+        (WebKit::WebPageProxy::didRestoreFrameFromPageCache):
+        When a frame is restored from the page cache, add it back to the hierarchy.
+
+        (WebKit::WebPageProxy::didRemoveFrameFromHierarchy):
+        Detached frames should also be removed from the hierarchy.
+
+        * UIProcess/WebPageProxy.h:
+        Add new declarations for didSaveFrameToPageCache and didRestoreFrameFromPageCache.
+
+        * UIProcess/WebPageProxy.messages.in:
+        Add messages for DidSaveFrameToPageCache and DidRestoreFrameFromPageCache.
+
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::savePlatformDataToCachedFrame): 
+        (WebKit::WebFrameLoaderClient::transitionToCommittedFromCachedFrame):
+        Remove notImplemented, there is no work we need to do here.
+
+        (WebKit::WebFrameLoaderClient::didSaveToPageCache): 
+        (WebKit::WebFrameLoaderClient::didRestoreFromPageCache):
+        Send message to UIProcess to indicate this happened.
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+
+        * WebProcess/WebPage/WebFrame.cpp:
+        (WebKit::WebFrame::createSubframe):
+        Send parent frameID in addition to our own in the message to UIProcess.
+
 2010-12-23  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKit2/UIProcess/API/C/WKFrame.cpp b/WebKit2/UIProcess/API/C/WKFrame.cpp
index 5fee675..7c9ae11 100644
--- a/WebKit2/UIProcess/API/C/WKFrame.cpp
+++ b/WebKit2/UIProcess/API/C/WKFrame.cpp
@@ -90,6 +90,11 @@ WKPageRef WKFrameGetPage(WKFrameRef frameRef)
     return toAPI(toImpl(frameRef)->page());
 }
 
+WKArrayRef WKFrameCopyChildFrames(WKFrameRef frameRef)
+{
+    return toAPI(toImpl(frameRef)->childFrames().releaseRef());
+}
+
 WKCertificateInfoRef WKFrameGetCertificateInfo(WKFrameRef frameRef)
 {
     return toAPI(toImpl(frameRef)->certificateInfo());
diff --git a/WebKit2/UIProcess/API/C/WKFrame.h b/WebKit2/UIProcess/API/C/WKFrame.h
index b9e31d8..f812aeb 100644
--- a/WebKit2/UIProcess/API/C/WKFrame.h
+++ b/WebKit2/UIProcess/API/C/WKFrame.h
@@ -56,6 +56,8 @@ WK_EXPORT WKStringRef WKFrameCopyTitle(WKFrameRef frame);
 
 WK_EXPORT WKPageRef WKFrameGetPage(WKFrameRef frame);
 
+WK_EXPORT WKArrayRef WKFrameCopyChildFrames(WKFrameRef frame);
+
 WK_EXPORT WKCertificateInfoRef WKFrameGetCertificateInfo(WKFrameRef frame);
 
 WK_EXPORT bool WKFrameCanProvideSource(WKFrameRef frame);
diff --git a/WebKit2/UIProcess/WebFrameProxy.cpp b/WebKit2/UIProcess/WebFrameProxy.cpp
index 9d50ba0..23dc740 100644
--- a/WebKit2/UIProcess/WebFrameProxy.cpp
+++ b/WebKit2/UIProcess/WebFrameProxy.cpp
@@ -35,11 +35,17 @@
 #include <wtf/text/WTFString.h>
 
 using namespace WebCore;
+using namespace std;
 
 namespace WebKit {
 
 WebFrameProxy::WebFrameProxy(WebPageProxy* page, uint64_t frameID)
     : m_page(page)
+    , m_parentFrame(0)
+    , m_nextSibling(0)
+    , m_previousSibling(0)
+    , m_firstChild(0)
+    , m_lastChild(0)
     , m_loadState(LoadStateFinished)
     , m_isFrameSet(false)
     , m_frameID(frameID)
@@ -55,6 +61,12 @@ WebFrameProxy::~WebFrameProxy()
 void WebFrameProxy::disconnect()
 {
     m_page = 0;
+    m_parentFrame = 0;
+    m_nextSibling = 0;
+    m_previousSibling = 0;
+    m_firstChild = 0;
+    m_lastChild = 0;
+
     if (m_activeListener) {
         m_activeListener->invalidate();
         m_activeListener = 0;
@@ -168,6 +180,85 @@ void WebFrameProxy::didChangeTitle(const String& title)
     m_title = title;
 }
 
+void WebFrameProxy::appendChild(WebFrameProxy* child)
+{
+    ASSERT(child->page() == page());
+    ASSERT(!child->m_parentFrame);
+    ASSERT(!child->m_nextSibling);
+    ASSERT(!child->m_previousSibling);
+
+    child->m_parentFrame = this;
+
+    ASSERT(!m_lastChild->m_nextSibling);
+    WebFrameProxy* oldLast = m_lastChild;
+    m_lastChild = child;
+
+    if (oldLast) {
+        child->m_previousSibling = oldLast;
+        oldLast->m_nextSibling = child;
+    } else
+        m_firstChild = child;
+}
+
+void WebFrameProxy::removeChild(WebFrameProxy* child)
+{
+    child->m_parentFrame = 0;
+
+    WebFrameProxy*& newLocationForNext = m_firstChild == child ? m_firstChild : child->m_previousSibling->m_nextSibling;
+    WebFrameProxy*& newLocationForPrevious = m_lastChild == child ? m_lastChild : child->m_nextSibling->m_previousSibling;
+    swap(newLocationForNext, child->m_nextSibling);
+    swap(newLocationForPrevious, child->m_previousSibling);
+    child->m_previousSibling = 0;
+    child->m_nextSibling = 0;
+}
+
+bool WebFrameProxy::isDescendantOf(const WebFrameProxy* ancestor) const
+{
+    if (!ancestor)
+        return false;
+
+    if (m_page != ancestor->m_page)
+        return false;
+
+    for (const WebFrameProxy* frame = this; frame; frame = frame->m_parentFrame) {
+        if (frame == ancestor)
+            return true;
+    }
+
+    return false;
+}
+
+void WebFrameProxy::dumpFrameTreeToSTDOUT(unsigned indent)
+{
+    if (!indent && m_parentFrame)
+        printf("NOTE: Printing subtree.\n");
+
+    for (unsigned i = 0; i < indent; ++i)
+        printf(" ");
+    printf("| FRAME %d %s\n", (int)m_frameID, m_url.utf8().data());
+
+    for (WebFrameProxy* child = m_firstChild; child; child = child->m_nextSibling)
+        child->dumpFrameTreeToSTDOUT(indent + 4);
+}
+
+void WebFrameProxy::didRemoveFromHierarchy()
+{
+    if (m_parentFrame)
+        m_parentFrame->removeChild(this);
+}
+
+PassRefPtr<ImmutableArray> WebFrameProxy::childFrames()
+{
+    if (!m_firstChild)
+        return ImmutableArray::create();
+
+    Vector<RefPtr<APIObject> > vector;
+    for (WebFrameProxy* child = m_firstChild; child; child = child->m_nextSibling)
+        vector.append(child);
+
+    return ImmutableArray::adopt(vector);
+}
+
 void WebFrameProxy::receivedPolicyDecision(WebCore::PolicyAction action, uint64_t listenerID)
 {
     if (!m_page)
diff --git a/WebKit2/UIProcess/WebFrameProxy.h b/WebKit2/UIProcess/WebFrameProxy.h
index c8fc008..84c1eb8 100644
--- a/WebKit2/UIProcess/WebFrameProxy.h
+++ b/WebKit2/UIProcess/WebFrameProxy.h
@@ -27,6 +27,7 @@
 #define WebFrameProxy_h
 
 #include "APIObject.h"
+#include "ImmutableArray.h"
 #include "GenericCallback.h"
 #include "WebFrameListenerProxy.h"
 #include <WebCore/FrameLoaderTypes.h>
@@ -42,6 +43,7 @@ namespace CoreIPC {
 
 namespace WebKit {
 
+class ImmutableArray;
 class PlatformCertificateInfo;
 class WebCertificateInfo;
 class WebFormSubmissionListenerProxy;
@@ -58,6 +60,7 @@ public:
     {
         return adoptRef(new WebFrameProxy(page, frameID));
     }
+
     virtual ~WebFrameProxy();
 
     enum LoadState {
@@ -69,6 +72,12 @@ public:
     uint64_t frameID() const { return m_frameID; }
     WebPageProxy* page() { return m_page; }
 
+    WebFrameProxy* parentFrame() { return m_parentFrame; }
+    WebFrameProxy* nextSibling() { return m_nextSibling; }
+    WebFrameProxy* previousSibling() { return m_previousSibling; }
+    WebFrameProxy* firstChild() { return m_firstChild; }
+    WebFrameProxy* lastChild() { return m_lastChild; }
+
     void disconnect();
 
     bool isMainFrame() const;
@@ -108,6 +117,15 @@ public:
     void didSameDocumentNavigation(const String&); // eg. anchor navigation, session state change.
     void didChangeTitle(const String&);
 
+    // Frame tree operations.
+    void appendChild(WebFrameProxy*);
+    void removeChild(WebFrameProxy*);
+    void didRemoveFromHierarchy();
+    PassRefPtr<ImmutableArray> childFrames();
+    bool isDescendantOf(const WebFrameProxy* ancestor) const;
+    void dumpFrameTreeToSTDOUT(unsigned indent = 0);
+
+    // Policy operations.
     void receivedPolicyDecision(WebCore::PolicyAction, uint64_t listenerID);
     WebFramePolicyListenerProxy* setUpPolicyListenerProxy(uint64_t listenerID);
     WebFormSubmissionListenerProxy* setUpFormSubmissionListenerProxy(uint64_t listenerID);
@@ -118,6 +136,12 @@ private:
     virtual Type type() const { return APIType; }
 
     WebPageProxy* m_page;
+    WebFrameProxy* m_parentFrame;
+    WebFrameProxy* m_nextSibling;
+    WebFrameProxy* m_previousSibling;
+    WebFrameProxy* m_firstChild;
+    WebFrameProxy* m_lastChild;
+
     LoadState m_loadState;
     String m_url;
     String m_provisionalURL;
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 6f780d5..aa233c9 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -912,15 +912,51 @@ void WebPageProxy::didCreateMainFrame(uint64_t frameID)
     process()->frameCreated(frameID, m_mainFrame.get());
 }
 
-void WebPageProxy::didCreateSubFrame(uint64_t frameID)
+void WebPageProxy::didCreateSubframe(uint64_t frameID, uint64_t parentFrameID)
 {
     MESSAGE_CHECK(m_mainFrame);
+
+    WebFrameProxy* parentFrame = process()->webFrame(parentFrameID);
+    MESSAGE_CHECK(parentFrame);
+    MESSAGE_CHECK(parentFrame->isDescendantOf(m_mainFrame.get()));
+
     MESSAGE_CHECK(process()->canCreateFrame(frameID));
     
     RefPtr<WebFrameProxy> subFrame = WebFrameProxy::create(this, frameID);
 
     // Add the frame to the process wide map.
     process()->frameCreated(frameID, subFrame.get());
+
+    // Insert the frame into the frame hierarchy.
+    parentFrame->appendChild(subFrame.get());
+}
+
+void WebPageProxy::didSaveFrameToPageCache(uint64_t frameID)
+{
+    MESSAGE_CHECK(m_mainFrame);
+
+    WebFrameProxy* subframe = process()->webFrame(frameID);
+    MESSAGE_CHECK(subframe);
+    MESSAGE_CHECK(subframe->isDescendantOf(m_mainFrame.get()));
+
+    subframe->didRemoveFromHierarchy();
+}
+
+void WebPageProxy::didRestoreFrameFromPageCache(uint64_t frameID, uint64_t parentFrameID)
+{
+    MESSAGE_CHECK(m_mainFrame);
+
+    WebFrameProxy* subframe = process()->webFrame(frameID);
+    MESSAGE_CHECK(subframe);
+    MESSAGE_CHECK(!subframe->parentFrame());
+    MESSAGE_CHECK(subframe->page() == m_mainFrame->page());
+
+    WebFrameProxy* parentFrame = process()->webFrame(parentFrameID);
+    MESSAGE_CHECK(parentFrame);
+    MESSAGE_CHECK(parentFrame->isDescendantOf(m_mainFrame.get()));
+
+    // Insert the frame into the frame hierarchy.
+    parentFrame->appendChild(subframe);
 }
 
 void WebPageProxy::didStartProgress()
@@ -1120,6 +1156,8 @@ void WebPageProxy::didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::Argume
     WebFrameProxy* frame = process()->webFrame(frameID);
     MESSAGE_CHECK(frame);
 
+    frame->didRemoveFromHierarchy();
+
     m_loaderClient.didRemoveFrameFromHierarchy(this, frame, userData.get());
 }
 
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index cff9fc5..0163332 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -312,7 +312,9 @@ private:
     CoreIPC::SyncReplyMode didReceiveSyncWebPageProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
 
     void didCreateMainFrame(uint64_t frameID);
-    void didCreateSubFrame(uint64_t frameID);
+    void didCreateSubframe(uint64_t frameID, uint64_t parentFrameID);
+    void didSaveFrameToPageCache(uint64_t frameID);
+    void didRestoreFrameFromPageCache(uint64_t frameID, uint64_t parentFrameID);
 
     void didStartProvisionalLoadForFrame(uint64_t frameID, const String&, bool loadingSubstituteDataForUnreachableURL, CoreIPC::ArgumentDecoder*);
     void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, const String&, CoreIPC::ArgumentDecoder*);
diff --git a/WebKit2/UIProcess/WebPageProxy.messages.in b/WebKit2/UIProcess/WebPageProxy.messages.in
index ce2d0b4..cbecd10 100644
--- a/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -73,7 +73,9 @@ messages -> WebPageProxy {
 
     # Frame lifetime messages.
     DidCreateMainFrame(uint64_t frameID)
-    DidCreateSubFrame(uint64_t frameID)
+    DidCreateSubframe(uint64_t frameID, uint64_t parentFrameID)
+    DidSaveFrameToPageCache(uint64_t frameID);
+    DidRestoreFrameFromPageCache(uint64_t frameID, uint64_t parentFrameID);
 
     # Frame load messages.
     DidCommitLoadForFrame(uint64_t frameID, WTF::String mimeType, bool hasCustomRepresentation, WebKit::PlatformCertificateInfo certificateInfo, WebKit::InjectedBundleUserMessageEncoder userData)
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
index 96182e3..be10517 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -1043,12 +1043,10 @@ String WebFrameLoaderClient::userAgent(const KURL&)
 
 void WebFrameLoaderClient::savePlatformDataToCachedFrame(CachedFrame*)
 {
-    notImplemented();
 }
 
 void WebFrameLoaderClient::transitionToCommittedFromCachedFrame(CachedFrame*)
 {
-    notImplemented();
 }
 
 void WebFrameLoaderClient::transitionToCommittedForNewPage()
@@ -1079,6 +1077,31 @@ void WebFrameLoaderClient::transitionToCommittedForNewPage()
     m_frame->coreFrame()->view()->setTransparent(!webPage->drawsBackground());
 }
 
+void WebFrameLoaderClient::didSaveToPageCache()
+{
+    WebPage* webPage = m_frame->page();
+    if (!webPage)
+        return;
+
+    if (m_frame->isMainFrame())
+        return;
+
+    webPage->send(Messages::WebPageProxy::DidSaveFrameToPageCache(m_frame->frameID()));
+}
+
+void WebFrameLoaderClient::didRestoreFromPageCache()
+{
+    WebPage* webPage = m_frame->page();
+    if (!webPage)
+        return;
+
+    if (m_frame->isMainFrame())
+        return;
+
+    WebFrame* parentFrame = static_cast<WebFrameLoaderClient*>(m_frame->coreFrame()->tree()->parent()->loader()->client())->webFrame();
+    webPage->send(Messages::WebPageProxy::DidRestoreFrameFromPageCache(m_frame->frameID(), parentFrame->frameID()));
+}
+
 void WebFrameLoaderClient::dispatchDidBecomeFrameset(bool value)
 {
     WebPage* webPage = m_frame->page();
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
index 191aeb7..07d15d3 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
+++ b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
@@ -172,6 +172,9 @@ private:
     virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*);
     virtual void transitionToCommittedForNewPage();
 
+    virtual void didSaveToPageCache();
+    virtual void didRestoreFromPageCache();
+
     virtual void dispatchDidBecomeFrameset(bool);
 
     virtual bool canCachePage() const;
diff --git a/WebKit2/WebProcess/WebPage/WebFrame.cpp b/WebKit2/WebProcess/WebPage/WebFrame.cpp
index 4bea928..12aa4a3 100644
--- a/WebKit2/WebProcess/WebPage/WebFrame.cpp
+++ b/WebKit2/WebProcess/WebPage/WebFrame.cpp
@@ -91,7 +91,8 @@ PassRefPtr<WebFrame> WebFrame::createSubframe(WebPage* page, const String& frame
 {
     RefPtr<WebFrame> frame = create();
 
-    page->send(Messages::WebPageProxy::DidCreateSubFrame(frame->frameID()));
+    WebFrame* parentFrame = static_cast<WebFrameLoaderClient*>(ownerElement->document()->frame()->loader()->client())->webFrame();
+    page->send(Messages::WebPageProxy::DidCreateSubframe(frame->frameID(), parentFrame->frameID()));
 
     frame->init(page, frameName, ownerElement);
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list