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

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

Issue 2830043002: [DMC #1.92] Move DMC::RemoveMarkersUnderWords() to DMListEditor (Closed)
Patch Set: Update 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.h » ('j') | 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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 } 487 }
488 488
489 void DocumentMarkerController::RemoveSpellingMarkersUnderWords( 489 void DocumentMarkerController::RemoveSpellingMarkersUnderWords(
490 const Vector<String>& words) { 490 const Vector<String>& words) {
491 for (auto& node_markers : markers_) { 491 for (auto& node_markers : markers_) {
492 const Node& node = *node_markers.key; 492 const Node& node = *node_markers.key;
493 if (!node.IsTextNode()) // MarkerRemoverPredicate requires a Text node. 493 if (!node.IsTextNode()) // MarkerRemoverPredicate requires a Text node.
494 continue; 494 continue;
495 MarkerLists* markers = node_markers.value; 495 MarkerLists* markers = node_markers.value;
496 for (DocumentMarker::MarkerType type : DocumentMarker::AllMarkers()) { 496 for (DocumentMarker::MarkerType type : DocumentMarker::AllMarkers()) {
497 Member<MarkerList>& list = ListForType(markers, type); 497 MarkerList* list = ListForType(markers, type);
498 if (!list) 498 if (!list)
499 continue; 499 continue;
500 bool removed_markers = false; 500 bool removed_markers = DocumentMarkerListEditor::RemoveMarkersUnderWords(
501 for (size_t j = list->size(); j > 0; --j) { 501 list, ToText(node).data(), words);
502 const DocumentMarker& marker = *list->at(j - 1);
503
504 const unsigned start = marker.StartOffset();
505 const unsigned length = marker.EndOffset() - marker.StartOffset();
506
507 const String marker_text = ToText(node).data().Substring(start, length);
508 if (words.Contains(marker_text)) {
509 list->erase(j - 1);
510 removed_markers = true;
511 }
512 }
513 if (removed_markers && type == DocumentMarker::kTextMatch) 502 if (removed_markers && type == DocumentMarker::kTextMatch)
514 InvalidatePaintForTickmarks(node); 503 InvalidatePaintForTickmarks(node);
515 } 504 }
516 } 505 }
517 } 506 }
518 507
519 void DocumentMarkerController::RemoveMarkersOfTypes( 508 void DocumentMarkerController::RemoveMarkersOfTypes(
520 DocumentMarker::MarkerTypes marker_types) { 509 DocumentMarker::MarkerTypes marker_types) {
521 if (!PossiblyHasMarkers(marker_types)) 510 if (!PossiblyHasMarkers(marker_types))
522 return; 511 return;
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 } 727 }
739 728
740 } // namespace blink 729 } // namespace blink
741 730
742 #ifndef NDEBUG 731 #ifndef NDEBUG
743 void showDocumentMarkers(const blink::DocumentMarkerController* controller) { 732 void showDocumentMarkers(const blink::DocumentMarkerController* controller) {
744 if (controller) 733 if (controller)
745 controller->ShowMarkers(); 734 controller->ShowMarkers();
746 } 735 }
747 #endif 736 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698