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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 // Cancels any outstanding requests for scoping string matches on the frame. | 90 // Cancels any outstanding requests for scoping string matches on the frame. |
91 void cancelPendingScopingEffort(); | 91 void cancelPendingScopingEffort(); |
92 | 92 |
93 // This function is called to reset the total number of matches found during | 93 // This function is called to reset the total number of matches found during |
94 // the scoping effort. | 94 // the scoping effort. |
95 void resetMatchCount(); | 95 void resetMatchCount(); |
96 | 96 |
97 // Return the index in the find-in-page cache of the match closest to the | 97 // Return the index in the find-in-page cache of the match closest to the |
98 // provided point in find-in-page coordinates, or -1 in case of error. | 98 // provided point in find-in-page coordinates, or -1 in case of error. |
99 // The squared distance to the closest match is returned in the |distanceSquar
ed| parameter. | 99 // The squared distance to the closest match is returned in the |
| 100 // |distanceSquared| parameter. |
100 int nearestFindMatch(const FloatPoint&, float* distanceSquared); | 101 int nearestFindMatch(const FloatPoint&, float* distanceSquared); |
101 | 102 |
102 // Returns whether this frame has the active match. | 103 // Returns whether this frame has the active match. |
103 bool activeMatchFrame() const { return m_currentActiveMatchFrame; } | 104 bool activeMatchFrame() const { return m_currentActiveMatchFrame; } |
104 | 105 |
105 // Returns the active match in the current frame. Could be a null range if | 106 // Returns the active match in the current frame. Could be a null range if |
106 // the local frame has no active match. | 107 // the local frame has no active match. |
107 Range* activeMatch() const { return m_activeMatch.get(); } | 108 Range* activeMatch() const { return m_activeMatch.get(); } |
108 | 109 |
109 void flushCurrentScoping(); | 110 void flushCurrentScoping(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // match index returned by nearestFindMatch. Returns the ordinal of the new | 158 // match index returned by nearestFindMatch. Returns the ordinal of the new |
158 // selected match or -1 in case of error. Also provides the bounding box of | 159 // selected match or -1 in case of error. Also provides the bounding box of |
159 // the marker in window coordinates if selectionRect is not null. | 160 // the marker in window coordinates if selectionRect is not null. |
160 int selectFindMatch(unsigned index, WebRect* selectionRect); | 161 int selectFindMatch(unsigned index, WebRect* selectionRect); |
161 | 162 |
162 // Compute and cache the rects for FindMatches if required. | 163 // Compute and cache the rects for FindMatches if required. |
163 // Rects are automatically invalidated in case of content size changes, | 164 // Rects are automatically invalidated in case of content size changes, |
164 // propagating the invalidation to child frames. | 165 // propagating the invalidation to child frames. |
165 void updateFindMatchRects(); | 166 void updateFindMatchRects(); |
166 | 167 |
167 // Sets the markers within a range as active or inactive. Returns true if at l
east | 168 // Sets the markers within a range as active or inactive. Returns true if at |
168 // one such marker found. | 169 // least one such marker found. |
169 bool setMarkerActive(Range*, bool active); | 170 bool setMarkerActive(Range*, bool active); |
170 | 171 |
171 // Removes all markers. | 172 // Removes all markers. |
172 void unmarkAllTextMatches(); | 173 void unmarkAllTextMatches(); |
173 | 174 |
174 // Determines whether the scoping effort is required for a particular frame. | 175 // Determines whether the scoping effort is required for a particular frame. |
175 // It is not necessary if the frame is invisible, for example, or if this | 176 // It is not necessary if the frame is invisible, for example, or if this |
176 // is a repeat search that already returned nothing last time the same prefix | 177 // is a repeat search that already returned nothing last time the same prefix |
177 // was searched. | 178 // was searched. |
178 bool shouldScopeMatches(const WTF::String& searchText, const WebFindOptions&); | 179 bool shouldScopeMatches(const WTF::String& searchText, const WebFindOptions&); |
179 | 180 |
180 // Removes the current frame from the global scoping effort and triggers any | 181 // Removes the current frame from the global scoping effort and triggers any |
181 // updates if appropriate. This method does not mark the scoping operation | 182 // updates if appropriate. This method does not mark the scoping operation |
182 // as finished. | 183 // as finished. |
183 void flushCurrentScopingEffort(int identifier); | 184 void flushCurrentScopingEffort(int identifier); |
184 | 185 |
185 // Finishes the current scoping effort and triggers any updates if appropriate
. | 186 // Finishes the current scoping effort and triggers any updates if |
| 187 // appropriate. |
186 void finishCurrentScopingEffort(int identifier); | 188 void finishCurrentScopingEffort(int identifier); |
187 | 189 |
188 // Queue up a deferred call to scopeStringMatches. | 190 // Queue up a deferred call to scopeStringMatches. |
189 void scopeStringMatchesSoon(int identifier, | 191 void scopeStringMatchesSoon(int identifier, |
190 const WebString& searchText, | 192 const WebString& searchText, |
191 const WebFindOptions&, | 193 const WebFindOptions&, |
192 bool reset); | 194 bool reset); |
193 | 195 |
194 // Called by a DeferredScopeStringMatches instance. | 196 // Called by a DeferredScopeStringMatches instance. |
195 void callScopeStringMatches(DeferredScopeStringMatches*, | 197 void callScopeStringMatches(DeferredScopeStringMatches*, |
(...skipping 29 matching lines...) Expand all Loading... |
225 Member<Range> m_resumeScopingFromRange; | 227 Member<Range> m_resumeScopingFromRange; |
226 | 228 |
227 // Keeps track of the last string this frame searched for. This is used for | 229 // Keeps track of the last string this frame searched for. This is used for |
228 // short-circuiting searches in the following scenarios: When a frame has | 230 // short-circuiting searches in the following scenarios: When a frame has |
229 // been searched and returned 0 results, we don't need to search that frame | 231 // been searched and returned 0 results, we don't need to search that frame |
230 // again if the user is just adding to the search (making it more specific). | 232 // again if the user is just adding to the search (making it more specific). |
231 WTF::String m_lastSearchString; | 233 WTF::String m_lastSearchString; |
232 | 234 |
233 // Keeps track of how many matches this frame has found so far, so that we | 235 // Keeps track of how many matches this frame has found so far, so that we |
234 // don't lose count between scoping efforts, and is also used (in conjunction | 236 // don't lose count between scoping efforts, and is also used (in conjunction |
235 // with m_lastSearchString) to figure out if we need to search the frame again
. | 237 // with m_lastSearchString) to figure out if we need to search the frame |
| 238 // again. |
236 int m_lastMatchCount; | 239 int m_lastMatchCount; |
237 | 240 |
238 // This variable keeps a cumulative total of matches found so far in this | 241 // This variable keeps a cumulative total of matches found so far in this |
239 // frame, and is only incremented by calling IncreaseMatchCount. | 242 // frame, and is only incremented by calling IncreaseMatchCount. |
240 int m_totalMatchCount; | 243 int m_totalMatchCount; |
241 | 244 |
242 // Keeps track of whether the frame is currently scoping (being searched for m
atches). | 245 // Keeps track of whether the frame is currently scoping (being searched for |
| 246 // matches). |
243 bool m_frameScoping; | 247 bool m_frameScoping; |
244 | 248 |
245 // Identifier of the latest find-in-page request. Required to be stored in | 249 // Identifier of the latest find-in-page request. Required to be stored in |
246 // the frame in order to reply if required in case the frame is detached. | 250 // the frame in order to reply if required in case the frame is detached. |
247 int m_findRequestIdentifier; | 251 int m_findRequestIdentifier; |
248 | 252 |
249 // Keeps track of when the scoping effort should next invalidate the scrollbar | 253 // Keeps track of when the scoping effort should next invalidate the scrollbar |
250 // and the frame area. | 254 // and the frame area. |
251 int m_nextInvalidateAfter; | 255 int m_nextInvalidateAfter; |
252 | 256 |
(...skipping 26 matching lines...) Expand all Loading... |
279 // Determines if the rects in the find-in-page matches cache of this frame | 283 // Determines if the rects in the find-in-page matches cache of this frame |
280 // are invalid and should be recomputed. | 284 // are invalid and should be recomputed. |
281 bool m_findMatchRectsAreValid; | 285 bool m_findMatchRectsAreValid; |
282 }; | 286 }; |
283 | 287 |
284 } // namespace blink | 288 } // namespace blink |
285 | 289 |
286 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::TextFinder::FindMatch); | 290 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::TextFinder::FindMatch); |
287 | 291 |
288 #endif // TextFinder_h | 292 #endif // TextFinder_h |
OLD | NEW |