Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: third_party/WebKit/Source/platform/text/TextChecking.h

Issue 2228293002: Remove dead code in spell checker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@DeprecateTextCheckingType
Patch Set: 201608101257 Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 Google Inc. All rights reserved. 2 * Copyright (c) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 21 matching lines...) Expand all
32 #define TextChecking_h 32 #define TextChecking_h
33 33
34 #include "platform/heap/Handle.h" 34 #include "platform/heap/Handle.h"
35 #include "platform/text/TextDecoration.h" 35 #include "platform/text/TextDecoration.h"
36 #include "wtf/Allocator.h" 36 #include "wtf/Allocator.h"
37 #include "wtf/Vector.h" 37 #include "wtf/Vector.h"
38 #include "wtf/text/WTFString.h" 38 #include "wtf/text/WTFString.h"
39 39
40 namespace blink { 40 namespace blink {
41 41
42 enum TextCheckingType {
43 TextCheckingTypeNone = 0,
44 TextCheckingTypeSpelling = 1 << 1,
45 TextCheckingTypeGrammar = 1 << 2,
46 };
47
48 typedef unsigned TextCheckingTypeMask;
49
50 enum TextCheckingProcessType { 42 enum TextCheckingProcessType {
51 TextCheckingProcessBatch, 43 TextCheckingProcessBatch,
52 TextCheckingProcessIncremental 44 TextCheckingProcessIncremental
53 }; 45 };
54 46
55 struct GrammarDetail { 47 struct GrammarDetail {
56 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 48 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
57 int location; 49 int location;
58 int length; 50 int length;
59 Vector<String> guesses; 51 Vector<String> guesses;
(...skipping 11 matching lines...) Expand all
71 }; 63 };
72 64
73 const int unrequestedTextCheckingSequence = -1; 65 const int unrequestedTextCheckingSequence = -1;
74 66
75 class TextCheckingRequestData final { 67 class TextCheckingRequestData final {
76 DISALLOW_NEW(); 68 DISALLOW_NEW();
77 friend class SpellCheckRequest; // For access to m_sequence. 69 friend class SpellCheckRequest; // For access to m_sequence.
78 public: 70 public:
79 TextCheckingRequestData() 71 TextCheckingRequestData()
80 : m_sequence(unrequestedTextCheckingSequence) 72 : m_sequence(unrequestedTextCheckingSequence)
81 , m_mask(TextCheckingTypeNone)
82 , m_processType(TextCheckingProcessIncremental) 73 , m_processType(TextCheckingProcessIncremental)
83 { } 74 { }
84 TextCheckingRequestData(int sequence, const String& text, TextCheckingTypeMa sk mask, TextCheckingProcessType processType, const Vector<uint32_t>& markers, c onst Vector<unsigned>& offsets) 75 TextCheckingRequestData(int sequence, const String& text, TextCheckingProces sType processType, const Vector<uint32_t>& markers, const Vector<unsigned>& offs ets)
85 : m_sequence(sequence) 76 : m_sequence(sequence)
86 , m_text(text) 77 , m_text(text)
87 , m_mask(mask)
88 , m_processType(processType) 78 , m_processType(processType)
89 , m_markers(markers) 79 , m_markers(markers)
90 , m_offsets(offsets) 80 , m_offsets(offsets)
91 { } 81 { }
92 82
93 int sequence() const { return m_sequence; } 83 int sequence() const { return m_sequence; }
94 String text() const { return m_text; } 84 String text() const { return m_text; }
95 TextCheckingTypeMask mask() const { return m_mask; }
96 bool maskContains(TextCheckingType type) const { return m_mask & type; }
97 TextCheckingProcessType processType() const { return m_processType; } 85 TextCheckingProcessType processType() const { return m_processType; }
98 const Vector<uint32_t>& markers() const { return m_markers; } 86 const Vector<uint32_t>& markers() const { return m_markers; }
99 const Vector<unsigned>& offsets() const { return m_offsets; } 87 const Vector<unsigned>& offsets() const { return m_offsets; }
100 88
101 private: 89 private:
102 int m_sequence; 90 int m_sequence;
103 String m_text; 91 String m_text;
104 TextCheckingTypeMask m_mask;
105 TextCheckingProcessType m_processType; 92 TextCheckingProcessType m_processType;
106 Vector<uint32_t> m_markers; 93 Vector<uint32_t> m_markers;
107 Vector<unsigned> m_offsets; 94 Vector<unsigned> m_offsets;
108 }; 95 };
109 96
110 class TextCheckingRequest : public GarbageCollectedFinalized<TextCheckingRequest > { 97 class TextCheckingRequest : public GarbageCollectedFinalized<TextCheckingRequest > {
111 public: 98 public:
112 virtual ~TextCheckingRequest() { } 99 virtual ~TextCheckingRequest() { }
113 DEFINE_INLINE_VIRTUAL_TRACE() { } 100 DEFINE_INLINE_VIRTUAL_TRACE() { }
114 101
115 virtual const TextCheckingRequestData& data() const = 0; 102 virtual const TextCheckingRequestData& data() const = 0;
116 virtual void didSucceed(const Vector<TextCheckingResult>&) = 0; 103 virtual void didSucceed(const Vector<TextCheckingResult>&) = 0;
117 virtual void didCancel() = 0; 104 virtual void didCancel() = 0;
118 }; 105 };
119 106
120 } // namespace blink 107 } // namespace blink
121 108
122 #endif // TextChecking_h 109 #endif // TextChecking_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698