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