1/*
2 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20#pragma once
21
22#include "APIObject.h"
23#include "SharedMemory.h"
24#include "WebHitTestResultData.h"
25#include <WebCore/DictionaryPopupInfo.h>
26#include <WebCore/FloatPoint.h>
27#include <WebCore/IntRect.h>
28#include <WebCore/PageOverlay.h>
29#include <wtf/Forward.h>
30#include <wtf/RefPtr.h>
31#include <wtf/text/WTFString.h>
32
33OBJC_CLASS DDActionContext;
34
35namespace IPC {
36class Decoder;
37class Encoder;
38}
39
40namespace WebCore {
41class HitTestResult;
42}
43
44namespace API {
45
46class WebFrame;
47
48class HitTestResult : public API::ObjectImpl<API::Object::Type::HitTestResult> {
49public:
50 static Ref<HitTestResult> create(const WebKit::WebHitTestResultData&);
51
52 WTF::String absoluteImageURL() const { return m_data.absoluteImageURL; }
53 WTF::String absolutePDFURL() const { return m_data.absolutePDFURL; }
54 WTF::String absoluteLinkURL() const { return m_data.absoluteLinkURL; }
55 WTF::String absoluteMediaURL() const { return m_data.absoluteMediaURL; }
56
57 WTF::String linkLabel() const { return m_data.linkLabel; }
58 WTF::String linkTitle() const { return m_data.linkTitle; }
59 WTF::String lookupText() const { return m_data.lookupText; }
60
61 bool isContentEditable() const { return m_data.isContentEditable; }
62
63 WebCore::IntRect elementBoundingBox() const { return m_data.elementBoundingBox; }
64
65 bool isScrollbar() const { return m_data.isScrollbar; }
66
67 bool isSelected() const { return m_data.isSelected; }
68
69 bool isTextNode() const { return m_data.isTextNode; }
70
71 bool isOverTextInsideFormControlElement() const { return m_data.isOverTextInsideFormControlElement; }
72
73 bool isDownloadableMedia() const { return m_data.isDownloadableMedia; }
74
75private:
76 explicit HitTestResult(const WebKit::WebHitTestResultData& hitTestResultData)
77 : m_data(hitTestResultData)
78 {
79 }
80
81 WebKit::WebHitTestResultData m_data;
82};
83
84} // namespace API
85