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

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

Issue 2246143004: Use EphemeralRange instead of Range* in DocumentMarkerController class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on master Created 4 years, 4 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 | « third_party/WebKit/Source/core/testing/Internals.cpp ('k') | 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) 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 // To stop looking for the active tickmark, we set this flag. 359 // To stop looking for the active tickmark, we set this flag.
360 m_locatingActiveRect = false; 360 m_locatingActiveRect = false;
361 361
362 // Notify browser of new location for the selected rectangle. 362 // Notify browser of new location for the selected rectangle.
363 reportFindInPageSelection( 363 reportFindInPageSelection(
364 ownerFrame().frameView()->contentsToRootFrame(resultBounds), 364 ownerFrame().frameView()->contentsToRootFrame(resultBounds),
365 m_activeMatchIndex + 1, 365 m_activeMatchIndex + 1,
366 identifier); 366 identifier);
367 } 367 }
368 368
369 ownerFrame().frame()->document()->markers().addTextMatchMarker(resultRan ge, foundActiveMatch); 369 ownerFrame().frame()->document()->markers().addTextMatchMarker(Ephemeral Range(resultRange), foundActiveMatch);
370 370
371 m_findMatchesCache.append(FindMatch(resultRange, m_lastMatchCount + matc hCount)); 371 m_findMatchesCache.append(FindMatch(resultRange, m_lastMatchCount + matc hCount));
372 372
373 // Set the new start for the search range to be the end of the previous 373 // Set the new start for the search range to be the end of the previous
374 // result range. There is no need to use a VisiblePosition here, 374 // result range. There is no need to use a VisiblePosition here,
375 // since findPlainText will use a TextIterator to go over the visible 375 // since findPlainText will use a TextIterator to go over the visible
376 // text nodes. 376 // text nodes.
377 searchStart = result.endPosition(); 377 searchStart = result.endPosition();
378 378
379 m_resumeScopingFromRange = Range::create(result.document(), toPositionIn DOMTree(result.endPosition()), toPositionInDOMTree(result.endPosition())); 379 m_resumeScopingFromRange = Range::create(result.document(), toPositionIn DOMTree(result.endPosition()), toPositionInDOMTree(result.endPosition()));
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 } 655 }
656 656
657 TextFinder::~TextFinder() 657 TextFinder::~TextFinder()
658 { 658 {
659 } 659 }
660 660
661 bool TextFinder::setMarkerActive(Range* range, bool active) 661 bool TextFinder::setMarkerActive(Range* range, bool active)
662 { 662 {
663 if (!range || range->collapsed()) 663 if (!range || range->collapsed())
664 return false; 664 return false;
665 return ownerFrame().frame()->document()->markers().setMarkersActive(range, a ctive); 665 return ownerFrame().frame()->document()->markers().setMarkersActive(Ephemera lRange(range), active);
666 } 666 }
667 667
668 void TextFinder::unmarkAllTextMatches() 668 void TextFinder::unmarkAllTextMatches()
669 { 669 {
670 LocalFrame* frame = ownerFrame().frame(); 670 LocalFrame* frame = ownerFrame().frame();
671 if (frame && frame->page() && frame->editor().markedTextMatchesAreHighlighte d()) 671 if (frame && frame->page() && frame->editor().markedTextMatchesAreHighlighte d())
672 frame->document()->markers().removeMarkers(DocumentMarker::TextMatch); 672 frame->document()->markers().removeMarkers(DocumentMarker::TextMatch);
673 } 673 }
674 674
675 bool TextFinder::shouldScopeMatches(const String& searchText) 675 bool TextFinder::shouldScopeMatches(const String& searchText)
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 DEFINE_TRACE(TextFinder) 739 DEFINE_TRACE(TextFinder)
740 { 740 {
741 visitor->trace(m_ownerFrame); 741 visitor->trace(m_ownerFrame);
742 visitor->trace(m_activeMatch); 742 visitor->trace(m_activeMatch);
743 visitor->trace(m_resumeScopingFromRange); 743 visitor->trace(m_resumeScopingFromRange);
744 visitor->trace(m_deferredScopingWork); 744 visitor->trace(m_deferredScopingWork);
745 visitor->trace(m_findMatchesCache); 745 visitor->trace(m_findMatchesCache);
746 } 746 }
747 747
748 } // namespace blink 748 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/testing/Internals.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698