Reviewed by Darin.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2006 07:42:12 +0000 (07:42 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2006 07:42:12 +0000 (07:42 +0000)
        - Move name and parent from Frame to FrameTreeNode
        http://bugzilla.opendarwin.org/show_bug.cgi?id=6994

        * bridge/mac/BrowserExtensionMac.mm:
        (WebCore::BrowserExtensionMac::createNewWindow):
        * bridge/mac/MacFrame.h:
        * bridge/mac/MacFrame.mm:
        (WebCore::MacFrame::generateFrameName):
        (WebCore::MacFrame::submitForm):
        (WebCore::Frame::frameDetached):
        (WebCore::MacFrame::nextKeyViewInFrameHierarchy):
        (WebCore::MacFrame::createEmptyDocument):
        * bridge/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge setParent:]):
        (-[WebCoreFrameBridge parent]):
        (-[WebCoreFrameBridge setName:]):
        (-[WebCoreFrameBridge name]):
        * khtml/ecma/kjs_window.cpp:
        (KJS::Window::getValueProperty):
        (KJS::Window::put):
        (KJS::Window::isSafeScript):
        (KJS::WindowFunc::callAsFunction):
        * khtml/html/html_baseimpl.cpp:
        (WebCore::HTMLFrameElementImpl::isURLAllowed):
        * khtml/html/html_headimpl.cpp:
        (WebCore::HTMLLinkElementImpl::process):
        * khtml/xml/DocumentImpl.cpp:
        (WebCore::DocumentImpl::ownerElement):
        (WebCore::DocumentImpl::parentDocument):
        * page/Frame.cpp:
        (WebCore::Frame::checkCompleted):
        (WebCore::Frame::redirectionTimerFired):
        (WebCore::Frame::requestFrameName):
        (WebCore::Frame::slotChildCompleted):
        (WebCore::Frame::incrementFrameCount):
        (WebCore::Frame::decrementFrameCount):
        (WebCore::Frame::topLevelFrameCount):
        (WebCore::Frame::selectFrameElementInParentIfFullySelected):
        (WebCore::Frame::handleFallbackContent):
        (WebCore::Frame::userGestureHint):
        (WebCore::Frame::canCachePage):
        (WebCore::Frame::updatePolicyBaseURL):
        * page/Frame.h:
        * page/FramePrivate.h:
        (WebCore::FramePrivate::FramePrivate):
        * page/FrameTreeNode.cpp:
        (WebCore::FrameTreeNode::setName):
        (WebCore::FrameTreeNode::appendChild):
        (WebCore::FrameTreeNode::removeChild):
        * page/FrameTreeNode.h:
        (WebCore::FrameTreeNode::FrameTreeNode):
        (WebCore::FrameTreeNode::name):
        (WebCore::FrameTreeNode::parent):
        (WebCore::FrameTreeNode::setParent):
        * rendering/render_frames.cpp:
        (WebCore::isURLAllowed):

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

16 files changed:
WebCore/ChangeLog
WebCore/bindings/objc/DOMInternal.mm
WebCore/bridge/mac/BrowserExtensionMac.mm
WebCore/bridge/mac/MacFrame.h
WebCore/bridge/mac/MacFrame.mm
WebCore/bridge/mac/WebCoreFrameBridge.mm
WebCore/khtml/ecma/kjs_window.cpp
WebCore/khtml/html/html_baseimpl.cpp
WebCore/khtml/html/html_headimpl.cpp
WebCore/khtml/xml/DocumentImpl.cpp
WebCore/page/Frame.cpp
WebCore/page/Frame.h
WebCore/page/FramePrivate.h
WebCore/page/FrameTreeNode.cpp
WebCore/page/FrameTreeNode.h
WebCore/rendering/render_frames.cpp

index f7a7b6e0b86ee1cc63207c45976396cb46834e78..97876ee51185b8a164961ca3f08d948ae4997e7b 100644 (file)
@@ -1,3 +1,64 @@
+2006-01-31  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Darin.
+
+        - Move name and parent from Frame to FrameTreeNode
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=6994
+
+        * bridge/mac/BrowserExtensionMac.mm:
+        (WebCore::BrowserExtensionMac::createNewWindow):
+        * bridge/mac/MacFrame.h:
+        * bridge/mac/MacFrame.mm:
+        (WebCore::MacFrame::generateFrameName):
+        (WebCore::MacFrame::submitForm):
+        (WebCore::Frame::frameDetached):
+        (WebCore::MacFrame::nextKeyViewInFrameHierarchy):
+        (WebCore::MacFrame::createEmptyDocument):
+        * bridge/mac/WebCoreFrameBridge.mm:
+        (-[WebCoreFrameBridge setParent:]):
+        (-[WebCoreFrameBridge parent]):
+        (-[WebCoreFrameBridge setName:]):
+        (-[WebCoreFrameBridge name]):
+        * khtml/ecma/kjs_window.cpp:
+        (KJS::Window::getValueProperty):
+        (KJS::Window::put):
+        (KJS::Window::isSafeScript):
+        (KJS::WindowFunc::callAsFunction):
+        * khtml/html/html_baseimpl.cpp:
+        (WebCore::HTMLFrameElementImpl::isURLAllowed):
+        * khtml/html/html_headimpl.cpp:
+        (WebCore::HTMLLinkElementImpl::process):
+        * khtml/xml/DocumentImpl.cpp:
+        (WebCore::DocumentImpl::ownerElement):
+        (WebCore::DocumentImpl::parentDocument):
+        * page/Frame.cpp:
+        (WebCore::Frame::checkCompleted):
+        (WebCore::Frame::redirectionTimerFired):
+        (WebCore::Frame::requestFrameName):
+        (WebCore::Frame::slotChildCompleted):
+        (WebCore::Frame::incrementFrameCount):
+        (WebCore::Frame::decrementFrameCount):
+        (WebCore::Frame::topLevelFrameCount):
+        (WebCore::Frame::selectFrameElementInParentIfFullySelected):
+        (WebCore::Frame::handleFallbackContent):
+        (WebCore::Frame::userGestureHint):
+        (WebCore::Frame::canCachePage):
+        (WebCore::Frame::updatePolicyBaseURL):
+        * page/Frame.h:
+        * page/FramePrivate.h:
+        (WebCore::FramePrivate::FramePrivate):
+        * page/FrameTreeNode.cpp:
+        (WebCore::FrameTreeNode::setName):
+        (WebCore::FrameTreeNode::appendChild):
+        (WebCore::FrameTreeNode::removeChild):
+        * page/FrameTreeNode.h:
+        (WebCore::FrameTreeNode::FrameTreeNode):
+        (WebCore::FrameTreeNode::name):
+        (WebCore::FrameTreeNode::parent):
+        (WebCore::FrameTreeNode::setParent):
+        * rendering/render_frames.cpp:
+        (WebCore::isURLAllowed):
+
 2006-02-01  Darin Adler  <darin@apple.com>
 
         Checking in without review because I *just* broke this with my last check-in.
index f8740f51b3c4f6574fa8f4791d45be19c7d86371..a03501f6448efb30d6b0d3cdd60a4a61672f6567 100644 (file)
@@ -121,7 +121,8 @@ DOMStringImpl::operator NSString *() const
 
 DOMString::DOMString(NSString *str)
 {
-    ASSERT(str);
+    if (!str)
+        return;
 
     CFIndex size = CFStringGetLength(reinterpret_cast<CFStringRef>(str));
     if (size == 0)
index fcc041bad47bbac872146ce65142bd184e336ff9..f16772b5a3d8f8aa37b2d099a2c9cfa679cdeb47 100644 (file)
@@ -30,6 +30,7 @@
 #import "MacFrame.h"
 #import "WebCoreFrameBridge.h"
 #import <kxmlcore/Assertions.h>
+#import "FrameTreeNode.h"
 
 namespace WebCore {
 
@@ -118,7 +119,7 @@ void BrowserExtensionMac::createNewWindow(const KURL &url,
         return;
     
     if ([bridge part])
-       [bridge part]->setName(urlArgs.frameName);
+       [bridge part]->treeNode()->setName(urlArgs.frameName);
     
     if (partResult)
        *partResult = [bridge part];
index ce60d37634161d55bc4f85b29b12684f82970b40..4296dc1507af5b688a55ab26d95a10332fe1e689 100644 (file)
@@ -308,7 +308,7 @@ public:
     virtual void handledOnloadEvents();
 
 protected:
-    virtual QString generateFrameName();
+    virtual DOMString generateFrameName();
 
     virtual void startRedirectionTimer();
     virtual void stopRedirectionTimer();
index 24d6a67bb8064e1e43a475595888dc524348266f..eaef7c7d77411fa5475a8de578776ba89a0e8601 100644 (file)
@@ -180,10 +180,10 @@ void MacFrame::freeClipboard()
     }
 }
 
-QString MacFrame::generateFrameName()
+DOMString MacFrame::generateFrameName()
 {
     KWQ_BLOCK_EXCEPTIONS;
-    return QString::fromNSString([_bridge generateFrameName]);
+    return [_bridge generateFrameName];
     KWQ_UNBLOCK_EXCEPTIONS;
 
     return QString();
@@ -525,7 +525,7 @@ void MacFrame::submitForm(const KURL &url, const URLArgs &args)
     WebCoreFrameBridge *target = args.frameName.isEmpty() ? _bridge : [_bridge findFrameNamed:args.frameName.getNSString()];
     Frame *targetPart = [target part];
     bool willReplaceThisFrame = false;
-    for (Frame *p = this; p; p = p->parentFrame()) {
+    for (Frame *p = this; p; p = p->treeNode()->parent()) {
         if (p == targetPart) {
             willReplaceThisFrame = true;
             break;
@@ -568,7 +568,7 @@ void Frame::frameDetached()
     // FIXME: This should be a virtual function, with the second part in MacFrame, and the first
     // part in Frame, so it works for KHTML too.
 
-    Frame *parent = parentFrame();
+    Frame *parent = treeNode()->parent();
     if (parent) {
         FrameList& parentFrames = parent->d->m_frames;
         FrameIt end = parentFrames.end();
@@ -999,7 +999,7 @@ NSView *MacFrame::nextKeyViewInFrameHierarchy(NodeImpl *node, KWQSelectionDirect
 {
     NSView *next = nextKeyViewInFrame(node, direction);
     if (!next) {
-        MacFrame *parent = Mac(parentFrame());
+        MacFrame *parent = Mac(treeNode()->parent());
         if (parent) {
             next = parent->nextKeyViewInFrameHierarchy(parent->childFrame(this)->m_renderer->element(), direction);
         }
@@ -1428,9 +1428,9 @@ void MacFrame::createEmptyDocument()
         [_bridge loadEmptyDocumentSynchronously];
         KWQ_UNBLOCK_EXCEPTIONS;
 
-        if (parentFrame() && (parentFrame()->childFrame(this)->m_type == ChildFrame::IFrame ||
-                parentFrame()->childFrame(this)->m_type == ChildFrame::Object)) {
-            d->m_doc->setBaseURL(parentFrame()->d->m_doc->baseURL());
+        if (treeNode()->parent() && (treeNode()->parent()->childFrame(this)->m_type == ChildFrame::IFrame ||
+                treeNode()->parent()->childFrame(this)->m_type == ChildFrame::Object)) {
+            d->m_doc->setBaseURL(treeNode()->parent()->d->m_doc->baseURL());
         }
     }
 }
index f2561956a3daf14e37cb21835d34eece7211700e..a829b17f9ac12016c34d8a9fd73c334eeab4f863 100644 (file)
@@ -555,12 +555,13 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
 
 - (void)setParent:(WebCoreFrameBridge *)parent
 {
-    m_frame->setParent([parent part]);
+    // FIXME: frames should be created with the right parent in the first place
+    m_frame->treeNode()->setParent([parent part]);
 }
 
 - (WebCoreFrameBridge *)parent
 {
-    MacFrame *parentFrame = Mac(m_frame->parentFrame());
+    MacFrame *parentFrame = Mac(m_frame->treeNode()->parent());
     if (!parentFrame)
         return nil;
     return parentFrame->bridge();
@@ -1552,12 +1553,12 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
 
 - (void)setName:(NSString *)name
 {
-    m_frame->setName(QString::fromNSString(name));
+    m_frame->treeNode()->setName(name);
 }
 
 - (NSString *)name
 {
-    return m_frame->name().getNSString();
+    return m_frame->treeNode()->name();
 }
 
 - (void)_addFramePathToString:(NSMutableString *)path
index d5452b7747733f89db0395afd8c53e08b9c7b29c..8b5a4144058f3648675c6858fe641b97d71c7000 100644 (file)
@@ -57,6 +57,7 @@
 #include <kdebug.h>
 #include <kjs/collector.h>
 #include <klocale.h>
+#include "FrameTreeNode.h"
 
 #if KHTML_XSLT
 #include "XSLTProcessor.h"
@@ -708,7 +709,7 @@ JSValue *Window::getValueProperty(ExecState *exec, int token) const
     case _Location:
       return location();
     case Name:
-      return jsString(m_frame->name());
+      return jsString(m_frame->treeNode()->name());
     case _Navigator:
     case ClientInformation: {
       // Store the navigator in the object so we get the same one each time.
@@ -750,7 +751,7 @@ JSValue *Window::getValueProperty(ExecState *exec, int token) const
       updateLayout();
       return jsNumber(m_frame->view()->contentsY());
     case Parent:
-      return retrieve(m_frame->parentFrame() ? m_frame->parentFrame() : (Frame*)m_frame);
+      return retrieve(m_frame->treeNode()->parent() ? m_frame->treeNode()->parent() : (Frame*)m_frame);
     case Personalbar:
       return personalbar(exec);
     case ScreenLeft:
@@ -788,8 +789,8 @@ JSValue *Window::getValueProperty(ExecState *exec, int token) const
       return retrieve(m_frame);
     case Top: {
       Frame *p = m_frame;
-      while (p->parentFrame())
-        p = p->parentFrame();
+      while (p->treeNode()->parent())
+        p = p->treeNode()->parent();
       return retrieve(p);
     }
     case _Screen:
@@ -1179,7 +1180,7 @@ void Window::put(ExecState* exec, const Identifier &propertyName, JSValue *value
       return;
     case Name:
       if (isSafeScript(exec))
-        m_frame->setName( value->toString(exec).qstring() );
+        m_frame->treeNode()->setName(value->toString(exec).qstring());
       return;
     default:
       break;
@@ -1240,9 +1241,9 @@ bool Window::isSafeScript(const ScriptInterpreter *origin, const ScriptInterpret
     // or opener, allow access from any document in the same domain as
     // the parent or opener.
     if (shouldLoadAsEmptyDocument(targetPart->url())) {
-        Frame *ancestorPart = targetPart->opener() ? targetPart->opener() : targetPart->parentFrame();
+        Frame *ancestorPart = targetPart->opener() ? targetPart->opener() : targetPart->treeNode()->parent();
         while (ancestorPart && shouldLoadAsEmptyDocument(ancestorPart->url())) {
-            ancestorPart = ancestorPart->parentFrame();
+            ancestorPart = ancestorPart->treeNode()->parent();
         }
 
         if (ancestorPart)
@@ -1305,9 +1306,9 @@ bool Window::isSafeScript(ExecState *exec) const
   // or opener, allow access from any document in the same domain as
   // the parent or opener.
   if (shouldLoadAsEmptyDocument(m_frame->url())) {
-    Frame *ancestorPart = m_frame->opener() ? m_frame->opener() : m_frame->parentFrame();
+    Frame *ancestorPart = m_frame->opener() ? m_frame->opener() : m_frame->treeNode()->parent();
     while (ancestorPart && shouldLoadAsEmptyDocument(ancestorPart->url())) {
-      ancestorPart = ancestorPart->parentFrame();
+      ancestorPart = ancestorPart->treeNode()->parent();
     }
     
     if (ancestorPart)
@@ -1604,8 +1605,8 @@ JSValue *WindowFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const Li
       URLArgs uargs;
       uargs.frameName = frameName;
       if (uargs.frameName == "_top") {
-          while (frame->parentFrame())
-              frame = frame->parentFrame();
+          while (frame->treeNode()->parent())
+              frame = frame->treeNode()->parent();
           
           const Window* window = Window::retrieveWindow(frame);
           if (!url.url().startsWith("javascript:", false) || (window && window->isSafeScript(exec))) {
@@ -1615,8 +1616,8 @@ JSValue *WindowFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const Li
           return Window::retrieve(frame);
       }
       if (uargs.frameName == "_parent") {
-          if (frame->parentFrame())
-              frame = frame->parentFrame();
+          if (frame->treeNode()->parent())
+              frame = frame->treeNode()->parent();
           
           const Window* window = Window::retrieveWindow(frame);
           if (!url.url().startsWith("javascript:", false) || (window && window->isSafeScript(exec))) {
index 12eea42ec243f788df2107dc93efe448aa5d15da..a70b21be3b39fc7dec9c8171f2ef569e49e38d96 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "FrameView.h"
 #include "Frame.h"
+#include "FrameTreeNode.h"
 
 #include "rendering/render_frames.h"
 #include "css/cssstyleselector.h"
@@ -311,7 +312,7 @@ bool HTMLFrameElementImpl::isURLAllowed(const AtomicString &URLString) const
     // We allow one level of self-reference because some sites depend on that.
     // But we don't allow more than one.
     bool foundSelfReference = false;
-    for (Frame *frame = w->frame(); frame; frame = frame->parentFrame()) {
+    for (Frame *frame = w->frame(); frame; frame = frame->treeNode()->parent()) {
         KURL frameURL = frame->url();
         frameURL.setRef(QString::null);
         if (frameURL == newURL) {
index cbfcb6b5a58de5ad056e61b5eecaa01d74a051a3..0e9fcf47ae7bf66cc7a5d9b1c3bad3b314641b9d 100644 (file)
@@ -32,6 +32,7 @@
 #include "dom_node.h"
 
 #include "Frame.h"
+#include "FrameTreeNode.h"
 #include "kjs_proxy.h"
 
 #include "CachedCSSStyleSheet.h"
@@ -222,7 +223,7 @@ void HTMLLinkElementImpl::process()
     Frame *frame = getDocument()->frame();
 
     // IE extension: location of small icon for locationbar / bookmarks
-    if (frame && m_isIcon && !m_url.isEmpty() && !frame->parentFrame()) {
+    if (frame && m_isIcon && !m_url.isEmpty() && !frame->treeNode()->parent()) {
         if (!type.isEmpty()) // Mozilla extension to IE extension: icon specified with type
             frame->browserExtension()->setTypedIconURL(KURL(m_url.qstring()), type);
         else 
index 37eb17f41e376a852325c16539bde349060f4ad0..86835e61b0fcb8051850e82bfd16dfa975944985 100644 (file)
@@ -2347,7 +2347,7 @@ ElementImpl *DocumentImpl::ownerElement()
     Frame *childPart = childView->frame();
     if (!childPart)
         return 0;
-    Frame *parent = childPart->parentFrame();
+    Frame *parent = childPart->treeNode()->parent();
     if (!parent)
         return 0;
     ChildFrame *childFrame = parent->childFrame(childPart);
@@ -2915,7 +2915,7 @@ DocumentImpl *DocumentImpl::parentDocument() const
     Frame *childPart = frame();
     if (!childPart)
         return 0;
-    Frame *parent = childPart->parentFrame();
+    Frame *parent = childPart->treeNode()->parent();
     if (!parent)
         return 0;
     return parent->document();
index 3ec4a79f9ef6fb4624542a2556746d18c2d0c454..392762da549e12f4210b192ee65275cda742101e 100644 (file)
@@ -991,7 +991,7 @@ void Frame::checkCompleted()
   {
     // Do not start redirection for frames here! That action is
     // deferred until the parent emits a completed signal.
-    if (!parentFrame())
+    if (!treeNode()->parent())
       startRedirectionTimer();
 
     emit completed( true );
@@ -1182,7 +1182,7 @@ void Frame::redirectionTimerFired(Timer<Frame>*)
         // go(i!=0) from a frame navigates into the history of the frame only,
         // in both IE and NS (but not in Mozilla).... we can't easily do that
         // in Konqueror...
-        if (d->m_scheduledHistoryNavigationSteps == 0) // add && parentFrame() to get only frames, but doesn't matter
+        if (d->m_scheduledHistoryNavigationSteps == 0) // add && parent() to get only frames, but doesn't matter
             openURL( url() ); /// ## need args.reload=true?
         else {
             if (d->m_extension) {
@@ -1581,7 +1581,7 @@ bool Frame::requestFrame( RenderPart *part, const QString &url, const QString &f
   return requestObject( &(*it), completeURL( url ));
 }
 
-QString Frame::requestFrameName()
+DOMString Frame::requestFrameName()
 {
     return generateFrameName();
 }
@@ -1882,7 +1882,7 @@ void Frame::slotChildCompleted( bool complete )
   child->m_bCompleted = true;
   child->m_args = URLArgs();
 
-  if ( complete && parentFrame() == 0 )
+  if (complete && treeNode()->parent() == 0)
     d->m_bPendingChildRedirection = true;
 
   checkCompleted();
@@ -1936,11 +1936,6 @@ bool Frame::frameExists( const QString &frameName )
   return (!(*it).m_renderer.isNull());
 }
 
-Frame *Frame::parentFrame() const
-{
-  return parent();
-}
-
 int Frame::zoomFactor() const
 {
   return d->m_zoomFactor;
@@ -2516,7 +2511,6 @@ void Frame::preloadScript(const QString &url, const QString &script)
     Cache::preloadScript(url, script);
 }
 
-
 bool Frame::restored() const
 {
   return d->m_restored;
@@ -2524,27 +2518,26 @@ bool Frame::restored() const
 
 void Frame::incrementFrameCount()
 {
-  frameCount++;
-  if (parentFrame()) {
-    parentFrame()->incrementFrameCount();
-  }
+    // FIXME: this should be in Page
+    frameCount++;
+    if (treeNode()->parent())
+        treeNode()->parent()->incrementFrameCount();
 }
 
 void Frame::decrementFrameCount()
 {
-  frameCount--;
-  if (parentFrame()) {
-    parentFrame()->decrementFrameCount();
-  }
+    // FIXME: this should be in Page
+    frameCount--;
+    if (treeNode()->parent())
+        treeNode()->parent()->decrementFrameCount();
 }
 
 int Frame::topLevelFrameCount()
 {
-  if (parentFrame()) {
-    return parentFrame()->topLevelFrameCount();
-  }
-
-  return frameCount;
+    // FIXME: this should be in Page
+    if (treeNode()->parent())
+        return treeNode()->parent()->topLevelFrameCount();
+    return frameCount;
 }
 
 bool Frame::tabsToLinks() const
@@ -2999,7 +2992,7 @@ void Frame::lifeSupportTimerFired(Timer<Frame>*)
 void Frame::selectFrameElementInParentIfFullySelected()
 {
     // Find the parent frame; if there is none, then we have nothing to do.
-    Frame *parent = parentFrame();
+    Frame *parent = treeNode()->parent();
     if (!parent)
         return;
     FrameView *parentView = parent->view();
@@ -3039,7 +3032,7 @@ void Frame::selectFrameElementInParentIfFullySelected()
 
 void Frame::handleFallbackContent()
 {
-    Frame *parent = parentFrame();
+    Frame *parent = treeNode()->parent();
     if (!parent)
         return;
     ChildFrame *childFrame = parent->childFrame(this);
@@ -3070,8 +3063,8 @@ void Frame::provisionalLoadStarted()
 bool Frame::userGestureHint()
 {
     Frame *rootFrame = this;
-    while (rootFrame->parentFrame())
-        rootFrame = rootFrame->parentFrame();
+    while (rootFrame->treeNode()->parent())
+        rootFrame = rootFrame->treeNode()->parent();
 
     if (rootFrame->jScript() && rootFrame->jScript()->interpreter())
         return rootFrame->jScript()->interpreter()->wasRunByUserGesture();
@@ -3321,7 +3314,7 @@ bool Frame::canCachePage()
     // 4.  The URL for the page is not https.
     // 5.  The page has no applets.
     if (d->m_frames.count() || d->m_objects.count() ||
-        parentFrame() ||
+        treeNode()->parent() ||
         d->m_url.protocol().startsWith("https") || 
         (d->m_doc && (d->m_doc->applets()->length() != 0 ||
                       d->m_doc->hasWindowEventListener(unloadEvent) ||
@@ -3425,8 +3418,8 @@ QPtrList<Frame> &Frame::mutableInstances()
 
 void Frame::updatePolicyBaseURL()
 {
-    if (parentFrame() && parentFrame()->document())
-        setPolicyBaseURL(parentFrame()->document()->policyBaseURL());
+    if (treeNode()->parent() && treeNode()->parent()->document())
+        setPolicyBaseURL(treeNode()->parent()->document()->policyBaseURL());
     else
         setPolicyBaseURL(d->m_url.url());
 }
@@ -3737,34 +3730,6 @@ QChar Frame::backslashAsCurrencySymbol() const
     return codec->backslashAsCurrencySymbol();
 }
 
-void Frame::setName(const QString& name)
-{
-    QString n = name;
-    
-    Frame *parent = parentFrame();
-    
-    // FIXME: is the blank rule needed or useful?
-    if (parent && (name.isEmpty() || parent->frameExists(name) || name == "_blank"))
-        n = parent->requestFrameName();
-    
-    d->m_name = name;
-}
-
-const QString& Frame::name()
-{
-    return d->m_name;
-}
-
-void Frame::setParent(Frame* parent) 
-{ 
-    d->m_parent = parent; 
-}
-
-Frame* Frame::parent() const 
-{ 
-    return d->m_parent; 
-}
-
 bool Frame::markedTextUsesUnderlines() const
 {
     return m_markedTextUsesUnderlines;
index adc16ab5f1546f7c7d34b897d886cdf630657bea..8ff391828bea81e3258537fd6c56d2b123147154 100644 (file)
@@ -613,13 +613,6 @@ public:
 
   const KHTMLSettings *settings() const;
 
-  /**
-   * Returns a pointer to the parent Frame, if any.
-   *
-   *  Returns 0L otherwise.
-   */
-  Frame *parentFrame() const;
-
   /**
    * Returns a list of names of all frame (including iframe) objects of
    * the current document. Note that this method is not working recursively
@@ -839,7 +832,7 @@ public:
   virtual bool lastEventIsMouseUp() const = 0;
   virtual QString overrideMediaType() const = 0;
 protected:
-  virtual QString generateFrameName() = 0;
+  virtual DOMString generateFrameName() = 0;
 
 public slots:
   /**
@@ -928,13 +921,14 @@ private:
    * always the same.
    * The sequence is reset in clear().
    */
-  QString requestFrameName();
 
   bool requestObject(RenderPart *frame, const QString &url, const QString &serviceType,
                       const QStringList &paramNames = QStringList(), const QStringList &paramValues = QStringList());
   bool requestObject(ChildFrame *child, const KURL &url, const URLArgs &args = URLArgs());
 
 public:
+  DOMString requestFrameName();
+
   DocumentImpl *document() const;
   void setDocument(DocumentImpl* newDoc);
 
@@ -1035,8 +1029,6 @@ private:
   // Convenience, to avoid repeating the code to dig down to get this.
 
   QChar backslashAsCurrencySymbol() const;
-  void setName(const QString& name);
-  const QString& name();
 
   QValueList<MarkedTextUnderline> markedTextUnderlines() const;  
   bool markedTextUsesUnderlines() const;
@@ -1103,8 +1095,6 @@ public:
   virtual void detachFromView();
 
   KURL url() const;
-  void setParent(Frame* parent);
-  Frame* parent() const;
 
   // split out controller objects
   FrameTreeNode* treeNode();
index 90724bb7999a31b25100550e4996993731475106..3f3262299a5705078273ef2a72eecda8918a6d14 100644 (file)
@@ -90,7 +90,7 @@ class FramePrivate
 {
 public:
   FramePrivate(Frame *parent, Frame *thisFrame)
-      : m_treeNode(thisFrame), m_parent(parent)
+      : m_treeNode(thisFrameparent)
       , m_redirectionTimer(thisFrame, &Frame::redirectionTimerFired)
       , m_caretBlinkTimer(thisFrame, &Frame::caretBlinkTimerFired)
       , m_lifeSupportTimer(thisFrame, &Frame::lifeSupportTimerFired)
@@ -178,8 +178,6 @@ public:
   }
 
   FrameTreeNode m_treeNode;
-  Frame *m_parent;
-  QString m_name;
 
   // old style frame info
   FrameList m_frames;
index f88bcd288331d3eb6a4e44ba8e48ed7fd01f8c78..a3a379fa4c5ba20f3d1bf958eb278ca375aa5037 100644 (file)
@@ -37,9 +37,20 @@ FrameTreeNode::~FrameTreeNode()
         child->detachFromView();
 }
 
+void FrameTreeNode::setName(const DOMString& name) 
+{ 
+    DOMString n = name;
+        
+    // FIXME: is the blank rule needed or useful?
+    if (parent() && (name.isEmpty() || parent()->frameExists(name.qstring()) || name == "_blank"))
+        n = parent()->requestFrameName();
+    
+    m_name = n;
+}
+
 void FrameTreeNode::appendChild(PassRefPtr<Frame> child)
 {
-    child->setParent(m_thisFrame);
+    child->treeNode()->m_parent = m_thisFrame;
 
     Frame* oldLast = m_lastChild;
     m_lastChild = child.get();
@@ -57,7 +68,7 @@ void FrameTreeNode::appendChild(PassRefPtr<Frame> child)
 
 void FrameTreeNode::removeChild(Frame* child)
 {
-    child->setParent(0);
+    child->treeNode()->m_parent = 0;
     child->detachFromView();
 
     // Slightly tricky way to prevent deleting the child until we are done with it, w/o
index 14ec403d25c83311239f590f34d8552cde6ed3d6..db23307519c7dfdb425bb479f9a2309dde2cc95a 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <kxmlcore/RefPtr.h>
 #include <kxmlcore/PassRefPtr.h>
+#include "dom_string.h"
 
 namespace WebCore {
 
@@ -31,8 +32,9 @@ class Frame;
 class FrameTreeNode
 {
 public:
-    FrameTreeNode(Frame* thisFrame) 
+    FrameTreeNode(Frame* thisFrame, Frame* parentFrame
         : m_thisFrame(thisFrame)
+        , m_parent(parentFrame)
         , m_previousSibling(0)
         , m_lastChild(0)
         , m_childCount(0)
@@ -40,6 +42,11 @@ public:
     }
     ~FrameTreeNode();
 
+    DOMString& name() { return m_name; }
+    void setName(const DOMString& name);
+    Frame* parent() { return m_parent; }
+    void setParent(Frame* parent) { m_parent = parent; }
+    
     Frame* nextSibling() { return m_nextSibling.get(); }
     Frame* previousSibling() { return m_previousSibling; }
     Frame* firstChild() { return m_firstChild.get(); }
@@ -52,6 +59,9 @@ public:
  private:
     Frame* m_thisFrame;
 
+    Frame *m_parent;
+    DOMString m_name;
+
     // FIXME: use ListRefPtr?
     RefPtr<Frame> m_nextSibling;
     Frame* m_previousSibling;
index 6d3bdda1e4fc0aa0f236c16a4c6a20960213fd2b..79654138d7c20b1ca197fdab0a0099f7d8747aec 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "DocumentImpl.h"
 #include "Frame.h"
+#include "FrameTreeNode.h"
 #include "FrameView.h"
 #include "html/html_baseimpl.h"
 #include "html/html_objectimpl.h"
@@ -739,7 +740,7 @@ static bool isURLAllowed(DOM::DocumentImpl *doc, const QString &url)
     // We allow one level of self-reference because some sites depend on that.
     // But we don't allow more than one.
     bool foundSelfReference = false;
-    for (Frame *frame = doc->frame(); frame; frame = frame->parentFrame()) {
+    for (Frame *frame = doc->frame(); frame; frame = frame->treeNode()->parent()) {
         KURL frameURL = frame->url();
         frameURL.setRef(QString::null);
         if (frameURL == newURL) {