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