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

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

Issue 2723663002: Refactor DocumentMarkerController (Closed)
Patch Set: Rebase on https://codereview.chromium.org/2755013004 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
(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 DocumentMarkerController;
14
15 class DocumentMarkerList : public GarbageCollected<DocumentMarkerList> {
16 WTF_MAKE_NONCOPYABLE(DocumentMarkerList);
17
18 public:
19 explicit DocumentMarkerList(DocumentMarkerController*);
20 using iterator = Member<DocumentMarker>*;
21 using const_iterator = const Member<DocumentMarker>*;
22
23 virtual DocumentMarker::MarkerType allowedMarkerType() const = 0;
24
25 virtual size_t size() const = 0;
26 virtual bool empty() const = 0;
27 virtual DocumentMarker* at(size_t index) = 0;
28
29 virtual void clear() = 0;
30
31 virtual iterator begin() = 0;
32 virtual iterator end() = 0;
33 virtual const_iterator begin() const = 0;
34 virtual const_iterator end() const = 0;
35
Xiaocheng 2017/03/17 23:56:33 I think we should store |m_markers| directly in Do
rlanday 2017/03/18 01:12:27 I think one of the ideas behind the refactor was t
36 virtual void appendMarkersToInputList(DocumentMarkerVector* list) const = 0;
37 virtual bool copyMarkers(unsigned startOffset,
38 int length,
39 Node* dstNode,
40 int delta) const = 0;
41 virtual void removeMarkers(unsigned startOffset,
42 int length,
43 bool shouldRemovePartiallyOverlappingMarkers,
44 bool* didRemoveMarker) = 0;
45 virtual bool shiftMarkers(unsigned offset,
46 unsigned oldLength,
47 unsigned newLength) = 0;
48
49 DECLARE_VIRTUAL_TRACE();
50
51 protected:
52 struct ShiftMarkerResult {
53 unsigned newStartOffset;
54 unsigned newEndOffset;
55 bool shouldRemoveMarker;
56 };
57
58 static bool startsAfter(const Member<DocumentMarker>&, size_t startOffset);
Xiaocheng 2017/03/17 23:56:33 This function is defined but not used.
59 static bool endsBefore(size_t startOffset, const Member<DocumentMarker>& rhv);
Xiaocheng 2017/03/17 23:56:33 If we store |m_markers| directly in DML, we can al
60 static bool compareByStart(const Member<DocumentMarker>& lhv,
Xiaocheng 2017/03/17 23:56:33 This should be a local function in EditingMarkerLi
61 const Member<DocumentMarker>& rhv);
62
63 ShiftMarkerResult getShiftedMarkerPosition(const DocumentMarker&,
Xiaocheng 2017/03/17 23:56:33 This should be a member function of DocumentMarker
64 unsigned offset,
65 unsigned oldLength,
66 unsigned newLength);
67
68 Member<DocumentMarkerController> m_documentMarkerController;
69 };
70
71 } // namespace blink
72
73 #endif // DocumentMarkerList_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698