diff options
Diffstat (limited to 'Source/WebKit2/Shared/WebHitTestResult.h')
-rw-r--r-- | Source/WebKit2/Shared/WebHitTestResult.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/WebKit2/Shared/WebHitTestResult.h b/Source/WebKit2/Shared/WebHitTestResult.h index 798a2db2b..e53a5c7e2 100644 --- a/Source/WebKit2/Shared/WebHitTestResult.h +++ b/Source/WebKit2/Shared/WebHitTestResult.h @@ -21,8 +21,10 @@ #define WebHitTestResult_h #include "APIObject.h" +#include <WebCore/FrameView.h> #include <WebCore/HitTestResult.h> #include <WebCore/KURL.h> +#include <WebCore/Node.h> #include <wtf/Forward.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> @@ -49,11 +51,29 @@ public: String linkLabel; String linkTitle; bool isContentEditable; + WebCore::IntRect elementBoundingBox; Data() { } + WebCore::IntRect elementBoundingBoxInWindowCoordinates(const WebCore::HitTestResult& hitTestResult) + { + WebCore::Node* node = hitTestResult.innerNonSharedNode(); + if (!node) + return WebCore::IntRect(); + + WebCore::Frame* frame = node->document()->frame(); + if (!frame) + return WebCore::IntRect(); + + WebCore::FrameView* view = frame->view(); + if (!view) + return WebCore::IntRect(); + + return view->contentsToWindow(node->pixelSnappedBoundingBox()); + } + explicit Data(const WebCore::HitTestResult& hitTestResult) : absoluteImageURL(hitTestResult.absoluteImageURL().string()) , absolutePDFURL(hitTestResult.absolutePDFURL().string()) @@ -62,6 +82,7 @@ public: , linkLabel(hitTestResult.textContent()) , linkTitle(hitTestResult.titleDisplayString()) , isContentEditable(hitTestResult.isContentEditable()) + , elementBoundingBox(elementBoundingBoxInWindowCoordinates(hitTestResult)) { } @@ -81,6 +102,8 @@ public: bool isContentEditable() const { return m_data.isContentEditable; } + WebCore::IntRect elementBoundingBox() const { return m_data.elementBoundingBox; } + private: explicit WebHitTestResult(const WebHitTestResult::Data& hitTestResultData) : m_data(hitTestResultData) |