+2008-12-02 Kevin Watters <kevinwatters@gmail.com>
+
+ Reviewed by Kevin Ollivier.
+
+ Add HitTest to wxWebView (and wxWebFrame).
+
+ https://bugs.webkit.org/show_bug.cgi?id=22459
+
+ * WebFrame.cpp:
+ (wxWebFrame::HitTest):
+ * WebFrame.h:
+ * WebView.cpp:
+ (wxWebView::HitTest):
+ * WebView.h:
+
2008-11-24 Darin Fisher <darin@chromium.org>
Fix bustage.
#include "Document.h"
#include "Editor.h"
#include "Element.h"
+#include "EventHandler.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameView.h"
+#include "HitTestResult.h"
#include "HTMLFrameOwnerElement.h"
#include "markup.h"
#include "Page.h"
m_impl->frame->editor()->paste();
}
+
+wxWebViewDOMElementInfo wxWebFrame::HitTest(const wxPoint& pos) const
+{
+ wxWebViewDOMElementInfo domInfo;
+
+ if (m_impl->frame->view()) {
+ WebCore::HitTestResult result = m_impl->frame->eventHandler()->hitTestResultAtPoint(m_impl->frame->view()->windowToContents(pos), false);
+ if (result.innerNode()) {
+ domInfo.SetLink(result.absoluteLinkURL().string());
+ domInfo.SetText(result.textContent());
+ domInfo.SetImageSrc(result.absoluteImageURL().string());
+ domInfo.SetSelected(result.isSelected());
+ }
+ }
+
+ return domInfo;
+}
+
#define WXDLLIMPEXP_WEBKIT
#endif // SWIG
+class WXDLLIMPEXP_WEBKIT wxWebViewDOMElementInfo
+{
+public:
+ wxWebViewDOMElementInfo();
+
+ ~wxWebViewDOMElementInfo() { }
+
+ wxString GetTagName() const { return m_tagName; }
+ void SetTagName(const wxString& name) { m_tagName = name; }
+
+ bool IsSelected() const { return m_isSelected; }
+ void SetSelected(bool sel) { m_isSelected = sel; }
+
+ wxString GetText() const { return m_text; }
+ void SetText(const wxString& text) { m_text = text; }
+
+ wxString GetImageSrc() const { return m_imageSrc; }
+ void SetImageSrc(const wxString& src) { m_imageSrc = src; }
+
+ wxString GetLink() const { return m_link; }
+ void SetLink(const wxString& link) { m_link = link; }
+
+private:
+ void* m_domElement;
+ bool m_isSelected;
+ wxString m_tagName;
+ wxString m_text;
+ wxString m_imageSrc;
+ wxString m_link;
+};
+
class WXDLLIMPEXP_WEBKIT wxWebFrame
{
// ChromeClientWx needs to get the Page* stored by the wxWebView
void SetPageTitle(const wxString& title) { m_title = title; }
WebCore::Frame* GetFrame();
+
+ wxWebViewDOMElementInfo HitTest(const wxPoint& post) const;
private:
float m_textMagnifier;
event.Skip();
}
+
+wxWebViewDOMElementInfo wxWebView::HitTest(const wxPoint& pos) const
+{
+ if (m_mainFrame)
+ return m_mainFrame->HitTest(pos);
+
+ return wxWebViewDOMElementInfo();
+}
+
#include "wx/wx.h"
#endif
+#include "WebFrame.h"
+
class WebViewPrivate;
class WebViewFrameData;
class wxWebFrame;
wxWebFrame* GetMainFrame() { return m_mainFrame; }
+ wxWebViewDOMElementInfo HitTest(const wxPoint& post) const;
+
protected:
// event handlers (these functions should _not_ be virtual)
wxWEBVIEW_NAV_OTHER = 32
};
-class WXDLLIMPEXP_WEBKIT wxWebViewDOMElementInfo
-{
-public:
- wxWebViewDOMElementInfo();
-
- ~wxWebViewDOMElementInfo() { }
-
- wxString GetTagName() const { return m_tagName; }
- void SetTagName(const wxString& name) { m_tagName = name; }
-
- bool IsSelected() const { return m_isSelected; }
- void SetSelected(bool sel) { m_isSelected = sel; }
-
- wxString GetText() const { return m_text; }
- void SetText(const wxString& text) { m_text = text; }
-
- wxString GetImageSrc() const { return m_imageSrc; }
- void SetImageSrc(const wxString& src) { m_imageSrc = src; }
-
- wxString GetLink() const { return m_link; }
- void SetLink(const wxString& link) { m_link = link; }
-
-private:
- void* m_domElement;
- bool m_isSelected;
- wxString m_tagName;
- wxString m_text;
- wxString m_imageSrc;
- wxString m_link;
-};
-
class WXDLLIMPEXP_WEBKIT wxWebViewBeforeLoadEvent : public wxCommandEvent
{
#ifndef SWIG