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 13 matching lines...) Expand all Loading... | |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef TextFinder_h | 31 #ifndef TextFinder_h |
32 #define TextFinder_h | 32 #define TextFinder_h |
33 | 33 |
34 #include "WebFrame.h" | 34 #include "WebFindOptions.h" |
35 | 35 #include "core/editing/FindOptions.h" |
36 #include "FrameLoaderClientImpl.h" | |
37 #include "core/frame/Frame.h" | |
38 #include "core/frame/FrameDestructionObserver.h" | |
39 #include "platform/geometry/FloatRect.h" | 36 #include "platform/geometry/FloatRect.h" |
40 #include "public/platform/WebFileSystemType.h" | 37 #include "public/platform/WebFloatPoint.h" |
41 #include "wtf/Compiler.h" | 38 #include "public/platform/WebFloatRect.h" |
42 #include "wtf/OwnPtr.h" | 39 #include "public/platform/WebRect.h" |
43 #include "wtf/RefCounted.h" | 40 #include "wtf/PassOwnPtr.h" |
41 #include "wtf/PassRefPtr.h" | |
42 #include "wtf/Vector.h" | |
44 #include "wtf/text/WTFString.h" | 43 #include "wtf/text/WTFString.h" |
45 | 44 |
46 namespace WebCore { | 45 namespace WebCore { |
47 class GraphicsContext; | |
48 class HTMLInputElement; | |
49 class HistoryItem; | |
50 class IntSize; | |
51 class KURL; | |
52 class Node; | |
53 class Range; | 46 class Range; |
54 class SubstituteData; | |
55 struct FrameLoadRequest; | |
56 struct WindowFeatures; | |
57 } | 47 } |
58 | 48 |
59 namespace blink { | 49 namespace blink { |
60 class ChromePrintContext; | 50 class WebFrameImpl; |
61 class WebDataSourceImpl; | |
62 class WebInputElement; | |
63 class WebFrameClient; | |
64 class WebPerformance; | |
65 class WebPluginContainerImpl; | |
66 class WebView; | |
67 class WebViewImpl; | |
68 struct WebPrintParams; | |
69 | 51 |
70 template <typename T> class WebVector; | 52 template <typename T> class WebVector; |
71 | 53 |
72 // Implementation of WebFrame, note that this is a reference counted object. | 54 class TextFinder { |
73 class WebFrameImpl | |
74 : public WebFrame | |
75 , public RefCounted<WebFrameImpl> | |
76 , public WebCore::FrameDestructionObserver { | |
77 public: | 55 public: |
78 // WebFrame methods: | 56 static PassOwnPtr<TextFinder> create(WebFrameImpl* ownerFrame); |
79 virtual void close(); | 57 |
80 virtual WebString uniqueName() const; | 58 bool find( |
81 virtual WebString assignedName() const; | |
82 virtual void setName(const WebString&); | |
83 virtual long long embedderIdentifier() const; | |
84 virtual WebVector<WebIconURL> iconURLs(int iconTypesMask) const; | |
85 virtual WebSize scrollOffset() const; | |
86 virtual void setScrollOffset(const WebSize&); | |
87 virtual WebSize minimumScrollOffset() const; | |
88 virtual WebSize maximumScrollOffset() const; | |
89 virtual WebSize contentsSize() const; | |
90 virtual bool hasVisibleContent() const; | |
91 virtual WebRect visibleContentRect() const; | |
92 virtual bool hasHorizontalScrollbar() const; | |
93 virtual bool hasVerticalScrollbar() const; | |
94 virtual WebView* view() const; | |
95 virtual WebFrame* opener() const; | |
96 virtual void setOpener(const WebFrame*); | |
97 virtual WebFrame* parent() const; | |
98 virtual WebFrame* top() const; | |
99 virtual WebFrame* firstChild() const; | |
100 virtual WebFrame* lastChild() const; | |
101 virtual WebFrame* nextSibling() const; | |
102 virtual WebFrame* previousSibling() const; | |
103 virtual WebFrame* traverseNext(bool wrap) const; | |
104 virtual WebFrame* traversePrevious(bool wrap) const; | |
105 virtual WebFrame* findChildByName(const WebString&) const; | |
106 virtual WebFrame* findChildByExpression(const WebString&) const; | |
107 virtual WebDocument document() const; | |
108 virtual WebPerformance performance() const; | |
109 virtual NPObject* windowObject() const; | |
110 virtual void bindToWindowObject(const WebString& name, NPObject*); | |
111 virtual void bindToWindowObject(const WebString& name, NPObject*, void*); | |
112 virtual void executeScript(const WebScriptSource&); | |
113 virtual void executeScriptInIsolatedWorld( | |
114 int worldID, const WebScriptSource* sources, unsigned numSources, | |
115 int extensionGroup); | |
116 virtual void setIsolatedWorldSecurityOrigin(int worldID, const WebSecurityOr igin&); | |
117 virtual void setIsolatedWorldContentSecurityPolicy(int worldID, const WebStr ing&); | |
118 virtual void addMessageToConsole(const WebConsoleMessage&); | |
119 virtual void collectGarbage(); | |
120 virtual bool checkIfRunInsecureContent(const WebURL&) const; | |
121 virtual v8::Handle<v8::Value> executeScriptAndReturnValue( | |
122 const WebScriptSource&); | |
123 virtual void executeScriptInIsolatedWorld( | |
124 int worldID, const WebScriptSource* sourcesIn, unsigned numSources, | |
125 int extensionGroup, WebVector<v8::Local<v8::Value> >* results); | |
126 virtual v8::Handle<v8::Value> callFunctionEvenIfScriptDisabled( | |
127 v8::Handle<v8::Function>, | |
128 v8::Handle<v8::Object>, | |
129 int argc, | |
130 v8::Handle<v8::Value> argv[]); | |
131 virtual v8::Local<v8::Context> mainWorldScriptContext() const; | |
132 virtual v8::Handle<v8::Value> createFileSystem(WebFileSystemType, | |
133 const WebString& name, | |
134 const WebString& path); | |
135 virtual v8::Handle<v8::Value> createSerializableFileSystem(WebFileSystemType , | |
136 const WebString& name, | |
137 const WebString& path); | |
138 virtual v8::Handle<v8::Value> createFileEntry(WebFileSystemType, | |
139 const WebString& fileSystemName, | |
140 const WebString& fileSystemPath, | |
141 const WebString& filePath, | |
142 bool isDirectory); | |
143 virtual void reload(bool ignoreCache); | |
144 virtual void reloadWithOverrideURL(const WebURL& overrideUrl, bool ignoreCac he); | |
145 virtual void loadRequest(const WebURLRequest&); | |
146 virtual void loadHistoryItem(const WebHistoryItem&); | |
147 virtual void loadData( | |
148 const WebData&, const WebString& mimeType, const WebString& textEncoding , | |
149 const WebURL& baseURL, const WebURL& unreachableURL, bool replace); | |
150 virtual void loadHTMLString( | |
151 const WebData& html, const WebURL& baseURL, const WebURL& unreachableURL , | |
152 bool replace); | |
153 virtual bool isLoading() const; | |
154 virtual void stopLoading(); | |
155 virtual WebDataSource* provisionalDataSource() const; | |
156 virtual WebDataSource* dataSource() const; | |
157 virtual WebHistoryItem previousHistoryItem() const; | |
158 virtual WebHistoryItem currentHistoryItem() const; | |
159 virtual void enableViewSourceMode(bool enable); | |
160 virtual bool isViewSourceModeEnabled() const; | |
161 virtual void setReferrerForRequest(WebURLRequest&, const WebURL& referrer); | |
162 virtual void dispatchWillSendRequest(WebURLRequest&); | |
163 virtual WebURLLoader* createAssociatedURLLoader(const WebURLLoaderOptions&); | |
164 virtual unsigned unloadListenerCount() const; | |
165 virtual void replaceSelection(const WebString&); | |
166 virtual void insertText(const WebString&); | |
167 virtual void setMarkedText(const WebString&, unsigned location, unsigned len gth); | |
168 virtual void unmarkText(); | |
169 virtual bool hasMarkedText() const; | |
170 virtual WebRange markedRange() const; | |
171 virtual bool firstRectForCharacterRange(unsigned location, unsigned length, WebRect&) const; | |
172 virtual size_t characterIndexForPoint(const WebPoint&) const; | |
173 virtual bool executeCommand(const WebString&, const WebNode& = WebNode()); | |
174 virtual bool executeCommand(const WebString&, const WebString& value, const WebNode& = WebNode()); | |
175 virtual bool isCommandEnabled(const WebString&) const; | |
176 virtual void enableContinuousSpellChecking(bool); | |
177 virtual bool isContinuousSpellCheckingEnabled() const; | |
178 virtual void requestTextChecking(const WebElement&); | |
179 virtual void replaceMisspelledRange(const WebString&); | |
180 virtual void removeSpellingMarkers(); | |
181 virtual bool hasSelection() const; | |
182 virtual WebRange selectionRange() const; | |
183 virtual WebString selectionAsText() const; | |
184 virtual WebString selectionAsMarkup() const; | |
185 virtual bool selectWordAroundCaret(); | |
186 virtual void selectRange(const WebPoint& base, const WebPoint& extent); | |
187 virtual void selectRange(const WebRange&); | |
188 virtual void moveCaretSelectionTowardsWindowPoint(const WebPoint&); | |
189 virtual void moveRangeSelection(const WebPoint& base, const WebPoint& extent ); | |
190 virtual void moveCaretSelection(const WebPoint&); | |
191 virtual void setCaretVisible(bool); | |
192 virtual int printBegin(const WebPrintParams&, const WebNode& constrainToNode ); | |
193 virtual float printPage(int pageToPrint, WebCanvas*); | |
194 virtual float getPrintPageShrink(int page); | |
195 virtual void printEnd(); | |
196 virtual bool isPrintScalingDisabledForPlugin(const WebNode&); | |
197 virtual bool hasCustomPageSizeStyle(int pageIndex); | |
198 virtual bool isPageBoxVisible(int pageIndex); | |
199 virtual void pageSizeAndMarginsInPixels(int pageIndex, | |
200 WebSize& pageSize, | |
201 int& marginTop, | |
202 int& marginRight, | |
203 int& marginBottom, | |
204 int& marginLeft); | |
205 virtual WebString pageProperty(const WebString& propertyName, int pageIndex) ; | |
206 virtual void printPagesWithBoundaries(WebCanvas*, const WebSize&); | |
207 virtual bool find( | |
208 int identifier, const WebString& searchText, const WebFindOptions&, | 59 int identifier, const WebString& searchText, const WebFindOptions&, |
209 bool wrapWithinFrame, WebRect* selectionRect); | 60 bool wrapWithinFrame, WebRect* selectionRect); |
210 virtual void stopFinding(bool clearSelection); | 61 void stopFinding(bool clearSelection); |
211 virtual void scopeStringMatches( | 62 void scopeStringMatches( |
212 int identifier, const WebString& searchText, const WebFindOptions&, | 63 int identifier, const WebString& searchText, const WebFindOptions&, |
213 bool reset); | 64 bool reset); |
214 virtual void cancelPendingScopingEffort(); | 65 void cancelPendingScopingEffort(); |
215 virtual void increaseMatchCount(int count, int identifier); | 66 void increaseMatchCount(int identifier, int count); |
216 virtual void resetMatchCount(); | 67 void resetMatchCount(); |
217 virtual int findMatchMarkersVersion() const; | 68 int findMatchMarkersVersion() const { return m_findMatchMarkersVersion; } |
218 virtual WebFloatRect activeFindMatchRect(); | 69 WebFloatRect activeFindMatchRect(); |
219 virtual void findMatchRects(WebVector<WebFloatRect>&); | 70 void findMatchRects(WebVector<WebFloatRect>&); |
220 virtual int selectNearestFindMatch(const WebFloatPoint&, WebRect* selectionR ect); | 71 int selectNearestFindMatch(const WebFloatPoint&, WebRect* selectionRect); |
221 | |
222 virtual void sendOrientationChangeEvent(int orientation); | |
223 | |
224 virtual void dispatchMessageEventWithOriginCheck( | |
225 const WebSecurityOrigin& intendedTargetOrigin, | |
226 const WebDOMEvent&); | |
227 | |
228 virtual WebString contentAsText(size_t maxChars) const; | |
229 virtual WebString contentAsMarkup() const; | |
230 virtual WebString renderTreeAsText(RenderAsTextControls toShow = RenderAsTex tNormal) const; | |
231 virtual WebString markerTextForListItem(const WebElement&) const; | |
232 virtual WebRect selectionBoundsRect() const; | |
233 | |
234 virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const; | |
235 virtual WebString layerTreeAsText(bool showDebugInfo = false) const; | |
236 | |
237 // WebCore::FrameDestructionObserver methods. | |
238 virtual void willDetachPage(); | |
239 | |
240 static WebFrameImpl* create(WebFrameClient*); | |
241 // FIXME: Move the embedderIdentifier concept fully to the embedder and | |
242 // remove this factory method. | |
243 static WebFrameImpl* create(WebFrameClient*, long long embedderIdentifier); | |
244 virtual ~WebFrameImpl(); | |
245 | |
246 // Called by the WebViewImpl to initialize the main frame for the page. | |
247 void initializeAsMainFrame(WebCore::Page*); | |
248 | |
249 PassRefPtr<WebCore::Frame> createChildFrame( | |
250 const WebCore::FrameLoadRequest&, WebCore::HTMLFrameOwnerElement*); | |
251 | |
252 void didChangeContentsSize(const WebCore::IntSize&); | |
253 | |
254 void createFrameView(); | |
255 | |
256 static WebFrameImpl* fromFrame(WebCore::Frame* frame); | |
257 static WebFrameImpl* fromFrameOwnerElement(WebCore::Element* element); | |
258 | |
259 // If the frame hosts a PluginDocument, this method returns the WebPluginCon tainerImpl | |
260 // that hosts the plugin. | |
261 static WebPluginContainerImpl* pluginContainerFromFrame(WebCore::Frame*); | |
262 | |
263 // If the frame hosts a PluginDocument, this method returns the WebPluginCon tainerImpl | |
264 // that hosts the plugin. If the provided node is a plugin, then it runs its | |
265 // WebPluginContainerImpl. | |
266 static WebPluginContainerImpl* pluginContainerFromNode(WebCore::Frame*, cons t WebNode&); | |
267 | |
268 WebViewImpl* viewImpl() const; | |
269 | |
270 WebCore::FrameView* frameView() const { return frame() ? frame()->view() : 0 ; } | |
271 | |
272 // Getters for the impls corresponding to Get(Provisional)DataSource. They | |
273 // may return 0 if there is no corresponding data source. | |
274 WebDataSourceImpl* dataSourceImpl() const; | |
275 WebDataSourceImpl* provisionalDataSourceImpl() const; | |
276 | 72 |
277 // Returns which frame has an active match. This function should only be | 73 // Returns which frame has an active match. This function should only be |
278 // called on the main frame, as it is the only frame keeping track. Returned | 74 // called on the main frame, as it is the only frame keeping track. Returned |
279 // value can be 0 if no frame has an active match. | 75 // value can be 0 if no frame has an active match. |
280 WebFrameImpl* activeMatchFrame() const { return m_currentActiveMatchFrame; } | 76 WebFrameImpl* activeMatchFrame() const { return m_currentActiveMatchFrame; } |
281 | 77 |
282 // Returns the active match in the current frame. Could be a null range if | 78 // Returns the active match in the current frame. Could be a null range if |
283 // the local frame has no active match. | 79 // the local frame has no active match. |
284 WebCore::Range* activeMatch() const { return m_activeMatch.get(); } | 80 WebCore::Range* activeMatch() const { return m_activeMatch.get(); } |
285 | 81 |
286 // When a Find operation ends, we want to set the selection to what was acti ve | 82 void flushCurrentScoping(); |
287 // and set focus to the first focusable node we find (starting with the firs t | |
288 // node in the matched range and going up the inheritance chain). If we find | |
289 // nothing to focus we focus the first focusable node in the range. This | |
290 // allows us to set focus to a link (when we find text inside a link), which | |
291 // allows us to navigate by pressing Enter after closing the Find box. | |
292 void setFindEndstateFocusAndSelection(); | |
293 | 83 |
294 void didFail(const WebCore::ResourceError&, bool wasProvisional); | 84 void resetActiveMatch() { m_activeMatch = 0; } |
295 | 85 |
296 // Sets whether the WebFrameImpl allows its document to be scrolled. | 86 int totalMatchCount() const { return m_totalMatchCount; } |
297 // If the parameter is true, allow the document to be scrolled. | 87 bool scopingInProgress() const { return m_scopingInProgress; } |
298 // Otherwise, disallow scrolling. | 88 void increaseMarkerVersion() { ++m_findMatchMarkersVersion; } |
299 void setCanHaveScrollbars(bool); | |
300 | 89 |
301 WebFrameClient* client() const { return m_client; } | 90 ~TextFinder(); |
302 void setClient(WebFrameClient* client) { m_client = client; } | |
303 | |
304 void setInputEventsTransformForEmulation(const WebCore::IntSize&, float); | |
305 | |
306 static void selectWordAroundPosition(WebCore::Frame*, WebCore::VisiblePositi on); | |
307 | 91 |
308 private: | 92 private: |
309 class DeferredScopeStringMatches; | 93 class DeferredScopeStringMatches; |
310 friend class DeferredScopeStringMatches; | 94 friend class DeferredScopeStringMatches; |
311 friend class FrameLoaderClientImpl; | |
312 | 95 |
313 struct FindMatch { | 96 struct FindMatch { |
314 RefPtr<WebCore::Range> m_range; | 97 RefPtr<WebCore::Range> m_range; |
315 | 98 |
316 // 1-based index within this frame. | 99 // 1-based index within this frame. |
317 int m_ordinal; | 100 int m_ordinal; |
318 | 101 |
319 // In find-in-page coordinates. | 102 // In find-in-page coordinates. |
320 // Lazily calculated by updateFindMatchRects. | 103 // Lazily calculated by updateFindMatchRects. |
321 WebCore::FloatRect m_rect; | 104 WebCore::FloatRect m_rect; |
322 | 105 |
323 FindMatch(PassRefPtr<WebCore::Range>, int ordinal); | 106 FindMatch(PassRefPtr<WebCore::Range>, int ordinal); |
324 }; | 107 }; |
325 | 108 |
326 // A bit mask specifying area of the frame to invalidate. | 109 // A bit mask specifying area of the frame to invalidate. |
327 enum AreaToInvalidate { | 110 enum AreaToInvalidate { |
328 InvalidateNothing, | 111 InvalidateNothing, |
329 InvalidateContentArea, | 112 InvalidateContentArea, |
330 InvalidateScrollbar, // Vertical scrollbar only. | 113 InvalidateScrollbar, // Vertical scrollbar only. |
331 InvalidateAll // Both content area and the scrollbar. | 114 InvalidateAll // Both content area and the scrollbar. |
332 }; | 115 }; |
333 | 116 |
334 WebFrameImpl(WebFrameClient*, long long frame_identifier); | 117 explicit TextFinder(WebFrameImpl* ownerFrame); |
yosin_UTC9
2013/12/09 01:29:12
nit: Can we pass reference rather than pointer? Si
Andrey Kraynov
2013/12/13 14:03:58
Sure we can.
| |
335 | |
336 // Sets the local WebCore frame and registers destruction observers. | |
337 void setWebCoreFrame(WebCore::Frame*); | |
338 | 118 |
339 // Notifies the delegate about a new selection rect. | 119 // Notifies the delegate about a new selection rect. |
340 void reportFindInPageSelection( | 120 void reportFindInPageSelection( |
341 const WebRect& selectionRect, int activeMatchOrdinal, int identifier); | 121 const WebRect& selectionRect, int activeMatchOrdinal, int identifier); |
342 | 122 |
343 // Clear the find-in-page matches cache forcing rects to be fully | 123 // Clear the find-in-page matches cache forcing rects to be fully |
344 // calculated again next time updateFindMatchRects is called. | 124 // calculated again next time updateFindMatchRects is called. |
345 void clearFindMatchesCache(); | 125 void clearFindMatchesCache(); |
346 | 126 |
347 // Check if the activeMatchFrame still exists in the frame tree. | 127 // Check if the activeMatchFrame still exists in the frame tree. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
401 bool reset); | 181 bool reset); |
402 | 182 |
403 // Called by a DeferredScopeStringMatches instance. | 183 // Called by a DeferredScopeStringMatches instance. |
404 void callScopeStringMatches( | 184 void callScopeStringMatches( |
405 DeferredScopeStringMatches*, int identifier, const WebString& searchText , | 185 DeferredScopeStringMatches*, int identifier, const WebString& searchText , |
406 const WebFindOptions&, bool reset); | 186 const WebFindOptions&, bool reset); |
407 | 187 |
408 // Determines whether to invalidate the content area and scrollbar. | 188 // Determines whether to invalidate the content area and scrollbar. |
409 void invalidateIfNecessary(); | 189 void invalidateIfNecessary(); |
410 | 190 |
411 void loadJavaScriptURL(const WebCore::KURL&); | 191 // Sets the markers within a current match range as active or inactive. |
192 void setMatchMarkerActive(bool); | |
412 | 193 |
413 // Returns a hit-tested VisiblePosition for the given point | 194 void decrementFramesScopingCount(int identifier); |
414 WebCore::VisiblePosition visiblePositionForWindowPoint(const WebPoint&); | |
415 | 195 |
416 class WebFrameInit : public WebCore::FrameInit { | 196 // Owner frame |
yosin_UTC9
2013/12/16 03:51:04
nit: We don't need to have this comment. Variable
Andrey Kraynov
2013/12/18 11:00:22
Fixed.
| |
417 public: | 197 WebFrameImpl* m_ownerFrame; |
yosin_UTC9
2013/12/09 01:29:12
Can we make |m_ownerFrame| as reference?
Andrey Kraynov
2013/12/13 14:03:58
Yes, definitely.
This leads us to the code like 'a
yosin_UTC9
2013/12/16 03:51:04
I think it is OK. Using m_ownerFrame is more often
| |
418 static PassRefPtr<WebFrameInit> create(WebFrameImpl* webFrameImpl, int64 _t frameID) | |
419 { | |
420 return adoptRef(new WebFrameInit(webFrameImpl, frameID)); | |
421 } | |
422 | |
423 private: | |
424 WebFrameInit(WebFrameImpl* webFrameImpl, int64_t frameID) | |
425 : WebCore::FrameInit(frameID) | |
426 , m_frameLoaderClientImpl(webFrameImpl) | |
427 { | |
428 setFrameLoaderClient(&m_frameLoaderClientImpl); | |
429 } | |
430 | |
431 FrameLoaderClientImpl m_frameLoaderClientImpl; | |
432 }; | |
433 RefPtr<WebFrameInit> m_frameInit; | |
434 | |
435 WebFrameClient* m_client; | |
436 | 198 |
437 // A way for the main frame to keep track of which frame has an active | 199 // A way for the main frame to keep track of which frame has an active |
438 // match. Should be 0 for all other frames. | 200 // match. Should be 0 for all other frames. |
439 WebFrameImpl* m_currentActiveMatchFrame; | 201 WebFrameImpl* m_currentActiveMatchFrame; |
440 | 202 |
441 // The range of the active match for the current frame. | 203 // The range of the active match for the current frame. |
442 RefPtr<WebCore::Range> m_activeMatch; | 204 RefPtr<WebCore::Range> m_activeMatch; |
443 | 205 |
444 // The index of the active match for the current frame. | 206 // The index of the active match for the current frame. |
445 int m_activeMatchIndexInCurrentFrame; | 207 int m_activeMatchIndexInCurrentFrame; |
446 | 208 |
447 // This flag is used by the scoping effort to determine if we need to figure | |
448 // out which rectangle is the active match. Once we find the active | |
449 // rectangle we clear this flag. | |
450 bool m_locatingActiveRect; | |
451 | |
452 // The scoping effort can time out and we need to keep track of where we | 209 // The scoping effort can time out and we need to keep track of where we |
453 // ended our last search so we can continue from where we left of. | 210 // ended our last search so we can continue from where we left of. |
454 RefPtr<WebCore::Range> m_resumeScopingFromRange; | 211 RefPtr<WebCore::Range> m_resumeScopingFromRange; |
455 | 212 |
456 // Keeps track of the last string this frame searched for. This is used for | 213 // Keeps track of the last string this frame searched for. This is used for |
457 // short-circuiting searches in the following scenarios: When a frame has | 214 // short-circuiting searches in the following scenarios: When a frame has |
458 // been searched and returned 0 results, we don't need to search that frame | 215 // been searched and returned 0 results, we don't need to search that frame |
459 // again if the user is just adding to the search (making it more specific). | 216 // again if the user is just adding to the search (making it more specific). |
460 WTF::String m_lastSearchString; | 217 WTF::String m_lastSearchString; |
461 | 218 |
462 // Keeps track of how many matches this frame has found so far, so that we | 219 // Keeps track of how many matches this frame has found so far, so that we |
463 // don't loose count between scoping efforts, and is also used (in conjuncti on | 220 // don't loose count between scoping efforts, and is also used (in conjuncti on |
464 // with m_lastSearchString) to figure out if we need to search the frame aga in. | 221 // with m_lastSearchString) to figure out if we need to search the frame aga in. |
465 int m_lastMatchCount; | 222 int m_lastMatchCount; |
466 | 223 |
467 // This variable keeps a cumulative total of matches found so far for ALL th e | 224 // This variable keeps a cumulative total of matches found so far for ALL th e |
468 // frames on the page, and is only incremented by calling IncreaseMatchCount | 225 // frames on the page, and is only incremented by calling IncreaseMatchCount |
469 // (on the main frame only). It should be -1 for all other frames. | 226 // (on the main frame only). It should be -1 for all other frames. |
470 int m_totalMatchCount; | 227 int m_totalMatchCount; |
471 | 228 |
472 // This variable keeps a cumulative total of how many frames are currently | 229 // This variable keeps a cumulative total of how many frames are currently |
473 // scoping, and is incremented/decremented on the main frame only. | 230 // scoping, and is incremented/decremented on the main frame only. |
474 // It should be -1 for all other frames. | 231 // It should be -1 for all other frames. |
475 int m_framesScopingCount; | 232 int m_framesScopingCount; |
476 | 233 |
477 // Identifier of the latest find-in-page request. Required to be stored in | 234 // Identifier of the latest find-in-page request. Required to be stored in |
478 // the frame in order to reply if required in case the frame is detached. | 235 // the frame in order to reply if required in case the frame is detached. |
479 int m_findRequestIdentifier; | 236 int m_findRequestIdentifier; |
480 | 237 |
481 // Keeps track of whether there is an scoping effort ongoing in the frame. | |
482 bool m_scopingInProgress; | |
483 | |
484 // Keeps track of whether the last find request completed its scoping effort | |
485 // without finding any matches in this frame. | |
486 bool m_lastFindRequestCompletedWithNoMatches; | |
487 | |
488 // Keeps track of when the scoping effort should next invalidate the scrollb ar | 238 // Keeps track of when the scoping effort should next invalidate the scrollb ar |
489 // and the frame area. | 239 // and the frame area. |
490 int m_nextInvalidateAfter; | 240 int m_nextInvalidateAfter; |
491 | 241 |
492 // A list of all of the pending calls to scopeStringMatches. | 242 // A list of all of the pending calls to scopeStringMatches. |
493 Vector<DeferredScopeStringMatches*> m_deferredScopingWork; | 243 Vector<DeferredScopeStringMatches*> m_deferredScopingWork; |
494 | 244 |
495 // Version number incremented on the main frame only whenever the document | 245 // Version number incremented on the main frame only whenever the document |
496 // find-in-page match markers change. It should be 0 for all other frames. | 246 // find-in-page match markers change. It should be 0 for all other frames. |
497 int m_findMatchMarkersVersion; | 247 int m_findMatchMarkersVersion; |
498 | 248 |
499 // Local cache of the find match markers currently displayed for this frame. | 249 // Local cache of the find match markers currently displayed for this frame. |
500 Vector<FindMatch> m_findMatchesCache; | 250 Vector<FindMatch> m_findMatchesCache; |
501 | 251 |
502 // Determines if the rects in the find-in-page matches cache of this frame | |
503 // are invalid and should be recomputed. | |
504 bool m_findMatchRectsAreValid; | |
505 | |
506 // Contents size when find-in-page match rects were last computed for this | 252 // Contents size when find-in-page match rects were last computed for this |
507 // frame's cache. | 253 // frame's cache. |
508 WebCore::IntSize m_contentsSizeForCurrentFindMatchRects; | 254 WebCore::IntSize m_contentsSizeForCurrentFindMatchRects; |
509 | 255 |
510 // Valid between calls to BeginPrint() and EndPrint(). Containts the print | 256 // This flag is used by the scoping effort to determine if we need to figure |
511 // information. Is used by PrintPage(). | 257 // out which rectangle is the active match. Once we find the active |
512 OwnPtr<ChromePrintContext> m_printContext; | 258 // rectangle we clear this flag. |
259 bool m_locatingActiveRect; | |
513 | 260 |
514 // Stores the additional input events offset and scale when device metrics e mulation is enabled. | 261 // Keeps track of whether there is an scoping effort ongoing in the frame. |
515 WebCore::IntSize m_inputEventsOffsetForEmulation; | 262 bool m_scopingInProgress; |
516 float m_inputEventsScaleFactorForEmulation; | 263 |
264 // Keeps track of whether the last find request completed its scoping effort | |
265 // without finding any matches in this frame. | |
266 bool m_lastFindRequestCompletedWithNoMatches; | |
267 | |
268 // Determines if the rects in the find-in-page matches cache of this frame | |
269 // are invalid and should be recomputed. | |
270 bool m_findMatchRectsAreValid; | |
517 }; | 271 }; |
518 | 272 |
519 inline WebFrameImpl* toWebFrameImpl(WebFrame* webFrame) | |
520 { | |
521 return static_cast<WebFrameImpl*>(webFrame); | |
522 } | |
523 | |
524 inline const WebFrameImpl* toWebFrameImpl(const WebFrame* webFrame) | |
525 { | |
526 return static_cast<const WebFrameImpl*>(webFrame); | |
527 } | |
528 | |
529 // This will catch anyone doing an unnecessary cast. | |
530 void toWebFrameImpl(const WebFrameImpl*); | |
531 | |
532 } // namespace blink | 273 } // namespace blink |
533 | 274 |
534 #endif // TextFinder_h | 275 #endif // TextFinder_h |
OLD | NEW |