diff options
Diffstat (limited to 'webkit/glue')
-rw-r--r-- | webkit/glue/webframe.h | 7 | ||||
-rw-r--r-- | webkit/glue/webframe_impl.cc | 14 | ||||
-rw-r--r-- | webkit/glue/webframe_impl.h | 2 |
3 files changed, 23 insertions, 0 deletions
diff --git a/webkit/glue/webframe.h b/webkit/glue/webframe.h index 1789bfb..faa98bd 100644 --- a/webkit/glue/webframe.h +++ b/webkit/glue/webframe.h @@ -191,6 +191,13 @@ class WebFrame { // Returns the top-most frame in the frame hierarchy containing this frame. virtual WebFrame* GetTop() const = 0; + // Returns the first child frame of this frame, or NULL if it has no children. + virtual WebFrame* GetFirstChild() const = 0; + + // Returns the next sibling frame of this frame, or NULL if there are no more + // siblings. + virtual WebFrame* GetNextSibling() const = 0; + // Returns the child frame with the given xpath. // The document of this frame is used as the context node. // The xpath may need a recursive traversal if non-trivial diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index 24d1e4b..c8c50ef 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -683,6 +683,20 @@ WebFrame* WebFrameImpl::GetTop() const { return NULL; } +WebFrame* WebFrameImpl::GetFirstChild() const { + if (frame_ && frame_->tree()->firstChild()) + return FromFrame(frame_->tree()->firstChild()); + + return NULL; +} + +WebFrame* WebFrameImpl::GetNextSibling() const { + if (frame_ && frame_->tree()->nextSibling()) + return FromFrame(frame_->tree()->nextSibling()); + + return NULL; +} + WebFrame* WebFrameImpl::GetChildFrame(const std::wstring& xpath) const { // xpath string can represent a frame deep down the tree (across multiple // frame DOMs). diff --git a/webkit/glue/webframe_impl.h b/webkit/glue/webframe_impl.h index 6db3aa0..5ddfdea 100644 --- a/webkit/glue/webframe_impl.h +++ b/webkit/glue/webframe_impl.h @@ -106,6 +106,8 @@ class WebFrameImpl : public WebFrame, public base::RefCounted<WebFrameImpl> { virtual WebFrame* GetOpener() const; virtual WebFrame* GetParent() const; virtual WebFrame* GetTop() const; + virtual WebFrame* GetFirstChild() const; + virtual WebFrame* GetNextSibling() const; virtual WebFrame* GetChildFrame(const std::wstring& xpath) const; virtual WebView* GetView() const; virtual void GetForms(std::vector<WebKit::WebForm>* forms) const; |