| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU Library General Public License | 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 | 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, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
| 18 */ | 18 */ |
| 19 | 19 |
| 20 #ifndef FrameTree_h | 20 #ifndef FrameTree_h |
| 21 #define FrameTree_h | 21 #define FrameTree_h |
| 22 | 22 |
| 23 #include "wtf/text/AtomicString.h" | 23 #include "wtf/text/AtomicString.h" |
| 24 | 24 |
| 25 namespace WebCore { | 25 namespace WebCore { |
| 26 | 26 |
| 27 class Frame; | 27 class Frame; |
| 28 class LocalFrame; | |
| 29 class TreeScope; | 28 class TreeScope; |
| 30 | 29 |
| 31 class FrameTree { | 30 class FrameTree { |
| 32 WTF_MAKE_NONCOPYABLE(FrameTree); | 31 WTF_MAKE_NONCOPYABLE(FrameTree); |
| 33 public: | 32 public: |
| 34 explicit FrameTree(Frame* thisFrame); | 33 explicit FrameTree(Frame* thisFrame); |
| 35 ~FrameTree(); | 34 ~FrameTree(); |
| 36 | 35 |
| 37 const AtomicString& name() const { return m_name; } | 36 const AtomicString& name() const { return m_name; } |
| 38 const AtomicString& uniqueName() const { return m_uniqueName; } | 37 const AtomicString& uniqueName() const { return m_uniqueName; } |
| 39 // If |name| is not empty, |fallbackName| is ignored. Otherwise, | 38 // If |name| is not empty, |fallbackName| is ignored. Otherwise, |
| 40 // |fallbackName| is used as a source of uniqueName. | 39 // |fallbackName| is used as a source of uniqueName. |
| 41 void setName(const AtomicString& name, const AtomicString& fallbackName = nu
llAtom); | 40 void setName(const AtomicString& name, const AtomicString& fallbackName = nu
llAtom); |
| 42 | 41 |
| 43 LocalFrame* parent() const; | 42 Frame* parent() const; |
| 44 LocalFrame* top() const; | 43 Frame* top() const; |
| 45 LocalFrame* previousSibling() const; | 44 Frame* previousSibling() const; |
| 46 LocalFrame* nextSibling() const; | 45 Frame* nextSibling() const; |
| 47 LocalFrame* firstChild() const; | 46 Frame* firstChild() const; |
| 48 LocalFrame* lastChild() const; | 47 Frame* lastChild() const; |
| 49 | 48 |
| 50 bool isDescendantOf(const LocalFrame* ancestor) const; | 49 bool isDescendantOf(const Frame* ancestor) const; |
| 51 LocalFrame* traversePreviousWithWrap(bool) const; | 50 Frame* traversePreviousWithWrap(bool) const; |
| 52 LocalFrame* traverseNext(const LocalFrame* stayWithin = 0) const; | 51 Frame* traverseNext(const Frame* stayWithin = 0) const; |
| 53 LocalFrame* traverseNextWithWrap(bool) const; | 52 Frame* traverseNextWithWrap(bool) const; |
| 54 | 53 |
| 55 LocalFrame* child(const AtomicString& name) const; | 54 Frame* child(const AtomicString& name) const; |
| 56 LocalFrame* find(const AtomicString& name) const; | 55 Frame* find(const AtomicString& name) const; |
| 57 unsigned childCount() const; | 56 unsigned childCount() const; |
| 58 | 57 |
| 59 LocalFrame* scopedChild(unsigned index) const; | 58 Frame* scopedChild(unsigned index) const; |
| 60 LocalFrame* scopedChild(const AtomicString& name) const; | 59 Frame* scopedChild(const AtomicString& name) const; |
| 61 unsigned scopedChildCount() const; | 60 unsigned scopedChildCount() const; |
| 62 void invalidateScopedChildCount(); | 61 void invalidateScopedChildCount(); |
| 63 | 62 |
| 64 private: | 63 private: |
| 65 LocalFrame* deepLastChild() const; | 64 Frame* deepLastChild() const; |
| 66 AtomicString uniqueChildName(const AtomicString& requestedName) const; | 65 AtomicString uniqueChildName(const AtomicString& requestedName) const; |
| 67 bool uniqueNameExists(const AtomicString& name) const; | 66 bool uniqueNameExists(const AtomicString& name) const; |
| 68 unsigned scopedChildCount(TreeScope*) const; | 67 unsigned scopedChildCount(TreeScope*) const; |
| 69 | 68 |
| 70 Frame* m_thisFrame; | 69 Frame* m_thisFrame; |
| 71 | 70 |
| 72 AtomicString m_name; // The actual frame name (may be empty). | 71 AtomicString m_name; // The actual frame name (may be empty). |
| 73 AtomicString m_uniqueName; | 72 AtomicString m_uniqueName; |
| 74 | 73 |
| 75 mutable unsigned m_scopedChildCount; | 74 mutable unsigned m_scopedChildCount; |
| 76 }; | 75 }; |
| 77 | 76 |
| 78 } // namespace WebCore | 77 } // namespace WebCore |
| 79 | 78 |
| 80 #ifndef NDEBUG | 79 #ifndef NDEBUG |
| 81 // Outside the WebCore namespace for ease of invocation from gdb. | 80 // Outside the WebCore namespace for ease of invocation from gdb. |
| 82 void showFrameTree(const WebCore::LocalFrame*); | 81 void showFrameTree(const WebCore::Frame*); |
| 83 #endif | 82 #endif |
| 84 | 83 |
| 85 #endif // FrameTree_h | 84 #endif // FrameTree_h |
| OLD | NEW |