Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/markers/DocumentMarker.h |
| diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarker.h b/third_party/WebKit/Source/core/editing/markers/DocumentMarker.h |
| index 06f90d4a9d9b801d5c207d81a848d0a6d113e0ad..68629a886a57821973989e137099c836bab26f30 100644 |
| --- a/third_party/WebKit/Source/core/editing/markers/DocumentMarker.h |
| +++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarker.h |
| @@ -46,6 +46,8 @@ class CORE_EXPORT DocumentMarker : public GarbageCollected<DocumentMarker> { |
| TextMatchMarkerIndex, |
| InvisibleSpellcheckMarkerIndex, |
| CompositionMarkerIndex, |
| + SuggestionMarkerIndex, |
|
aelias_OOO_until_Jul13
2017/02/10 21:43:55
This marker type should probably be returned in Mi
|
| + SuggestionBackgroundHighlightMarkerIndex, |
| MarkerTypeIndexesCount |
| }; |
| @@ -55,6 +57,9 @@ class CORE_EXPORT DocumentMarker : public GarbageCollected<DocumentMarker> { |
| TextMatch = 1 << TextMatchMarkerIndex, |
| InvisibleSpellcheck = 1 << InvisibleSpellcheckMarkerIndex, |
| Composition = 1 << CompositionMarkerIndex, |
| + Suggestion = 1 << SuggestionMarkerIndex, |
| + SuggestionBackgroundHighlight = 1 |
| + << SuggestionBackgroundHighlightMarkerIndex, |
| }; |
| class MarkerTypes { |
| @@ -82,7 +87,9 @@ class CORE_EXPORT DocumentMarker : public GarbageCollected<DocumentMarker> { |
| public: |
| AllMarkers() |
| : MarkerTypes(Spelling | Grammar | TextMatch | InvisibleSpellcheck | |
| - Composition) {} |
| + Composition | |
| + Suggestion | |
| + SuggestionBackgroundHighlight) {} |
| }; |
| class MisspellingMarkers : public MarkerTypes { |
| @@ -102,11 +109,19 @@ class CORE_EXPORT DocumentMarker : public GarbageCollected<DocumentMarker> { |
| const String& description, |
| uint32_t hash); |
| DocumentMarker(unsigned startOffset, unsigned endOffset, bool activeMatch); |
| - DocumentMarker(unsigned startOffset, |
| + DocumentMarker(MarkerType, |
| + unsigned startOffset, |
| unsigned endOffset, |
| Color underlineColor, |
| bool thick, |
| Color backgroundColor); |
| + DocumentMarker(unsigned startOffset, |
| + unsigned endOffset, |
| + Color underlineColor, |
| + bool thick, |
| + Color backgroundColor, |
| + const std::vector<std::string>& suggestions, |
| + int32_t suggestionMarkerID); |
|
rlanday
2017/01/31 19:50:22
Should this be int, int32_t, or maybe an unsigned
|
| DocumentMarker(const DocumentMarker&); |
| @@ -120,10 +135,13 @@ class CORE_EXPORT DocumentMarker : public GarbageCollected<DocumentMarker> { |
| Color underlineColor() const; |
| bool thick() const; |
| Color backgroundColor() const; |
| + const std::vector<std::string> suggestions() const; |
| + int suggestionMarkerID() const; |
|
rlanday
2017/01/31 19:50:22
note: DocumentMarker already has a concept of a "h
aelias_OOO_until_Jul13
2017/02/10 21:43:55
Let's try to unify it by keeping populating the ha
|
| DocumentMarkerDetails* details() const; |
| void setActiveMatch(bool); |
| void clearDetails() { m_details.clear(); } |
| + void replaceSuggestion(int index, const std::string& newSuggestion); |
|
esprehn
2017/01/31 22:41:35
No std::string
rlanday
2017/01/31 23:30:09
Ok
|
| // Offset modifications are done by DocumentMarkerController. |
| // Other classes should not call following setters. |
| @@ -162,6 +180,7 @@ class DocumentMarkerDetails |
| virtual bool isDescription() const { return false; } |
| virtual bool isTextMatch() const { return false; } |
| virtual bool isComposition() const { return false; } |
| + virtual bool isSuggestion() const { return true; } |
| DEFINE_INLINE_VIRTUAL_TRACE() {} |
| }; |