webengine/osswebengine/WebCore/ksvg2/misc/PointerEventsHitRules.cpp
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     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 #if ENABLE(SVG)
       
    24 #include "PointerEventsHitRules.h"
       
    25 
       
    26 namespace WebCore {
       
    27 
       
    28 PointerEventsHitRules::PointerEventsHitRules(ESVGHitTesting hitTesting, EPointerEvents pointerEvents)
       
    29     : requireVisible(false)
       
    30     , requireFill(false)
       
    31     , requireStroke(false)
       
    32     , canHitStroke(false)
       
    33     , canHitFill(false)
       
    34 {
       
    35     if (hitTesting == SVG_PATH_HITTESTING) {
       
    36         switch (pointerEvents)
       
    37         {
       
    38             case PE_VISIBLE_PAINTED:
       
    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                 requireVisible = true;
       
    76                 requireFill = true;
       
    77                 requireStroke = true;
       
    78                 canHitFill = true;
       
    79                 canHitStroke = true;
       
    80                 break;
       
    81             case PE_VISIBLE_FILL:
       
    82             case PE_VISIBLE_STROKE:
       
    83             case PE_VISIBLE:
       
    84                 requireVisible = true;
       
    85                 canHitFill = true;
       
    86                 canHitStroke = true;
       
    87                 break;
       
    88             case PE_PAINTED:
       
    89                 requireFill = true;
       
    90                 requireStroke = true;
       
    91                 canHitFill = true;
       
    92                 canHitStroke = true;
       
    93                 break;
       
    94             case PE_FILL:
       
    95             case PE_STROKE:
       
    96             case PE_ALL:
       
    97                 canHitFill = true;
       
    98                 canHitStroke = true;
       
    99                 break;
       
   100             case PE_NONE:
       
   101                 // nothing to do here, defaults are all false.
       
   102                 break;
       
   103         }
       
   104     }
       
   105 }
       
   106 
       
   107 }
       
   108 
       
   109 // vim:ts=4:noet
       
   110 #endif // ENABLE(SVG)