diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/page/FrameTree.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/page/FrameTree.h')
-rw-r--r-- | Source/WebCore/page/FrameTree.h | 172 |
1 files changed, 89 insertions, 83 deletions
diff --git a/Source/WebCore/page/FrameTree.h b/Source/WebCore/page/FrameTree.h index c6b5c0191..052f3609e 100644 --- a/Source/WebCore/page/FrameTree.h +++ b/Source/WebCore/page/FrameTree.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006-2017 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -17,94 +17,100 @@ * Boston, MA 02110-1301, USA. */ -#ifndef FrameTree_h -#define FrameTree_h +#pragma once #include <wtf/text/AtomicString.h> namespace WebCore { - class Frame; - class TreeScope; - - class FrameTree { - WTF_MAKE_NONCOPYABLE(FrameTree); - public: - const static unsigned invalidCount = static_cast<unsigned>(-1); - - FrameTree(Frame& thisFrame, Frame* parentFrame) - : m_thisFrame(thisFrame) - , m_parent(parentFrame) - , m_previousSibling(0) - , m_lastChild(0) - , m_scopedChildCount(invalidCount) - { - } - - ~FrameTree(); - - const AtomicString& name() const { return m_name; } - const AtomicString& uniqueName() const { return m_uniqueName; } - void setName(const AtomicString&); - void clearName(); - Frame* parent() const; - void setParent(Frame* parent) { m_parent = parent; } - - Frame* nextSibling() const { return m_nextSibling.get(); } - Frame* previousSibling() const { return m_previousSibling; } - Frame* firstChild() const { return m_firstChild.get(); } - Frame* lastChild() const { return m_lastChild; } - - bool isDescendantOf(const Frame* ancestor) const; - Frame* traverseNext(const Frame* stayWithin = 0) const; - Frame* traverseNextWithWrap(bool) const; - Frame* traversePreviousWithWrap(bool) const; - - void appendChild(PassRefPtr<Frame>); - bool transferChild(PassRefPtr<Frame>); - void detachFromParent() { m_parent = 0; } - void removeChild(Frame*); - - Frame* child(unsigned index) const; - Frame* child(const AtomicString& name) const; - Frame* find(const AtomicString& name) const; - unsigned childCount() const; - - AtomicString uniqueChildName(const AtomicString& requestedName) const; - - Frame& top() const; - - Frame* scopedChild(unsigned index) const; - Frame* scopedChild(const AtomicString& name) const; - unsigned scopedChildCount() const; - - private: - Frame* deepLastChild() const; - void actuallyAppendChild(PassRefPtr<Frame>); - - bool scopedBy(TreeScope*) const; - Frame* scopedChild(unsigned index, TreeScope*) const; - Frame* scopedChild(const AtomicString& name, TreeScope*) const; - unsigned scopedChildCount(TreeScope*) const; - - Frame& m_thisFrame; - - Frame* m_parent; - AtomicString m_name; // The actual frame name (may be empty). - AtomicString m_uniqueName; - - RefPtr<Frame> m_nextSibling; - Frame* m_previousSibling; - RefPtr<Frame> m_firstChild; - Frame* m_lastChild; - mutable unsigned m_scopedChildCount; - }; +class Frame; +class TreeScope; + +class FrameTree { + WTF_MAKE_NONCOPYABLE(FrameTree); +public: + const static unsigned invalidCount = static_cast<unsigned>(-1); + + FrameTree(Frame& thisFrame, Frame* parentFrame) + : m_thisFrame(thisFrame) + , m_parent(parentFrame) + , m_previousSibling(nullptr) + , m_lastChild(nullptr) + , m_scopedChildCount(invalidCount) + { + } + + ~FrameTree(); + + const AtomicString& name() const { return m_name; } + const AtomicString& uniqueName() const { return m_uniqueName; } + WEBCORE_EXPORT void setName(const AtomicString&); + WEBCORE_EXPORT void clearName(); + WEBCORE_EXPORT Frame* parent() const; + void setParent(Frame* parent) { m_parent = parent; } + + Frame* nextSibling() const { return m_nextSibling.get(); } + Frame* previousSibling() const { return m_previousSibling; } + Frame* firstChild() const { return m_firstChild.get(); } + Frame* lastChild() const { return m_lastChild; } + + Frame* firstRenderedChild() const; + Frame* nextRenderedSibling() const; + + WEBCORE_EXPORT bool isDescendantOf(const Frame* ancestor) const; + + WEBCORE_EXPORT Frame* traverseNext(const Frame* stayWithin = nullptr) const; + // Rendered means being the main frame or having an ownerRenderer. It may not have been parented in the Widget tree yet (see WidgetHierarchyUpdatesSuspensionScope). + WEBCORE_EXPORT Frame* traverseNextRendered(const Frame* stayWithin = nullptr) const; + WEBCORE_EXPORT Frame* traverseNextWithWrap(bool) const; + WEBCORE_EXPORT Frame* traversePreviousWithWrap(bool) const; + + Frame* traverseNextInPostOrderWithWrap(bool) const; + + WEBCORE_EXPORT void appendChild(Frame&); + void detachFromParent() { m_parent = nullptr; } + void removeChild(Frame&); + + Frame* child(unsigned index) const; + Frame* child(const AtomicString& name) const; + WEBCORE_EXPORT Frame* find(const AtomicString& name) const; + WEBCORE_EXPORT unsigned childCount() const; + + AtomicString uniqueChildName(const AtomicString& requestedName) const; + + WEBCORE_EXPORT Frame& top() const; + + WEBCORE_EXPORT Frame* scopedChild(unsigned index) const; + WEBCORE_EXPORT Frame* scopedChild(const AtomicString& name) const; + unsigned scopedChildCount() const; + + unsigned indexInParent() const; + +private: + Frame* deepFirstChild() const; + Frame* deepLastChild() const; + + bool scopedBy(TreeScope*) const; + Frame* scopedChild(unsigned index, TreeScope*) const; + Frame* scopedChild(const AtomicString& name, TreeScope*) const; + unsigned scopedChildCount(TreeScope*) const; + + Frame& m_thisFrame; + + Frame* m_parent; + AtomicString m_name; // The actual frame name (may be empty). + AtomicString m_uniqueName; + + RefPtr<Frame> m_nextSibling; + Frame* m_previousSibling; + RefPtr<Frame> m_firstChild; + Frame* m_lastChild; + mutable unsigned m_scopedChildCount; +}; } // namespace WebCore -#ifndef NDEBUG -// Outside the WebCore namespace for ease of invocation from gdb. -void showFrameTree(const WebCore::Frame*); +#if ENABLE(TREE_DEBUGGING) +// Outside the WebCore namespace for ease of invocation from the debugger. +WEBCORE_EXPORT void showFrameTree(const WebCore::Frame*); #endif - -#endif // FrameTree_h |