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

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

Issue 2826493003: [DMC #3] Prepare DocumentMarkerController for using different DocumentMarkerList impls (Closed)
Patch Set: Rebase 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
index bf490f4fec57e955af0788cb4a6b07234f7e5839..d13fbd068d1a5dcbea34863c5b6999f7e3a38508 100644
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
@@ -65,6 +65,12 @@ DocumentMarker::MarkerTypeIndex MarkerTypeToMarkerIndex(
return DocumentMarker::kSpellingMarkerIndex;
}
+DocumentMarkerList* CreateListForType(DocumentMarker::MarkerType type) {
+ // All MarkerTypes use GenericDocumentMarkerListImpl for now. Eventually we
+ // will use different marker list classes for different MarkerTypes.
+ return new GenericDocumentMarkerListImpl();
+}
+
} // namespace
Member<DocumentMarkerList>& DocumentMarkerController::ListForType(
@@ -206,11 +212,8 @@ void DocumentMarkerController::AddMarker(Node* node,
}
const DocumentMarker::MarkerType new_marker_type = new_marker->GetType();
- if (!ListForType(markers, new_marker_type)) {
- // TODO(rlanday): add method for deciding what type of list to create based
- // on the MarkerType
- ListForType(markers, new_marker_type) = new GenericDocumentMarkerListImpl;
- }
+ if (!ListForType(markers, new_marker_type))
+ ListForType(markers, new_marker_type) = CreateListForType(new_marker_type);
DocumentMarkerList* const list = ListForType(markers, new_marker_type);
list->Add(new_marker);
@@ -250,11 +253,8 @@ void DocumentMarkerController::MoveMarkers(Node* src_node,
if (!src_list)
continue;
- if (!ListForType(dst_markers, type)) {
- // TODO(rlanday): add method for deciding what type of list to create
- // based on the MarkerType
- ListForType(dst_markers, type) = new GenericDocumentMarkerListImpl;
- }
+ if (!ListForType(dst_markers, type))
+ ListForType(dst_markers, type) = CreateListForType(type);
DocumentMarkerList* const dst_list = ListForType(dst_markers, type);
if (src_list->MoveMarkers(length, dst_list))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698