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 "platform/geometry/FloatRect.h" | 36 #include "platform/geometry/FloatRect.h" |
39 #include "public/platform/WebFileSystemType.h" | 37 #include "public/platform/WebFloatPoint.h" |
40 #include "wtf/Compiler.h" | 38 #include "public/platform/WebFloatRect.h" |
41 #include "wtf/OwnPtr.h" | 39 #include "public/platform/WebRect.h" |
42 #include "wtf/RefCounted.h" | 40 #include "wtf/PassOwnPtr.h" |
| 41 #include "wtf/PassRefPtr.h" |
| 42 #include "wtf/Vector.h" |
43 #include "wtf/text/WTFString.h" | 43 #include "wtf/text/WTFString.h" |
44 | 44 |
45 namespace WebCore { | 45 namespace WebCore { |
46 class GraphicsContext; | |
47 class HTMLInputElement; | |
48 class HistoryItem; | |
49 class IntSize; | |
50 class KURL; | |
51 class Node; | |
52 class Range; | 46 class Range; |
53 class SubstituteData; | |
54 struct FrameLoadRequest; | |
55 struct WindowFeatures; | |
56 } | 47 } |
57 | 48 |
58 namespace blink { | 49 namespace blink { |
59 class ChromePrintContext; | 50 class WebFrameImpl; |
60 class SharedWorkerRepositoryClientImpl; | |
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: | 55 public: |
77 // WebFrame methods: | 56 static PassOwnPtr<TextFinder> create(WebFrameImpl& ownerFrame); |
78 virtual void close(); | 57 |
79 virtual WebString uniqueName() const; | 58 bool find( |
80 virtual WebString assignedName() const; | |
81 virtual void setName(const WebString&); | |
82 virtual long long embedderIdentifier() const; | |
83 virtual WebVector<WebIconURL> iconURLs(int iconTypesMask) const; | |
84 virtual void setRemoteWebLayer(WebLayer*); | |
85 virtual void setPermissionClient(WebPermissionClient*); | |
86 virtual void setSharedWorkerRepositoryClient(WebSharedWorkerRepositoryClient
*); | |
87 virtual WebSize scrollOffset() const; | |
88 virtual void setScrollOffset(const WebSize&); | |
89 virtual WebSize minimumScrollOffset() const; | |
90 virtual WebSize maximumScrollOffset() const; | |
91 virtual WebSize contentsSize() const; | |
92 virtual bool hasVisibleContent() const; | |
93 virtual WebRect visibleContentRect() const; | |
94 virtual bool hasHorizontalScrollbar() const; | |
95 virtual bool hasVerticalScrollbar() const; | |
96 virtual WebView* view() const; | |
97 virtual WebFrame* opener() const; | |
98 virtual void setOpener(const WebFrame*); | |
99 virtual WebFrame* parent() const; | |
100 virtual WebFrame* top() const; | |
101 virtual WebFrame* firstChild() const; | |
102 virtual WebFrame* lastChild() const; | |
103 virtual WebFrame* nextSibling() const; | |
104 virtual WebFrame* previousSibling() const; | |
105 virtual WebFrame* traverseNext(bool wrap) const; | |
106 virtual WebFrame* traversePrevious(bool wrap) const; | |
107 virtual WebFrame* findChildByName(const WebString&) const; | |
108 virtual WebFrame* findChildByExpression(const WebString&) const; | |
109 virtual WebDocument document() const; | |
110 virtual WebPerformance performance() const; | |
111 virtual NPObject* windowObject() const; | |
112 virtual void bindToWindowObject(const WebString& name, NPObject*); | |
113 virtual void bindToWindowObject(const WebString& name, NPObject*, void*); | |
114 virtual void executeScript(const WebScriptSource&); | |
115 virtual void executeScriptInIsolatedWorld( | |
116 int worldID, const WebScriptSource* sources, unsigned numSources, | |
117 int extensionGroup); | |
118 virtual void setIsolatedWorldSecurityOrigin(int worldID, const WebSecurityOr
igin&); | |
119 virtual void setIsolatedWorldContentSecurityPolicy(int worldID, const WebStr
ing&); | |
120 virtual void addMessageToConsole(const WebConsoleMessage&); | |
121 virtual void collectGarbage(); | |
122 virtual bool checkIfRunInsecureContent(const WebURL&) const; | |
123 virtual v8::Handle<v8::Value> executeScriptAndReturnValue( | |
124 const WebScriptSource&); | |
125 virtual void executeScriptInIsolatedWorld( | |
126 int worldID, const WebScriptSource* sourcesIn, unsigned numSources, | |
127 int extensionGroup, WebVector<v8::Local<v8::Value> >* results); | |
128 virtual v8::Handle<v8::Value> callFunctionEvenIfScriptDisabled( | |
129 v8::Handle<v8::Function>, | |
130 v8::Handle<v8::Object>, | |
131 int argc, | |
132 v8::Handle<v8::Value> argv[]); | |
133 virtual v8::Local<v8::Context> mainWorldScriptContext() const; | |
134 virtual v8::Handle<v8::Value> createFileSystem(WebFileSystemType, | |
135 const WebString& name, | |
136 const WebString& path); | |
137 virtual v8::Handle<v8::Value> createSerializableFileSystem(WebFileSystemType
, | |
138 const WebString& name, | |
139 const WebString& path); | |
140 virtual v8::Handle<v8::Value> createFileEntry(WebFileSystemType, | |
141 const WebString& fileSystemName, | |
142 const WebString& fileSystemPath, | |
143 const WebString& filePath, | |
144 bool isDirectory); | |
145 virtual void reload(bool ignoreCache); | |
146 virtual void reloadWithOverrideURL(const WebURL& overrideUrl, bool ignoreCac
he); | |
147 virtual void loadRequest(const WebURLRequest&); | |
148 virtual void loadHistoryItem(const WebHistoryItem&); | |
149 virtual void loadData( | |
150 const WebData&, const WebString& mimeType, const WebString& textEncoding
, | |
151 const WebURL& baseURL, const WebURL& unreachableURL, bool replace); | |
152 virtual void loadHTMLString( | |
153 const WebData& html, const WebURL& baseURL, const WebURL& unreachableURL
, | |
154 bool replace); | |
155 virtual bool isLoading() const; | |
156 virtual void stopLoading(); | |
157 virtual WebDataSource* provisionalDataSource() const; | |
158 virtual WebDataSource* dataSource() const; | |
159 virtual WebHistoryItem previousHistoryItem() const; | |
160 virtual WebHistoryItem currentHistoryItem() const; | |
161 virtual void enableViewSourceMode(bool enable); | |
162 virtual bool isViewSourceModeEnabled() const; | |
163 virtual void setReferrerForRequest(WebURLRequest&, const WebURL& referrer); | |
164 virtual void dispatchWillSendRequest(WebURLRequest&); | |
165 virtual WebURLLoader* createAssociatedURLLoader(const WebURLLoaderOptions&); | |
166 virtual unsigned unloadListenerCount() const; | |
167 virtual void replaceSelection(const WebString&); | |
168 virtual void insertText(const WebString&); | |
169 virtual void setMarkedText(const WebString&, unsigned location, unsigned len
gth); | |
170 virtual void unmarkText(); | |
171 virtual bool hasMarkedText() const; | |
172 virtual WebRange markedRange() const; | |
173 virtual bool firstRectForCharacterRange(unsigned location, unsigned length,
WebRect&) const; | |
174 virtual size_t characterIndexForPoint(const WebPoint&) const; | |
175 virtual bool executeCommand(const WebString&, const WebNode& = WebNode()); | |
176 virtual bool executeCommand(const WebString&, const WebString& value, const
WebNode& = WebNode()); | |
177 virtual bool isCommandEnabled(const WebString&) const; | |
178 virtual void enableContinuousSpellChecking(bool); | |
179 virtual bool isContinuousSpellCheckingEnabled() const; | |
180 virtual void requestTextChecking(const WebElement&); | |
181 virtual void replaceMisspelledRange(const WebString&); | |
182 virtual void removeSpellingMarkers(); | |
183 virtual bool hasSelection() const; | |
184 virtual WebRange selectionRange() const; | |
185 virtual WebString selectionAsText() const; | |
186 virtual WebString selectionAsMarkup() const; | |
187 virtual bool selectWordAroundCaret(); | |
188 virtual void selectRange(const WebPoint& base, const WebPoint& extent); | |
189 virtual void selectRange(const WebRange&); | |
190 virtual void moveRangeSelection(const WebPoint& base, const WebPoint& extent
); | |
191 virtual void moveCaretSelection(const WebPoint&); | |
192 virtual void setCaretVisible(bool); | |
193 virtual int printBegin(const WebPrintParams&, const WebNode& constrainToNode
); | |
194 virtual float printPage(int pageToPrint, WebCanvas*); | |
195 virtual float getPrintPageShrink(int page); | |
196 virtual void printEnd(); | |
197 virtual bool isPrintScalingDisabledForPlugin(const WebNode&); | |
198 virtual bool hasCustomPageSizeStyle(int pageIndex); | |
199 virtual bool isPageBoxVisible(int pageIndex); | |
200 virtual void pageSizeAndMarginsInPixels(int pageIndex, | |
201 WebSize& pageSize, | |
202 int& marginTop, | |
203 int& marginRight, | |
204 int& marginBottom, | |
205 int& marginLeft); | |
206 virtual WebString pageProperty(const WebString& propertyName, int pageIndex)
; | |
207 virtual void printPagesWithBoundaries(WebCanvas*, const WebSize&); | |
208 virtual bool find( | |
209 int identifier, const WebString& searchText, const WebFindOptions&, | 59 int identifier, const WebString& searchText, const WebFindOptions&, |
210 bool wrapWithinFrame, WebRect* selectionRect); | 60 bool wrapWithinFrame, WebRect* selectionRect); |
211 virtual void stopFinding(bool clearSelection); | 61 void stopFindingAndClearSelection(); |
212 virtual void scopeStringMatches( | 62 void scopeStringMatches( |
213 int identifier, const WebString& searchText, const WebFindOptions&, | 63 int identifier, const WebString& searchText, const WebFindOptions&, |
214 bool reset); | 64 bool reset); |
215 virtual void cancelPendingScopingEffort(); | 65 void cancelPendingScopingEffort(); |
216 virtual void increaseMatchCount(int count, int identifier); | 66 void increaseMatchCount(int identifier, int count); |
217 virtual void resetMatchCount(); | 67 void resetMatchCount(); |
218 virtual int findMatchMarkersVersion() const; | 68 int findMatchMarkersVersion() const { return m_findMatchMarkersVersion; } |
219 virtual WebFloatRect activeFindMatchRect(); | 69 WebFloatRect activeFindMatchRect(); |
220 virtual void findMatchRects(WebVector<WebFloatRect>&); | 70 void findMatchRects(WebVector<WebFloatRect>&); |
221 virtual int selectNearestFindMatch(const WebFloatPoint&, WebRect* selectionR
ect); | 71 int selectNearestFindMatch(const WebFloatPoint&, WebRect* selectionRect); |
222 | |
223 virtual void sendOrientationChangeEvent(int orientation); | |
224 | |
225 virtual void dispatchMessageEventWithOriginCheck( | |
226 const WebSecurityOrigin& intendedTargetOrigin, | |
227 const WebDOMEvent&); | |
228 | |
229 virtual WebString contentAsText(size_t maxChars) const; | |
230 virtual WebString contentAsMarkup() const; | |
231 virtual WebString renderTreeAsText(RenderAsTextControls toShow = RenderAsTex
tNormal) const; | |
232 virtual WebString markerTextForListItem(const WebElement&) const; | |
233 virtual WebRect selectionBoundsRect() const; | |
234 | |
235 virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const; | |
236 virtual WebString layerTreeAsText(bool showDebugInfo = false) const; | |
237 | |
238 void willDetachParent(); | |
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 WebCore::Frame* frame() const { return m_frame.get(); } | 90 ~TextFinder(); |
302 WebFrameClient* client() const { return m_client; } | |
303 void setClient(WebFrameClient* client) { m_client = client; } | |
304 | |
305 WebPermissionClient* permissionClient() { return m_permissionClient; } | |
306 SharedWorkerRepositoryClientImpl* sharedWorkerRepositoryClient() const { ret
urn m_sharedWorkerRepositoryClient.get(); } | |
307 | |
308 void setInputEventsTransformForEmulation(const WebCore::IntSize&, float); | |
309 | |
310 static void selectWordAroundPosition(WebCore::Frame*, WebCore::VisiblePositi
on); | |
311 | 91 |
312 private: | 92 private: |
313 class DeferredScopeStringMatches; | 93 class DeferredScopeStringMatches; |
314 friend class DeferredScopeStringMatches; | 94 friend class DeferredScopeStringMatches; |
315 friend class FrameLoaderClientImpl; | |
316 | 95 |
317 struct FindMatch { | 96 struct FindMatch { |
318 RefPtr<WebCore::Range> m_range; | 97 RefPtr<WebCore::Range> m_range; |
319 | 98 |
320 // 1-based index within this frame. | 99 // 1-based index within this frame. |
321 int m_ordinal; | 100 int m_ordinal; |
322 | 101 |
323 // In find-in-page coordinates. | 102 // In find-in-page coordinates. |
324 // Lazily calculated by updateFindMatchRects. | 103 // Lazily calculated by updateFindMatchRects. |
325 WebCore::FloatRect m_rect; | 104 WebCore::FloatRect m_rect; |
326 | 105 |
327 FindMatch(PassRefPtr<WebCore::Range>, int ordinal); | 106 FindMatch(PassRefPtr<WebCore::Range>, int ordinal); |
328 }; | 107 }; |
329 | 108 |
330 // A bit mask specifying area of the frame to invalidate. | 109 // A bit mask specifying area of the frame to invalidate. |
331 enum AreaToInvalidate { | 110 enum AreaToInvalidate { |
332 InvalidateNothing, | 111 InvalidateNothing, |
333 InvalidateContentArea, | 112 InvalidateContentArea, |
334 InvalidateScrollbar, // Vertical scrollbar only. | 113 InvalidateScrollbar, // Vertical scrollbar only. |
335 InvalidateAll // Both content area and the scrollbar. | 114 InvalidateAll // Both content area and the scrollbar. |
336 }; | 115 }; |
337 | 116 |
338 WebFrameImpl(WebFrameClient*, long long frame_identifier); | 117 explicit TextFinder(WebFrameImpl& ownerFrame); |
339 | |
340 // Sets the local WebCore frame and registers destruction observers. | |
341 void setWebCoreFrame(PassRefPtr<WebCore::Frame>); | |
342 | 118 |
343 // Notifies the delegate about a new selection rect. | 119 // Notifies the delegate about a new selection rect. |
344 void reportFindInPageSelection( | 120 void reportFindInPageSelection( |
345 const WebRect& selectionRect, int activeMatchOrdinal, int identifier); | 121 const WebRect& selectionRect, int activeMatchOrdinal, int identifier); |
346 | 122 |
347 // 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 |
348 // calculated again next time updateFindMatchRects is called. | 124 // calculated again next time updateFindMatchRects is called. |
349 void clearFindMatchesCache(); | 125 void clearFindMatchesCache(); |
350 | 126 |
351 // 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... |
405 bool reset); | 181 bool reset); |
406 | 182 |
407 // Called by a DeferredScopeStringMatches instance. | 183 // Called by a DeferredScopeStringMatches instance. |
408 void callScopeStringMatches( | 184 void callScopeStringMatches( |
409 DeferredScopeStringMatches*, int identifier, const WebString& searchText
, | 185 DeferredScopeStringMatches*, int identifier, const WebString& searchText
, |
410 const WebFindOptions&, bool reset); | 186 const WebFindOptions&, bool reset); |
411 | 187 |
412 // Determines whether to invalidate the content area and scrollbar. | 188 // Determines whether to invalidate the content area and scrollbar. |
413 void invalidateIfNecessary(); | 189 void invalidateIfNecessary(); |
414 | 190 |
415 void loadJavaScriptURL(const WebCore::KURL&); | 191 // Sets the markers within a current match range as active or inactive. |
| 192 void setMatchMarkerActive(bool); |
416 | 193 |
417 // Returns a hit-tested VisiblePosition for the given point | 194 void decrementFramesScopingCount(int identifier); |
418 WebCore::VisiblePosition visiblePositionForWindowPoint(const WebPoint&); | |
419 | 195 |
420 class WebFrameInit : public WebCore::FrameInit { | 196 // Returns the ordinal of the first match in the owner frame. |
421 public: | 197 int ordinalOfFirstMatch() const; |
422 static PassRefPtr<WebFrameInit> create(WebFrameImpl* webFrameImpl, int64
_t frameID) | |
423 { | |
424 return adoptRef(new WebFrameInit(webFrameImpl, frameID)); | |
425 } | |
426 | 198 |
427 private: | 199 WebFrameImpl& m_ownerFrame; |
428 WebFrameInit(WebFrameImpl* webFrameImpl, int64_t frameID) | |
429 : WebCore::FrameInit(frameID) | |
430 , m_frameLoaderClientImpl(webFrameImpl) | |
431 { | |
432 setFrameLoaderClient(&m_frameLoaderClientImpl); | |
433 } | |
434 | |
435 FrameLoaderClientImpl m_frameLoaderClientImpl; | |
436 }; | |
437 RefPtr<WebFrameInit> m_frameInit; | |
438 | |
439 // The embedder retains a reference to the WebCore Frame while it is active
in the DOM. This | |
440 // reference is released when the frame is removed from the DOM or the entir
e page is closed. | |
441 RefPtr<WebCore::Frame> m_frame; | |
442 | |
443 WebFrameClient* m_client; | |
444 WebPermissionClient* m_permissionClient; | |
445 OwnPtr<SharedWorkerRepositoryClientImpl> m_sharedWorkerRepositoryClient; | |
446 | 200 |
447 // A way for the main frame to keep track of which frame has an active | 201 // A way for the main frame to keep track of which frame has an active |
448 // match. Should be 0 for all other frames. | 202 // match. Should be 0 for all other frames. |
449 WebFrameImpl* m_currentActiveMatchFrame; | 203 WebFrameImpl* m_currentActiveMatchFrame; |
450 | 204 |
451 // The range of the active match for the current frame. | 205 // The range of the active match for the current frame. |
452 RefPtr<WebCore::Range> m_activeMatch; | 206 RefPtr<WebCore::Range> m_activeMatch; |
453 | 207 |
454 // The index of the active match for the current frame. | 208 // The index of the active match for the current frame. |
455 int m_activeMatchIndexInCurrentFrame; | 209 int m_activeMatchIndexInCurrentFrame; |
456 | 210 |
457 // This flag is used by the scoping effort to determine if we need to figure | |
458 // out which rectangle is the active match. Once we find the active | |
459 // rectangle we clear this flag. | |
460 bool m_locatingActiveRect; | |
461 | |
462 // The scoping effort can time out and we need to keep track of where we | 211 // The scoping effort can time out and we need to keep track of where we |
463 // ended our last search so we can continue from where we left of. | 212 // ended our last search so we can continue from where we left of. |
464 RefPtr<WebCore::Range> m_resumeScopingFromRange; | 213 RefPtr<WebCore::Range> m_resumeScopingFromRange; |
465 | 214 |
466 // Keeps track of the last string this frame searched for. This is used for | 215 // Keeps track of the last string this frame searched for. This is used for |
467 // short-circuiting searches in the following scenarios: When a frame has | 216 // short-circuiting searches in the following scenarios: When a frame has |
468 // been searched and returned 0 results, we don't need to search that frame | 217 // been searched and returned 0 results, we don't need to search that frame |
469 // again if the user is just adding to the search (making it more specific). | 218 // again if the user is just adding to the search (making it more specific). |
470 WTF::String m_lastSearchString; | 219 WTF::String m_lastSearchString; |
471 | 220 |
472 // Keeps track of how many matches this frame has found so far, so that we | 221 // Keeps track of how many matches this frame has found so far, so that we |
473 // don't loose count between scoping efforts, and is also used (in conjuncti
on | 222 // don't loose count between scoping efforts, and is also used (in conjuncti
on |
474 // with m_lastSearchString) to figure out if we need to search the frame aga
in. | 223 // with m_lastSearchString) to figure out if we need to search the frame aga
in. |
475 int m_lastMatchCount; | 224 int m_lastMatchCount; |
476 | 225 |
477 // This variable keeps a cumulative total of matches found so far for ALL th
e | 226 // This variable keeps a cumulative total of matches found so far for ALL th
e |
478 // frames on the page, and is only incremented by calling IncreaseMatchCount | 227 // frames on the page, and is only incremented by calling IncreaseMatchCount |
479 // (on the main frame only). It should be -1 for all other frames. | 228 // (on the main frame only). It should be -1 for all other frames. |
480 int m_totalMatchCount; | 229 int m_totalMatchCount; |
481 | 230 |
482 // This variable keeps a cumulative total of how many frames are currently | 231 // This variable keeps a cumulative total of how many frames are currently |
483 // scoping, and is incremented/decremented on the main frame only. | 232 // scoping, and is incremented/decremented on the main frame only. |
484 // It should be -1 for all other frames. | 233 // It should be -1 for all other frames. |
485 int m_framesScopingCount; | 234 int m_framesScopingCount; |
486 | 235 |
487 // Identifier of the latest find-in-page request. Required to be stored in | 236 // Identifier of the latest find-in-page request. Required to be stored in |
488 // the frame in order to reply if required in case the frame is detached. | 237 // the frame in order to reply if required in case the frame is detached. |
489 int m_findRequestIdentifier; | 238 int m_findRequestIdentifier; |
490 | 239 |
491 // Keeps track of whether there is an scoping effort ongoing in the frame. | |
492 bool m_scopingInProgress; | |
493 | |
494 // Keeps track of whether the last find request completed its scoping effort | |
495 // without finding any matches in this frame. | |
496 bool m_lastFindRequestCompletedWithNoMatches; | |
497 | |
498 // Keeps track of when the scoping effort should next invalidate the scrollb
ar | 240 // Keeps track of when the scoping effort should next invalidate the scrollb
ar |
499 // and the frame area. | 241 // and the frame area. |
500 int m_nextInvalidateAfter; | 242 int m_nextInvalidateAfter; |
501 | 243 |
502 // A list of all of the pending calls to scopeStringMatches. | 244 // A list of all of the pending calls to scopeStringMatches. |
503 Vector<DeferredScopeStringMatches*> m_deferredScopingWork; | 245 Vector<DeferredScopeStringMatches*> m_deferredScopingWork; |
504 | 246 |
505 // Version number incremented on the main frame only whenever the document | 247 // Version number incremented on the main frame only whenever the document |
506 // find-in-page match markers change. It should be 0 for all other frames. | 248 // find-in-page match markers change. It should be 0 for all other frames. |
507 int m_findMatchMarkersVersion; | 249 int m_findMatchMarkersVersion; |
508 | 250 |
509 // Local cache of the find match markers currently displayed for this frame. | 251 // Local cache of the find match markers currently displayed for this frame. |
510 Vector<FindMatch> m_findMatchesCache; | 252 Vector<FindMatch> m_findMatchesCache; |
511 | 253 |
512 // Determines if the rects in the find-in-page matches cache of this frame | |
513 // are invalid and should be recomputed. | |
514 bool m_findMatchRectsAreValid; | |
515 | |
516 // Contents size when find-in-page match rects were last computed for this | 254 // Contents size when find-in-page match rects were last computed for this |
517 // frame's cache. | 255 // frame's cache. |
518 WebCore::IntSize m_contentsSizeForCurrentFindMatchRects; | 256 WebCore::IntSize m_contentsSizeForCurrentFindMatchRects; |
519 | 257 |
520 // Valid between calls to BeginPrint() and EndPrint(). Containts the print | 258 // This flag is used by the scoping effort to determine if we need to figure |
521 // information. Is used by PrintPage(). | 259 // out which rectangle is the active match. Once we find the active |
522 OwnPtr<ChromePrintContext> m_printContext; | 260 // rectangle we clear this flag. |
| 261 bool m_locatingActiveRect; |
523 | 262 |
524 // Stores the additional input events offset and scale when device metrics e
mulation is enabled. | 263 // Keeps track of whether there is an scoping effort ongoing in the frame. |
525 WebCore::IntSize m_inputEventsOffsetForEmulation; | 264 bool m_scopingInProgress; |
526 float m_inputEventsScaleFactorForEmulation; | 265 |
| 266 // Keeps track of whether the last find request completed its scoping effort |
| 267 // without finding any matches in this frame. |
| 268 bool m_lastFindRequestCompletedWithNoMatches; |
| 269 |
| 270 // Determines if the rects in the find-in-page matches cache of this frame |
| 271 // are invalid and should be recomputed. |
| 272 bool m_findMatchRectsAreValid; |
527 }; | 273 }; |
528 | 274 |
529 DEFINE_TYPE_CASTS(WebFrameImpl, WebFrame, frame, true, true); | |
530 | |
531 } // namespace blink | 275 } // namespace blink |
532 | 276 |
533 #endif | 277 #endif |
OLD | NEW |