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#ifndef WebHitTestResultData_h
21#define WebHitTestResultData_h
22
23#include "APIObject.h"
24#include "SharedMemory.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 WebKit {
45
46struct WebHitTestResultData {
47 String absoluteImageURL;
48 String absolutePDFURL;
49 String absoluteLinkURL;
50 String absoluteMediaURL;
51 String linkLabel;
52 String linkTitle;
53 String linkSuggestedFilename;
54 bool isContentEditable;
55 WebCore::IntRect elementBoundingBox;
56 bool isScrollbar;
57 bool isSelected;
58 bool isTextNode;
59 bool isOverTextInsideFormControlElement;
60 bool isDownloadableMedia;
61
62 String lookupText;
63 RefPtr<WebKit::SharedMemory> imageSharedMemory;
64 uint64_t imageSize;
65
66#if PLATFORM(MAC)
67 RetainPtr<DDActionContext> detectedDataActionContext;
68#endif
69 WebCore::FloatRect detectedDataBoundingBox;
70 RefPtr<WebCore::TextIndicator> detectedDataTextIndicator;
71 WebCore::PageOverlay::PageOverlayID detectedDataOriginatingPageOverlay;
72
73 WebCore::DictionaryPopupInfo dictionaryPopupInfo;
74
75 RefPtr<WebCore::TextIndicator> linkTextIndicator;
76
77 WebHitTestResultData();
78 explicit WebHitTestResultData(const WebCore::HitTestResult&);
79 WebHitTestResultData(const WebCore::HitTestResult&, bool includeImage);
80 ~WebHitTestResultData();
81
82 void encode(IPC::Encoder&) const;
83 void platformEncode(IPC::Encoder&) const;
84 static bool decode(IPC::Decoder&, WebHitTestResultData&);
85 static bool platformDecode(IPC::Decoder&, WebHitTestResultData&);
86
87 WebCore::IntRect elementBoundingBoxInWindowCoordinates(const WebCore::HitTestResult&);
88};
89
90} // namespace WebKit
91
92#endif // WebHitTestResultData_h
93