diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-09-18 15:53:33 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-09-18 15:53:33 +0200 |
commit | 6bbb7fbbac94d0f511a7bd0cbd50854ab643bfb2 (patch) | |
tree | d9c68d1cca0b3e352f1e438561f3e504e641a08f /Source/WebKit2/Shared/WebHitTestResult.h | |
parent | d0424a769059c84ae20beb3c217812792ea6726b (diff) | |
download | qtwebkit-6bbb7fbbac94d0f511a7bd0cbd50854ab643bfb2.tar.gz |
Imported WebKit commit c7503cef7ecb236730d1309676ab9fc723fd061d (http://svn.webkit.org/repository/webkit/trunk@128886)
New snapshot with various build fixes
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) |