2 * Copyright (C) 2006 Apple Computer, Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
23 #include <wtf/text/AtomicString.h>
29 class FrameTree : public Noncopyable {
31 FrameTree(Frame* thisFrame, Frame* parentFrame)
32 : m_thisFrame(thisFrame)
33 , m_parent(parentFrame)
34 , m_previousSibling(0)
41 const AtomicString& name() const { return m_name; }
42 const AtomicString& uniqueName() const { return m_uniqueName; }
43 void setName(const AtomicString&);
45 Frame* parent(bool checkForDisconnectedFrame = false) const;
46 void setParent(Frame* parent) { m_parent = parent; }
48 Frame* nextSibling() const { return m_nextSibling.get(); }
49 Frame* previousSibling() const { return m_previousSibling; }
50 Frame* firstChild() const { return m_firstChild.get(); }
51 Frame* lastChild() const { return m_lastChild; }
52 unsigned childCount() const { return m_childCount; }
54 bool isDescendantOf(const Frame* ancestor) const;
55 Frame* traverseNext(const Frame* stayWithin = 0) const;
56 Frame* traverseNextWithWrap(bool) const;
57 Frame* traversePreviousWithWrap(bool) const;
59 void appendChild(PassRefPtr<Frame>);
60 void detachFromParent() { m_parent = 0; }
61 void removeChild(Frame*);
63 Frame* child(unsigned index) const;
64 Frame* child(const AtomicString& name) const;
65 Frame* find(const AtomicString& name) const;
67 AtomicString uniqueChildName(const AtomicString& requestedName) const;
69 Frame* top(bool checkForDisconnectedFrame = false) const;
72 Frame* deepLastChild() const;
77 AtomicString m_name; // The actual frame name (may be empty).
78 AtomicString m_uniqueName;
80 // FIXME: use ListRefPtr?
81 RefPtr<Frame> m_nextSibling;
82 Frame* m_previousSibling;
83 RefPtr<Frame> m_firstChild;
85 unsigned m_childCount;
88 } // namespace WebCore