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

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

Issue 2956453002: Clean up DocumentMarkerController::MarkersFor() (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
7 * reserved. 7 * reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 std::find_if(markers.begin(), markers.end(), [=](DocumentMarker* marker) { 376 std::find_if(markers.begin(), markers.end(), [=](DocumentMarker* marker) {
377 return marker->StartOffset() < offset && offset < marker->EndOffset(); 377 return marker->StartOffset() < offset && offset < marker->EndOffset();
378 }); 378 });
379 return it == markers.end() ? nullptr : *it; 379 return it == markers.end() ? nullptr : *it;
380 } 380 }
381 381
382 DocumentMarkerVector DocumentMarkerController::MarkersFor( 382 DocumentMarkerVector DocumentMarkerController::MarkersFor(
383 Node* node, 383 Node* node,
384 DocumentMarker::MarkerTypes marker_types) { 384 DocumentMarker::MarkerTypes marker_types) {
385 DocumentMarkerVector result; 385 DocumentMarkerVector result;
386 if (!PossiblyHasMarkers(marker_types))
387 return result;
386 388
387 MarkerLists* markers = markers_.at(node); 389 MarkerLists* markers = markers_.at(node);
388 if (!markers) 390 if (!markers)
389 return result; 391 return result;
390 392
391 for (DocumentMarker::MarkerType type : DocumentMarker::AllMarkers()) { 393 for (DocumentMarker::MarkerType type : marker_types) {
392 DocumentMarkerList* const list = ListForType(markers, type); 394 DocumentMarkerList* const list = ListForType(markers, type);
393 if (!list || list->IsEmpty() || !marker_types.Contains(type)) 395 if (!list || list->IsEmpty())
394 continue; 396 continue;
395 397
396 result.AppendVector(list->GetMarkers()); 398 result.AppendVector(list->GetMarkers());
397 } 399 }
398 400
399 std::sort(result.begin(), result.end(), 401 std::sort(result.begin(), result.end(),
400 [](const Member<DocumentMarker>& marker1, 402 [](const Member<DocumentMarker>& marker1,
401 const Member<DocumentMarker>& marker2) { 403 const Member<DocumentMarker>& marker2) {
402 return marker1->StartOffset() < marker2->StartOffset(); 404 return marker1->StartOffset() < marker2->StartOffset();
403 }); 405 });
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 } 735 }
734 736
735 } // namespace blink 737 } // namespace blink
736 738
737 #ifndef NDEBUG 739 #ifndef NDEBUG
738 void showDocumentMarkers(const blink::DocumentMarkerController* controller) { 740 void showDocumentMarkers(const blink::DocumentMarkerController* controller) {
739 if (controller) 741 if (controller)
740 controller->ShowMarkers(); 742 controller->ShowMarkers();
741 } 743 }
742 #endif 744 #endif
OLDNEW
« 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