Home | History | Annotate | Download | only in dom
      1 /*
      2  * This file is part of the DOM implementation for WebCore.
      3  *
      4  * Copyright (C) 2006 Apple Computer, Inc.
      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  * along 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 
     23 #ifndef DocumentMarker_h
     24 #define DocumentMarker_h
     25 
     26 #include "PlatformString.h"
     27 
     28 namespace WebCore {
     29     class String;
     30 
     31 // A range of a node within a document that is "marked", such as the range of a misspelled word.
     32 // It optionally includes a description that could be displayed in the user interface.
     33 // It also optionally includes a flag specifying whether the match is active, which is ignored
     34 // for all types other than type TextMatch.
     35 struct DocumentMarker {
     36 
     37     enum MarkerType {
     38         AllMarkers  = -1,
     39         Spelling,
     40         Grammar,
     41         TextMatch,
     42         Replacement
     43     };
     44 
     45     MarkerType type;
     46     unsigned startOffset;
     47     unsigned endOffset;
     48     String description;
     49     bool activeMatch;
     50 
     51     bool operator==(const DocumentMarker& o) const
     52     {
     53         return type == o.type && startOffset == o.startOffset && endOffset == o.endOffset;
     54     }
     55 
     56     bool operator!=(const DocumentMarker& o) const
     57     {
     58         return !(*this == o);
     59     }
     60 };
     61 
     62 } // namespace WebCore
     63 
     64 #endif // DocumentMarker_h
     65