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

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

Issue 2812423002: [DMC #1] Refactor DocumentMarkerController on top of new DocumentMarkerListEditor class (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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h
index 39e83dffbf90573d450aa093816b4753adff6ef7..c024320cde2a64eb07f1ed9780475f930979a1d8 100644
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h
@@ -38,6 +38,9 @@
#include "wtf/HashMap.h"
#include "wtf/Vector.h"
+// TODO: remove
+#include "core/editing/markers/RenderedDocumentMarker.h"
rlanday 2017/04/13 02:31:45 oops, I can remove this, I was implementing Docume
+
namespace blink {
class Node;
@@ -53,6 +56,28 @@ class MarkerRemoverPredicate final {
Vector<String> words_;
};
+class DocumentMarkerList
Xiaocheng 2017/04/13 02:39:51 Let's use another name, say, GenericDocumentMarker
+ : public GarbageCollectedFinalized<DocumentMarkerList> {
+ public:
+ bool IsEmpty() const;
+
+ void Add(DocumentMarker*);
+ void Clear();
+
+ void AppendMarkersToInputList(DocumentMarkerVector* input_list) const;
+
+ bool MoveMarkers(int length, DocumentMarkerList* dst_list);
+ bool RemoveMarkers(unsigned start_offset, int length);
+ bool ShiftMarkers(unsigned offset, unsigned old_length, unsigned new_length);
+
+ DECLARE_TRACE();
+
+ private:
+ void MergeOverlapping(DocumentMarker*);
+
+ HeapVector<Member<DocumentMarker>> markers_;
Xiaocheng 2017/04/13 02:39:51 RenderedDocumentMarker is another (big) source of
yosin_UTC9 2017/04/13 05:53:57 I agree. We would like to have small and focused p
+};
+
class CORE_EXPORT DocumentMarkerController final
: public GarbageCollected<DocumentMarkerController>,
public SynchronousMutationObserver {
@@ -127,13 +152,11 @@ class CORE_EXPORT DocumentMarkerController final
unsigned new_length) final;
private:
- void AddMarker(Node*, const DocumentMarker&);
+ void AddMarker(Node*, const DocumentMarker*);
- using MarkerList = HeapVector<Member<RenderedDocumentMarker>>;
- using MarkerLists =
- HeapVector<Member<MarkerList>, DocumentMarker::kMarkerTypeIndexesCount>;
+ using MarkerLists = HeapVector<Member<DocumentMarkerList>,
+ DocumentMarker::kMarkerTypeIndexesCount>;
using MarkerMap = HeapHashMap<WeakMember<const Node>, Member<MarkerLists>>;
- void MergeOverlapping(MarkerList*, RenderedDocumentMarker*);
bool PossiblyHasMarkers(DocumentMarker::MarkerTypes);
void RemoveMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes);
void RemoveMarkers(TextIterator&, DocumentMarker::MarkerTypes);

Powered by Google App Engine
This is Rietveld 408576698