1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_SPELL_CHECK_MARKER_H_
6 #define THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_SPELL_CHECK_MARKER_H_
7 
8 #include "third_party/blink/renderer/core/editing/markers/document_marker.h"
9 #include "third_party/blink/renderer/platform/wtf/casting.h"
10 
11 namespace blink {
12 
13 // A subclass of DocumentMarker used to implement functionality shared between
14 // spelling and grammar markers. These two marker types both store a
15 // description string that can contain suggested replacements for a misspelling
16 // or grammar error.
17 class CORE_EXPORT SpellCheckMarker : public DocumentMarker {
18  public:
19   SpellCheckMarker(unsigned start_offset,
20                    unsigned end_offset,
21                    const String& description);
22 
Description()23   const String& Description() const { return description_; }
24 
25  private:
26   const String description_;
27 
28   DISALLOW_COPY_AND_ASSIGN(SpellCheckMarker);
29 };
30 
31 bool CORE_EXPORT IsSpellCheckMarker(const DocumentMarker&);
32 
33 template <>
34 struct DowncastTraits<SpellCheckMarker> {
35   static bool AllowFrom(const DocumentMarker& marker) {
36     return IsSpellCheckMarker(marker);
37   }
38 };
39 
40 }  // namespace blink
41 
42 #endif
43