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

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

Issue 1313883002: Introduce firstRangeOf() as replacement of VisibleSelection::firstRange() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-25T17:47:14 Created 5 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 | « Source/modules/accessibility/AXLayoutObject.cpp ('k') | Source/web/WebViewImpl.cpp » ('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) 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 if (m_activeMatch && &m_activeMatch->ownerDocument() != ownerFrame().frame() ->document()) 128 if (m_activeMatch && &m_activeMatch->ownerDocument() != ownerFrame().frame() ->document())
129 m_activeMatch = nullptr; 129 m_activeMatch = nullptr;
130 130
131 // If the user has selected something since the last Find operation we want 131 // If the user has selected something since the last Find operation we want
132 // to start from there. Otherwise, we start searching from where the last Fi nd 132 // to start from there. Otherwise, we start searching from where the last Fi nd
133 // operation left off (either a Find or a FindNext operation). 133 // operation left off (either a Find or a FindNext operation).
134 VisibleSelection selection(ownerFrame().frame()->selection().selection()); 134 VisibleSelection selection(ownerFrame().frame()->selection().selection());
135 bool activeSelection = !selection.isNone(); 135 bool activeSelection = !selection.isNone();
136 if (activeSelection) { 136 if (activeSelection) {
137 m_activeMatch = selection.firstRange().get(); 137 m_activeMatch = firstRangeOf(selection).get();
138 ownerFrame().frame()->selection().clear(); 138 ownerFrame().frame()->selection().clear();
139 } 139 }
140 140
141 ASSERT(ownerFrame().frame() && ownerFrame().frame()->view()); 141 ASSERT(ownerFrame().frame() && ownerFrame().frame()->view());
142 const FindOptions findOptions = (options.forward ? 0 : Backwards) 142 const FindOptions findOptions = (options.forward ? 0 : Backwards)
143 | (options.matchCase ? 0 : CaseInsensitive) 143 | (options.matchCase ? 0 : CaseInsensitive)
144 | (wrapWithinFrame ? WrapAround : 0) 144 | (wrapWithinFrame ? WrapAround : 0)
145 | (options.wordStart ? AtWordStarts : 0) 145 | (options.wordStart ? AtWordStarts : 0)
146 | (options.medialCapitalAsWordStart ? TreatMedialCapitalAsWordStart : 0) 146 | (options.medialCapitalAsWordStart ? TreatMedialCapitalAsWordStart : 0)
147 | (options.findNext ? 0 : StartInSelection); 147 | (options.findNext ? 0 : StartInSelection);
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 visitor->trace(m_ownerFrame); 802 visitor->trace(m_ownerFrame);
803 visitor->trace(m_currentActiveMatchFrame); 803 visitor->trace(m_currentActiveMatchFrame);
804 visitor->trace(m_activeMatch); 804 visitor->trace(m_activeMatch);
805 visitor->trace(m_resumeScopingFromRange); 805 visitor->trace(m_resumeScopingFromRange);
806 visitor->trace(m_deferredScopingWork); 806 visitor->trace(m_deferredScopingWork);
807 visitor->trace(m_findMatchesCache); 807 visitor->trace(m_findMatchesCache);
808 #endif 808 #endif
809 } 809 }
810 810
811 } // namespace blink 811 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/accessibility/AXLayoutObject.cpp ('k') | Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698