#ifndef FrameTree_h
#define FrameTree_h
#include "wtf/text/AtomicString.h"
namespace WebCore {
class LocalFrame;
class TreeScope;
class FrameTree {
WTF_MAKE_NONCOPYABLE(FrameTree);
public:
explicit FrameTree(LocalFrame* thisFrame);
~FrameTree();
const AtomicString& name() const { return m_name; }
const AtomicString& uniqueName() const { return m_uniqueName; }
void setName(const AtomicString& name, const AtomicString& fallbackName = nullAtom);
LocalFrame* parent() const;
LocalFrame* top() const;
LocalFrame* previousSibling() const;
LocalFrame* nextSibling() const;
LocalFrame* firstChild() const;
LocalFrame* lastChild() const;
bool isDescendantOf(const LocalFrame* ancestor) const;
LocalFrame* traversePreviousWithWrap(bool) const;
LocalFrame* traverseNext(const LocalFrame* stayWithin = 0) const;
LocalFrame* traverseNextWithWrap(bool) const;
LocalFrame* child(const AtomicString& name) const;
LocalFrame* find(const AtomicString& name) const;
unsigned childCount() const;
LocalFrame* scopedChild(unsigned index) const;
LocalFrame* scopedChild(const AtomicString& name) const;
unsigned scopedChildCount() const;
void invalidateScopedChildCount();
private:
LocalFrame* deepLastChild() const;
AtomicString uniqueChildName(const AtomicString& requestedName) const;
bool uniqueNameExists(const AtomicString& name) const;
unsigned scopedChildCount(TreeScope*) const;
LocalFrame* m_thisFrame;
AtomicString m_name;
AtomicString m_uniqueName;
mutable unsigned m_scopedChildCount;
};
}
#ifndef NDEBUG
void showFrameTree(const WebCore::LocalFrame*);
#endif
#endif