webengine/osswebengine/WebCore/page/FrameTree.h
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 // -*- mode: c++; c-basic-offset: 4 -*-
       
     2 /*
       
     3  * Copyright (C) 2006 Apple Computer, Inc.
       
     4  *
       
     5  * This library is free software; you can redistribute it and/or
       
     6  * modify it under the terms of the GNU Library General Public
       
     7  * License as published by the Free Software Foundation; either
       
     8  * version 2 of the License, or (at your option) any later version.
       
     9  *
       
    10  * This library is distributed in the hope that it will be useful,
       
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    13  * Library General Public License for more details.
       
    14  *
       
    15  * You should have received a copy of the GNU Library General Public License
       
    16  * along with this library; see the file COPYING.LIB.  If not, write to
       
    17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
       
    18  * Boston, MA 02110-1301, USA.
       
    19  */
       
    20 
       
    21 #ifndef FrameTree_h
       
    22 #define FrameTree_h
       
    23 
       
    24 #include "AtomicString.h"
       
    25 
       
    26 namespace WebCore {
       
    27 
       
    28     class Frame;
       
    29 
       
    30     class FrameTree : Noncopyable {
       
    31     public:
       
    32         FrameTree(Frame* thisFrame, Frame* parentFrame) 
       
    33             : m_thisFrame(thisFrame)
       
    34             , m_parent(parentFrame)
       
    35             , m_previousSibling(0)
       
    36             , m_lastChild(0)
       
    37             , m_childCount(0)
       
    38         {
       
    39         }
       
    40         ~FrameTree();
       
    41 
       
    42         const AtomicString& name() const { return m_name; }
       
    43         void setName(const AtomicString&);
       
    44         Frame* parent() const { return m_parent; }
       
    45         void setParent(Frame* parent) { m_parent = parent; }
       
    46         
       
    47         Frame* nextSibling() const { return m_nextSibling.get(); }
       
    48         Frame* previousSibling() const { return m_previousSibling; }
       
    49         Frame* firstChild() const { return m_firstChild.get(); }
       
    50         Frame* lastChild() const { return m_lastChild; }
       
    51         unsigned childCount() const { return m_childCount; }
       
    52 
       
    53         bool isDescendantOf(const Frame* ancestor) const;
       
    54         Frame* traverseNext(const Frame* stayWithin = 0) const;
       
    55         Frame* traverseNextWithWrap(bool) const;
       
    56         Frame* traversePreviousWithWrap(bool) const;
       
    57         
       
    58         void appendChild(PassRefPtr<Frame>);
       
    59         void removeChild(Frame*);
       
    60 
       
    61         Frame* child(unsigned index) const;
       
    62         Frame* child(const AtomicString& name) const;
       
    63         Frame* find(const AtomicString& name) const;
       
    64 
       
    65         AtomicString uniqueChildName(const AtomicString& requestedName) const;
       
    66 
       
    67         Frame* top() const;
       
    68 
       
    69     private:
       
    70         Frame* deepLastChild() const;
       
    71 
       
    72         Frame* m_thisFrame;
       
    73 
       
    74         Frame* m_parent;
       
    75         AtomicString m_name;
       
    76 
       
    77         // FIXME: use ListRefPtr?
       
    78         RefPtr<Frame> m_nextSibling;
       
    79         Frame* m_previousSibling;
       
    80         RefPtr<Frame> m_firstChild;
       
    81         Frame* m_lastChild;
       
    82         unsigned m_childCount;
       
    83     };
       
    84 
       
    85 } // namespace WebCore
       
    86 
       
    87 #endif // FrameTree_h