1773979f92560dd1aead375c82fd75b584a141e5dJohn Reck/*
2773979f92560dd1aead375c82fd75b584a141e5dJohn Reck* Copyright (C) 2011 Google Inc. All rights reserved.
3773979f92560dd1aead375c82fd75b584a141e5dJohn Reck*
4773979f92560dd1aead375c82fd75b584a141e5dJohn Reck* Redistribution and use in source and binary forms, with or without
5773979f92560dd1aead375c82fd75b584a141e5dJohn Reck* modification, are permitted provided that the following conditions
6773979f92560dd1aead375c82fd75b584a141e5dJohn Reck* are met:
7773979f92560dd1aead375c82fd75b584a141e5dJohn Reck*
8773979f92560dd1aead375c82fd75b584a141e5dJohn Reck* 1.  Redistributions of source code must retain the above copyright
9773979f92560dd1aead375c82fd75b584a141e5dJohn Reck*     notice, this list of conditions and the following disclaimer.
10773979f92560dd1aead375c82fd75b584a141e5dJohn Reck * 2.  Redistributions in binary form must reproduce the above copyright
11773979f92560dd1aead375c82fd75b584a141e5dJohn Reck *     notice, this list of conditions and the following disclaimer in the
12773979f92560dd1aead375c82fd75b584a141e5dJohn Reck *     documentation and/or other materials provided with the distribution.
13773979f92560dd1aead375c82fd75b584a141e5dJohn Reck *
14773979f92560dd1aead375c82fd75b584a141e5dJohn Reck * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
15773979f92560dd1aead375c82fd75b584a141e5dJohn Reck * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16773979f92560dd1aead375c82fd75b584a141e5dJohn Reck * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17773979f92560dd1aead375c82fd75b584a141e5dJohn Reck * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
18773979f92560dd1aead375c82fd75b584a141e5dJohn Reck * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19773979f92560dd1aead375c82fd75b584a141e5dJohn Reck * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20773979f92560dd1aead375c82fd75b584a141e5dJohn Reck * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21773979f92560dd1aead375c82fd75b584a141e5dJohn Reck * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22773979f92560dd1aead375c82fd75b584a141e5dJohn Reck * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23773979f92560dd1aead375c82fd75b584a141e5dJohn Reck * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24773979f92560dd1aead375c82fd75b584a141e5dJohn Reck */
25773979f92560dd1aead375c82fd75b584a141e5dJohn Reck
26773979f92560dd1aead375c82fd75b584a141e5dJohn Reck#ifndef WebHitTestInfo_h
27773979f92560dd1aead375c82fd75b584a141e5dJohn Reck#define WebHitTestInfo_h
28773979f92560dd1aead375c82fd75b584a141e5dJohn Reck
29773979f92560dd1aead375c82fd75b584a141e5dJohn Reck#include "../WebPoint.h"
30773979f92560dd1aead375c82fd75b584a141e5dJohn Reck#include "../WebPrivateOwnPtr.h"
31773979f92560dd1aead375c82fd75b584a141e5dJohn Reck#include "../WebURL.h"
32773979f92560dd1aead375c82fd75b584a141e5dJohn Reck
33773979f92560dd1aead375c82fd75b584a141e5dJohn Recknamespace WebCore {
34773979f92560dd1aead375c82fd75b584a141e5dJohn Reckclass HitTestResult;
35773979f92560dd1aead375c82fd75b584a141e5dJohn Reckclass Node;
36773979f92560dd1aead375c82fd75b584a141e5dJohn Reck}
37773979f92560dd1aead375c82fd75b584a141e5dJohn Reck
38773979f92560dd1aead375c82fd75b584a141e5dJohn Recknamespace WebKit {
39773979f92560dd1aead375c82fd75b584a141e5dJohn Reck
40773979f92560dd1aead375c82fd75b584a141e5dJohn Reck// Properties of a hit test result, i.e. properties of the nodes at a given point
41773979f92560dd1aead375c82fd75b584a141e5dJohn Reck// (the hit point) on the page. Both urls may be populated at the same time, for
42773979f92560dd1aead375c82fd75b584a141e5dJohn Reck// example in the instance of an <img> inside an <a>.
43773979f92560dd1aead375c82fd75b584a141e5dJohn Reckclass WebHitTestInfo {
44773979f92560dd1aead375c82fd75b584a141e5dJohn Reckpublic:
45773979f92560dd1aead375c82fd75b584a141e5dJohn Reck    WebHitTestInfo();
46773979f92560dd1aead375c82fd75b584a141e5dJohn Reck    WebHitTestInfo(const WebHitTestInfo&);
47773979f92560dd1aead375c82fd75b584a141e5dJohn Reck    ~WebHitTestInfo();
48773979f92560dd1aead375c82fd75b584a141e5dJohn Reck
49773979f92560dd1aead375c82fd75b584a141e5dJohn Reck    // The absolute URL of the link returned by the hit test.
50773979f92560dd1aead375c82fd75b584a141e5dJohn Reck    WEBKIT_API WebURL linkURL() const;
51773979f92560dd1aead375c82fd75b584a141e5dJohn Reck
52773979f92560dd1aead375c82fd75b584a141e5dJohn Reck    // The absolute URL of the image returned by the hit test.
53773979f92560dd1aead375c82fd75b584a141e5dJohn Reck    WEBKIT_API WebURL imageURL() const;
54773979f92560dd1aead375c82fd75b584a141e5dJohn Reck
55773979f92560dd1aead375c82fd75b584a141e5dJohn Reck    // The node that got hit.
56773979f92560dd1aead375c82fd75b584a141e5dJohn Reck    WEBKIT_API WebCore::Node* node() const;
57773979f92560dd1aead375c82fd75b584a141e5dJohn Reck
58773979f92560dd1aead375c82fd75b584a141e5dJohn Reck    // Point coordinates of the hit.
59773979f92560dd1aead375c82fd75b584a141e5dJohn Reck    WEBKIT_API WebPoint point() const;
60773979f92560dd1aead375c82fd75b584a141e5dJohn Reck
61773979f92560dd1aead375c82fd75b584a141e5dJohn Reck    // True iff the hit was on an editable field or node.
62773979f92560dd1aead375c82fd75b584a141e5dJohn Reck    WEBKIT_API bool isContentEditable() const;
63773979f92560dd1aead375c82fd75b584a141e5dJohn Reck
64773979f92560dd1aead375c82fd75b584a141e5dJohn Reck#if WEBKIT_IMPLEMENTATION
65773979f92560dd1aead375c82fd75b584a141e5dJohn Reck    WebHitTestInfo(const WebCore::HitTestResult&);
66773979f92560dd1aead375c82fd75b584a141e5dJohn Reck    WebHitTestInfo& operator=(const WebCore::HitTestResult&);
67773979f92560dd1aead375c82fd75b584a141e5dJohn Reck    operator WebCore::HitTestResult() const;
68773979f92560dd1aead375c82fd75b584a141e5dJohn Reck#endif
69773979f92560dd1aead375c82fd75b584a141e5dJohn Reck
70773979f92560dd1aead375c82fd75b584a141e5dJohn Reckprotected:
71773979f92560dd1aead375c82fd75b584a141e5dJohn Reck    WebPrivateOwnPtr<WebCore::HitTestResult> m_private;
72773979f92560dd1aead375c82fd75b584a141e5dJohn Reck};
73773979f92560dd1aead375c82fd75b584a141e5dJohn Reck
74773979f92560dd1aead375c82fd75b584a141e5dJohn Reck} // namespace WebKit
75773979f92560dd1aead375c82fd75b584a141e5dJohn Reck
76773979f92560dd1aead375c82fd75b584a141e5dJohn Reck#endif
77