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

Side by Side Diff: third_party/WebKit/Source/web/TextFinder.cpp

Issue 2763893002: [WIP] Clean up DocumentMarkerController API (Closed)
Patch Set: Created 3 years, 9 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 // To stop looking for the active tickmark, we set this flag. 390 // To stop looking for the active tickmark, we set this flag.
391 m_locatingActiveRect = false; 391 m_locatingActiveRect = false;
392 392
393 // Notify browser of new location for the selected rectangle. 393 // Notify browser of new location for the selected rectangle.
394 reportFindInPageSelection( 394 reportFindInPageSelection(
395 ownerFrame().frameView()->contentsToRootFrame(resultBounds), 395 ownerFrame().frameView()->contentsToRootFrame(resultBounds),
396 m_activeMatchIndex + 1, identifier); 396 m_activeMatchIndex + 1, identifier);
397 } 397 }
398 398
399 ownerFrame().frame()->document()->markers().addTextMatchMarker( 399 ownerFrame().frame()->document()->markers().addTextMatchMarker(
400 EphemeralRange(resultRange), foundActiveMatch); 400 resultRange->startPosition(), resultRange->endPosition(),
401 foundActiveMatch);
401 402
402 m_findMatchesCache.push_back( 403 m_findMatchesCache.push_back(
403 FindMatch(resultRange, m_lastMatchCount + matchCount)); 404 FindMatch(resultRange, m_lastMatchCount + matchCount));
404 405
405 // Set the new start for the search range to be the end of the previous 406 // Set the new start for the search range to be the end of the previous
406 // result range. There is no need to use a VisiblePosition here, 407 // result range. There is no need to use a VisiblePosition here,
407 // since findPlainText will use a TextIterator to go over the visible 408 // since findPlainText will use a TextIterator to go over the visible
408 // text nodes. 409 // text nodes.
409 searchStart = result.endPosition(); 410 searchStart = result.endPosition();
410 411
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 m_locatingActiveRect(false), 688 m_locatingActiveRect(false),
688 m_scopingInProgress(false), 689 m_scopingInProgress(false),
689 m_lastFindRequestCompletedWithNoMatches(false), 690 m_lastFindRequestCompletedWithNoMatches(false),
690 m_findMatchRectsAreValid(false) {} 691 m_findMatchRectsAreValid(false) {}
691 692
692 TextFinder::~TextFinder() {} 693 TextFinder::~TextFinder() {}
693 694
694 bool TextFinder::setMarkerActive(Range* range, bool active) { 695 bool TextFinder::setMarkerActive(Range* range, bool active) {
695 if (!range || range->collapsed()) 696 if (!range || range->collapsed())
696 return false; 697 return false;
697 return ownerFrame().frame()->document()->markers().setMarkersActive( 698 return ownerFrame().frame()->document()->markers().setTextMatchMarkersActive(
698 EphemeralRange(range), active); 699 EphemeralRange(range), active);
699 } 700 }
700 701
701 void TextFinder::unmarkAllTextMatches() { 702 void TextFinder::unmarkAllTextMatches() {
702 LocalFrame* frame = ownerFrame().frame(); 703 LocalFrame* frame = ownerFrame().frame();
703 if (frame && frame->page() && 704 if (frame && frame->page() &&
704 frame->editor().markedTextMatchesAreHighlighted()) 705 frame->editor().markedTextMatchesAreHighlighted())
705 frame->document()->markers().removeMarkers(DocumentMarker::TextMatch); 706 frame->document()->markers().removeMarkers(DocumentMarker::TextMatch);
706 } 707 }
707 708
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 780
780 DEFINE_TRACE(TextFinder) { 781 DEFINE_TRACE(TextFinder) {
781 visitor->trace(m_ownerFrame); 782 visitor->trace(m_ownerFrame);
782 visitor->trace(m_activeMatch); 783 visitor->trace(m_activeMatch);
783 visitor->trace(m_resumeScopingFromRange); 784 visitor->trace(m_resumeScopingFromRange);
784 visitor->trace(m_deferredScopingWork); 785 visitor->trace(m_deferredScopingWork);
785 visitor->trace(m_findMatchesCache); 786 visitor->trace(m_findMatchesCache);
786 } 787 }
787 788
788 } // namespace blink 789 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698