Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Side by Side Diff: public/webview/WebFrame.h

Issue 16623002: mv public/webview to public/webpage (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « public/webview/WebFormElement.h ('k') | public/webview/WebFrameClient.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
29 */
30
31 #ifndef WebFrame_h
32 #define WebFrame_h
33
34 #include "../platform/WebCanvas.h"
35 #include "../platform/WebFileSystem.h"
36 #include "../platform/WebFileSystemType.h"
37 #include "../platform/WebMessagePortChannel.h"
38 #include "../platform/WebReferrerPolicy.h"
39 #include "../platform/WebURL.h"
40 #include "WebIconURL.h"
41 #include "WebNode.h"
42 #include "WebURLLoaderOptions.h"
43
44 struct NPObject;
45
46 namespace v8 {
47 class Context;
48 class Function;
49 class Object;
50 class Value;
51 template <class T> class Handle;
52 template <class T> class Local;
53 }
54
55 namespace WebKit {
56
57 class WebData;
58 class WebDataSource;
59 class WebDocument;
60 class WebElement;
61 class WebFormElement;
62 class WebHistoryItem;
63 class WebInputElement;
64 class WebPerformance;
65 class WebRange;
66 class WebSecurityOrigin;
67 class WebString;
68 class WebURL;
69 class WebURLLoader;
70 class WebURLRequest;
71 class WebView;
72 struct WebConsoleMessage;
73 struct WebFindOptions;
74 struct WebFloatPoint;
75 struct WebFloatRect;
76 struct WebPoint;
77 struct WebPrintParams;
78 struct WebRect;
79 struct WebScriptSource;
80 struct WebSize;
81 struct WebURLLoaderOptions;
82
83 template <typename T> class WebVector;
84
85 class WebFrame {
86 public:
87 // Control of renderTreeAsText output
88 enum RenderAsTextControl {
89 RenderAsTextNormal = 0,
90 RenderAsTextDebug = 1 << 0,
91 RenderAsTextPrinting = 1 << 1
92 };
93 typedef unsigned RenderAsTextControls;
94
95 // Returns the number of live WebFrame objects, used for leak checking.
96 WEBKIT_EXPORT static int instanceCount();
97
98 // Returns the WebFrame associated with the current V8 context. This
99 // function can return 0 if the context is associated with a Document that
100 // is not currently being displayed in a Frame.
101 WEBKIT_EXPORT static WebFrame* frameForCurrentContext();
102
103 // Returns the frame corresponding to the given context. This can return 0
104 // if the context is detached from the frame, or if the context doesn't
105 // correspond to a frame (e.g., workers).
106 WEBKIT_EXPORT static WebFrame* frameForContext(v8::Handle<v8::Context>);
107
108 // Returns the frame inside a given frame or iframe element. Returns 0 if
109 // the given element is not a frame, iframe or if the frame is empty.
110 WEBKIT_EXPORT static WebFrame* fromFrameOwnerElement(const WebElement&);
111
112
113 // Basic properties ---------------------------------------------------
114
115 // The unique name of this frame.
116 virtual WebString uniqueName() const = 0;
117
118 // The name of this frame. If no name is given, empty string is returned.
119 virtual WebString assignedName() const = 0;
120
121 // Sets the name of this frame. For child frames (frames that are not a
122 // top-most frame) the actual name may have a suffix appended to make the
123 // frame name unique within the hierarchy.
124 virtual void setName(const WebString&) = 0;
125
126 // A globally unique identifier for this frame.
127 virtual long long identifier() const = 0;
128
129 // The urls of the given combination types of favicon (if any) specified by
130 // the document loaded in this frame. The iconTypesMask is a bit-mask of
131 // WebIconURL::Type values, used to select from the available set of icon
132 // URLs
133 virtual WebVector<WebIconURL> iconURLs(int iconTypesMask) const = 0;
134
135
136 // Geometry -----------------------------------------------------------
137
138 // NOTE: These routines do not force page layout so their results may
139 // not be accurate if the page layout is out-of-date.
140
141 // If set to false, do not draw scrollbars on this frame's view.
142 virtual void setCanHaveScrollbars(bool) = 0;
143
144 // The scroll offset from the top-left corner of the frame in pixels.
145 virtual WebSize scrollOffset() const = 0;
146 virtual void setScrollOffset(const WebSize&) = 0;
147
148 // The minimum and maxium scroll positions in pixels.
149 virtual WebSize minimumScrollOffset() const = 0;
150 virtual WebSize maximumScrollOffset() const = 0;
151
152 // The size of the contents area.
153 virtual WebSize contentsSize() const = 0;
154
155 // Returns true if the contents (minus scrollbars) has non-zero area.
156 virtual bool hasVisibleContent() const = 0;
157
158 // Returns the visible content rect (minus scrollbars, in absolute coordinat e)
159 virtual WebRect visibleContentRect() const = 0;
160
161 virtual bool hasHorizontalScrollbar() const = 0;
162 virtual bool hasVerticalScrollbar() const = 0;
163
164
165 // Hierarchy ----------------------------------------------------------
166
167 // Returns the containing view.
168 virtual WebView* view() const = 0;
169
170 // Returns the frame that opened this frame or 0 if there is none.
171 virtual WebFrame* opener() const = 0;
172
173 // Sets the frame that opened this one or 0 if there is none.
174 virtual void setOpener(const WebFrame*) = 0;
175
176 // Reset the frame that opened this frame to 0.
177 // This is executed between layout tests runs
178 void clearOpener() { setOpener(0); }
179
180 // Returns the parent frame or 0 if this is a top-most frame.
181 virtual WebFrame* parent() const = 0;
182
183 // Returns the top-most frame in the hierarchy containing this frame.
184 virtual WebFrame* top() const = 0;
185
186 // Returns the first/last child frame.
187 virtual WebFrame* firstChild() const = 0;
188 virtual WebFrame* lastChild() const = 0;
189
190 // Returns the next/previous sibling frame.
191 virtual WebFrame* nextSibling() const = 0;
192 virtual WebFrame* previousSibling() const = 0;
193
194 // Returns the next/previous frame in "frame traversal order"
195 // optionally wrapping around.
196 virtual WebFrame* traverseNext(bool wrap) const = 0;
197 virtual WebFrame* traversePrevious(bool wrap) const = 0;
198
199 // Returns the child frame identified by the given name.
200 virtual WebFrame* findChildByName(const WebString& name) const = 0;
201
202 // Returns the child frame identified by the given xpath expression.
203 virtual WebFrame* findChildByExpression(const WebString& xpath) const = 0;
204
205
206 // Content ------------------------------------------------------------
207
208 virtual WebDocument document() const = 0;
209
210 virtual WebPerformance performance() const = 0;
211
212
213 // Scripting ----------------------------------------------------------
214
215 // Returns a NPObject corresponding to this frame's DOMWindow.
216 virtual NPObject* windowObject() const = 0;
217
218 // Binds a NPObject as a property of this frame's DOMWindow.
219 virtual void bindToWindowObject(const WebString& name, NPObject*) = 0;
220 virtual void bindToWindowObject(
221 const WebString& name, NPObject*, void*) = 0;
222
223 // Executes script in the context of the current page.
224 virtual void executeScript(const WebScriptSource&) = 0;
225
226 // Executes JavaScript in a new world associated with the web frame.
227 // The script gets its own global scope and its own prototypes for
228 // intrinsic JavaScript objects (String, Array, and so-on). It also
229 // gets its own wrappers for all DOM nodes and DOM constructors.
230 // extensionGroup is an embedder-provided specifier that controls which
231 // v8 extensions are loaded into the new context - see
232 // WebKit::registerExtension for the corresponding specifier.
233 //
234 // worldID must be > 0 (as 0 represents the main world).
235 virtual void executeScriptInIsolatedWorld(
236 int worldID, const WebScriptSource* sources, unsigned numSources,
237 int extensionGroup) = 0;
238
239 // Associates an isolated world (see above for description) with a security
240 // origin. XMLHttpRequest instances used in that world will be considered
241 // to come from that origin, not the frame's.
242 virtual void setIsolatedWorldSecurityOrigin(
243 int worldID, const WebSecurityOrigin&) = 0;
244
245 // Associates a content security policy with an isolated world. This policy
246 // should be used when evaluating script in the isolated world, and should
247 // also replace a protected resource's CSP when evaluating resources
248 // injected into the DOM.
249 //
250 // FIXME: Setting this simply bypasses the protected resource's CSP. It
251 // doesn't yet restrict the isolated world to the provided policy.
252 virtual void setIsolatedWorldContentSecurityPolicy(
253 int worldID, const WebString&) = 0;
254
255 // Logs to the console associated with this frame.
256 virtual void addMessageToConsole(const WebConsoleMessage&) = 0;
257
258 // Calls window.gc() if it is defined.
259 virtual void collectGarbage() = 0;
260
261 // Check if the scripting URL represents a mixed content condition relative
262 // to this frame.
263 virtual bool checkIfRunInsecureContent(const WebURL&) const = 0;
264
265 // Executes script in the context of the current page and returns the value
266 // that the script evaluated to.
267 virtual v8::Handle<v8::Value> executeScriptAndReturnValue(
268 const WebScriptSource&) = 0;
269
270 // worldID must be > 0 (as 0 represents the main world).
271 virtual void executeScriptInIsolatedWorld(
272 int worldID, const WebScriptSource* sourcesIn, unsigned numSources,
273 int extensionGroup, WebVector<v8::Local<v8::Value> >* results) = 0;
274
275 // Call the function with the given receiver and arguments, bypassing
276 // canExecute().
277 virtual v8::Handle<v8::Value> callFunctionEvenIfScriptDisabled(
278 v8::Handle<v8::Function>,
279 v8::Handle<v8::Object>,
280 int argc,
281 v8::Handle<v8::Value> argv[]) = 0;
282
283 // Returns the V8 context for associated with the main world and this
284 // frame. There can be many V8 contexts associated with this frame, one for
285 // each isolated world and one for the main world. If you don't know what
286 // the "main world" or an "isolated world" is, then you probably shouldn't
287 // be calling this API.
288 virtual v8::Local<v8::Context> mainWorldScriptContext() const = 0;
289
290 // Creates an instance of file system object.
291 virtual v8::Handle<v8::Value> createFileSystem(WebFileSystemType,
292 const WebString& name,
293 const WebString& rootURL) = 0;
294 // Creates an instance of serializable file system object.
295 // FIXME: Remove this API after we have a better way of creating serialized
296 // file system object.
297 virtual v8::Handle<v8::Value> createSerializableFileSystem(WebFileSystemType ,
298 const WebString& name,
299 const WebString& rootURL) = 0;
300 // Creates an instance of file or directory entry object.
301 virtual v8::Handle<v8::Value> createFileEntry(WebFileSystemType,
302 const WebString& fileSystemName,
303 const WebString& fileSystemRootURL,
304 const WebString& filePath,
305 bool isDirectory) = 0;
306
307 // Navigation ----------------------------------------------------------
308
309 // Reload the current document.
310 // True |ignoreCache| explicitly bypasses caches.
311 // False |ignoreCache| revalidates any existing cache entries.
312 virtual void reload(bool ignoreCache = false) = 0;
313
314 // This is used for situations where we want to reload a different URL becau se of a redirect.
315 virtual void reloadWithOverrideURL(const WebURL& overrideUrl, bool ignoreCac he = false) = 0;
316
317 // Load the given URL.
318 virtual void loadRequest(const WebURLRequest&) = 0;
319
320 // Load the given history state, corresponding to a back/forward
321 // navigation.
322 virtual void loadHistoryItem(const WebHistoryItem&) = 0;
323
324 // Loads the given data with specific mime type and optional text
325 // encoding. For HTML data, baseURL indicates the security origin of
326 // the document and is used to resolve links. If specified,
327 // unreachableURL is reported via WebDataSource::unreachableURL. If
328 // replace is false, then this data will be loaded as a normal
329 // navigation. Otherwise, the current history item will be replaced.
330 virtual void loadData(const WebData& data,
331 const WebString& mimeType,
332 const WebString& textEncoding,
333 const WebURL& baseURL,
334 const WebURL& unreachableURL = WebURL(),
335 bool replace = false) = 0;
336
337 // This method is short-hand for calling LoadData, where mime_type is
338 // "text/html" and text_encoding is "UTF-8".
339 virtual void loadHTMLString(const WebData& html,
340 const WebURL& baseURL,
341 const WebURL& unreachableURL = WebURL(),
342 bool replace = false) = 0;
343
344 // Returns true if the current frame is busy loading content.
345 virtual bool isLoading() const = 0;
346
347 // Stops any pending loads on the frame and its children.
348 virtual void stopLoading() = 0;
349
350 // Returns the data source that is currently loading. May be null.
351 virtual WebDataSource* provisionalDataSource() const = 0;
352
353 // Returns the data source that is currently loaded.
354 virtual WebDataSource* dataSource() const = 0;
355
356 // Returns the previous history item. Check WebHistoryItem::isNull()
357 // before using.
358 virtual WebHistoryItem previousHistoryItem() const = 0;
359
360 // Returns the current history item. Check WebHistoryItem::isNull()
361 // before using.
362 virtual WebHistoryItem currentHistoryItem() const = 0;
363
364 // View-source rendering mode. Set this before loading an URL to cause
365 // it to be rendered in view-source mode.
366 virtual void enableViewSourceMode(bool) = 0;
367 virtual bool isViewSourceModeEnabled() const = 0;
368
369 // Sets the referrer for the given request to be the specified URL or
370 // if that is null, then it sets the referrer to the referrer that the
371 // frame would use for subresources. NOTE: This method also filters
372 // out invalid referrers (e.g., it is invalid to send a HTTPS URL as
373 // the referrer for a HTTP request).
374 virtual void setReferrerForRequest(WebURLRequest&, const WebURL&) = 0;
375
376 // Called to associate the WebURLRequest with this frame. The request
377 // will be modified to inherit parameters that allow it to be loaded.
378 // This method ends up triggering WebFrameClient::willSendRequest.
379 // DEPRECATED: Please use createAssociatedURLLoader instead.
380 virtual void dispatchWillSendRequest(WebURLRequest&) = 0;
381
382 // Returns a WebURLLoader that is associated with this frame. The loader
383 // will, for example, be cancelled when WebFrame::stopLoading is called.
384 // FIXME: stopLoading does not yet cancel an associated loader!!
385 virtual WebURLLoader* createAssociatedURLLoader(const WebURLLoaderOptions& = WebURLLoaderOptions()) = 0;
386
387 // Called from within WebFrameClient::didReceiveDocumentData to commit
388 // data for the frame that will be used to construct the frame's
389 // document.
390 virtual void commitDocumentData(const char* data, size_t length) = 0;
391
392 // Returns the number of registered unload listeners.
393 virtual unsigned unloadListenerCount() const = 0;
394
395 // Returns true if this frame is in the process of opening a new frame
396 // with a suppressed opener.
397 virtual bool willSuppressOpenerInNewFrame() const = 0;
398
399
400 // Editing -------------------------------------------------------------
401
402 // Replaces the selection with the given text.
403 virtual void replaceSelection(const WebString& text) = 0;
404
405 virtual void insertText(const WebString& text) = 0;
406
407 virtual void setMarkedText(const WebString& text, unsigned location, unsigne d length) = 0;
408 virtual void unmarkText() = 0;
409 virtual bool hasMarkedText() const = 0;
410
411 virtual WebRange markedRange() const = 0;
412
413 // Returns the frame rectangle in window coordinate space of the given text
414 // range.
415 virtual bool firstRectForCharacterRange(unsigned location, unsigned length, WebRect&) const = 0;
416
417 // Returns the index of a character in the Frame's text stream at the given
418 // point. The point is in the window coordinate space. Will return
419 // WTF::notFound if the point is invalid.
420 virtual size_t characterIndexForPoint(const WebPoint&) const = 0;
421
422 // Supports commands like Undo, Redo, Cut, Copy, Paste, SelectAll,
423 // Unselect, etc. See EditorCommand.cpp for the full list of supported
424 // commands.
425 virtual bool executeCommand(const WebString&, const WebNode& = WebNode()) = 0;
426 virtual bool executeCommand(const WebString&, const WebString& value, const WebNode& = WebNode()) = 0;
427 virtual bool isCommandEnabled(const WebString&) const = 0;
428
429 // Spell-checking support.
430 virtual void enableContinuousSpellChecking(bool) = 0;
431 virtual bool isContinuousSpellCheckingEnabled() const = 0;
432 virtual void requestTextChecking(const WebElement&) = 0;
433 virtual void replaceMisspelledRange(const WebString&) = 0;
434 virtual void removeSpellingMarkers() = 0;
435
436 // Selection -----------------------------------------------------------
437
438 virtual bool hasSelection() const = 0;
439
440 virtual WebRange selectionRange() const = 0;
441
442 virtual WebString selectionAsText() const = 0;
443 virtual WebString selectionAsMarkup() const = 0;
444
445 // Expands the selection to a word around the caret and returns
446 // true. Does nothing and returns false if there is no caret or
447 // there is ranged selection.
448 virtual bool selectWordAroundCaret() = 0;
449
450 // DEPRECATED: Use moveRangeSelection/moveCaretSelection.
451 virtual void selectRange(const WebPoint& base, const WebPoint& extent) = 0;
452 virtual void moveCaretSelectionTowardsWindowPoint(const WebPoint&) = 0;
453
454 virtual void selectRange(const WebRange&) = 0;
455
456 // Move the current selection to the provided window point/points. If the
457 // current selection is editable, the new selection will be restricted to
458 // the root editable element.
459 virtual void moveRangeSelection(const WebPoint& base, const WebPoint& extent ) = 0;
460 virtual void moveCaretSelection(const WebPoint&) = 0;
461
462 // Printing ------------------------------------------------------------
463
464 // Reformats the WebFrame for printing. WebPrintParams specifies the printab le
465 // content size, paper size, printable area size, printer DPI and print
466 // scaling option. If constrainToNode node is specified, then only the given node
467 // is printed (for now only plugins are supported), instead of the entire fr ame.
468 // Returns the number of pages that can be printed at the given
469 // page size. The out param useBrowserOverlays specifies whether the browser
470 // process should use its overlays (header, footer, margins etc) or whether
471 // the renderer controls this.
472 virtual int printBegin(const WebPrintParams&,
473 const WebNode& constrainToNode = WebNode(),
474 bool* useBrowserOverlays = 0) = 0;
475
476 // Returns the page shrinking factor calculated by webkit (usually
477 // between 1/1.25 and 1/2). Returns 0 if the page number is invalid or
478 // not in printing mode.
479 virtual float getPrintPageShrink(int page) = 0;
480
481 // Prints one page, and returns the calculated page shrinking factor
482 // (usually between 1/1.25 and 1/2). Returns 0 if the page number is
483 // invalid or not in printing mode.
484 virtual float printPage(int pageToPrint, WebCanvas*) = 0;
485
486 // Reformats the WebFrame for screen display.
487 virtual void printEnd() = 0;
488
489 // If the frame contains a full-frame plugin or the given node refers to a
490 // plugin whose content indicates that printed output should not be scaled,
491 // return true, otherwise return false.
492 virtual bool isPrintScalingDisabledForPlugin(const WebNode& = WebNode()) = 0 ;
493
494 // CSS3 Paged Media ----------------------------------------------------
495
496 // Returns true if page box (margin boxes and page borders) is visible.
497 virtual bool isPageBoxVisible(int pageIndex) = 0;
498
499 // Returns true if the page style has custom size information.
500 virtual bool hasCustomPageSizeStyle(int pageIndex) = 0;
501
502 // Returns the preferred page size and margins in pixels, assuming 96
503 // pixels per inch. pageSize, marginTop, marginRight, marginBottom,
504 // marginLeft must be initialized to the default values that are used if
505 // auto is specified.
506 virtual void pageSizeAndMarginsInPixels(int pageIndex,
507 WebSize& pageSize,
508 int& marginTop,
509 int& marginRight,
510 int& marginBottom,
511 int& marginLeft) = 0;
512
513 // Returns the value for a page property that is only defined when printing.
514 // printBegin must have been called before this method.
515 virtual WebString pageProperty(const WebString& propertyName, int pageIndex) = 0;
516
517 // Find-in-page --------------------------------------------------------
518
519 // Searches a frame for a given string.
520 //
521 // If a match is found, this function will select it (scrolling down to
522 // make it visible if needed) and fill in selectionRect with the
523 // location of where the match was found (in window coordinates).
524 //
525 // If no match is found, this function clears all tickmarks and
526 // highlighting.
527 //
528 // Returns true if the search string was found, false otherwise.
529 virtual bool find(int identifier,
530 const WebString& searchText,
531 const WebFindOptions& options,
532 bool wrapWithinFrame,
533 WebRect* selectionRect) = 0;
534
535 // Notifies the frame that we are no longer interested in searching.
536 // This will abort any asynchronous scoping effort already under way
537 // (see the function scopeStringMatches for details) and erase all
538 // tick-marks and highlighting from the previous search. If
539 // clearSelection is true, it will also make sure the end state for the
540 // find operation does not leave a selection. This can occur when the
541 // user clears the search string but does not close the find box.
542 virtual void stopFinding(bool clearSelection) = 0;
543
544 // Counts how many times a particular string occurs within the frame.
545 // It also retrieves the location of the string and updates a vector in
546 // the frame so that tick-marks and highlighting can be drawn. This
547 // function does its work asynchronously, by running for a certain
548 // time-slice and then scheduling itself (co-operative multitasking) to
549 // be invoked later (repeating the process until all matches have been
550 // found). This allows multiple frames to be searched at the same time
551 // and provides a way to cancel at any time (see
552 // cancelPendingScopingEffort). The parameter searchText specifies
553 // what to look for and |reset| signals whether this is a brand new
554 // request or a continuation of the last scoping effort.
555 virtual void scopeStringMatches(int identifier,
556 const WebString& searchText,
557 const WebFindOptions& options,
558 bool reset) = 0;
559
560 // Cancels any outstanding requests for scoping string matches on a frame.
561 virtual void cancelPendingScopingEffort() = 0;
562
563 // This function is called on the main frame during the scoping effort
564 // to keep a running tally of the accumulated total match-count for all
565 // frames. After updating the count it will notify the WebViewClient
566 // about the new count.
567 virtual void increaseMatchCount(int count, int identifier) = 0;
568
569 // This function is called on the main frame to reset the total number
570 // of matches found during the scoping effort.
571 virtual void resetMatchCount() = 0;
572
573 // Returns a counter that is incremented when the find-in-page markers are
574 // changed on any frame. Switching the active marker doesn't change the
575 // current version. Should be called only on the main frame.
576 virtual int findMatchMarkersVersion() const = 0;
577
578 // Returns the bounding box of the active find-in-page match marker or an
579 // empty rect if no such marker exists. The rect is returned in find-in-page
580 // coordinates whatever frame the active marker is.
581 // Should be called only on the main frame.
582 virtual WebFloatRect activeFindMatchRect() = 0;
583
584 // Swaps the contents of the provided vector with the bounding boxes of the
585 // find-in-page match markers from all frames. The bounding boxes are return ed
586 // in find-in-page coordinates. This method should be called only on the mai n frame.
587 virtual void findMatchRects(WebVector<WebFloatRect>&) = 0;
588
589 // Selects the find-in-page match in the appropriate frame closest to the
590 // provided point in find-in-page coordinates. Returns the ordinal of such
591 // match or -1 if none could be found. If not null, selectionRect is set to
592 // the bounding box of the selected match in window coordinates.
593 // This method should be called only on the main frame.
594 virtual int selectNearestFindMatch(const WebFloatPoint&,
595 WebRect* selectionRect) = 0;
596
597 // OrientationChange event ---------------------------------------------
598
599 // Orientation is the interface orientation in degrees.
600 // Some examples are:
601 // 0 is straight up; -90 is when the device is rotated 90 clockwise;
602 // 90 is when rotated counter clockwise.
603 virtual void sendOrientationChangeEvent(int orientation) = 0;
604
605 // Events --------------------------------------------------------------
606
607 // Dispatches a message event on the current DOMWindow in this WebFrame.
608 virtual void dispatchMessageEventWithOriginCheck(
609 const WebSecurityOrigin& intendedTargetOrigin,
610 const WebDOMEvent&) = 0;
611
612
613 // Utility -------------------------------------------------------------
614
615 // Returns the contents of this frame as a string. If the text is
616 // longer than maxChars, it will be clipped to that length. WARNING:
617 // This function may be slow depending on the number of characters
618 // retrieved and page complexity. For a typically sized page, expect
619 // it to take on the order of milliseconds.
620 //
621 // If there is room, subframe text will be recursively appended. Each
622 // frame will be separated by an empty line.
623 virtual WebString contentAsText(size_t maxChars) const = 0;
624
625 // Returns HTML text for the contents of this frame. This is generated
626 // from the DOM.
627 virtual WebString contentAsMarkup() const = 0;
628
629 // Returns a text representation of the render tree. This method is used
630 // to support layout tests.
631 virtual WebString renderTreeAsText(RenderAsTextControls toShow = RenderAsTex tNormal) const = 0;
632
633 // Calls markerTextForListItem() defined in WebCore/rendering/RenderTreeAsTe xt.h.
634 virtual WebString markerTextForListItem(const WebElement&) const = 0;
635
636 // Prints all of the pages into the canvas, with page boundaries drawn as
637 // one pixel wide blue lines. This method exists to support layout tests.
638 virtual void printPagesWithBoundaries(WebCanvas*, const WebSize&) = 0;
639
640 // Returns the bounds rect for current selection. If selection is performed
641 // on transformed text, the rect will still bound the selection but will
642 // not be transformed itself. If no selection is present, the rect will be
643 // empty ((0,0), (0,0)).
644 virtual WebRect selectionBoundsRect() const = 0;
645
646 // Only for testing purpose:
647 // Returns true if selection.anchorNode has a marker on range from |from| wi th |length|.
648 virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const = 0;
649
650 // Dumps the layer tree, used by the accelerated compositor, in
651 // text form. This is used only by layout tests.
652 virtual WebString layerTreeAsText(bool showDebugInfo = false) const = 0;
653
654 protected:
655 ~WebFrame() { }
656 };
657
658 } // namespace WebKit
659
660 #endif
OLDNEW
« no previous file with comments | « public/webview/WebFormElement.h ('k') | public/webview/WebFrameClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698