OLD | NEW |
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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 void TextFinder::ClearActiveFindMatch() { | 225 void TextFinder::ClearActiveFindMatch() { |
226 current_active_match_frame_ = false; | 226 current_active_match_frame_ = false; |
227 SetMarkerActive(active_match_.Get(), false); | 227 SetMarkerActive(active_match_.Get(), false); |
228 ResetActiveMatch(); | 228 ResetActiveMatch(); |
229 } | 229 } |
230 | 230 |
231 void TextFinder::StopFindingAndClearSelection() { | 231 void TextFinder::StopFindingAndClearSelection() { |
232 CancelPendingScopingEffort(); | 232 CancelPendingScopingEffort(); |
233 | 233 |
234 // Remove all markers for matches found and turn off the highlighting. | 234 // Remove all markers for matches found and turn off the highlighting. |
235 OwnerFrame().GetFrame()->GetDocument()->Markers().RemoveMarkers( | 235 OwnerFrame().GetFrame()->GetDocument()->Markers().RemoveMarkersOfTypes( |
236 DocumentMarker::kTextMatch); | 236 DocumentMarker::kTextMatch); |
237 OwnerFrame().GetFrame()->GetEditor().SetMarkedTextMatchesAreHighlighted( | 237 OwnerFrame().GetFrame()->GetEditor().SetMarkedTextMatchesAreHighlighted( |
238 false); | 238 false); |
239 ClearFindMatchesCache(); | 239 ClearFindMatchesCache(); |
240 ResetActiveMatch(); | 240 ResetActiveMatch(); |
241 | 241 |
242 // Let the frame know that we don't want tickmarks anymore. | 242 // Let the frame know that we don't want tickmarks anymore. |
243 OwnerFrame().GetFrameView()->InvalidatePaintForTickmarks(); | 243 OwnerFrame().GetFrameView()->InvalidatePaintForTickmarks(); |
244 } | 244 } |
245 | 245 |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 bool TextFinder::SetMarkerActive(Range* range, bool active) { | 702 bool TextFinder::SetMarkerActive(Range* range, bool active) { |
703 if (!range || range->collapsed()) | 703 if (!range || range->collapsed()) |
704 return false; | 704 return false; |
705 return OwnerFrame().GetFrame()->GetDocument()->Markers().SetMarkersActive( | 705 return OwnerFrame().GetFrame()->GetDocument()->Markers().SetMarkersActive( |
706 EphemeralRange(range), active); | 706 EphemeralRange(range), active); |
707 } | 707 } |
708 | 708 |
709 void TextFinder::UnmarkAllTextMatches() { | 709 void TextFinder::UnmarkAllTextMatches() { |
710 LocalFrame* frame = OwnerFrame().GetFrame(); | 710 LocalFrame* frame = OwnerFrame().GetFrame(); |
711 if (frame && frame->GetPage() && | 711 if (frame && frame->GetPage() && |
712 frame->GetEditor().MarkedTextMatchesAreHighlighted()) | 712 frame->GetEditor().MarkedTextMatchesAreHighlighted()) { |
713 frame->GetDocument()->Markers().RemoveMarkers(DocumentMarker::kTextMatch); | 713 frame->GetDocument()->Markers().RemoveMarkersOfTypes( |
| 714 DocumentMarker::kTextMatch); |
| 715 } |
714 } | 716 } |
715 | 717 |
716 bool TextFinder::ShouldScopeMatches(const String& search_text, | 718 bool TextFinder::ShouldScopeMatches(const String& search_text, |
717 const WebFindOptions& options) { | 719 const WebFindOptions& options) { |
718 // Don't scope if we can't find a frame or a view. | 720 // Don't scope if we can't find a frame or a view. |
719 // The user may have closed the tab/application, so abort. | 721 // The user may have closed the tab/application, so abort. |
720 LocalFrame* frame = OwnerFrame().GetFrame(); | 722 LocalFrame* frame = OwnerFrame().GetFrame(); |
721 if (!frame || !frame->View() || !frame->GetPage()) | 723 if (!frame || !frame->View() || !frame->GetPage()) |
722 return false; | 724 return false; |
723 | 725 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 | 789 |
788 DEFINE_TRACE(TextFinder) { | 790 DEFINE_TRACE(TextFinder) { |
789 visitor->Trace(owner_frame_); | 791 visitor->Trace(owner_frame_); |
790 visitor->Trace(active_match_); | 792 visitor->Trace(active_match_); |
791 visitor->Trace(resume_scoping_from_range_); | 793 visitor->Trace(resume_scoping_from_range_); |
792 visitor->Trace(deferred_scoping_work_); | 794 visitor->Trace(deferred_scoping_work_); |
793 visitor->Trace(find_matches_cache_); | 795 visitor->Trace(find_matches_cache_); |
794 } | 796 } |
795 | 797 |
796 } // namespace blink | 798 } // namespace blink |
OLD | NEW |