15267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)/*
25267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * Copyright (C) 2009 Google Inc. All rights reserved.
35267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) *
45267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * Redistribution and use in source and binary forms, with or without
55267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * modification, are permitted provided that the following conditions are
65267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * met:
75267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) *
85267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) *     * Redistributions of source code must retain the above copyright
95267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * notice, this list of conditions and the following disclaimer.
105267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) *     * Redistributions in binary form must reproduce the above
115267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * copyright notice, this list of conditions and the following disclaimer
125267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * in the documentation and/or other materials provided with the
135267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * distribution.
145267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) *     * Neither the name of Google Inc. nor the names of its
155267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * contributors may be used to endorse or promote products derived from
165267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * this software without specific prior written permission.
175267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) *
185267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
195267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
205267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
215267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
225267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
235267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
245267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
255267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
265267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
275267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
285267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
295267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) */
305267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
315267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#ifndef WebFrame_h
325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#define WebFrame_h
335267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3407a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch#include "WebCompositionUnderline.h"
35a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch#include "WebHistoryItem.h"
365267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "WebIconURL.h"
375267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "WebNode.h"
385267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "WebURLLoaderOptions.h"
3909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)#include "public/platform/WebCanvas.h"
4009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)#include "public/platform/WebMessagePortChannel.h"
41323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)#include "public/platform/WebPrivateOwnPtr.h"
4209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)#include "public/platform/WebReferrerPolicy.h"
4309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)#include "public/platform/WebURL.h"
4409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)#include "public/platform/WebURLRequest.h"
455267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
465267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct NPObject;
475267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
485267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)namespace v8 {
495267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class Context;
505267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class Function;
515267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class Object;
525267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class Value;
535267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)template <class T> class Handle;
545267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)template <class T> class Local;
555267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)}
565267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5751b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)namespace blink {
585267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
59e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)class Frame;
60323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)class OpenedFrameTracker;
617242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucciclass Visitor;
625267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebData;
635267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebDataSource;
645267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebDocument;
655267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebElement;
665267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebFormElement;
671e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)class WebFrameClient;
685267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebInputElement;
6909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)class WebLayer;
706f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdochclass WebLocalFrame;
715267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebPerformance;
7209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)class WebPermissionClient;
735267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebRange;
7410f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdochclass WebRemoteFrame;
755267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebSecurityOrigin;
7609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)class WebSharedWorkerRepositoryClient;
775267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebString;
785267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebURL;
795267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebURLLoader;
805267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebURLRequest;
815267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebView;
825267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct WebConsoleMessage;
835267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct WebFindOptions;
845267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct WebFloatPoint;
855267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct WebFloatRect;
865267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct WebPoint;
875267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct WebPrintParams;
885267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct WebRect;
895267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct WebScriptSource;
905267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct WebSize;
915267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct WebURLLoaderOptions;
925267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
935267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)template <typename T> class WebVector;
945267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
956f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch// Frames may be rendered in process ('local') or out of process ('remote').
966f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch// A remote frame is always cross-site; a local frame may be either same-site or
976f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch// cross-site.
986f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch// WebFrame is the base class for both WebLocalFrame and WebRemoteFrame and
996f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch// contains methods that are valid on both local and remote frames, such as
1006f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdoch// getting a frame's parent or its opener.
1015267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebFrame {
1025267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)public:
1035267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Control of renderTreeAsText output
1045267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    enum RenderAsTextControl {
1055267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        RenderAsTextNormal = 0,
1065267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        RenderAsTextDebug = 1 << 0,
1075267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        RenderAsTextPrinting = 1 << 1
1085267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    };
1095267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    typedef unsigned RenderAsTextControls;
1105267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1115267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the number of live WebFrame objects, used for leak checking.
11206f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)    BLINK_EXPORT static int instanceCount();
1135267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
11410f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch    virtual bool isWebLocalFrame() const = 0;
11507a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual WebLocalFrame* toWebLocalFrame() = 0;
11610f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch    virtual bool isWebRemoteFrame() const = 0;
11710f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch    virtual WebRemoteFrame* toWebRemoteFrame() = 0;
1185267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1197242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    BLINK_EXPORT bool swap(WebFrame*);
120323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)
1217242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    // This method closes and deletes the WebFrame. This is typically called by
1227242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    // the embedder in response to a frame detached callback to the WebFrame
1237242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    // client.
1241e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    virtual void close() = 0;
1251e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)
1267242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    // Called by the embedder when it needs to detach the subtree rooted at this
1277242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    // frame.
1287242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    BLINK_EXPORT void detach();
1295267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1305267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Basic properties ---------------------------------------------------
1315267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The unique name of this frame.
1335267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebString uniqueName() const = 0;
1345267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1355267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The name of this frame. If no name is given, empty string is returned.
1365267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebString assignedName() const = 0;
1375267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1385267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Sets the name of this frame. For child frames (frames that are not a
1395267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // top-most frame) the actual name may have a suffix appended to make the
1405267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // frame name unique within the hierarchy.
1415267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setName(const WebString&) = 0;
1425267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1435267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The urls of the given combination types of favicon (if any) specified by
1445267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // the document loaded in this frame. The iconTypesMask is a bit-mask of
1455267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // WebIconURL::Type values, used to select from the available set of icon
1465267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // URLs
1475267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebVector<WebIconURL> iconURLs(int iconTypesMask) const = 0;
1485267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
14909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // Notify the WebFrame as to whether its frame will be rendered in a
15009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // separate renderer process.
15109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    virtual void setIsRemote(bool) = 0;
15209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
15309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // For a WebFrame with contents being rendered in another process, this
15409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // sets a layer for use by the in-process compositor. WebLayer should be
15509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // null if the content is being rendered in the current process.
156e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    virtual void setRemoteWebLayer(WebLayer*) = 0;
15709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
15809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // Initializes the various client interfaces.
15909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    virtual void setPermissionClient(WebPermissionClient*) = 0;
16009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    virtual void setSharedWorkerRepositoryClient(WebSharedWorkerRepositoryClient*) = 0;
16109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
1625267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Geometry -----------------------------------------------------------
1635267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1645267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // NOTE: These routines do not force page layout so their results may
1655267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // not be accurate if the page layout is out-of-date.
1665267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1675267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // If set to false, do not draw scrollbars on this frame's view.
1685267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setCanHaveScrollbars(bool) = 0;
1695267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1705267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The scroll offset from the top-left corner of the frame in pixels.
1715267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebSize scrollOffset() const = 0;
1725267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setScrollOffset(const WebSize&) = 0;
1735267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1745267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The minimum and maxium scroll positions in pixels.
1755267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebSize minimumScrollOffset() const = 0;
1765267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebSize maximumScrollOffset() const = 0;
1775267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1785267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The size of the contents area.
1795267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebSize contentsSize() const = 0;
1805267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1815267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns true if the contents (minus scrollbars) has non-zero area.
1825267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool hasVisibleContent() const = 0;
1835267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1845267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the visible content rect (minus scrollbars, in absolute coordinate)
1855267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebRect visibleContentRect() const = 0;
1865267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1875267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool hasHorizontalScrollbar() const = 0;
1885267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool hasVerticalScrollbar() const = 0;
1895267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1905267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Hierarchy ----------------------------------------------------------
1915267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1925267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the containing view.
1935267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebView* view() const = 0;
1945267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1955267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the frame that opened this frame or 0 if there is none.
196323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    BLINK_EXPORT WebFrame* opener() const;
1975267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1985267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Sets the frame that opened this one or 0 if there is none.
199323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    virtual void setOpener(WebFrame*);
2005267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2015267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Reset the frame that opened this frame to 0.
2025267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // This is executed between layout tests runs
2035267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    void clearOpener() { setOpener(0); }
2045267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
20509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // Adds the given frame as a child of this frame.
20676c265b59aa821ccbf8c75ab2bb0d036e97d2956Torne (Richard Coles)    BLINK_EXPORT void appendChild(WebFrame*);
20709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
20809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // Removes the given child from this frame.
209323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    virtual void removeChild(WebFrame*);
21009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
2115267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the parent frame or 0 if this is a top-most frame.
212323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    BLINK_EXPORT WebFrame* parent() const;
2135267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2145267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the top-most frame in the hierarchy containing this frame.
215323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    BLINK_EXPORT WebFrame* top() const;
2165267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2175267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the first/last child frame.
218323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    BLINK_EXPORT WebFrame* firstChild() const;
219323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    BLINK_EXPORT WebFrame* lastChild() const;
2205267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
221323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    // Returns the previous/next sibling frame.
222323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    BLINK_EXPORT WebFrame* previousSibling() const;
223323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    BLINK_EXPORT WebFrame* nextSibling() const;
2245267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
22576c265b59aa821ccbf8c75ab2bb0d036e97d2956Torne (Richard Coles)    // Returns the previous/next frame in "frame traversal order",
2265267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // optionally wrapping around.
22776c265b59aa821ccbf8c75ab2bb0d036e97d2956Torne (Richard Coles)    BLINK_EXPORT WebFrame* traversePrevious(bool wrap) const;
22876c265b59aa821ccbf8c75ab2bb0d036e97d2956Torne (Richard Coles)    BLINK_EXPORT WebFrame* traverseNext(bool wrap) const;
2295267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2305267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the child frame identified by the given name.
23176c265b59aa821ccbf8c75ab2bb0d036e97d2956Torne (Richard Coles)    BLINK_EXPORT WebFrame* findChildByName(const WebString& name) const;
2325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2335267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2345267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Content ------------------------------------------------------------
2355267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2365267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebDocument document() const = 0;
2375267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2385267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebPerformance performance() const = 0;
2395267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2405267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
24107a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    // Closing -------------------------------------------------------------
24207a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch
24307a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    // Runs beforeunload handlers for this frame, returning false if a
24407a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    // handler suppressed unloading.
24507a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual bool dispatchBeforeUnloadEvent() = 0;
24607a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch
247aafa69cb17c9d6606c07663ade5f81388a2c5986Ben Murdoch    // Runs unload handlers for this frame.
248aafa69cb17c9d6606c07663ade5f81388a2c5986Ben Murdoch    virtual void dispatchUnloadEvent() = 0;
249aafa69cb17c9d6606c07663ade5f81388a2c5986Ben Murdoch
25007a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch
2515267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Scripting ----------------------------------------------------------
2525267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2535267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns a NPObject corresponding to this frame's DOMWindow.
2545267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual NPObject* windowObject() const = 0;
2555267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2565267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Binds a NPObject as a property of this frame's DOMWindow.
2575267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void bindToWindowObject(const WebString& name, NPObject*) = 0;
258e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    virtual void bindToWindowObject(
259e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch        const WebString& name, NPObject*, void*) = 0;
2605267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2615267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Executes script in the context of the current page.
2625267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void executeScript(const WebScriptSource&) = 0;
2635267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2645267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Executes JavaScript in a new world associated with the web frame.
2655267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The script gets its own global scope and its own prototypes for
2665267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // intrinsic JavaScript objects (String, Array, and so-on). It also
2675267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // gets its own wrappers for all DOM nodes and DOM constructors.
2685267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // extensionGroup is an embedder-provided specifier that controls which
2695267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // v8 extensions are loaded into the new context - see
27051b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    // blink::registerExtension for the corresponding specifier.
2715267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    //
2725267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // worldID must be > 0 (as 0 represents the main world).
273e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    // worldID must be < EmbedderWorldIdLimit, high number used internally.
2745267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void executeScriptInIsolatedWorld(
2755267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        int worldID, const WebScriptSource* sources, unsigned numSources,
2765267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        int extensionGroup) = 0;
2775267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2785267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Associates an isolated world (see above for description) with a security
2795267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // origin. XMLHttpRequest instances used in that world will be considered
2805267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // to come from that origin, not the frame's.
2815267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setIsolatedWorldSecurityOrigin(
2825267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        int worldID, const WebSecurityOrigin&) = 0;
2835267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2845267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Associates a content security policy with an isolated world. This policy
2855267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // should be used when evaluating script in the isolated world, and should
2865267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // also replace a protected resource's CSP when evaluating resources
2875267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // injected into the DOM.
2885267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    //
2895267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // FIXME: Setting this simply bypasses the protected resource's CSP. It
2905267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    //     doesn't yet restrict the isolated world to the provided policy.
2915267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setIsolatedWorldContentSecurityPolicy(
2925267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        int worldID, const WebString&) = 0;
2935267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2945267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Logs to the console associated with this frame.
2955267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void addMessageToConsole(const WebConsoleMessage&) = 0;
2965267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2975267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Calls window.gc() if it is defined.
2985267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void collectGarbage() = 0;
2995267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3005267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Check if the scripting URL represents a mixed content condition relative
3015267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // to this frame.
3025267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool checkIfRunInsecureContent(const WebURL&) const = 0;
3035267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3045267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Executes script in the context of the current page and returns the value
3055267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // that the script evaluated to.
3065267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual v8::Handle<v8::Value> executeScriptAndReturnValue(
3075267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        const WebScriptSource&) = 0;
3085267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3095267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // worldID must be > 0 (as 0 represents the main world).
310e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    // worldID must be < EmbedderWorldIdLimit, high number used internally.
3115267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void executeScriptInIsolatedWorld(
3125267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        int worldID, const WebScriptSource* sourcesIn, unsigned numSources,
3135267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        int extensionGroup, WebVector<v8::Local<v8::Value> >* results) = 0;
3145267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3155267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Call the function with the given receiver and arguments, bypassing
3165267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // canExecute().
3175267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual v8::Handle<v8::Value> callFunctionEvenIfScriptDisabled(
3185267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        v8::Handle<v8::Function>,
319d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)        v8::Handle<v8::Value>,
3205267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        int argc,
3215267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        v8::Handle<v8::Value> argv[]) = 0;
3225267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3235267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the V8 context for associated with the main world and this
3245267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // frame. There can be many V8 contexts associated with this frame, one for
3255267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // each isolated world and one for the main world. If you don't know what
3265267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // the "main world" or an "isolated world" is, then you probably shouldn't
3275267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // be calling this API.
3285267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual v8::Local<v8::Context> mainWorldScriptContext() const = 0;
3295267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3305267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Navigation ----------------------------------------------------------
3315267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Reload the current document.
3335267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // True |ignoreCache| explicitly bypasses caches.
3345267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // False |ignoreCache| revalidates any existing cache entries.
3355267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void reload(bool ignoreCache = false) = 0;
3365267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3375267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // This is used for situations where we want to reload a different URL because of a redirect.
3385267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void reloadWithOverrideURL(const WebURL& overrideUrl, bool ignoreCache = false) = 0;
3395267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3405267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Load the given URL.
3415267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void loadRequest(const WebURLRequest&) = 0;
3425267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3435267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Load the given history state, corresponding to a back/forward
344a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch    // navigation of a frame. Multiple frames may be navigated via separate calls.
345a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch    virtual void loadHistoryItem(
346a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch        const WebHistoryItem&,
347a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch        WebHistoryLoadType,
348a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch        WebURLRequest::CachePolicy = WebURLRequest::UseProtocolCachePolicy) = 0;
3495267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3505267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Loads the given data with specific mime type and optional text
3515267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // encoding.  For HTML data, baseURL indicates the security origin of
3525267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // the document and is used to resolve links.  If specified,
3535267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // unreachableURL is reported via WebDataSource::unreachableURL.  If
3545267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // replace is false, then this data will be loaded as a normal
3555267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // navigation.  Otherwise, the current history item will be replaced.
3565267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void loadData(const WebData& data,
3575267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                          const WebString& mimeType,
3585267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                          const WebString& textEncoding,
3595267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                          const WebURL& baseURL,
3605267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                          const WebURL& unreachableURL = WebURL(),
3615267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                          bool replace = false) = 0;
3625267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3635267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // This method is short-hand for calling LoadData, where mime_type is
3645267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // "text/html" and text_encoding is "UTF-8".
3655267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void loadHTMLString(const WebData& html,
3665267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                                const WebURL& baseURL,
3675267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                                const WebURL& unreachableURL = WebURL(),
3685267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                                bool replace = false) = 0;
3695267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3705267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Stops any pending loads on the frame and its children.
3715267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void stopLoading() = 0;
3725267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3735267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the data source that is currently loading.  May be null.
3745267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebDataSource* provisionalDataSource() const = 0;
3755267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3765267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the data source that is currently loaded.
3775267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebDataSource* dataSource() const = 0;
3785267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3795267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // View-source rendering mode.  Set this before loading an URL to cause
3805267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // it to be rendered in view-source mode.
3815267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void enableViewSourceMode(bool) = 0;
3825267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool isViewSourceModeEnabled() const = 0;
3835267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3845267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Sets the referrer for the given request to be the specified URL or
3855267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // if that is null, then it sets the referrer to the referrer that the
3865267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // frame would use for subresources.  NOTE: This method also filters
3875267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // out invalid referrers (e.g., it is invalid to send a HTTPS URL as
3885267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // the referrer for a HTTP request).
3895267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setReferrerForRequest(WebURLRequest&, const WebURL&) = 0;
3905267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3915267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Called to associate the WebURLRequest with this frame.  The request
3925267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // will be modified to inherit parameters that allow it to be loaded.
3935267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // This method ends up triggering WebFrameClient::willSendRequest.
3945267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // DEPRECATED: Please use createAssociatedURLLoader instead.
3955267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void dispatchWillSendRequest(WebURLRequest&) = 0;
3965267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3975267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns a WebURLLoader that is associated with this frame.  The loader
3985267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // will, for example, be cancelled when WebFrame::stopLoading is called.
3995267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // FIXME: stopLoading does not yet cancel an associated loader!!
4005267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebURLLoader* createAssociatedURLLoader(const WebURLLoaderOptions& = WebURLLoaderOptions()) = 0;
4015267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4025267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the number of registered unload listeners.
4035267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual unsigned unloadListenerCount() const = 0;
4045267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4055267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4065267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Editing -------------------------------------------------------------
4075267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4085267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Replaces the selection with the given text.
4095267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void replaceSelection(const WebString& text) = 0;
4105267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4115267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void insertText(const WebString& text) = 0;
4125267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4135267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setMarkedText(const WebString& text, unsigned location, unsigned length) = 0;
4145267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void unmarkText() = 0;
4155267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool hasMarkedText() const = 0;
4165267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4175267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebRange markedRange() const = 0;
4185267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4195267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the frame rectangle in window coordinate space of the given text
4205267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // range.
4215267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool firstRectForCharacterRange(unsigned location, unsigned length, WebRect&) const = 0;
4225267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4235267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the index of a character in the Frame's text stream at the given
4245267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // point. The point is in the window coordinate space. Will return
4255267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // WTF::notFound if the point is invalid.
4265267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual size_t characterIndexForPoint(const WebPoint&) const = 0;
4275267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4285267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Supports commands like Undo, Redo, Cut, Copy, Paste, SelectAll,
4295267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Unselect, etc. See EditorCommand.cpp for the full list of supported
4305267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // commands.
4315267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool executeCommand(const WebString&, const WebNode& = WebNode()) = 0;
4325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool executeCommand(const WebString&, const WebString& value, const WebNode& = WebNode()) = 0;
4335267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool isCommandEnabled(const WebString&) const = 0;
4345267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4355267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Spell-checking support.
4365267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void enableContinuousSpellChecking(bool) = 0;
4375267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool isContinuousSpellCheckingEnabled() const = 0;
4385267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void requestTextChecking(const WebElement&) = 0;
4395267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void replaceMisspelledRange(const WebString&) = 0;
4405267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void removeSpellingMarkers() = 0;
4415267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4425267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Selection -----------------------------------------------------------
4435267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4445267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool hasSelection() const = 0;
4455267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4465267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebRange selectionRange() const = 0;
4475267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4485267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebString selectionAsText() const = 0;
4495267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebString selectionAsMarkup() const = 0;
4505267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4515267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Expands the selection to a word around the caret and returns
4525267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // true. Does nothing and returns false if there is no caret or
4535267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // there is ranged selection.
4545267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool selectWordAroundCaret() = 0;
4555267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
456a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    // DEPRECATED: Use moveRangeSelection.
4575267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void selectRange(const WebPoint& base, const WebPoint& extent) = 0;
4585267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4595267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void selectRange(const WebRange&) = 0;
4605267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4615267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Move the current selection to the provided window point/points. If the
4625267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // current selection is editable, the new selection will be restricted to
4635267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // the root editable element.
4645267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void moveRangeSelection(const WebPoint& base, const WebPoint& extent) = 0;
4655267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void moveCaretSelection(const WebPoint&) = 0;
4665267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
46707a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual bool setEditableSelectionOffsets(int start, int end) = 0;
46807a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual bool setCompositionFromExistingText(int compositionStart, int compositionEnd, const WebVector<WebCompositionUnderline>& underlines) = 0;
46907a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    virtual void extendSelectionAndDelete(int before, int after) = 0;
47007a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch
471e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)    virtual void setCaretVisible(bool) = 0;
472e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)
4735267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Printing ------------------------------------------------------------
4745267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4755267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Reformats the WebFrame for printing. WebPrintParams specifies the printable
4765267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // content size, paper size, printable area size, printer DPI and print
4775267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // scaling option. If constrainToNode node is specified, then only the given node
4785267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // is printed (for now only plugins are supported), instead of the entire frame.
4795267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the number of pages that can be printed at the given
48006f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)    // page size.
48106f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)    virtual int printBegin(const WebPrintParams&, const WebNode& constrainToNode = WebNode()) = 0;
4825267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4835267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the page shrinking factor calculated by webkit (usually
4845267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // between 1/1.25 and 1/2). Returns 0 if the page number is invalid or
4855267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // not in printing mode.
4865267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual float getPrintPageShrink(int page) = 0;
4875267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4885267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Prints one page, and returns the calculated page shrinking factor
4895267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // (usually between 1/1.25 and 1/2).  Returns 0 if the page number is
4905267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // invalid or not in printing mode.
4915267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual float printPage(int pageToPrint, WebCanvas*) = 0;
4925267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4935267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Reformats the WebFrame for screen display.
4945267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void printEnd() = 0;
4955267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4965267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // If the frame contains a full-frame plugin or the given node refers to a
4975267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // plugin whose content indicates that printed output should not be scaled,
4985267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // return true, otherwise return false.
4995267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool isPrintScalingDisabledForPlugin(const WebNode& = WebNode()) = 0;
5005267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
501c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)    // Returns the number of copies to be printed.
502c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)    virtual int getPrintCopiesForPlugin(const WebNode& = WebNode()) = 0;
503c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)
5045267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // CSS3 Paged Media ----------------------------------------------------
5055267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5065267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns true if page box (margin boxes and page borders) is visible.
5075267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool isPageBoxVisible(int pageIndex) = 0;
5085267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5095267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns true if the page style has custom size information.
5105267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool hasCustomPageSizeStyle(int pageIndex) = 0;
5115267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5125267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the preferred page size and margins in pixels, assuming 96
5135267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // pixels per inch. pageSize, marginTop, marginRight, marginBottom,
5145267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // marginLeft must be initialized to the default values that are used if
5155267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // auto is specified.
5165267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void pageSizeAndMarginsInPixels(int pageIndex,
5175267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                                            WebSize& pageSize,
5185267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                                            int& marginTop,
5195267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                                            int& marginRight,
5205267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                                            int& marginBottom,
5215267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                                            int& marginLeft) = 0;
5225267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5235267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the value for a page property that is only defined when printing.
5245267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // printBegin must have been called before this method.
5255267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebString pageProperty(const WebString& propertyName, int pageIndex) = 0;
5265267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5275267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Find-in-page --------------------------------------------------------
5285267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5295267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Searches a frame for a given string.
5305267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    //
5315267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // If a match is found, this function will select it (scrolling down to
5325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // make it visible if needed) and fill in selectionRect with the
5335267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // location of where the match was found (in window coordinates).
5345267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    //
5355267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // If no match is found, this function clears all tickmarks and
5365267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // highlighting.
5375267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    //
5385267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns true if the search string was found, false otherwise.
5395267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool find(int identifier,
5405267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                      const WebString& searchText,
5415267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                      const WebFindOptions& options,
5425267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                      bool wrapWithinFrame,
5435267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                      WebRect* selectionRect) = 0;
5445267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5455267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Notifies the frame that we are no longer interested in searching.
5465267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // This will abort any asynchronous scoping effort already under way
5475267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // (see the function scopeStringMatches for details) and erase all
5485267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // tick-marks and highlighting from the previous search.  If
5495267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // clearSelection is true, it will also make sure the end state for the
5505267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // find operation does not leave a selection.  This can occur when the
5515267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // user clears the search string but does not close the find box.
5525267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void stopFinding(bool clearSelection) = 0;
5535267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5545267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Counts how many times a particular string occurs within the frame.
5555267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // It also retrieves the location of the string and updates a vector in
5565267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // the frame so that tick-marks and highlighting can be drawn.  This
5575267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // function does its work asynchronously, by running for a certain
5585267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // time-slice and then scheduling itself (co-operative multitasking) to
5595267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // be invoked later (repeating the process until all matches have been
5605267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // found).  This allows multiple frames to be searched at the same time
5615267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // and provides a way to cancel at any time (see
5625267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // cancelPendingScopingEffort).  The parameter searchText specifies
5635267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // what to look for and |reset| signals whether this is a brand new
5645267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // request or a continuation of the last scoping effort.
5655267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void scopeStringMatches(int identifier,
5665267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                                    const WebString& searchText,
5675267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                                    const WebFindOptions& options,
5685267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                                    bool reset) = 0;
5695267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5705267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Cancels any outstanding requests for scoping string matches on a frame.
5715267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void cancelPendingScopingEffort() = 0;
5725267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5735267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // This function is called on the main frame during the scoping effort
5745267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // to keep a running tally of the accumulated total match-count for all
5755267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // frames.  After updating the count it will notify the WebViewClient
5765267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // about the new count.
5775267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void increaseMatchCount(int count, int identifier) = 0;
5785267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5795267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // This function is called on the main frame to reset the total number
5805267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // of matches found during the scoping effort.
5815267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void resetMatchCount() = 0;
5825267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5835267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns a counter that is incremented when the find-in-page markers are
5845267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // changed on any frame. Switching the active marker doesn't change the
5855267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // current version. Should be called only on the main frame.
5865267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual int findMatchMarkersVersion() const = 0;
5875267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5885267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the bounding box of the active find-in-page match marker or an
5895267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // empty rect if no such marker exists. The rect is returned in find-in-page
5905267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // coordinates whatever frame the active marker is.
5915267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Should be called only on the main frame.
5925267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebFloatRect activeFindMatchRect() = 0;
5935267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5945267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Swaps the contents of the provided vector with the bounding boxes of the
5955267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // find-in-page match markers from all frames. The bounding boxes are returned
5965267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // in find-in-page coordinates. This method should be called only on the main frame.
5975267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void findMatchRects(WebVector<WebFloatRect>&) = 0;
5985267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5995267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Selects the find-in-page match in the appropriate frame closest to the
6005267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // provided point in find-in-page coordinates. Returns the ordinal of such
6015267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // match or -1 if none could be found. If not null, selectionRect is set to
6025267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // the bounding box of the selected match in window coordinates.
6035267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // This method should be called only on the main frame.
6045267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual int selectNearestFindMatch(const WebFloatPoint&,
6055267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                                       WebRect* selectionRect) = 0;
6065267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
60743e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles)
60843e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles)    // Set the tickmarks for the frame. This will override the default tickmarks
60943e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles)    // generated by find results. If this is called with an empty array, the
61043e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles)    // default behavior will be restored.
61143e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles)    virtual void setTickmarks(const WebVector<WebRect>&) = 0;
61243e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles)
6135267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Events --------------------------------------------------------------
6145267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
6155267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Dispatches a message event on the current DOMWindow in this WebFrame.
6165267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void dispatchMessageEventWithOriginCheck(
6175267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        const WebSecurityOrigin& intendedTargetOrigin,
6185267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        const WebDOMEvent&) = 0;
6195267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
6205267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
6215267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Utility -------------------------------------------------------------
6225267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
6235267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the contents of this frame as a string.  If the text is
6245267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // longer than maxChars, it will be clipped to that length.  WARNING:
6255267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // This function may be slow depending on the number of characters
6265267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // retrieved and page complexity.  For a typically sized page, expect
6275267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // it to take on the order of milliseconds.
6285267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    //
6295267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // If there is room, subframe text will be recursively appended. Each
6305267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // frame will be separated by an empty line.
6315267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebString contentAsText(size_t maxChars) const = 0;
6325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
6335267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns HTML text for the contents of this frame.  This is generated
6345267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // from the DOM.
6355267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebString contentAsMarkup() const = 0;
6365267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
6375267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns a text representation of the render tree.  This method is used
6385267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // to support layout tests.
6395267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebString renderTreeAsText(RenderAsTextControls toShow = RenderAsTextNormal) const = 0;
6405267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
6415267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Calls markerTextForListItem() defined in WebCore/rendering/RenderTreeAsText.h.
6425267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebString markerTextForListItem(const WebElement&) const = 0;
6435267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
6445267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Prints all of the pages into the canvas, with page boundaries drawn as
6455267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // one pixel wide blue lines. This method exists to support layout tests.
6465267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void printPagesWithBoundaries(WebCanvas*, const WebSize&) = 0;
6475267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
6485267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the bounds rect for current selection. If selection is performed
6495267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // on transformed text, the rect will still bound the selection but will
6505267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // not be transformed itself. If no selection is present, the rect will be
6515267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // empty ((0,0), (0,0)).
6525267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebRect selectionBoundsRect() const = 0;
6535267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
6545267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Only for testing purpose:
6555267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns true if selection.anchorNode has a marker on range from |from| with |length|.
6565267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const = 0;
6575267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
6585267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Dumps the layer tree, used by the accelerated compositor, in
6595267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // text form. This is used only by layout tests.
6605267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebString layerTreeAsText(bool showDebugInfo = false) const = 0;
6615267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
66276c265b59aa821ccbf8c75ab2bb0d036e97d2956Torne (Richard Coles)#if BLINK_IMPLEMENTATION
663e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    static WebFrame* fromFrame(Frame*);
6647242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    static void traceChildren(Visitor*, WebFrame*);
66576c265b59aa821ccbf8c75ab2bb0d036e97d2956Torne (Richard Coles)#endif
66676c265b59aa821ccbf8c75ab2bb0d036e97d2956Torne (Richard Coles)
6675267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)protected:
668323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    explicit WebFrame();
669323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    virtual ~WebFrame();
670323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)
671323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)private:
672323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    friend class OpenedFrameTracker;
673323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)
674323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    WebFrame* m_parent;
675323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    WebFrame* m_previousSibling;
676323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    WebFrame* m_nextSibling;
677323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    WebFrame* m_firstChild;
678323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    WebFrame* m_lastChild;
679323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)
680323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    WebFrame* m_opener;
681323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    WebPrivateOwnPtr<OpenedFrameTracker> m_openedFrameTracker;
6825267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)};
6835267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
684d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)#if BLINK_IMPLEMENTATION
685e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)Frame* toCoreFrame(const WebFrame*);
686d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)#endif
687d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)
68851b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)} // namespace blink
6895267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
6905267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#endif
691