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 |
(...skipping 24 matching lines...) Expand all Loading... |
35 public: | 35 public: |
36 explicit FrameTree(Frame* thisFrame); | 36 explicit FrameTree(Frame* thisFrame); |
37 ~FrameTree(); | 37 ~FrameTree(); |
38 | 38 |
39 const AtomicString& name() const { return m_name; } | 39 const AtomicString& name() const { return m_name; } |
40 const AtomicString& uniqueName() const { return m_uniqueName; } | 40 const AtomicString& uniqueName() const { return m_uniqueName; } |
41 // If |name| is not empty, |fallbackName| is ignored. Otherwise, | 41 // If |name| is not empty, |fallbackName| is ignored. Otherwise, |
42 // |fallbackName| is used as a source of uniqueName. | 42 // |fallbackName| is used as a source of uniqueName. |
43 void setName(const AtomicString& name, const AtomicString& fallbackName = nu
llAtom); | 43 void setName(const AtomicString& name, const AtomicString& fallbackName = nu
llAtom); |
44 | 44 |
45 // Directly assigns both the name and uniqueName. Should only be used when | 45 // Directly assigns both the name and uniqueName. Can be used when |
46 // switching between LocalFrames and RemoteFrames for the same logical frame | 46 // |uniqueName| is already known (i.e. when it has been precalculated by |
47 // so that the unique name stays unique. | 47 // calculateUniqueNameForNewChildFrame OR when replicating the name between |
48 void setNameForReplacementFrame(const AtomicString& name, const AtomicString
& uniqueName); | 48 // LocalFrames and RemoteFrames for the same logical frame). |
| 49 void setPrecalculatedName(const AtomicString& name, const AtomicString& uniq
ueName); |
49 | 50 |
50 Frame* parent() const; | 51 Frame* parent() const; |
51 Frame* top() const; | 52 Frame* top() const; |
52 Frame* previousSibling() const; | 53 Frame* previousSibling() const; |
53 Frame* nextSibling() const; | 54 Frame* nextSibling() const; |
54 Frame* firstChild() const; | 55 Frame* firstChild() const; |
55 Frame* lastChild() const; | 56 Frame* lastChild() const; |
56 | 57 |
57 bool isDescendantOf(const Frame* ancestor) const; | 58 bool isDescendantOf(const Frame* ancestor) const; |
58 Frame* traversePreviousWithWrap(bool) const; | 59 Frame* traversePreviousWithWrap(bool) const; |
59 Frame* traverseNext(const Frame* stayWithin = nullptr) const; | 60 Frame* traverseNext(const Frame* stayWithin = nullptr) const; |
60 Frame* traverseNextWithWrap(bool) const; | 61 Frame* traverseNextWithWrap(bool) const; |
61 | 62 |
62 Frame* child(const AtomicString& name) const; | 63 Frame* child(const AtomicString& name) const; |
63 Frame* find(const AtomicString& name) const; | 64 Frame* find(const AtomicString& name) const; |
64 unsigned childCount() const; | 65 unsigned childCount() const; |
65 | 66 |
66 Frame* scopedChild(unsigned index) const; | 67 Frame* scopedChild(unsigned index) const; |
67 Frame* scopedChild(const AtomicString& name) const; | 68 Frame* scopedChild(const AtomicString& name) const; |
68 unsigned scopedChildCount() const; | 69 unsigned scopedChildCount() const; |
69 void invalidateScopedChildCount(); | 70 void invalidateScopedChildCount(); |
70 | 71 |
71 DECLARE_TRACE(); | 72 DECLARE_TRACE(); |
72 | 73 |
| 74 AtomicString calculateUniqueNameForNewChildFrame( |
| 75 const AtomicString& name, |
| 76 const AtomicString& fallbackName = nullAtom) const; |
| 77 |
73 private: | 78 private: |
74 Frame* deepLastChild() const; | 79 Frame* deepLastChild() const; |
75 AtomicString uniqueChildName(const AtomicString& requestedName) const; | 80 AtomicString calculateUniqueNameForChildFrame( |
| 81 bool existingChildFrame, |
| 82 const AtomicString& name, |
| 83 const AtomicString& fallbackName = nullAtom) const; |
76 bool uniqueNameExists(const AtomicString& name) const; | 84 bool uniqueNameExists(const AtomicString& name) const; |
77 | 85 |
78 RawPtrWillBeMember<Frame> m_thisFrame; | 86 RawPtrWillBeMember<Frame> m_thisFrame; |
79 | 87 |
80 AtomicString m_name; // The actual frame name (may be empty). | 88 AtomicString m_name; // The actual frame name (may be empty). |
81 AtomicString m_uniqueName; | 89 AtomicString m_uniqueName; |
82 | 90 |
83 mutable unsigned m_scopedChildCount; | 91 mutable unsigned m_scopedChildCount; |
84 }; | 92 }; |
85 | 93 |
86 } // namespace blink | 94 } // namespace blink |
87 | 95 |
88 #ifndef NDEBUG | 96 #ifndef NDEBUG |
89 // Outside the WebCore namespace for ease of invocation from gdb. | 97 // Outside the WebCore namespace for ease of invocation from gdb. |
90 void showFrameTree(const blink::Frame*); | 98 void showFrameTree(const blink::Frame*); |
91 #endif | 99 #endif |
92 | 100 |
93 #endif // FrameTree_h | 101 #endif // FrameTree_h |
OLD | NEW |