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

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

Issue 2960473002: [MarkersIntersectingRange #2.1] Add DocumentMarkerController::FirstMarkerIntersectingOffsetRange() (Closed)
Patch Set: Rebase Created 3 years, 5 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
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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 391
392 const HeapVector<Member<DocumentMarker>>& results = 392 const HeapVector<Member<DocumentMarker>>& results =
393 list->MarkersIntersectingRange(offset, offset); 393 list->MarkersIntersectingRange(offset, offset);
394 if (!results.IsEmpty()) 394 if (!results.IsEmpty())
395 return results.front(); 395 return results.front();
396 } 396 }
397 397
398 return nullptr; 398 return nullptr;
399 } 399 }
400 400
401 DocumentMarker* DocumentMarkerController::FirstMarkerIntersectingOffsetRange(
402 const Text& node,
403 unsigned start_offset,
404 unsigned end_offset,
405 DocumentMarker::MarkerTypes types) {
406 if (!PossiblyHasMarkers(types))
407 return nullptr;
408
409 MarkerLists* const markers = markers_.at(&node);
410 if (!markers)
411 return nullptr;
412
413 for (DocumentMarker::MarkerType type : types) {
414 const DocumentMarkerList* const list = ListForType(markers, type);
415 if (!list)
416 continue;
417
418 DocumentMarker* found_marker =
419 list->FirstMarkerIntersectingRange(start_offset, end_offset);
420 if (found_marker)
421 return found_marker;
422 }
423
424 return nullptr;
425 }
426
401 DocumentMarkerVector DocumentMarkerController::MarkersFor( 427 DocumentMarkerVector DocumentMarkerController::MarkersFor(
402 Node* node, 428 Node* node,
403 DocumentMarker::MarkerTypes marker_types) { 429 DocumentMarker::MarkerTypes marker_types) {
404 DocumentMarkerVector result; 430 DocumentMarkerVector result;
405 if (!PossiblyHasMarkers(marker_types)) 431 if (!PossiblyHasMarkers(marker_types))
406 return result; 432 return result;
407 433
408 MarkerLists* markers = markers_.at(node); 434 MarkerLists* markers = markers_.at(node);
409 if (!markers) 435 if (!markers)
410 return result; 436 return result;
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 } 780 }
755 781
756 } // namespace blink 782 } // namespace blink
757 783
758 #ifndef NDEBUG 784 #ifndef NDEBUG
759 void showDocumentMarkers(const blink::DocumentMarkerController* controller) { 785 void showDocumentMarkers(const blink::DocumentMarkerController* controller) {
760 if (controller) 786 if (controller)
761 controller->ShowMarkers(); 787 controller->ShowMarkers();
762 } 788 }
763 #endif 789 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698