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