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

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

Issue 2723663002: Refactor DocumentMarkerController (Closed)
Patch Set: Created 3 years, 9 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 * This file is part of the DOM implementation for WebCore. 2 * This file is part of the DOM implementation for WebCore.
3 * 3 *
4 * Copyright (C) 2006 Apple Computer, Inc. 4 * Copyright (C) 2006 Apple Computer, Inc.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 14 matching lines...) Expand all
25 25
26 #include "core/CoreExport.h" 26 #include "core/CoreExport.h"
27 #include "platform/graphics/Color.h" 27 #include "platform/graphics/Color.h"
28 #include "platform/heap/Handle.h" 28 #include "platform/heap/Handle.h"
29 #include "wtf/VectorTraits.h" 29 #include "wtf/VectorTraits.h"
30 #include "wtf/text/WTFString.h" 30 #include "wtf/text/WTFString.h"
31 31
32 namespace blink { 32 namespace blink {
33 33
34 class DocumentMarkerDetails; 34 class DocumentMarkerDetails;
35 class RenderedTextMatchMarker;
35 36
36 // A range of a node within a document that is "marked", such as the range of a 37 // A range of a node within a document that is "marked", such as the range of a
37 // misspelled word. It optionally includes a description that could be displayed 38 // misspelled word. It optionally includes a description that could be displayed
38 // in the user interface. It also optionally includes a flag specifying whether 39 // in the user interface. It also optionally includes a flag specifying whether
39 // the match is active, which is ignored for all types other than type 40 // the match is active, which is ignored for all types other than type
40 // TextMatch. 41 // TextMatch.
41 class CORE_EXPORT DocumentMarker : public GarbageCollected<DocumentMarker> { 42 class CORE_EXPORT DocumentMarker : public GarbageCollected<DocumentMarker> {
42 public: 43 public:
43 enum MarkerTypeIndex { 44 enum MarkerTypeIndex {
44 SpellingMarkerIndex = 0, 45 SpellingMarkerIndex = 0,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 const String& description() const; 112 const String& description() const;
112 bool activeMatch() const; 113 bool activeMatch() const;
113 Color underlineColor() const; 114 Color underlineColor() const;
114 bool thick() const; 115 bool thick() const;
115 Color backgroundColor() const; 116 Color backgroundColor() const;
116 DocumentMarkerDetails* details() const; 117 DocumentMarkerDetails* details() const;
117 118
118 void setActiveMatch(bool); 119 void setActiveMatch(bool);
119 void clearDetails() { m_details.clear(); } 120 void clearDetails() { m_details.clear(); }
120 121
121 // Offset modifications are done by DocumentMarkerController. 122 // Offset modifications are done by DocumentMarkerController and the classes
122 // Other classes should not call following setters. 123 // that implement the marker lists. Other classes should not call following
124 // setters.
123 void setStartOffset(unsigned offset) { m_startOffset = offset; } 125 void setStartOffset(unsigned offset) { m_startOffset = offset; }
124 void setEndOffset(unsigned offset) { m_endOffset = offset; } 126 void setEndOffset(unsigned offset) { m_endOffset = offset; }
125 void shiftOffsets(int delta); 127 void shiftOffsets(int delta);
126 128
129 virtual bool isRenderedTextMatch() const;
130
131 RenderedTextMatchMarker* asRenderedTextMatchMarker();
Xiaocheng 2017/03/01 22:24:48 Please use the DEFINE_TYPE_CASTS macro to define t
132
127 bool operator==(const DocumentMarker& o) const { 133 bool operator==(const DocumentMarker& o) const {
128 return type() == o.type() && startOffset() == o.startOffset() && 134 return type() == o.type() && startOffset() == o.startOffset() &&
129 endOffset() == o.endOffset(); 135 endOffset() == o.endOffset();
130 } 136 }
131 137
132 bool operator!=(const DocumentMarker& o) const { return !(*this == o); } 138 bool operator!=(const DocumentMarker& o) const { return !(*this == o); }
133 139
134 DECLARE_TRACE(); 140 DECLARE_TRACE();
135 141
136 private: 142 private:
(...skipping 17 matching lines...) Expand all
154 virtual bool isDescription() const { return false; } 160 virtual bool isDescription() const { return false; }
155 virtual bool isTextMatch() const { return false; } 161 virtual bool isTextMatch() const { return false; }
156 virtual bool isComposition() const { return false; } 162 virtual bool isComposition() const { return false; }
157 163
158 DEFINE_INLINE_VIRTUAL_TRACE() {} 164 DEFINE_INLINE_VIRTUAL_TRACE() {}
159 }; 165 };
160 166
161 } // namespace blink 167 } // namespace blink
162 168
163 #endif // DocumentMarker_h 169 #endif // DocumentMarker_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698