2 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
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.
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.
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.
20 #ifndef WebHitTestResult_h
21 #define WebHitTestResult_h
23 #include "APIObject.h"
24 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
25 #include <WebCore/Color.h>
27 #include <WebCore/HitTestResult.h>
28 #include <WebCore/KURL.h>
29 #include <wtf/Forward.h>
30 #include <wtf/PassRefPtr.h>
31 #include <wtf/RefPtr.h>
32 #include <wtf/text/WTFString.h>
34 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
35 #include "DataReference.h"
39 class ArgumentDecoder;
40 class ArgumentEncoder;
47 class WebHitTestResult : public APIObject {
49 static const Type APIType = TypeHitTestResult;
51 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
52 enum HitTestResultContext{
53 HitTestResultContextDocument = 1 << 1,
54 HitTestResultContextLink = 1 << 2,
55 HitTestResultContextImage = 1 << 3,
56 HitTestResultContextMedia = 1 << 4,
57 HitTestResultContextSelection = 1 << 5,
58 HitTestResultContextEditable = 1 << 6,
59 HitTestResultContextText = 1 << 7,
60 #if ENABLE(TIZEN_DRAG_SUPPORT)
61 HitTestResultDragSupport = 1 << 8
66 HitTestModeDefault = 1 << 1,
67 HitTestModeNodeData = 1 << 2,
68 HitTestModeImageData = 1 << 3,
69 HitTestModeAll = HitTestModeDefault | HitTestModeNodeData | HitTestModeImageData
74 String absoluteImageURL;
75 String absolutePDFURL;
76 String absoluteLinkURL;
77 String absoluteMediaURL;
80 bool isContentEditable;
82 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
84 unsigned int hitTestMode;
86 #if ENABLE(TIZEN_DRAG_SUPPORT)
90 #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
91 WebCore::IntRect focusedRect;
92 WebCore::Color focusedColor;
98 typedef HashMap<String, String> AttributeMap;
99 AttributeMap attributeMap;
104 Vector<uint8_t> data;
105 String fileNameExtension;
114 explicit Data(const WebCore::HitTestResult& hitTestResult)
115 : absoluteImageURL(hitTestResult.absoluteImageURL().string())
116 , absolutePDFURL(hitTestResult.absolutePDFURL().string())
117 , absoluteLinkURL(hitTestResult.absoluteLinkURL().string())
118 , absoluteMediaURL(hitTestResult.absoluteMediaURL().string())
119 , linkLabel(hitTestResult.textContent())
120 , linkTitle(hitTestResult.titleDisplayString())
121 , isContentEditable(hitTestResult.isContentEditable())
122 #if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
123 , context(HitTestResultContextDocument)
124 , hitTestMode(HitTestModeDefault)
125 #if ENABLE(TIZEN_DRAG_SUPPORT)
126 , isDragSupport(hitTestResult.isDragSupport())
132 void encode(CoreIPC::ArgumentEncoder*) const;
133 static bool decode(CoreIPC::ArgumentDecoder*, WebHitTestResult::Data&);
136 static PassRefPtr<WebHitTestResult> create(const WebHitTestResult::Data&);
138 String absoluteImageURL() const { return m_data.absoluteImageURL; }
139 String absolutePDFURL() const { return m_data.absolutePDFURL; }
140 String absoluteLinkURL() const { return m_data.absoluteLinkURL; }
141 String absoluteMediaURL() const { return m_data.absoluteMediaURL; }
143 String linkLabel() const { return m_data.linkLabel; }
144 String linkTitle() const { return m_data.linkTitle; }
146 bool isContentEditable() const { return m_data.isContentEditable; }
147 #if ENABLE(TIZEN_DRAG_SUPPORT)
148 bool isDragSupport() const { return m_data.isDragSupport; }
152 explicit WebHitTestResult(const WebHitTestResult::Data& hitTestResultData)
153 : m_data(hitTestResultData)
157 virtual Type type() const { return APIType; }
162 } // namespace WebKit
164 #endif // WebHitTestResult_h