| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 bool wrapWithinFrame, | 65 bool wrapWithinFrame, |
| 66 bool* activeNow = nullptr); | 66 bool* activeNow = nullptr); |
| 67 void clearActiveFindMatch(); | 67 void clearActiveFindMatch(); |
| 68 void stopFindingAndClearSelection(); | 68 void stopFindingAndClearSelection(); |
| 69 void increaseMatchCount(int identifier, int count); | 69 void increaseMatchCount(int identifier, int count); |
| 70 int findMatchMarkersVersion() const { return m_findMatchMarkersVersion; } | 70 int findMatchMarkersVersion() const { return m_findMatchMarkersVersion; } |
| 71 WebFloatRect activeFindMatchRect(); | 71 WebFloatRect activeFindMatchRect(); |
| 72 void findMatchRects(WebVector<WebFloatRect>&); | 72 void findMatchRects(WebVector<WebFloatRect>&); |
| 73 int selectNearestFindMatch(const WebFloatPoint&, WebRect* selectionRect); | 73 int selectNearestFindMatch(const WebFloatPoint&, WebRect* selectionRect); |
| 74 | 74 |
| 75 // Counts how many times a particular string occurs within the frame. It | 75 // Starts brand new scoping request: resets the scoping state and |
| 76 // also retrieves the location of the string and updates a vector in the | 76 // asyncronously calls scopeStringMatches(). |
| 77 // frame so that tick-marks and highlighting can be drawn. This function | 77 void startScopingStringMatches(int identifier, |
| 78 // does its work asynchronously, by running for a certain time-slice and | 78 const WebString& searchText, |
| 79 // then scheduling itself (co-operative multitasking) to be invoked later | 79 const WebFindOptions&); |
| 80 // (repeating the process until all matches have been found). This allows | |
| 81 // multiple frames to be searched at the same time and provides a way to | |
| 82 // cancel at any time (see cancelPendingScopingEffort). The parameter | |
| 83 // searchText specifies what to look for and |reset| signals whether this is | |
| 84 // a brand new request or a continuation of the last scoping effort. | |
| 85 void scopeStringMatches(int identifier, | |
| 86 const WebString& searchText, | |
| 87 const WebFindOptions&, | |
| 88 bool reset); | |
| 89 | 80 |
| 90 // Cancels any outstanding requests for scoping string matches on the frame. | 81 // Cancels any outstanding requests for scoping string matches on the frame. |
| 91 void cancelPendingScopingEffort(); | 82 void cancelPendingScopingEffort(); |
| 92 | 83 |
| 93 // This function is called to reset the total number of matches found during | 84 // This function is called to reset the total number of matches found during |
| 94 // the scoping effort. | 85 // the scoping effort. |
| 95 void resetMatchCount(); | 86 void resetMatchCount(); |
| 96 | 87 |
| 97 // Return the index in the find-in-page cache of the match closest to the | 88 // 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. | 89 // provided point in find-in-page coordinates, or -1 in case of error. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 171 |
| 181 // Removes the current frame from the global scoping effort and triggers any | 172 // Removes the current frame from the global scoping effort and triggers any |
| 182 // updates if appropriate. This method does not mark the scoping operation | 173 // updates if appropriate. This method does not mark the scoping operation |
| 183 // as finished. | 174 // as finished. |
| 184 void flushCurrentScopingEffort(int identifier); | 175 void flushCurrentScopingEffort(int identifier); |
| 185 | 176 |
| 186 // Finishes the current scoping effort and triggers any updates if | 177 // Finishes the current scoping effort and triggers any updates if |
| 187 // appropriate. | 178 // appropriate. |
| 188 void finishCurrentScopingEffort(int identifier); | 179 void finishCurrentScopingEffort(int identifier); |
| 189 | 180 |
| 181 // Counts how many times a particular string occurs within the frame. It |
| 182 // also retrieves the location of the string and updates a vector in the |
| 183 // frame so that tick-marks and highlighting can be drawn. This function |
| 184 // does its work asynchronously, by running for a certain time-slice and |
| 185 // then scheduling itself (co-operative multitasking) to be invoked later |
| 186 // (repeating the process until all matches have been found). This allows |
| 187 // multiple frames to be searched at the same time and provides a way to |
| 188 // cancel at any time (see cancelPendingScopingEffort). The parameter |
| 189 // searchText specifies what to look for. |
| 190 void scopeStringMatches(int identifier, |
| 191 const WebString& searchText, |
| 192 const WebFindOptions&); |
| 193 |
| 190 // Queue up a deferred call to scopeStringMatches. | 194 // Queue up a deferred call to scopeStringMatches. |
| 191 void scopeStringMatchesSoon(int identifier, | 195 void scopeStringMatchesSoon(int identifier, |
| 192 const WebString& searchText, | 196 const WebString& searchText, |
| 193 const WebFindOptions&, | 197 const WebFindOptions&); |
| 194 bool reset); | |
| 195 | 198 |
| 196 // Called by a DeferredScopeStringMatches instance. | 199 // Called by a DeferredScopeStringMatches instance. |
| 197 void callScopeStringMatches(DeferredScopeStringMatches*, | 200 void resumeScopingStringMatches(int identifier, |
| 198 int identifier, | 201 const WebString& searchText, |
| 199 const WebString& searchText, | 202 const WebFindOptions&); |
| 200 const WebFindOptions&, | |
| 201 bool reset); | |
| 202 | 203 |
| 203 // Determines whether to invalidate the content area and scrollbar. | 204 // Determines whether to invalidate the content area and scrollbar. |
| 204 void invalidateIfNecessary(); | 205 void invalidateIfNecessary(); |
| 205 | 206 |
| 206 WebLocalFrameImpl& ownerFrame() const { | 207 WebLocalFrameImpl& ownerFrame() const { |
| 207 DCHECK(m_ownerFrame); | 208 DCHECK(m_ownerFrame); |
| 208 return *m_ownerFrame; | 209 return *m_ownerFrame; |
| 209 } | 210 } |
| 210 | 211 |
| 211 Member<WebLocalFrameImpl> m_ownerFrame; | 212 Member<WebLocalFrameImpl> m_ownerFrame; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 bool m_frameScoping; | 248 bool m_frameScoping; |
| 248 | 249 |
| 249 // Identifier of the latest find-in-page request. Required to be stored in | 250 // Identifier of the latest find-in-page request. Required to be stored in |
| 250 // the frame in order to reply if required in case the frame is detached. | 251 // the frame in order to reply if required in case the frame is detached. |
| 251 int m_findRequestIdentifier; | 252 int m_findRequestIdentifier; |
| 252 | 253 |
| 253 // Keeps track of when the scoping effort should next invalidate the scrollbar | 254 // Keeps track of when the scoping effort should next invalidate the scrollbar |
| 254 // and the frame area. | 255 // and the frame area. |
| 255 int m_nextInvalidateAfter; | 256 int m_nextInvalidateAfter; |
| 256 | 257 |
| 257 // A list of all of the pending calls to scopeStringMatches. | 258 // Pending call to scopeStringMatches. |
| 258 HeapVector<Member<DeferredScopeStringMatches>> m_deferredScopingWork; | 259 Member<DeferredScopeStringMatches> m_deferredScopingWork; |
| 259 | 260 |
| 260 // Version number incremented whenever this frame's find-in-page match | 261 // Version number incremented whenever this frame's find-in-page match |
| 261 // markers change. | 262 // markers change. |
| 262 int m_findMatchMarkersVersion; | 263 int m_findMatchMarkersVersion; |
| 263 | 264 |
| 264 // Local cache of the find match markers currently displayed for this frame. | 265 // Local cache of the find match markers currently displayed for this frame. |
| 265 HeapVector<FindMatch> m_findMatchesCache; | 266 HeapVector<FindMatch> m_findMatchesCache; |
| 266 | 267 |
| 267 // Contents size when find-in-page match rects were last computed for this | 268 // Contents size when find-in-page match rects were last computed for this |
| 268 // frame's cache. | 269 // frame's cache. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 283 // Determines if the rects in the find-in-page matches cache of this frame | 284 // Determines if the rects in the find-in-page matches cache of this frame |
| 284 // are invalid and should be recomputed. | 285 // are invalid and should be recomputed. |
| 285 bool m_findMatchRectsAreValid; | 286 bool m_findMatchRectsAreValid; |
| 286 }; | 287 }; |
| 287 | 288 |
| 288 } // namespace blink | 289 } // namespace blink |
| 289 | 290 |
| 290 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::TextFinder::FindMatch); | 291 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::TextFinder::FindMatch); |
| 291 | 292 |
| 292 #endif // TextFinder_h | 293 #endif // TextFinder_h |
| OLD | NEW |