Changeset 38924 in webkit


Ignore:
Timestamp:
Dec 2, 2008 4:13:31 PM (15 years ago)
Author:
kevino@webkit.org
Message:

Reviewed by Kevin Ollivier.

Add HitTest to wxWebView (and wxWebFrame).

https://bugs.webkit.org/show_bug.cgi?id=22459

Location:
trunk/WebKit/wx
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/wx/ChangeLog

    r38738 r38924  
     12008-12-02  Kevin Watters  <kevinwatters@gmail.com>
     2
     3        Reviewed by Kevin Ollivier.
     4
     5        Add HitTest to wxWebView (and wxWebFrame).
     6       
     7        https://bugs.webkit.org/show_bug.cgi?id=22459
     8
     9        * WebFrame.cpp:
     10        (wxWebFrame::HitTest):
     11        * WebFrame.h:
     12        * WebView.cpp:
     13        (wxWebView::HitTest):
     14        * WebView.h:
     15
    1162008-11-24  Darin Fisher  <darin@chromium.org>
    217
  • trunk/WebKit/wx/WebFrame.cpp

    r38687 r38924  
    2929#include "Editor.h"
    3030#include "Element.h"
     31#include "EventHandler.h"
    3132#include "Frame.h"
    3233#include "FrameLoader.h"
    3334#include "FrameView.h"
     35#include "HitTestResult.h"
    3436#include "HTMLFrameOwnerElement.h"
    3537#include "markup.h"
     
    347349
    348350}
     351
     352wxWebViewDOMElementInfo wxWebFrame::HitTest(const wxPoint& pos) const
     353{
     354    wxWebViewDOMElementInfo domInfo;
     355
     356    if (m_impl->frame->view()) {
     357        WebCore::HitTestResult result = m_impl->frame->eventHandler()->hitTestResultAtPoint(m_impl->frame->view()->windowToContents(pos), false);
     358        if (result.innerNode()) {
     359            domInfo.SetLink(result.absoluteLinkURL().string());
     360            domInfo.SetText(result.textContent());
     361            domInfo.SetImageSrc(result.absoluteImageURL().string());
     362            domInfo.SetSelected(result.isSelected());
     363        }
     364    }
     365
     366    return domInfo;
     367}
     368
  • trunk/WebKit/wx/WebFrame.h

    r38687 r38924  
    5959#endif // SWIG
    6060
     61class WXDLLIMPEXP_WEBKIT wxWebViewDOMElementInfo
     62{
     63public:
     64    wxWebViewDOMElementInfo();
     65
     66    ~wxWebViewDOMElementInfo() { }
     67
     68    wxString GetTagName() const { return m_tagName; }
     69    void SetTagName(const wxString& name) { m_tagName = name; }
     70
     71    bool IsSelected() const { return m_isSelected; }
     72    void SetSelected(bool sel) { m_isSelected = sel; }
     73
     74    wxString GetText() const { return m_text; }
     75    void SetText(const wxString& text) { m_text = text; }
     76
     77    wxString GetImageSrc() const { return m_imageSrc; }
     78    void SetImageSrc(const wxString& src) { m_imageSrc = src; }
     79
     80    wxString GetLink() const { return m_link; }
     81    void SetLink(const wxString& link) { m_link = link; }
     82
     83private:
     84    void* m_domElement;
     85    bool m_isSelected;
     86    wxString m_tagName;
     87    wxString m_text;
     88    wxString m_imageSrc;
     89    wxString m_link;
     90};
     91
    6192class WXDLLIMPEXP_WEBKIT wxWebFrame
    6293{
     
    115146   
    116147    WebCore::Frame* GetFrame();
     148
     149    wxWebViewDOMElementInfo HitTest(const wxPoint& post) const;
    117150   
    118151private:
  • trunk/WebKit/wx/WebView.cpp

    r38687 r38924  
    628628    event.Skip();
    629629}
     630
     631wxWebViewDOMElementInfo wxWebView::HitTest(const wxPoint& pos) const
     632{
     633    if (m_mainFrame)
     634        return m_mainFrame->HitTest(pos);
     635
     636    return wxWebViewDOMElementInfo();
     637}
     638
  • trunk/WebKit/wx/WebView.h

    r38424 r38924  
    3434#endif
    3535
     36#include "WebFrame.h"
     37
    3638class WebViewPrivate;
    3739class WebViewFrameData;
     
    135137   
    136138    wxWebFrame* GetMainFrame() { return m_mainFrame; }
     139
     140    wxWebViewDOMElementInfo HitTest(const wxPoint& post) const;
    137141
    138142protected:
     
    189193};
    190194
    191 class WXDLLIMPEXP_WEBKIT wxWebViewDOMElementInfo
    192 {
    193 public:
    194     wxWebViewDOMElementInfo();
    195 
    196     ~wxWebViewDOMElementInfo() { }
    197    
    198     wxString GetTagName() const { return m_tagName; }
    199     void SetTagName(const wxString& name) { m_tagName = name; }
    200 
    201     bool IsSelected() const { return m_isSelected; }
    202     void SetSelected(bool sel) { m_isSelected = sel; }
    203  
    204     wxString GetText() const { return m_text; }
    205     void SetText(const wxString& text) { m_text = text; }
    206  
    207     wxString GetImageSrc() const { return m_imageSrc; }
    208     void SetImageSrc(const wxString& src) { m_imageSrc = src; }
    209  
    210     wxString GetLink() const { return m_link; }
    211     void SetLink(const wxString& link) { m_link = link; }
    212 
    213 private:
    214     void* m_domElement;
    215     bool m_isSelected;
    216     wxString m_tagName;
    217     wxString m_text;
    218     wxString m_imageSrc;
    219     wxString m_link;
    220 };
    221 
    222195class WXDLLIMPEXP_WEBKIT wxWebViewBeforeLoadEvent : public wxCommandEvent
    223196{
Note: See TracChangeset for help on using the changeset viewer.