1 /*
2 Copyright (C) 2007 Rob Buis <buis@kde.org>
3
4 This file is part of the KDE project
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 aint 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 #include "config.h"
23 #include "PointerEventsHitRules.h"
24
25 namespace WebCore {
26
PointerEventsHitRules(EHitTesting hitTesting,EPointerEvents pointerEvents)27 PointerEventsHitRules::PointerEventsHitRules(EHitTesting hitTesting, EPointerEvents pointerEvents)
28 : requireVisible(false)
29 , requireFill(false)
30 , requireStroke(false)
31 , canHitStroke(false)
32 , canHitFill(false)
33 {
34 if (hitTesting == SVG_PATH_HITTESTING) {
35 switch (pointerEvents)
36 {
37 case PE_VISIBLE_PAINTED:
38 case PE_AUTO: // "auto" is like "visiblePainted" when in SVG content
39 requireFill = true;
40 requireStroke = true;
41 case PE_VISIBLE:
42 requireVisible = true;
43 canHitFill = true;
44 canHitStroke = true;
45 break;
46 case PE_VISIBLE_FILL:
47 requireVisible = true;
48 canHitFill = true;
49 break;
50 case PE_VISIBLE_STROKE:
51 requireVisible = true;
52 canHitStroke = true;
53 break;
54 case PE_PAINTED:
55 requireFill = true;
56 requireStroke = true;
57 case PE_ALL:
58 canHitFill = true;
59 canHitStroke = true;
60 break;
61 case PE_FILL:
62 canHitFill = true;
63 break;
64 case PE_STROKE:
65 canHitStroke = true;
66 break;
67 case PE_NONE:
68 // nothing to do here, defaults are all false.
69 break;
70 }
71 } else {
72 switch (pointerEvents)
73 {
74 case PE_VISIBLE_PAINTED:
75 case PE_AUTO: // "auto" is like "visiblePainted" when in SVG content
76 requireVisible = true;
77 requireFill = true;
78 requireStroke = true;
79 canHitFill = true;
80 canHitStroke = true;
81 break;
82 case PE_VISIBLE_FILL:
83 case PE_VISIBLE_STROKE:
84 case PE_VISIBLE:
85 requireVisible = true;
86 canHitFill = true;
87 canHitStroke = true;
88 break;
89 case PE_PAINTED:
90 requireFill = true;
91 requireStroke = true;
92 canHitFill = true;
93 canHitStroke = true;
94 break;
95 case PE_FILL:
96 case PE_STROKE:
97 case PE_ALL:
98 canHitFill = true;
99 canHitStroke = true;
100 break;
101 case PE_NONE:
102 // nothing to do here, defaults are all false.
103 break;
104 }
105 }
106 }
107
108 }
109
110 // vim:ts=4:noet
111