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

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

Issue 2780313002: [WIP] Refactor DocumentMarker (Closed)
Patch Set: Move accessor methods into derived classes 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 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 9e58753851247bea874164178a39319b7f5b0f86..6d0d52bcde6425e870729c6c6a0fc70ea5461b8b 100644
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarker.h
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarker.h
@@ -32,14 +32,13 @@
namespace blink {
-class DocumentMarkerDetails;
-
// A range of a node within a document that is "marked", such as the range of a
// misspelled word. It optionally includes a description that could be displayed
// in the user interface. It also optionally includes a flag specifying whether
// the match is active, which is ignored for all types other than type
// TextMatch.
-class CORE_EXPORT DocumentMarker : public GarbageCollected<DocumentMarker> {
+class CORE_EXPORT DocumentMarker
+ : public GarbageCollectedFinalized<DocumentMarker> {
public:
enum MarkerTypeIndex {
SpellingMarkerIndex = 0,
@@ -135,32 +134,14 @@ class CORE_EXPORT DocumentMarker : public GarbageCollected<DocumentMarker> {
SpellCheckClientMarkers() : MarkerTypes(Spelling | Grammar) {}
};
- virtual DocumentMarker* clone() const;
+ virtual ~DocumentMarker();
- DocumentMarker(MarkerType,
- unsigned startOffset,
- unsigned endOffset,
- const String& description);
- DocumentMarker(unsigned startOffset,
- unsigned endOffset,
- Color underlineColor,
- bool thick,
- Color backgroundColor);
+ virtual DocumentMarker* clone() const = 0;
- MarkerType type() const { return m_type; }
+ virtual MarkerType type() const = 0;
unsigned startOffset() const { return m_startOffset; }
unsigned endOffset() const { return m_endOffset; }
- const String& description() const;
Xiaocheng 2017/03/31 02:01:01 Hmm... I didn't expect these accessors to be used
- bool activeMatch() const;
- Color underlineColor() const;
- bool thick() const;
- Color backgroundColor() const;
- DocumentMarkerDetails* details() const;
-
- void setActiveMatch(bool);
- void clearDetails() { m_details.clear(); }
-
struct MarkerOffsets {
unsigned startOffset;
unsigned endOffset;
@@ -176,37 +157,19 @@ class CORE_EXPORT DocumentMarker : public GarbageCollected<DocumentMarker> {
void setEndOffset(unsigned offset) { m_endOffset = offset; }
void shiftOffsets(int delta);
- DECLARE_TRACE();
+ DEFINE_INLINE_VIRTUAL_TRACE() {}
protected:
DocumentMarker(const DocumentMarker&);
- DocumentMarker(unsigned startOffset, unsigned endOffset, bool activeMatch);
+ DocumentMarker(unsigned startOffset, unsigned endOffset);
private:
- MarkerType m_type;
unsigned m_startOffset;
unsigned m_endOffset;
- Member<DocumentMarkerDetails> m_details;
};
using DocumentMarkerVector = HeapVector<Member<DocumentMarker>>;
-inline DocumentMarkerDetails* DocumentMarker::details() const {
- return m_details.get();
-}
-
-class DocumentMarkerDetails
- : public GarbageCollectedFinalized<DocumentMarkerDetails> {
- public:
- DocumentMarkerDetails() {}
- virtual ~DocumentMarkerDetails();
- virtual bool isDescription() const { return false; }
- virtual bool isTextMatch() const { return false; }
- virtual bool isComposition() const { return false; }
-
- DEFINE_INLINE_VIRTUAL_TRACE() {}
-};
-
} // namespace blink
#endif // DocumentMarker_h

Powered by Google App Engine
This is Rietveld 408576698