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

Unified Diff: third_party/WebKit/Source/core/editing/markers/DocumentMarker.h

Issue 2650113004: [WIP] Add support for Android SuggestionSpans when editing text (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
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..6a88f987a03b1ea6ec9a267f68e792411d16b68d 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,
+ 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
rlanday 2017/01/25 18:48:10 lol @ git cl format...
+ << 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 type,
+ 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);
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;
DocumentMarkerDetails* details() const;
void setActiveMatch(bool);
void clearDetails() { m_details.clear(); }
+ void replaceSuggestion(int index, const std::string& newSuggestion);
// 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() {}
};

Powered by Google App Engine
This is Rietveld 408576698