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

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

Issue 2805553003: DocumentMarkerList refactor as an interface (Closed)
Patch Set: Created 3 years, 8 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef DocumentMarkerList_h
6 #define DocumentMarkerList_h
7
8 #include "core/editing/markers/DocumentMarker.h"
9 #include "platform/heap/Handle.h"
10
11 namespace blink {
12
13 class CORE_EXPORT DocumentMarkerList
14 : public GarbageCollectedFinalized<DocumentMarkerList> {
Xiaocheng 2017/04/07 00:06:33 Should interfaces be on-heap? I guess not.
rlanday 2017/04/07 18:22:56 The subclasses need to inherit from GarbageCollect
15 public:
16 DocumentMarkerList();
Xiaocheng 2017/04/07 00:06:33 Since the class is purely virtual, can we get rid
rlanday 2017/04/07 18:22:55 The constructor is needed because DISALLOW_COPY_AN
17 using iterator = Member<DocumentMarker>*;
18 using const_iterator = const Member<DocumentMarker>*;
19
20 virtual ~DocumentMarkerList();
21
22 virtual DocumentMarker::MarkerType allowedMarkerType() const = 0;
Xiaocheng 2017/04/07 00:06:33 allowedMarkerType() and isFooMarkerList() are kind
rlanday 2017/04/07 18:22:55 Ok. The reason I thought it might be nice to have
23 virtual bool isCompositionMarkerList() const;
yosin_UTC9 2017/04/07 03:16:22 Having type predicate indicates that the design of
24 virtual bool isSpellCheckMarkerList() const;
25 virtual bool isTextMatchMarkerList() const;
26
27 virtual size_t size() const = 0;
yosin_UTC9 2017/04/07 03:16:22 Do we really need to expose |size()|?
rlanday 2017/04/07 18:22:56 It looks like we don't need it in the refactored v
rlanday 2017/04/07 18:22:56 It looks like we don't need it in the refactored v
28 virtual bool empty() const = 0;
29 virtual DocumentMarker* at(size_t index) = 0;
30
31 virtual void add(DocumentMarker*) = 0;
32 virtual void clear() = 0;
33
34 virtual iterator begin() = 0;
yosin_UTC9 2017/04/07 03:16:22 We should avoid to expose iterator.
35 virtual iterator end() = 0;
36 virtual const_iterator begin() const = 0;
37 virtual const_iterator end() const = 0;
38
39 virtual void appendMarkersToInputList(DocumentMarkerVector* list) const = 0;
40
41 enum class DidCopyMarkerOrNot { DidNotCopyMarker, DidCopyMarker };
42 virtual DidCopyMarkerOrNot copyMarkers(unsigned startOffset,
43 int length,
44 DocumentMarkerList* dstList,
45 int delta) = 0;
46
47 enum class DidRemoveMarkerOrNot { DidNotRemoveMarker, DidRemoveMarker };
48 virtual DidRemoveMarkerOrNot removeMarkers(
49 unsigned startOffset,
50 int length,
51 bool shouldRemovePartiallyOverlappingMarkers) = 0;
52
53 enum class DidShiftMarkerOrNot { DidNotShiftMarker, DidShiftMarker };
54 virtual DidShiftMarkerOrNot shiftMarkers(unsigned offset,
55 unsigned oldLength,
56 unsigned newLength) = 0;
57
58 DEFINE_INLINE_VIRTUAL_TRACE() {}
59 DISALLOW_COPY_AND_ASSIGN(DocumentMarkerList);
60 };
61
62 } // namespace blink
63
64 #endif // DocumentMarkerList_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698