WebCore:
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Jul 2008 00:01:52 +0000 (00:01 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Jul 2008 00:01:52 +0000 (00:01 +0000)
2008-07-30  Beth Dakin  <bdakin@apple.com>

        Reviewed by Anders Carlsson.

        Fixes <rdar://problem/6041390>

        Adds the ability to have a frame that is "disconnected" from the
        main frame from the perspective of top and parent in
        Javascript.

        * WebCore.base.exp:
        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::parent):
        (WebCore::DOMWindow::top):
        * page/Frame.cpp:
        (WebCore::Frame::isDisconnectedFrame):
        (WebCore::Frame::setIsDisconnectedFrame):
        (WebCore::FramePrivate::FramePrivate):
        * page/Frame.h:
        * page/FramePrivate.h:
        * page/FrameTree.cpp:
        (WebCore::FrameTree::parent):
        (WebCore::FrameTree::top):
        * page/FrameTree.h:

WebKit/mac:

2008-07-30  Beth Dakin  <bdakin@apple.com>

        Reviewed by Anders Carlsson.

        Fixes <rdar://problem/6041390>

        Adds the ability to have a frame that is "disconnected" from the
        main frame from the perspective of top and parent in
        Javascript.

        * WebView/WebFrame.mm:
        (-[WebFrame _setIsDisconnectedFrame]):
        * WebView/WebFramePrivate.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@35467 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/WebCore.base.exp
WebCore/page/DOMWindow.cpp
WebCore/page/Frame.cpp
WebCore/page/Frame.h
WebCore/page/FramePrivate.h
WebCore/page/FrameTree.cpp
WebCore/page/FrameTree.h
WebKit/mac/ChangeLog
WebKit/mac/WebView/WebFrame.mm
WebKit/mac/WebView/WebFramePrivate.h

index e573646ddbee05fe398f05cba12f230fbcc5298e..120594cca91e69de8bcdae667674b0823a30c403 100644 (file)
@@ -1,3 +1,28 @@
+2008-07-30  Beth Dakin  <bdakin@apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        Fixes <rdar://problem/6041390>
+
+        Adds the ability to have a frame that is "disconnected" from the 
+        main frame from the perspective of top and parent in 
+        Javascript.
+
+        * WebCore.base.exp:
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::parent):
+        (WebCore::DOMWindow::top):
+        * page/Frame.cpp:
+        (WebCore::Frame::isDisconnectedFrame):
+        (WebCore::Frame::setIsDisconnectedFrame):
+        (WebCore::FramePrivate::FramePrivate):
+        * page/Frame.h:
+        * page/FramePrivate.h:
+        * page/FrameTree.cpp:
+        (WebCore::FrameTree::parent):
+        (WebCore::FrameTree::top):
+        * page/FrameTree.h:
+
 2008-07-25  Eric Seidel  <eric@webkit.org>
 
         Reviewed by Justin.
index f4353a7d120c7099417e767cfc1a6381c68284ce..0d2b32bf497b2bd052b6eabbee9c2b7ca8129474 100644 (file)
@@ -160,8 +160,8 @@ __ZN7WebCore11FrameLoader24registerURLSchemeAsLocalERKNS_6StringE
 __ZN7WebCore11FrameLoader24setRestrictAccessToLocalEb
 __ZN7WebCore11FrameLoader25setProvisionalHistoryItemEN3WTF10PassRefPtrINS_11HistoryItemEEE
 __ZN7WebCore11FrameLoader26saveDocumentAndScrollStateEv
-__ZN7WebCore11FrameLoader36saveScrollPositionAndViewStateToItemEPNS_11HistoryItemE
 __ZN7WebCore11FrameLoader33loadFrameRequestWithFormAndValuesERKNS_16FrameLoadRequestEbPNS_5EventEPNS_15HTMLFormElementERKN3WTF7HashMapINS_6StringESA_NS_10StringHashENS8_10HashTraitsISA_EESD_EE
+__ZN7WebCore11FrameLoader36saveScrollPositionAndViewStateToItemEPNS_11HistoryItemE
 __ZN7WebCore11FrameLoader4loadEPNS_14DocumentLoaderE
 __ZN7WebCore11FrameLoader4loadERKNS_15ResourceRequestE
 __ZN7WebCore11FrameLoader4loadERKNS_15ResourceRequestERKNS_14SubstituteDataE
@@ -460,6 +460,7 @@ __ZN7WebCore5Frame14frameForWidgetEPKNS_6WidgetE
 __ZN7WebCore5Frame15sendScrollEventEv
 __ZN7WebCore5Frame16adjustPageHeightEPffff
 __ZN7WebCore5Frame17bindingRootObjectEv
+__ZN7WebCore5Frame17setIsDisconnectedEb
 __ZN7WebCore5Frame18windowScriptObjectEv
 __ZN7WebCore5Frame20setSelectionFromNoneEv
 __ZN7WebCore5Frame21markAllMatchesForTextERKNS_6StringEbj
@@ -851,6 +852,7 @@ __ZNK7WebCore9FrameTree20traverseNextWithWrapEb
 __ZNK7WebCore9FrameTree24traversePreviousWithWrapEb
 __ZNK7WebCore9FrameTree4findERKNS_12AtomicStringE
 __ZNK7WebCore9FrameTree5childERKNS_12AtomicStringE
+__ZNK7WebCore9FrameTree6parentEb
 __ZNK7WebCore9FrameView11needsLayoutEv
 __ZNK7WebCore9Selection17isContentEditableEv
 __ZNK7WebCore9Selection19rootEditableElementEv
index 4cf9b2a739fa98dd0f628e2db1485fe878204ca7..3f269c4a39f7fd75dea2f40fdf0f99c012c920b4 100644 (file)
@@ -718,7 +718,7 @@ DOMWindow* DOMWindow::parent() const
     if (!m_frame)
         return 0;
 
-    Frame* parent = m_frame->tree()->parent();
+    Frame* parent = m_frame->tree()->parent(true);
     if (parent)
         return parent->domWindow();
 
@@ -734,7 +734,7 @@ DOMWindow* DOMWindow::top() const
     if (!page)
         return 0;
 
-    return page->mainFrame()->domWindow();
+    return m_frame->tree()->top(true)->domWindow();
 }
 
 Document* DOMWindow::document() const
index 1addc4551be2fdfc0bee57d7e938a76edfdbb72e..561183291b39aa9347359885f262edc8a9c889c0 100644 (file)
@@ -1195,6 +1195,16 @@ RenderPart* Frame::ownerRenderer() const
     return static_cast<RenderPart*>(object);
 }
 
+bool Frame::isDisconnected() const
+{
+    return d->m_isDisconnected;
+}
+
+void Frame::setIsDisconnected(bool isDisconnected)
+{
+    d->m_isDisconnected = isDisconnected;
+}
+
 // returns FloatRect because going through IntRect would truncate any floats
 FloatRect Frame::selectionRect(bool clipToVisibleContent) const
 {
@@ -1960,6 +1970,7 @@ FramePrivate::FramePrivate(Page* page, Frame* parent, Frame* thisFrame, HTMLFram
     , frameCount(0)
     , m_prohibitsScrolling(false)
     , m_needsReapplyStyles(false)
+    , m_isDisconnected(false)
 #if ENABLE(NETSCAPE_PLUGIN_API)
     , m_windowScriptNPObject(0)
 #endif
index 7de78129dda1d49e7c4d565960e2af73f5161837..5f25afd2d6b2fe86700459ce50494eaa338f738d 100644 (file)
@@ -110,6 +110,9 @@ public:
 
     RenderView* contentRenderer() const; // root renderer for the document contained in this frame
     RenderPart* ownerRenderer() const; // renderer for the element that contains this frame
+    
+    bool isDisconnected() const;
+    void setIsDisconnected(bool);
 
     friend class FramePrivate;
 
index 15b78c6f5f7a7efe502613f6bc5c921430813736..fbdbb6b1d5b07bec324a09d3935734e998f3b797 100644 (file)
@@ -117,6 +117,8 @@ namespace WebCore {
         bool m_prohibitsScrolling;
 
         bool m_needsReapplyStyles;
+        
+        bool m_isDisconnected;
 
         // The root object used for objects bound outside the context of a plugin.
         RefPtr<KJS::Bindings::RootObject> m_bindingRootObject; 
index 1fbea6372a71d1e305a710adb7d246dcda746408..76abdf1a1de79fed33b7da7a0b2e9b970c8b4ac6 100644 (file)
@@ -49,6 +49,13 @@ void FrameTree::setName(const AtomicString& name)
     m_name = parent()->tree()->uniqueChildName(name);
 }
 
+Frame* FrameTree::parent(bool checkForDisconnectedFrame) const 
+{ 
+    if (checkForDisconnectedFrame && m_thisFrame->isDisconnected())
+        return 0;
+    return m_parent;
+}
+
 void FrameTree::appendChild(PassRefPtr<Frame> child)
 {
     ASSERT(child->page() == m_thisFrame->page());
@@ -289,14 +296,14 @@ Frame* FrameTree::deepLastChild() const
     return result;
 }
 
-Frame* FrameTree::top() const
+Frame* FrameTree::top(bool checkForDisconnectedFrame) const
 {
-    if (Page* page = m_thisFrame->page())
-        return page->mainFrame();
-
     Frame* frame = m_thisFrame;
-    while (Frame* parent = frame->tree()->parent())
+    for (Frame* parent = m_thisFrame; parent; parent = parent->tree()->parent()) {
         frame = parent;
+        if (checkForDisconnectedFrame && frame->isDisconnected())
+            return frame;
+    }
     return frame;
 }
 
index 79ce46b3b46774764e9c96e31678a87884c51dac..6dcb45ed669f3efbcd80e8f78446198491f2c592 100644 (file)
@@ -40,7 +40,7 @@ namespace WebCore {
 
         const AtomicString& name() const { return m_name; }
         void setName(const AtomicString&);
-        Frame* parent() const { return m_parent; }
+        Frame* parent(bool checkForDisconnectedFrame = false) const;
         void setParent(Frame* parent) { m_parent = parent; }
         
         Frame* nextSibling() const { return m_nextSibling.get(); }
@@ -63,7 +63,7 @@ namespace WebCore {
 
         AtomicString uniqueChildName(const AtomicString& requestedName) const;
 
-        Frame* top() const;
+        Frame* top(bool checkForDisconnectedFrame = false) const;
 
     private:
         Frame* deepLastChild() const;
index 6e78e6242a8025199c186ed39eacb71502f20ee5..2a3cc1d5a70102b75903c17e9afbbaf01109e679 100644 (file)
@@ -1,3 +1,17 @@
+2008-07-30  Beth Dakin  <bdakin@apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        Fixes <rdar://problem/6041390>
+
+        Adds the ability to have a frame that is "disconnected" from the 
+        main frame from the perspective of top and parent in 
+        Javascript.
+
+        * WebView/WebFrame.mm:
+        (-[WebFrame _setIsDisconnectedFrame]):
+        * WebView/WebFramePrivate.h:
+
 2008-07-29  Mark Rowe  <mrowe@apple.com>
 
         Tweak to the build fix to keep Dan happy.
index 252e2c56564bc2f0d67eaa545716b6909b2a518c..79b199f1dd5b35e049679227243f661e3c8b1fac 100644 (file)
@@ -1088,6 +1088,11 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
                                                 selector:selector];
 }
 
+- (void)_setIsDisconnected:(bool)isDisconnected
+{
+    _private->coreFrame->setIsDisconnected(isDisconnected);
+}
+
 #if ENABLE(NETSCAPE_PLUGIN_API)
 - (void)_recursive_resumeNullEventsForAllNetscapePlugins
 {
index 10b3c8c7bd8e477d95115df67e1837de0435fd62..47b009658d6d55094c1a038c73a2bd2f10e94953 100644 (file)
@@ -76,6 +76,8 @@ typedef enum {
 - (WebIconFetcher *)fetchApplicationIcon:(id)target
                                 selector:(SEL)selector;
 
+- (void)_setIsDisconnected:(bool)isDisconnected;
+
 #if ENABLE_NETSCAPE_PLUGIN_API
 - (void)_recursive_resumeNullEventsForAllNetscapePlugins;
 - (void)_recursive_pauseNullEventsForAllNetscapePlugins;