• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * This file is part of the HTML rendering engine for KDE.
3  *
4  * Copyright (C) 2006 Apple Computer, Inc.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB.  If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21 */
22 #ifndef HitTestResult_h
23 #define HitTestResult_h
24 
25 #include "IntPoint.h"
26 #include "TextDirection.h"
27 #include <wtf/RefPtr.h>
28 
29 namespace WebCore {
30 
31 class Element;
32 class Frame;
33 class Image;
34 class IntRect;
35 class KURL;
36 class Node;
37 class Scrollbar;
38 class String;
39 
40 class HitTestResult {
41 public:
42     HitTestResult(const IntPoint&);
43     HitTestResult(const HitTestResult&);
44     ~HitTestResult();
45     HitTestResult& operator=(const HitTestResult&);
46 
innerNode()47     Node* innerNode() const { return m_innerNode.get(); }
innerNonSharedNode()48     Node* innerNonSharedNode() const { return m_innerNonSharedNode.get(); }
point()49     IntPoint point() const { return m_point; }
localPoint()50     IntPoint localPoint() const { return m_localPoint; }
URLElement()51     Element* URLElement() const { return m_innerURLElement.get(); }
scrollbar()52     Scrollbar* scrollbar() const { return m_scrollbar.get(); }
isOverWidget()53     bool isOverWidget() const { return m_isOverWidget; }
54 
55     void setToNonShadowAncestor();
56 
57     void setInnerNode(Node*);
58     void setInnerNonSharedNode(Node*);
setPoint(const IntPoint & p)59     void setPoint(const IntPoint& p) { m_point = p; }
setLocalPoint(const IntPoint & p)60     void setLocalPoint(const IntPoint& p) { m_localPoint = p; }
61     void setURLElement(Element*);
62     void setScrollbar(Scrollbar*);
setIsOverWidget(bool b)63     void setIsOverWidget(bool b) { m_isOverWidget = b; }
64 
65     Frame* targetFrame() const;
66     IntRect boundingBox() const;
67     bool isSelected() const;
68     String spellingToolTip(TextDirection&) const;
69     String replacedString() const;
70     String title(TextDirection&) const;
71     String altDisplayString() const;
72     String titleDisplayString() const;
73     Image* image() const;
74     IntRect imageRect() const;
75     KURL absoluteImageURL() const;
76     KURL absoluteMediaURL() const;
77     KURL absoluteLinkURL() const;
78     String textContent() const;
79     bool isLiveLink() const;
80     bool isContentEditable() const;
81 
82 private:
83     RefPtr<Node> m_innerNode;
84     RefPtr<Node> m_innerNonSharedNode;
85     IntPoint m_point;
86     IntPoint m_localPoint; // A point in the local coordinate space of m_innerNonSharedNode's renderer.  Allows us to efficiently
87                            // determine where inside the renderer we hit on subsequent operations.
88     RefPtr<Element> m_innerURLElement;
89     RefPtr<Scrollbar> m_scrollbar;
90     bool m_isOverWidget; // Returns true if we are over a widget (and not in the border/padding area of a RenderWidget for example).
91 };
92 
93 String displayString(const String&, const Node*);
94 
95 } // namespace WebCore
96 
97 #endif // HitTestResult_h
98