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 "WebFindOptions.h" | 34 #include "WebFrame.h" |
35 #include "core/editing/FindOptions.h" | 35 |
| 36 #include "FrameLoaderClientImpl.h" |
| 37 #include "core/frame/Frame.h" |
36 #include "platform/geometry/FloatRect.h" | 38 #include "platform/geometry/FloatRect.h" |
37 #include "public/platform/WebFloatPoint.h" | 39 #include "public/platform/WebFileSystemType.h" |
38 #include "public/platform/WebFloatRect.h" | 40 #include "wtf/Compiler.h" |
39 #include "public/platform/WebRect.h" | 41 #include "wtf/OwnPtr.h" |
40 #include "wtf/PassOwnPtr.h" | 42 #include "wtf/RefCounted.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; |
46 class Range; | 52 class Range; |
| 53 class SubstituteData; |
| 54 struct FrameLoadRequest; |
| 55 struct WindowFeatures; |
47 } | 56 } |
48 | 57 |
49 namespace blink { | 58 namespace blink { |
50 class WebFrameImpl; | 59 class ChromePrintContext; |
| 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; |
51 | 69 |
52 template <typename T> class WebVector; | 70 template <typename T> class WebVector; |
53 | 71 |
54 class TextFinder { | 72 // Implementation of WebFrame, note that this is a reference counted object. |
| 73 class WebFrameImpl |
| 74 : public WebFrame |
| 75 , public RefCounted<WebFrameImpl> { |
55 public: | 76 public: |
56 static PassOwnPtr<TextFinder> create(WebFrameImpl& ownerFrame); | 77 // WebFrame methods: |
57 | 78 virtual void close(); |
58 bool find( | 79 virtual WebString uniqueName() const; |
| 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( |
59 int identifier, const WebString& searchText, const WebFindOptions&, | 209 int identifier, const WebString& searchText, const WebFindOptions&, |
60 bool wrapWithinFrame, WebRect* selectionRect); | 210 bool wrapWithinFrame, WebRect* selectionRect); |
61 void stopFindingAndClearSelection(); | 211 virtual void stopFinding(bool clearSelection); |
62 void scopeStringMatches( | 212 virtual void scopeStringMatches( |
63 int identifier, const WebString& searchText, const WebFindOptions&, | 213 int identifier, const WebString& searchText, const WebFindOptions&, |
64 bool reset); | 214 bool reset); |
65 void cancelPendingScopingEffort(); | 215 virtual void cancelPendingScopingEffort(); |
66 void increaseMatchCount(int identifier, int count); | 216 virtual void increaseMatchCount(int count, int identifier); |
67 void resetMatchCount(); | 217 virtual void resetMatchCount(); |
68 int findMatchMarkersVersion() const { return m_findMatchMarkersVersion; } | 218 virtual int findMatchMarkersVersion() const; |
69 WebFloatRect activeFindMatchRect(); | 219 virtual WebFloatRect activeFindMatchRect(); |
70 void findMatchRects(WebVector<WebFloatRect>&); | 220 virtual void findMatchRects(WebVector<WebFloatRect>&); |
71 int selectNearestFindMatch(const WebFloatPoint&, WebRect* selectionRect); | 221 virtual int selectNearestFindMatch(const WebFloatPoint&, WebRect* selectionR
ect); |
| 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; |
72 | 276 |
73 // Returns which frame has an active match. This function should only be | 277 // Returns which frame has an active match. This function should only be |
74 // called on the main frame, as it is the only frame keeping track. Returned | 278 // called on the main frame, as it is the only frame keeping track. Returned |
75 // value can be 0 if no frame has an active match. | 279 // value can be 0 if no frame has an active match. |
76 WebFrameImpl* activeMatchFrame() const { return m_currentActiveMatchFrame; } | 280 WebFrameImpl* activeMatchFrame() const { return m_currentActiveMatchFrame; } |
77 | 281 |
78 // Returns the active match in the current frame. Could be a null range if | 282 // Returns the active match in the current frame. Could be a null range if |
79 // the local frame has no active match. | 283 // the local frame has no active match. |
80 WebCore::Range* activeMatch() const { return m_activeMatch.get(); } | 284 WebCore::Range* activeMatch() const { return m_activeMatch.get(); } |
81 | 285 |
82 void flushCurrentScoping(); | 286 // When a Find operation ends, we want to set the selection to what was acti
ve |
| 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(); |
83 | 293 |
84 void resetActiveMatch() { m_activeMatch = 0; } | 294 void didFail(const WebCore::ResourceError&, bool wasProvisional); |
85 | 295 |
86 int totalMatchCount() const { return m_totalMatchCount; } | 296 // Sets whether the WebFrameImpl allows its document to be scrolled. |
87 bool scopingInProgress() const { return m_scopingInProgress; } | 297 // If the parameter is true, allow the document to be scrolled. |
88 void increaseMarkerVersion() { ++m_findMatchMarkersVersion; } | 298 // Otherwise, disallow scrolling. |
| 299 void setCanHaveScrollbars(bool); |
89 | 300 |
90 ~TextFinder(); | 301 WebCore::Frame* frame() const { return m_frame.get(); } |
| 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); |
91 | 311 |
92 private: | 312 private: |
93 class DeferredScopeStringMatches; | 313 class DeferredScopeStringMatches; |
94 friend class DeferredScopeStringMatches; | 314 friend class DeferredScopeStringMatches; |
| 315 friend class FrameLoaderClientImpl; |
95 | 316 |
96 struct FindMatch { | 317 struct FindMatch { |
97 RefPtr<WebCore::Range> m_range; | 318 RefPtr<WebCore::Range> m_range; |
98 | 319 |
99 // 1-based index within this frame. | 320 // 1-based index within this frame. |
100 int m_ordinal; | 321 int m_ordinal; |
101 | 322 |
102 // In find-in-page coordinates. | 323 // In find-in-page coordinates. |
103 // Lazily calculated by updateFindMatchRects. | 324 // Lazily calculated by updateFindMatchRects. |
104 WebCore::FloatRect m_rect; | 325 WebCore::FloatRect m_rect; |
105 | 326 |
106 FindMatch(PassRefPtr<WebCore::Range>, int ordinal); | 327 FindMatch(PassRefPtr<WebCore::Range>, int ordinal); |
107 }; | 328 }; |
108 | 329 |
109 // A bit mask specifying area of the frame to invalidate. | 330 // A bit mask specifying area of the frame to invalidate. |
110 enum AreaToInvalidate { | 331 enum AreaToInvalidate { |
111 InvalidateNothing, | 332 InvalidateNothing, |
112 InvalidateContentArea, | 333 InvalidateContentArea, |
113 InvalidateScrollbar, // Vertical scrollbar only. | 334 InvalidateScrollbar, // Vertical scrollbar only. |
114 InvalidateAll // Both content area and the scrollbar. | 335 InvalidateAll // Both content area and the scrollbar. |
115 }; | 336 }; |
116 | 337 |
117 explicit TextFinder(WebFrameImpl& ownerFrame); | 338 WebFrameImpl(WebFrameClient*, long long frame_identifier); |
| 339 |
| 340 // Sets the local WebCore frame and registers destruction observers. |
| 341 void setWebCoreFrame(PassRefPtr<WebCore::Frame>); |
118 | 342 |
119 // Notifies the delegate about a new selection rect. | 343 // Notifies the delegate about a new selection rect. |
120 void reportFindInPageSelection( | 344 void reportFindInPageSelection( |
121 const WebRect& selectionRect, int activeMatchOrdinal, int identifier); | 345 const WebRect& selectionRect, int activeMatchOrdinal, int identifier); |
122 | 346 |
123 // Clear the find-in-page matches cache forcing rects to be fully | 347 // Clear the find-in-page matches cache forcing rects to be fully |
124 // calculated again next time updateFindMatchRects is called. | 348 // calculated again next time updateFindMatchRects is called. |
125 void clearFindMatchesCache(); | 349 void clearFindMatchesCache(); |
126 | 350 |
127 // Check if the activeMatchFrame still exists in the frame tree. | 351 // Check if the activeMatchFrame still exists in the frame tree. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 bool reset); | 405 bool reset); |
182 | 406 |
183 // Called by a DeferredScopeStringMatches instance. | 407 // Called by a DeferredScopeStringMatches instance. |
184 void callScopeStringMatches( | 408 void callScopeStringMatches( |
185 DeferredScopeStringMatches*, int identifier, const WebString& searchText
, | 409 DeferredScopeStringMatches*, int identifier, const WebString& searchText
, |
186 const WebFindOptions&, bool reset); | 410 const WebFindOptions&, bool reset); |
187 | 411 |
188 // Determines whether to invalidate the content area and scrollbar. | 412 // Determines whether to invalidate the content area and scrollbar. |
189 void invalidateIfNecessary(); | 413 void invalidateIfNecessary(); |
190 | 414 |
191 // Sets the markers within a current match range as active or inactive. | 415 void loadJavaScriptURL(const WebCore::KURL&); |
192 void setMatchMarkerActive(bool); | |
193 | 416 |
194 void decrementFramesScopingCount(int identifier); | 417 // Returns a hit-tested VisiblePosition for the given point |
| 418 WebCore::VisiblePosition visiblePositionForWindowPoint(const WebPoint&); |
195 | 419 |
196 // Returns the ordinal of the first match in the owner frame. | 420 class WebFrameInit : public WebCore::FrameInit { |
197 int ordinalOfFirstMatch() const; | 421 public: |
| 422 static PassRefPtr<WebFrameInit> create(WebFrameImpl* webFrameImpl, int64
_t frameID) |
| 423 { |
| 424 return adoptRef(new WebFrameInit(webFrameImpl, frameID)); |
| 425 } |
198 | 426 |
199 WebFrameImpl& m_ownerFrame; | 427 private: |
| 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; |
200 | 446 |
201 // A way for the main frame to keep track of which frame has an active | 447 // A way for the main frame to keep track of which frame has an active |
202 // match. Should be 0 for all other frames. | 448 // match. Should be 0 for all other frames. |
203 WebFrameImpl* m_currentActiveMatchFrame; | 449 WebFrameImpl* m_currentActiveMatchFrame; |
204 | 450 |
205 // The range of the active match for the current frame. | 451 // The range of the active match for the current frame. |
206 RefPtr<WebCore::Range> m_activeMatch; | 452 RefPtr<WebCore::Range> m_activeMatch; |
207 | 453 |
208 // The index of the active match for the current frame. | 454 // The index of the active match for the current frame. |
209 int m_activeMatchIndexInCurrentFrame; | 455 int m_activeMatchIndexInCurrentFrame; |
210 | 456 |
| 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 |
211 // The scoping effort can time out and we need to keep track of where we | 462 // The scoping effort can time out and we need to keep track of where we |
212 // ended our last search so we can continue from where we left of. | 463 // ended our last search so we can continue from where we left of. |
213 RefPtr<WebCore::Range> m_resumeScopingFromRange; | 464 RefPtr<WebCore::Range> m_resumeScopingFromRange; |
214 | 465 |
215 // Keeps track of the last string this frame searched for. This is used for | 466 // Keeps track of the last string this frame searched for. This is used for |
216 // short-circuiting searches in the following scenarios: When a frame has | 467 // short-circuiting searches in the following scenarios: When a frame has |
217 // been searched and returned 0 results, we don't need to search that frame | 468 // been searched and returned 0 results, we don't need to search that frame |
218 // again if the user is just adding to the search (making it more specific). | 469 // again if the user is just adding to the search (making it more specific). |
219 WTF::String m_lastSearchString; | 470 WTF::String m_lastSearchString; |
220 | 471 |
221 // Keeps track of how many matches this frame has found so far, so that we | 472 // Keeps track of how many matches this frame has found so far, so that we |
222 // don't loose count between scoping efforts, and is also used (in conjuncti
on | 473 // don't loose count between scoping efforts, and is also used (in conjuncti
on |
223 // with m_lastSearchString) to figure out if we need to search the frame aga
in. | 474 // with m_lastSearchString) to figure out if we need to search the frame aga
in. |
224 int m_lastMatchCount; | 475 int m_lastMatchCount; |
225 | 476 |
226 // This variable keeps a cumulative total of matches found so far for ALL th
e | 477 // This variable keeps a cumulative total of matches found so far for ALL th
e |
227 // frames on the page, and is only incremented by calling IncreaseMatchCount | 478 // frames on the page, and is only incremented by calling IncreaseMatchCount |
228 // (on the main frame only). It should be -1 for all other frames. | 479 // (on the main frame only). It should be -1 for all other frames. |
229 int m_totalMatchCount; | 480 int m_totalMatchCount; |
230 | 481 |
231 // This variable keeps a cumulative total of how many frames are currently | 482 // This variable keeps a cumulative total of how many frames are currently |
232 // scoping, and is incremented/decremented on the main frame only. | 483 // scoping, and is incremented/decremented on the main frame only. |
233 // It should be -1 for all other frames. | 484 // It should be -1 for all other frames. |
234 int m_framesScopingCount; | 485 int m_framesScopingCount; |
235 | 486 |
236 // Identifier of the latest find-in-page request. Required to be stored in | 487 // Identifier of the latest find-in-page request. Required to be stored in |
237 // the frame in order to reply if required in case the frame is detached. | 488 // the frame in order to reply if required in case the frame is detached. |
238 int m_findRequestIdentifier; | 489 int m_findRequestIdentifier; |
239 | 490 |
| 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 |
240 // Keeps track of when the scoping effort should next invalidate the scrollb
ar | 498 // Keeps track of when the scoping effort should next invalidate the scrollb
ar |
241 // and the frame area. | 499 // and the frame area. |
242 int m_nextInvalidateAfter; | 500 int m_nextInvalidateAfter; |
243 | 501 |
244 // A list of all of the pending calls to scopeStringMatches. | 502 // A list of all of the pending calls to scopeStringMatches. |
245 Vector<DeferredScopeStringMatches*> m_deferredScopingWork; | 503 Vector<DeferredScopeStringMatches*> m_deferredScopingWork; |
246 | 504 |
247 // Version number incremented on the main frame only whenever the document | 505 // Version number incremented on the main frame only whenever the document |
248 // find-in-page match markers change. It should be 0 for all other frames. | 506 // find-in-page match markers change. It should be 0 for all other frames. |
249 int m_findMatchMarkersVersion; | 507 int m_findMatchMarkersVersion; |
250 | 508 |
251 // Local cache of the find match markers currently displayed for this frame. | 509 // Local cache of the find match markers currently displayed for this frame. |
252 Vector<FindMatch> m_findMatchesCache; | 510 Vector<FindMatch> m_findMatchesCache; |
253 | 511 |
| 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 |
254 // Contents size when find-in-page match rects were last computed for this | 516 // Contents size when find-in-page match rects were last computed for this |
255 // frame's cache. | 517 // frame's cache. |
256 WebCore::IntSize m_contentsSizeForCurrentFindMatchRects; | 518 WebCore::IntSize m_contentsSizeForCurrentFindMatchRects; |
257 | 519 |
258 // This flag is used by the scoping effort to determine if we need to figure | 520 // Valid between calls to BeginPrint() and EndPrint(). Containts the print |
259 // out which rectangle is the active match. Once we find the active | 521 // information. Is used by PrintPage(). |
260 // rectangle we clear this flag. | 522 OwnPtr<ChromePrintContext> m_printContext; |
261 bool m_locatingActiveRect; | |
262 | 523 |
263 // Keeps track of whether there is an scoping effort ongoing in the frame. | 524 // Stores the additional input events offset and scale when device metrics e
mulation is enabled. |
264 bool m_scopingInProgress; | 525 WebCore::IntSize m_inputEventsOffsetForEmulation; |
| 526 float m_inputEventsScaleFactorForEmulation; |
| 527 }; |
265 | 528 |
266 // Keeps track of whether the last find request completed its scoping effort | 529 DEFINE_TYPE_CASTS(WebFrameImpl, WebFrame, frame, true, true); |
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; | |
273 }; | |
274 | 530 |
275 } // namespace blink | 531 } // namespace blink |
276 | 532 |
277 #endif | 533 #endif |
OLD | NEW |