2 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
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
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.
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.
34 #include "WebIconURL.h"
36 #include "WebURLLoaderOptions.h"
37 #include "public/platform/WebCanvas.h"
38 #include "public/platform/WebFileSystem.h"
39 #include "public/platform/WebFileSystemType.h"
40 #include "public/platform/WebMessagePortChannel.h"
41 #include "public/platform/WebReferrerPolicy.h"
42 #include "public/platform/WebURL.h"
43 #include "public/platform/WebURLRequest.h"
52 template <class T> class Handle;
53 template <class T> class Local;
65 class WebInputElement;
68 class WebPermissionClient;
70 class WebSecurityOrigin;
71 class WebSharedWorkerRepositoryClient;
77 struct WebConsoleMessage;
78 struct WebFindOptions;
82 struct WebPrintParams;
84 struct WebScriptSource;
86 struct WebURLLoaderOptions;
88 template <typename T> class WebVector;
92 // Control of renderTreeAsText output
93 enum RenderAsTextControl {
94 RenderAsTextNormal = 0,
95 RenderAsTextDebug = 1 << 0,
96 RenderAsTextPrinting = 1 << 1
98 typedef unsigned RenderAsTextControls;
100 // Creates a WebFrame. Delete this WebFrame by calling WebFrame::close().
101 // It is valid to pass a null client pointer.
102 BLINK_EXPORT static WebFrame* create(WebFrameClient*);
104 // Same as create(WebFrameClient*) except the embedder may explicitly pass
105 // in the identifier for the WebFrame. This can be used with
106 // generateEmbedderIdentifier() if constructing the WebFrameClient for this
107 // frame requires the identifier.
109 // FIXME: Move the embedderIdentifier concept fully to the embedder and
110 // remove this factory method.
111 BLINK_EXPORT static WebFrame* create(WebFrameClient*, long long embedderIdentifier);
113 // Generates an identifier suitable for use with create() above.
115 BLINK_EXPORT static long long generateEmbedderIdentifier();
117 // Returns the number of live WebFrame objects, used for leak checking.
118 BLINK_EXPORT static int instanceCount();
120 // Returns the WebFrame associated with the current V8 context. This
121 // function can return 0 if the context is associated with a Document that
122 // is not currently being displayed in a Frame.
123 BLINK_EXPORT static WebFrame* frameForCurrentContext();
125 // Returns the frame corresponding to the given context. This can return 0
126 // if the context is detached from the frame, or if the context doesn't
127 // correspond to a frame (e.g., workers).
128 BLINK_EXPORT static WebFrame* frameForContext(v8::Handle<v8::Context>);
130 // Returns the frame inside a given frame or iframe element. Returns 0 if
131 // the given element is not a frame, iframe or if the frame is empty.
132 BLINK_EXPORT static WebFrame* fromFrameOwnerElement(const WebElement&);
134 // This method closes and deletes the WebFrame.
135 virtual void close() = 0;
138 // Basic properties ---------------------------------------------------
140 // The unique name of this frame.
141 virtual WebString uniqueName() const = 0;
143 // The name of this frame. If no name is given, empty string is returned.
144 virtual WebString assignedName() const = 0;
146 // Sets the name of this frame. For child frames (frames that are not a
147 // top-most frame) the actual name may have a suffix appended to make the
148 // frame name unique within the hierarchy.
149 virtual void setName(const WebString&) = 0;
151 // A globally unique identifier for this frame.
152 // FIXME: Convert users to embedderIdentifier() and remove identifier().
153 long long identifier() const { return embedderIdentifier(); }
154 virtual long long embedderIdentifier() const = 0;
156 // The urls of the given combination types of favicon (if any) specified by
157 // the document loaded in this frame. The iconTypesMask is a bit-mask of
158 // WebIconURL::Type values, used to select from the available set of icon
160 virtual WebVector<WebIconURL> iconURLs(int iconTypesMask) const = 0;
162 // Notify the WebFrame as to whether its frame will be rendered in a
163 // separate renderer process.
164 virtual void setIsRemote(bool) = 0;
166 // For a WebFrame with contents being rendered in another process, this
167 // sets a layer for use by the in-process compositor. WebLayer should be
168 // null if the content is being rendered in the current process.
169 virtual void setRemoteWebLayer(blink::WebLayer*) = 0;
171 // Initializes the various client interfaces.
172 virtual void setPermissionClient(WebPermissionClient*) = 0;
173 virtual void setSharedWorkerRepositoryClient(WebSharedWorkerRepositoryClient*) = 0;
176 // Geometry -----------------------------------------------------------
178 // NOTE: These routines do not force page layout so their results may
179 // not be accurate if the page layout is out-of-date.
181 // If set to false, do not draw scrollbars on this frame's view.
182 virtual void setCanHaveScrollbars(bool) = 0;
184 // The scroll offset from the top-left corner of the frame in pixels.
185 virtual WebSize scrollOffset() const = 0;
186 virtual void setScrollOffset(const WebSize&) = 0;
188 // The minimum and maxium scroll positions in pixels.
189 virtual WebSize minimumScrollOffset() const = 0;
190 virtual WebSize maximumScrollOffset() const = 0;
192 // The size of the contents area.
193 virtual WebSize contentsSize() const = 0;
195 // Returns true if the contents (minus scrollbars) has non-zero area.
196 virtual bool hasVisibleContent() const = 0;
198 // Returns the visible content rect (minus scrollbars, in absolute coordinate)
199 virtual WebRect visibleContentRect() const = 0;
201 virtual bool hasHorizontalScrollbar() const = 0;
202 virtual bool hasVerticalScrollbar() const = 0;
205 // Hierarchy ----------------------------------------------------------
207 // Returns the containing view.
208 virtual WebView* view() const = 0;
210 // Returns the frame that opened this frame or 0 if there is none.
211 virtual WebFrame* opener() const = 0;
213 // Sets the frame that opened this one or 0 if there is none.
214 virtual void setOpener(const WebFrame*) = 0;
216 // Reset the frame that opened this frame to 0.
217 // This is executed between layout tests runs
218 void clearOpener() { setOpener(0); }
220 // Adds the given frame as a child of this frame.
221 virtual void appendChild(WebFrame*) = 0;
223 // Removes the given child from this frame.
224 virtual void removeChild(WebFrame*) = 0;
226 // Returns the parent frame or 0 if this is a top-most frame.
227 virtual WebFrame* parent() const = 0;
229 // Returns the top-most frame in the hierarchy containing this frame.
230 virtual WebFrame* top() const = 0;
232 // Returns the first/last child frame.
233 virtual WebFrame* firstChild() const = 0;
234 virtual WebFrame* lastChild() const = 0;
236 // Returns the next/previous sibling frame.
237 virtual WebFrame* nextSibling() const = 0;
238 virtual WebFrame* previousSibling() const = 0;
240 // Returns the next/previous frame in "frame traversal order"
241 // optionally wrapping around.
242 virtual WebFrame* traverseNext(bool wrap) const = 0;
243 virtual WebFrame* traversePrevious(bool wrap) const = 0;
245 // Returns the child frame identified by the given name.
246 virtual WebFrame* findChildByName(const WebString& name) const = 0;
248 // Returns the child frame identified by the given xpath expression.
249 virtual WebFrame* findChildByExpression(const WebString& xpath) const = 0;
252 // Content ------------------------------------------------------------
254 virtual WebDocument document() const = 0;
256 virtual WebPerformance performance() const = 0;
259 // Scripting ----------------------------------------------------------
261 // Returns a NPObject corresponding to this frame's DOMWindow.
262 virtual NPObject* windowObject() const = 0;
264 // Binds a NPObject as a property of this frame's DOMWindow.
265 virtual void bindToWindowObject(const WebString& name, NPObject*) = 0;
266 virtual void bindToWindowObject(
267 const WebString& name, NPObject*, void*) = 0;
269 // Executes script in the context of the current page.
270 virtual void executeScript(const WebScriptSource&) = 0;
272 // Executes JavaScript in a new world associated with the web frame.
273 // The script gets its own global scope and its own prototypes for
274 // intrinsic JavaScript objects (String, Array, and so-on). It also
275 // gets its own wrappers for all DOM nodes and DOM constructors.
276 // extensionGroup is an embedder-provided specifier that controls which
277 // v8 extensions are loaded into the new context - see
278 // blink::registerExtension for the corresponding specifier.
280 // worldID must be > 0 (as 0 represents the main world).
281 // worldID must be < EmbedderWorldIdLimit, high number used internally.
282 virtual void executeScriptInIsolatedWorld(
283 int worldID, const WebScriptSource* sources, unsigned numSources,
284 int extensionGroup) = 0;
286 // Associates an isolated world (see above for description) with a security
287 // origin. XMLHttpRequest instances used in that world will be considered
288 // to come from that origin, not the frame's.
289 virtual void setIsolatedWorldSecurityOrigin(
290 int worldID, const WebSecurityOrigin&) = 0;
292 // Associates a content security policy with an isolated world. This policy
293 // should be used when evaluating script in the isolated world, and should
294 // also replace a protected resource's CSP when evaluating resources
295 // injected into the DOM.
297 // FIXME: Setting this simply bypasses the protected resource's CSP. It
298 // doesn't yet restrict the isolated world to the provided policy.
299 virtual void setIsolatedWorldContentSecurityPolicy(
300 int worldID, const WebString&) = 0;
302 // Logs to the console associated with this frame.
303 virtual void addMessageToConsole(const WebConsoleMessage&) = 0;
305 // Calls window.gc() if it is defined.
306 virtual void collectGarbage() = 0;
308 // Check if the scripting URL represents a mixed content condition relative
310 virtual bool checkIfRunInsecureContent(const WebURL&) const = 0;
312 // Executes script in the context of the current page and returns the value
313 // that the script evaluated to.
314 virtual v8::Handle<v8::Value> executeScriptAndReturnValue(
315 const WebScriptSource&) = 0;
317 // worldID must be > 0 (as 0 represents the main world).
318 // worldID must be < EmbedderWorldIdLimit, high number used internally.
319 virtual void executeScriptInIsolatedWorld(
320 int worldID, const WebScriptSource* sourcesIn, unsigned numSources,
321 int extensionGroup, WebVector<v8::Local<v8::Value> >* results) = 0;
323 // Call the function with the given receiver and arguments, bypassing
325 virtual v8::Handle<v8::Value> callFunctionEvenIfScriptDisabled(
326 v8::Handle<v8::Function>,
327 v8::Handle<v8::Object>,
329 v8::Handle<v8::Value> argv[]) = 0;
331 // Returns the V8 context for associated with the main world and this
332 // frame. There can be many V8 contexts associated with this frame, one for
333 // each isolated world and one for the main world. If you don't know what
334 // the "main world" or an "isolated world" is, then you probably shouldn't
335 // be calling this API.
336 virtual v8::Local<v8::Context> mainWorldScriptContext() const = 0;
338 // Creates an instance of file system object.
339 virtual v8::Handle<v8::Value> createFileSystem(WebFileSystemType,
340 const WebString& name,
341 const WebString& rootURL) = 0;
342 // Creates an instance of serializable file system object.
343 // FIXME: Remove this API after we have a better way of creating serialized
344 // file system object.
345 virtual v8::Handle<v8::Value> createSerializableFileSystem(WebFileSystemType,
346 const WebString& name,
347 const WebString& rootURL) = 0;
348 // Creates an instance of file or directory entry object.
349 virtual v8::Handle<v8::Value> createFileEntry(WebFileSystemType,
350 const WebString& fileSystemName,
351 const WebString& fileSystemRootURL,
352 const WebString& filePath,
353 bool isDirectory) = 0;
355 // Navigation ----------------------------------------------------------
357 // Reload the current document.
358 // True |ignoreCache| explicitly bypasses caches.
359 // False |ignoreCache| revalidates any existing cache entries.
360 virtual void reload(bool ignoreCache = false) = 0;
362 // This is used for situations where we want to reload a different URL because of a redirect.
363 virtual void reloadWithOverrideURL(const WebURL& overrideUrl, bool ignoreCache = false) = 0;
365 // Load the given URL.
366 virtual void loadRequest(const WebURLRequest&) = 0;
368 // Load the given history state, corresponding to a back/forward
370 virtual void loadHistoryItem(
371 const WebHistoryItem&,
372 WebURLRequest::CachePolicy = WebURLRequest::UseProtocolCachePolicy) = 0;
374 // Loads the given data with specific mime type and optional text
375 // encoding. For HTML data, baseURL indicates the security origin of
376 // the document and is used to resolve links. If specified,
377 // unreachableURL is reported via WebDataSource::unreachableURL. If
378 // replace is false, then this data will be loaded as a normal
379 // navigation. Otherwise, the current history item will be replaced.
380 virtual void loadData(const WebData& data,
381 const WebString& mimeType,
382 const WebString& textEncoding,
383 const WebURL& baseURL,
384 const WebURL& unreachableURL = WebURL(),
385 bool replace = false) = 0;
387 // This method is short-hand for calling LoadData, where mime_type is
388 // "text/html" and text_encoding is "UTF-8".
389 virtual void loadHTMLString(const WebData& html,
390 const WebURL& baseURL,
391 const WebURL& unreachableURL = WebURL(),
392 bool replace = false) = 0;
394 // Returns true if the current frame is busy loading content.
395 virtual bool isLoading() const = 0;
397 // Stops any pending loads on the frame and its children.
398 virtual void stopLoading() = 0;
400 // Returns the data source that is currently loading. May be null.
401 virtual WebDataSource* provisionalDataSource() const = 0;
403 // Returns the data source that is currently loaded.
404 virtual WebDataSource* dataSource() const = 0;
406 // Returns the previous history item. Check WebHistoryItem::isNull()
408 virtual WebHistoryItem previousHistoryItem() const = 0;
410 // Returns the current history item. Check WebHistoryItem::isNull()
412 virtual WebHistoryItem currentHistoryItem() const = 0;
414 // View-source rendering mode. Set this before loading an URL to cause
415 // it to be rendered in view-source mode.
416 virtual void enableViewSourceMode(bool) = 0;
417 virtual bool isViewSourceModeEnabled() const = 0;
419 // Sets the referrer for the given request to be the specified URL or
420 // if that is null, then it sets the referrer to the referrer that the
421 // frame would use for subresources. NOTE: This method also filters
422 // out invalid referrers (e.g., it is invalid to send a HTTPS URL as
423 // the referrer for a HTTP request).
424 virtual void setReferrerForRequest(WebURLRequest&, const WebURL&) = 0;
426 // Called to associate the WebURLRequest with this frame. The request
427 // will be modified to inherit parameters that allow it to be loaded.
428 // This method ends up triggering WebFrameClient::willSendRequest.
429 // DEPRECATED: Please use createAssociatedURLLoader instead.
430 virtual void dispatchWillSendRequest(WebURLRequest&) = 0;
432 // Returns a WebURLLoader that is associated with this frame. The loader
433 // will, for example, be cancelled when WebFrame::stopLoading is called.
434 // FIXME: stopLoading does not yet cancel an associated loader!!
435 virtual WebURLLoader* createAssociatedURLLoader(const WebURLLoaderOptions& = WebURLLoaderOptions()) = 0;
437 // Returns the number of registered unload listeners.
438 virtual unsigned unloadListenerCount() const = 0;
441 // Editing -------------------------------------------------------------
443 // Replaces the selection with the given text.
444 virtual void replaceSelection(const WebString& text) = 0;
446 virtual void insertText(const WebString& text) = 0;
448 virtual void setMarkedText(const WebString& text, unsigned location, unsigned length) = 0;
449 virtual void unmarkText() = 0;
450 virtual bool hasMarkedText() const = 0;
452 virtual WebRange markedRange() const = 0;
454 // Returns the frame rectangle in window coordinate space of the given text
456 virtual bool firstRectForCharacterRange(unsigned location, unsigned length, WebRect&) const = 0;
458 // Returns the index of a character in the Frame's text stream at the given
459 // point. The point is in the window coordinate space. Will return
460 // WTF::notFound if the point is invalid.
461 virtual size_t characterIndexForPoint(const WebPoint&) const = 0;
463 // Supports commands like Undo, Redo, Cut, Copy, Paste, SelectAll,
464 // Unselect, etc. See EditorCommand.cpp for the full list of supported
466 virtual bool executeCommand(const WebString&, const WebNode& = WebNode()) = 0;
467 virtual bool executeCommand(const WebString&, const WebString& value, const WebNode& = WebNode()) = 0;
468 virtual bool isCommandEnabled(const WebString&) const = 0;
470 // Spell-checking support.
471 virtual void enableContinuousSpellChecking(bool) = 0;
472 virtual bool isContinuousSpellCheckingEnabled() const = 0;
473 virtual void requestTextChecking(const WebElement&) = 0;
474 virtual void replaceMisspelledRange(const WebString&) = 0;
475 virtual void removeSpellingMarkers() = 0;
477 // Selection -----------------------------------------------------------
479 virtual bool hasSelection() const = 0;
481 virtual WebRange selectionRange() const = 0;
483 virtual WebString selectionAsText() const = 0;
484 virtual WebString selectionAsMarkup() const = 0;
486 // Expands the selection to a word around the caret and returns
487 // true. Does nothing and returns false if there is no caret or
488 // there is ranged selection.
489 virtual bool selectWordAroundCaret() = 0;
491 // DEPRECATED: Use moveRangeSelection.
492 virtual void selectRange(const WebPoint& base, const WebPoint& extent) = 0;
494 virtual void selectRange(const WebRange&) = 0;
496 // Move the current selection to the provided window point/points. If the
497 // current selection is editable, the new selection will be restricted to
498 // the root editable element.
499 virtual void moveRangeSelection(const WebPoint& base, const WebPoint& extent) = 0;
500 virtual void moveCaretSelection(const WebPoint&) = 0;
502 virtual void setCaretVisible(bool) = 0;
504 // Printing ------------------------------------------------------------
506 // Reformats the WebFrame for printing. WebPrintParams specifies the printable
507 // content size, paper size, printable area size, printer DPI and print
508 // scaling option. If constrainToNode node is specified, then only the given node
509 // is printed (for now only plugins are supported), instead of the entire frame.
510 // Returns the number of pages that can be printed at the given
512 virtual int printBegin(const WebPrintParams&, const WebNode& constrainToNode = WebNode()) = 0;
514 // Returns the page shrinking factor calculated by webkit (usually
515 // between 1/1.25 and 1/2). Returns 0 if the page number is invalid or
516 // not in printing mode.
517 virtual float getPrintPageShrink(int page) = 0;
519 // Prints one page, and returns the calculated page shrinking factor
520 // (usually between 1/1.25 and 1/2). Returns 0 if the page number is
521 // invalid or not in printing mode.
522 virtual float printPage(int pageToPrint, WebCanvas*) = 0;
524 // Reformats the WebFrame for screen display.
525 virtual void printEnd() = 0;
527 // If the frame contains a full-frame plugin or the given node refers to a
528 // plugin whose content indicates that printed output should not be scaled,
529 // return true, otherwise return false.
530 virtual bool isPrintScalingDisabledForPlugin(const WebNode& = WebNode()) = 0;
532 // CSS3 Paged Media ----------------------------------------------------
534 // Returns true if page box (margin boxes and page borders) is visible.
535 virtual bool isPageBoxVisible(int pageIndex) = 0;
537 // Returns true if the page style has custom size information.
538 virtual bool hasCustomPageSizeStyle(int pageIndex) = 0;
540 // Returns the preferred page size and margins in pixels, assuming 96
541 // pixels per inch. pageSize, marginTop, marginRight, marginBottom,
542 // marginLeft must be initialized to the default values that are used if
543 // auto is specified.
544 virtual void pageSizeAndMarginsInPixels(int pageIndex,
549 int& marginLeft) = 0;
551 // Returns the value for a page property that is only defined when printing.
552 // printBegin must have been called before this method.
553 virtual WebString pageProperty(const WebString& propertyName, int pageIndex) = 0;
555 // Find-in-page --------------------------------------------------------
557 // Searches a frame for a given string.
559 // If a match is found, this function will select it (scrolling down to
560 // make it visible if needed) and fill in selectionRect with the
561 // location of where the match was found (in window coordinates).
563 // If no match is found, this function clears all tickmarks and
566 // Returns true if the search string was found, false otherwise.
567 virtual bool find(int identifier,
568 const WebString& searchText,
569 const WebFindOptions& options,
570 bool wrapWithinFrame,
571 WebRect* selectionRect) = 0;
573 // Notifies the frame that we are no longer interested in searching.
574 // This will abort any asynchronous scoping effort already under way
575 // (see the function scopeStringMatches for details) and erase all
576 // tick-marks and highlighting from the previous search. If
577 // clearSelection is true, it will also make sure the end state for the
578 // find operation does not leave a selection. This can occur when the
579 // user clears the search string but does not close the find box.
580 virtual void stopFinding(bool clearSelection) = 0;
582 // Counts how many times a particular string occurs within the frame.
583 // It also retrieves the location of the string and updates a vector in
584 // the frame so that tick-marks and highlighting can be drawn. This
585 // function does its work asynchronously, by running for a certain
586 // time-slice and then scheduling itself (co-operative multitasking) to
587 // be invoked later (repeating the process until all matches have been
588 // found). This allows multiple frames to be searched at the same time
589 // and provides a way to cancel at any time (see
590 // cancelPendingScopingEffort). The parameter searchText specifies
591 // what to look for and |reset| signals whether this is a brand new
592 // request or a continuation of the last scoping effort.
593 virtual void scopeStringMatches(int identifier,
594 const WebString& searchText,
595 const WebFindOptions& options,
598 // Cancels any outstanding requests for scoping string matches on a frame.
599 virtual void cancelPendingScopingEffort() = 0;
601 // This function is called on the main frame during the scoping effort
602 // to keep a running tally of the accumulated total match-count for all
603 // frames. After updating the count it will notify the WebViewClient
604 // about the new count.
605 virtual void increaseMatchCount(int count, int identifier) = 0;
607 // This function is called on the main frame to reset the total number
608 // of matches found during the scoping effort.
609 virtual void resetMatchCount() = 0;
611 // Returns a counter that is incremented when the find-in-page markers are
612 // changed on any frame. Switching the active marker doesn't change the
613 // current version. Should be called only on the main frame.
614 virtual int findMatchMarkersVersion() const = 0;
616 // Returns the bounding box of the active find-in-page match marker or an
617 // empty rect if no such marker exists. The rect is returned in find-in-page
618 // coordinates whatever frame the active marker is.
619 // Should be called only on the main frame.
620 virtual WebFloatRect activeFindMatchRect() = 0;
622 // Swaps the contents of the provided vector with the bounding boxes of the
623 // find-in-page match markers from all frames. The bounding boxes are returned
624 // in find-in-page coordinates. This method should be called only on the main frame.
625 virtual void findMatchRects(WebVector<WebFloatRect>&) = 0;
627 // Selects the find-in-page match in the appropriate frame closest to the
628 // provided point in find-in-page coordinates. Returns the ordinal of such
629 // match or -1 if none could be found. If not null, selectionRect is set to
630 // the bounding box of the selected match in window coordinates.
631 // This method should be called only on the main frame.
632 virtual int selectNearestFindMatch(const WebFloatPoint&,
633 WebRect* selectionRect) = 0;
635 // OrientationChange event ---------------------------------------------
637 // Orientation is the interface orientation in degrees.
638 // Some examples are:
639 // 0 is straight up; -90 is when the device is rotated 90 clockwise;
640 // 90 is when rotated counter clockwise.
641 virtual void sendOrientationChangeEvent(int orientation) = 0;
643 // Events --------------------------------------------------------------
645 // Dispatches a message event on the current DOMWindow in this WebFrame.
646 virtual void dispatchMessageEventWithOriginCheck(
647 const WebSecurityOrigin& intendedTargetOrigin,
648 const WebDOMEvent&) = 0;
651 // Utility -------------------------------------------------------------
653 // Returns the contents of this frame as a string. If the text is
654 // longer than maxChars, it will be clipped to that length. WARNING:
655 // This function may be slow depending on the number of characters
656 // retrieved and page complexity. For a typically sized page, expect
657 // it to take on the order of milliseconds.
659 // If there is room, subframe text will be recursively appended. Each
660 // frame will be separated by an empty line.
661 virtual WebString contentAsText(size_t maxChars) const = 0;
663 // Returns HTML text for the contents of this frame. This is generated
665 virtual WebString contentAsMarkup() const = 0;
667 // Returns a text representation of the render tree. This method is used
668 // to support layout tests.
669 virtual WebString renderTreeAsText(RenderAsTextControls toShow = RenderAsTextNormal) const = 0;
671 // Calls markerTextForListItem() defined in WebCore/rendering/RenderTreeAsText.h.
672 virtual WebString markerTextForListItem(const WebElement&) const = 0;
674 // Prints all of the pages into the canvas, with page boundaries drawn as
675 // one pixel wide blue lines. This method exists to support layout tests.
676 virtual void printPagesWithBoundaries(WebCanvas*, const WebSize&) = 0;
678 // Returns the bounds rect for current selection. If selection is performed
679 // on transformed text, the rect will still bound the selection but will
680 // not be transformed itself. If no selection is present, the rect will be
681 // empty ((0,0), (0,0)).
682 virtual WebRect selectionBoundsRect() const = 0;
684 // Only for testing purpose:
685 // Returns true if selection.anchorNode has a marker on range from |from| with |length|.
686 virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const = 0;
688 // Dumps the layer tree, used by the accelerated compositor, in
689 // text form. This is used only by layout tests.
690 virtual WebString layerTreeAsText(bool showDebugInfo = false) const = 0;