1643ca7872b450ea4efacab6188849e5aac2ba161Steve Block/* 2643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * Copyright (C) 2009 Google Inc. All rights reserved. 3643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * 4643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * Redistribution and use in source and binary forms, with or without 5643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * modification, are permitted provided that the following conditions are 6643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * met: 7643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * 8643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * * Redistributions of source code must retain the above copyright 9643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * notice, this list of conditions and the following disclaimer. 10643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * * Redistributions in binary form must reproduce the above 11643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * copyright notice, this list of conditions and the following disclaimer 12643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * in the documentation and/or other materials provided with the 13643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * distribution. 14643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * * Neither the name of Google Inc. nor the names of its 15643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * contributors may be used to endorse or promote products derived from 16643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * this software without specific prior written permission. 17643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * 18643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28643ca7872b450ea4efacab6188849e5aac2ba161Steve Block * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29643ca7872b450ea4efacab6188849e5aac2ba161Steve Block */ 30643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 31643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#ifndef WebFrame_h 32643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#define WebFrame_h 33643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 34643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#include "WebCanvas.h" 352daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#include "WebFileSystem.h" 3665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#include "WebNode.h" 37643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#include "WebURL.h" 38643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 39643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstruct NPObject; 40643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 41643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#if WEBKIT_USING_V8 42643ca7872b450ea4efacab6188849e5aac2ba161Steve Blocknamespace v8 { 43643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockclass Context; 44dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockclass Value; 45dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blocktemplate <class T> class Handle; 46643ca7872b450ea4efacab6188849e5aac2ba161Steve Blocktemplate <class T> class Local; 47643ca7872b450ea4efacab6188849e5aac2ba161Steve Block} 48643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#endif 49643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 50643ca7872b450ea4efacab6188849e5aac2ba161Steve Blocknamespace WebKit { 51643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 52d0825bca7fe65beaee391d30da42e937db621564Steve Blockclass WebAnimationController; 53643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockclass WebData; 54643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockclass WebDataSource; 55d0825bca7fe65beaee391d30da42e937db621564Steve Blockclass WebDocument; 56d0825bca7fe65beaee391d30da42e937db621564Steve Blockclass WebElement; 57643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockclass WebFormElement; 58643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockclass WebHistoryItem; 59643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockclass WebInputElement; 60643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockclass WebPasswordAutocompleteListener; 61bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsenclass WebPerformance; 62643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockclass WebRange; 63643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockclass WebSecurityOrigin; 64643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockclass WebString; 65643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockclass WebURL; 664576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wangclass WebURLLoader; 67643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockclass WebURLRequest; 68643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockclass WebView; 69643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstruct WebConsoleMessage; 70643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstruct WebFindOptions; 712daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochstruct WebPoint; 72643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstruct WebRect; 73643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstruct WebScriptSource; 74643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstruct WebSize; 752bde8e466a4451c7319e3a072d118917957d6554Steve Blockstruct WebURLLoaderOptions; 762daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 77643ca7872b450ea4efacab6188849e5aac2ba161Steve Blocktemplate <typename T> class WebVector; 78643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 79643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockclass WebFrame { 80643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockpublic: 81d0825bca7fe65beaee391d30da42e937db621564Steve Block // Returns the number of live WebFrame objects, used for leak checking. 82d0825bca7fe65beaee391d30da42e937db621564Steve Block WEBKIT_API static int instanceCount(); 83d0825bca7fe65beaee391d30da42e937db621564Steve Block 84643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // The two functions below retrieve the WebFrame instances relating the 85643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // currently executing JavaScript. Since JavaScript can make function 86643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // calls across frames, though, we need to be more precise. 87643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // 88643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // For example, imagine that a JS function in frame A calls a function 89643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // in frame B, which calls native code, which wants to know what the 90643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // 'active' frame is. 91643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // 92643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // The 'entered context' is the context where execution first entered 93643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // the script engine; the context that is at the bottom of the JS 94643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // function stack. frameForEnteredContext() would return frame A in 95643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // our example. 96643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // 97643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // The 'current context' is the context the JS engine is currently 98643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // inside of; the context that is at the top of the JS function stack. 99643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // frameForCurrentContext() would return frame B in our example. 100643ca7872b450ea4efacab6188849e5aac2ba161Steve Block WEBKIT_API static WebFrame* frameForEnteredContext(); 101643ca7872b450ea4efacab6188849e5aac2ba161Steve Block WEBKIT_API static WebFrame* frameForCurrentContext(); 102643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 1032daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#if WEBKIT_USING_V8 1042daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch // Returns the frame corresponding to the given context. This can return 0 1052daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch // if the context is detached from the frame, or if the context doesn't 1062daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch // correspond to a frame (e.g., workers). 1072daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch WEBKIT_API static WebFrame* frameForContext(v8::Handle<v8::Context>); 1082daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#endif 1092daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 110d0825bca7fe65beaee391d30da42e937db621564Steve Block // Returns the frame inside a given frame or iframe element. Returns 0 if 111d0825bca7fe65beaee391d30da42e937db621564Steve Block // the given element is not a frame, iframe or if the frame is empty. 112d0825bca7fe65beaee391d30da42e937db621564Steve Block WEBKIT_API static WebFrame* fromFrameOwnerElement(const WebElement&); 113d0825bca7fe65beaee391d30da42e937db621564Steve Block 114643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 115643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Basic properties --------------------------------------------------- 116643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 117643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // The name of this frame. 118643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebString name() const = 0; 11906ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 12006ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen // Sets the name of this frame. For child frames (frames that are not a 12106ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen // top-most frame) the actual name may have a suffix appended to make the 12206ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen // frame name unique within the hierarchy. 12306ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen virtual void setName(const WebString&) = 0; 124643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 125a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch // A globally unique identifier for this frame. 126a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch virtual long long identifier() const = 0; 127a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 128643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // The url of the document loaded in this frame. This is equivalent to 129643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // dataSource()->request().url(). 130643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebURL url() const = 0; 131643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 132643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // The url of the favicon (if any) specified by the document loaded in 133643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // this frame. 134643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebURL favIconURL() const = 0; 135643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 136643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // The url of the OpenSearch Desription Document (if any) specified by 137643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // the document loaded in this frame. 138643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebURL openSearchDescriptionURL() const = 0; 139643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 140d0825bca7fe65beaee391d30da42e937db621564Steve Block // Return the frame's encoding. 141d0825bca7fe65beaee391d30da42e937db621564Steve Block virtual WebString encoding() const = 0; 142d0825bca7fe65beaee391d30da42e937db621564Steve Block 143643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 144643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Geometry ----------------------------------------------------------- 145643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 146643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // NOTE: These routines do not force page layout so their results may 147643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // not be accurate if the page layout is out-of-date. 148643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 149dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // If set to false, do not draw scrollbars on this frame's view. 150dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void setCanHaveScrollbars(bool) = 0; 151dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 152643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // The scroll offset from the top-left corner of the frame in pixels. 153643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebSize scrollOffset() const = 0; 15481bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch virtual void setScrollOffset(const WebSize&) = 0; 155643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 156643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // The size of the contents area. 157643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebSize contentsSize() const = 0; 158643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 159643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns the minimum preferred width of the content contained in the 160643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // current document. 161643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual int contentsPreferredWidth() const = 0; 162643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 163643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns the scroll height of the document element. This is 164643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // equivalent to the DOM property of the same name, and is the minimum 165643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // height required to display the document without scrollbars. 166643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual int documentElementScrollHeight() const = 0; 167643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 168643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns true if the contents (minus scrollbars) has non-zero area. 169643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual bool hasVisibleContent() const = 0; 170643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 171643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 172643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Hierarchy ---------------------------------------------------------- 173643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 174643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns the containing view. 175643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebView* view() const = 0; 176643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 177643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns the frame that opened this frame or 0 if there is none. 178643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebFrame* opener() const = 0; 179643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 18081bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch // Reset the frame that opened this frame to 0. 18181bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch // This is executed between layout tests runs 18281bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch virtual void clearOpener() = 0; 18381bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch 184643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns the parent frame or 0 if this is a top-most frame. 185643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebFrame* parent() const = 0; 186643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 187643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns the top-most frame in the hierarchy containing this frame. 188643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebFrame* top() const = 0; 189643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 190643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns the first/last child frame. 191643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebFrame* firstChild() const = 0; 192643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebFrame* lastChild() const = 0; 193643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 194643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns the next/previous sibling frame. 195643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebFrame* nextSibling() const = 0; 196643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebFrame* previousSibling() const = 0; 197643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 198643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns the next/previous frame in "frame traversal order" 199643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // optionally wrapping around. 200643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebFrame* traverseNext(bool wrap) const = 0; 201643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebFrame* traversePrevious(bool wrap) const = 0; 202643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 203643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns the child frame identified by the given name. 204643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebFrame* findChildByName(const WebString& name) const = 0; 205643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 206643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns the child frame identified by the given xpath expression. 207643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebFrame* findChildByExpression(const WebString& xpath) const = 0; 208643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 209643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 210643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Content ------------------------------------------------------------ 211643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 212d0825bca7fe65beaee391d30da42e937db621564Steve Block virtual WebDocument document() const = 0; 213d0825bca7fe65beaee391d30da42e937db621564Steve Block 214643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void forms(WebVector<WebFormElement>&) const = 0; 215643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 216d0825bca7fe65beaee391d30da42e937db621564Steve Block virtual WebAnimationController* animationController() = 0; 217d0825bca7fe65beaee391d30da42e937db621564Steve Block 218bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen virtual WebPerformance performance() const = 0; 219bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen 220643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 221643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Scripting ---------------------------------------------------------- 222643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 223643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns the security origin of the current document. 224643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebSecurityOrigin securityOrigin() const = 0; 225643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 226643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // This grants the currently loaded document access to all security 227643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // origins (including file URLs). Use with care. The access is 228643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // revoked when a new document is loaded into this frame. 229643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void grantUniversalAccess() = 0; 230643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 231643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns a NPObject corresponding to this frame's DOMWindow. 232643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual NPObject* windowObject() const = 0; 233643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 234643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Binds a NPObject as a property of this frame's DOMWindow. 235643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void bindToWindowObject(const WebString& name, NPObject*) = 0; 236643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 237643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Executes script in the context of the current page. 238643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void executeScript(const WebScriptSource&) = 0; 239643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 240643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Executes JavaScript in a new world associated with the web frame. 241643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // The script gets its own global scope and its own prototypes for 242643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // intrinsic JavaScript objects (String, Array, and so-on). It also 243643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // gets its own wrappers for all DOM nodes and DOM constructors. 244643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // extensionGroup is an embedder-provided specifier that controls which 245643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // v8 extensions are loaded into the new context - see 246643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // WebKit::registerExtension for the corresponding specifier. 247643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void executeScriptInIsolatedWorld( 248643ca7872b450ea4efacab6188849e5aac2ba161Steve Block int worldId, const WebScriptSource* sources, unsigned numSources, 249643ca7872b450ea4efacab6188849e5aac2ba161Steve Block int extensionGroup) = 0; 250643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 251643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Logs to the console associated with this frame. 252643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void addMessageToConsole(const WebConsoleMessage&) = 0; 253643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 254643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Calls window.gc() if it is defined. 255643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void collectGarbage() = 0; 256643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 257643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#if WEBKIT_USING_V8 258dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // Executes script in the context of the current page and returns the value 259dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // that the script evaluated to. 260dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual v8::Handle<v8::Value> executeScriptAndReturnValue( 261dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block const WebScriptSource&) = 0; 262dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 263643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns the V8 context for this frame, or an empty handle if there 264643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // is none. 265643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual v8::Local<v8::Context> mainWorldScriptContext() const = 0; 26681bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch 26781bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch // Creates an instance of file system object. 2682daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch virtual v8::Handle<v8::Value> createFileSystem(WebFileSystem::Type, 26981bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch const WebString& name, 27081bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch const WebString& path) = 0; 2712daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch // Creates an instance of file or directory entry object. 2722daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch virtual v8::Handle<v8::Value> createFileEntry(WebFileSystem::Type, 2732daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch const WebString& fileSystemName, 2742daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch const WebString& fileSystemPath, 2752daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch const WebString& filePath, 2762daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch bool isDirectory) = 0; 277643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#endif 278643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 279643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 280643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Styling ------------------------------------------------------------- 281643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 282643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Insert the given text as a STYLE element at the beginning of the 283643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // document. |elementId| can be empty, but if specified then it is used 284643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // as the id for the newly inserted element (replacing an existing one 285643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // with the same id, if any). 286643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual bool insertStyleText(const WebString& styleText, 287643ca7872b450ea4efacab6188849e5aac2ba161Steve Block const WebString& elementId) = 0; 288643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 289643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 290643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Navigation ---------------------------------------------------------- 291643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 292643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Reload the current document. 293692e5dbf12901edacf14812a6fae25462920af42Steve Block // True |ignoreCache| explicitly bypasses caches. 294692e5dbf12901edacf14812a6fae25462920af42Steve Block // False |ignoreCache| revalidates any existing cache entries. 295692e5dbf12901edacf14812a6fae25462920af42Steve Block virtual void reload(bool ignoreCache = false) = 0; 296643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 297643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Load the given URL. 298643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void loadRequest(const WebURLRequest&) = 0; 299643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 300643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Load the given history state, corresponding to a back/forward 301643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // navigation. 302643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void loadHistoryItem(const WebHistoryItem&) = 0; 303643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 304643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Loads the given data with specific mime type and optional text 305643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // encoding. For HTML data, baseURL indicates the security origin of 306643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // the document and is used to resolve links. If specified, 307643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // unreachableURL is reported via WebDataSource::unreachableURL. If 308643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // replace is false, then this data will be loaded as a normal 309643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // navigation. Otherwise, the current history item will be replaced. 310643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void loadData(const WebData& data, 311643ca7872b450ea4efacab6188849e5aac2ba161Steve Block const WebString& mimeType, 312643ca7872b450ea4efacab6188849e5aac2ba161Steve Block const WebString& textEncoding, 313643ca7872b450ea4efacab6188849e5aac2ba161Steve Block const WebURL& baseURL, 314643ca7872b450ea4efacab6188849e5aac2ba161Steve Block const WebURL& unreachableURL = WebURL(), 315643ca7872b450ea4efacab6188849e5aac2ba161Steve Block bool replace = false) = 0; 316643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 317643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // This method is short-hand for calling LoadData, where mime_type is 318643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // "text/html" and text_encoding is "UTF-8". 319643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void loadHTMLString(const WebData& html, 320643ca7872b450ea4efacab6188849e5aac2ba161Steve Block const WebURL& baseURL, 321643ca7872b450ea4efacab6188849e5aac2ba161Steve Block const WebURL& unreachableURL = WebURL(), 322643ca7872b450ea4efacab6188849e5aac2ba161Steve Block bool replace = false) = 0; 323643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 324643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns true if the current frame is busy loading content. 325643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual bool isLoading() const = 0; 326643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 327643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Stops any pending loads on the frame and its children. 328643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void stopLoading() = 0; 329643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 330643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns the data source that is currently loading. May be null. 331643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebDataSource* provisionalDataSource() const = 0; 332643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 333643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns the data source that is currently loaded. 334643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebDataSource* dataSource() const = 0; 335643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 336643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns the previous history item. Check WebHistoryItem::isNull() 337643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // before using. 338643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebHistoryItem previousHistoryItem() const = 0; 339643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 340643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns the current history item. Check WebHistoryItem::isNull() 341643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // before using. 342643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebHistoryItem currentHistoryItem() const = 0; 343643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 344643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // View-source rendering mode. Set this before loading an URL to cause 345643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // it to be rendered in view-source mode. 346643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void enableViewSourceMode(bool) = 0; 347643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual bool isViewSourceModeEnabled() const = 0; 348643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 349643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Sets the referrer for the given request to be the specified URL or 350643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // if that is null, then it sets the referrer to the referrer that the 351643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // frame would use for subresources. NOTE: This method also filters 352643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // out invalid referrers (e.g., it is invalid to send a HTTPS URL as 353643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // the referrer for a HTTP request). 354643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void setReferrerForRequest(WebURLRequest&, const WebURL&) = 0; 355643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 356643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Called to associate the WebURLRequest with this frame. The request 357643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // will be modified to inherit parameters that allow it to be loaded. 358643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // This method ends up triggering WebFrameClient::willSendRequest. 3594576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang // DEPRECATED: Please use createAssociatedURLLoader instead. 360643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void dispatchWillSendRequest(WebURLRequest&) = 0; 361643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 3622bde8e466a4451c7319e3a072d118917957d6554Steve Block // FIXME: Remove this overload when clients have been changed to pass options. 3632bde8e466a4451c7319e3a072d118917957d6554Steve Block virtual WebURLLoader* createAssociatedURLLoader() = 0; 3642bde8e466a4451c7319e3a072d118917957d6554Steve Block 3654576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang // Returns a WebURLLoader that is associated with this frame. The loader 3664576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang // will, for example, be cancelled when WebFrame::stopLoading is called. 3674576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang // FIXME: stopLoading does not yet cancel an associated loader!! 3682bde8e466a4451c7319e3a072d118917957d6554Steve Block virtual WebURLLoader* createAssociatedURLLoader(const WebURLLoaderOptions&) = 0; 3694576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang 370643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Called from within WebFrameClient::didReceiveDocumentData to commit 371643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // data for the frame that will be used to construct the frame's 372643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // document. 373643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void commitDocumentData(const char* data, size_t length) = 0; 374643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 375643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns the number of registered unload listeners. 376643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual unsigned unloadListenerCount() const = 0; 377643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 378643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns true if a user gesture is currently being processed. 379643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual bool isProcessingUserGesture() const = 0; 380643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 381643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns true if this frame is in the process of opening a new frame 382643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // with a suppressed opener. 383643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual bool willSuppressOpenerInNewFrame() const = 0; 384643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 385643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 386643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Editing ------------------------------------------------------------- 387643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 388643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Replaces the selection with the given text. 389643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void replaceSelection(const WebString& text) = 0; 390643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 391643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void insertText(const WebString& text) = 0; 392643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 393643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void setMarkedText(const WebString& text, unsigned location, unsigned length) = 0; 394643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void unmarkText() = 0; 395643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual bool hasMarkedText() const = 0; 396643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 397643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebRange markedRange() const = 0; 398643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 399bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen virtual bool firstRectForCharacterRange(unsigned location, unsigned length, WebRect&) const = 0; 400bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen 401643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Supports commands like Undo, Redo, Cut, Copy, Paste, SelectAll, 402643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Unselect, etc. See EditorCommand.cpp for the full list of supported 403643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // commands. 404643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual bool executeCommand(const WebString&) = 0; 405643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual bool executeCommand(const WebString&, const WebString& value) = 0; 406643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual bool isCommandEnabled(const WebString&) const = 0; 407643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 408643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Spell-checking support. 409643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void enableContinuousSpellChecking(bool) = 0; 410643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual bool isContinuousSpellCheckingEnabled() const = 0; 411643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 412643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 413643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Selection ----------------------------------------------------------- 414643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 415643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual bool hasSelection() const = 0; 416643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 417643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebRange selectionRange() const = 0; 418643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 419643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebString selectionAsText() const = 0; 420643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebString selectionAsMarkup() const = 0; 421643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 4225e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block // Expands the selection to a word around the caret and returns 4235e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block // true. Does nothing and returns false if there is no caret or 4245e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block // there is ranged selection. 4255e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block virtual bool selectWordAroundCaret() = 0; 4265e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block 4272daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch virtual void selectRange(const WebPoint& start, const WebPoint& end) = 0; 4282daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 429643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 430643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Printing ------------------------------------------------------------ 431643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 432dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // Reformats the WebFrame for printing. pageSize is the page size in 43365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch // points (a point in 1/72 of an inch). If |constrainToNode| node is 43465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch // specified, then only the given node is printed (for now only plugins are 43565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch // supported), instead of the entire frame. printerDPI is the user 43665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch // selected, DPI for the printer. Returns the number of pages that can be 43765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch // printed at the given page size. The out param useBrowserOverlays 438dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // specifies whether the browser process should use its overlays (header, 439dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // footer, margins etc) or whether the renderer controls this. 44065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch virtual int printBegin(const WebSize& pageSize, 44165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch const WebNode& constrainToNode = WebNode(), 44265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch int printerDPI = 72, 443dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block bool* useBrowserOverlays = 0) = 0; 444643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 445643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns the page shrinking factor calculated by webkit (usually 446643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // between 1/1.25 and 1/2). Returns 0 if the page number is invalid or 447643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // not in printing mode. 448643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual float getPrintPageShrink(int page) = 0; 449643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 450643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Prints one page, and returns the calculated page shrinking factor 451643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // (usually between 1/1.25 and 1/2). Returns 0 if the page number is 452643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // invalid or not in printing mode. 453643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual float printPage(int pageToPrint, WebCanvas*) = 0; 454643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 455643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Reformats the WebFrame for screen display. 456643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void printEnd() = 0; 457643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 45806ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen // CSS3 Paged Media ---------------------------------------------------- 45906ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 46006ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen // Returns true if page box (margin boxes and page borders) is visible. 46106ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen virtual bool isPageBoxVisible(int pageIndex) = 0; 46206ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 463ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block // Returns the preferred page size and margins in pixels, assuming 96 464ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block // pixels per inch. pageSize, marginTop, marginRight, marginBottom, 465ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block // marginLeft must be initialized to the default values that are used if 466ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block // auto is specified. 467ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block virtual void pageSizeAndMarginsInPixels(int pageIndex, 468ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block WebSize& pageSize, 469ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block int& marginTop, 470ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block int& marginRight, 471ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block int& marginBottom, 472ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block int& marginLeft) = 0; 473643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 474643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Find-in-page -------------------------------------------------------- 475643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 476643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Searches a frame for a given string. 477643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // 478643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // If a match is found, this function will select it (scrolling down to 479643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // make it visible if needed) and fill in selectionRect with the 480643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // location of where the match was found (in window coordinates). 481643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // 482643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // If no match is found, this function clears all tickmarks and 483643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // highlighting. 484643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // 485643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns true if the search string was found, false otherwise. 486643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual bool find(int identifier, 487643ca7872b450ea4efacab6188849e5aac2ba161Steve Block const WebString& searchText, 488643ca7872b450ea4efacab6188849e5aac2ba161Steve Block const WebFindOptions& options, 489643ca7872b450ea4efacab6188849e5aac2ba161Steve Block bool wrapWithinFrame, 490643ca7872b450ea4efacab6188849e5aac2ba161Steve Block WebRect* selectionRect) = 0; 491643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 492643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Notifies the frame that we are no longer interested in searching. 493643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // This will abort any asynchronous scoping effort already under way 494643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // (see the function scopeStringMatches for details) and erase all 495643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // tick-marks and highlighting from the previous search. If 496643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // clearSelection is true, it will also make sure the end state for the 497643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // find operation does not leave a selection. This can occur when the 498643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // user clears the search string but does not close the find box. 499643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void stopFinding(bool clearSelection) = 0; 500643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 501643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Counts how many times a particular string occurs within the frame. 502643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // It also retrieves the location of the string and updates a vector in 503643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // the frame so that tick-marks and highlighting can be drawn. This 504643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // function does its work asynchronously, by running for a certain 505643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // time-slice and then scheduling itself (co-operative multitasking) to 506643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // be invoked later (repeating the process until all matches have been 507643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // found). This allows multiple frames to be searched at the same time 508643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // and provides a way to cancel at any time (see 509643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // cancelPendingScopingEffort). The parameter searchText specifies 510643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // what to look for and |reset| signals whether this is a brand new 511643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // request or a continuation of the last scoping effort. 512643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void scopeStringMatches(int identifier, 513643ca7872b450ea4efacab6188849e5aac2ba161Steve Block const WebString& searchText, 514643ca7872b450ea4efacab6188849e5aac2ba161Steve Block const WebFindOptions& options, 515643ca7872b450ea4efacab6188849e5aac2ba161Steve Block bool reset) = 0; 516643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 517643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Cancels any outstanding requests for scoping string matches on a frame. 518643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void cancelPendingScopingEffort() = 0; 519643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 520643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // This function is called on the main frame during the scoping effort 521643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // to keep a running tally of the accumulated total match-count for all 522643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // frames. After updating the count it will notify the WebViewClient 523643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // about the new count. 524643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void increaseMatchCount(int count, int identifier) = 0; 525643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 526643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // This function is called on the main frame to reset the total number 527643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // of matches found during the scoping effort. 528643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual void resetMatchCount() = 0; 529643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 530d0825bca7fe65beaee391d30da42e937db621564Steve Block 531643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Password autocompletion --------------------------------------------- 532643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 533643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Registers a listener for the specified user name input element. The 534643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // listener will receive notifications for blur and when autocomplete 535643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // should be triggered. 5366c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen // An element can have only one listener. If a listener already exists, 5376c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen // this method returns false and does not add the new one. 5386c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen // Either way, the WebFrame becomes the owner of the passed listener. 5396c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen virtual bool registerPasswordListener( 540643ca7872b450ea4efacab6188849e5aac2ba161Steve Block WebInputElement, 541643ca7872b450ea4efacab6188849e5aac2ba161Steve Block WebPasswordAutocompleteListener*) = 0; 542643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 543ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block // Dispatches an Autocompletion notification to registered listener if one 544ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block // exists that is registered against the WebInputElement specified. 545ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block virtual void notifiyPasswordListenerOfAutocomplete( 546ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block const WebInputElement&) = 0; 547ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block 548d0825bca7fe65beaee391d30da42e937db621564Steve Block 549643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Utility ------------------------------------------------------------- 550643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 551643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns the contents of this frame as a string. If the text is 552643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // longer than maxChars, it will be clipped to that length. WARNING: 553643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // This function may be slow depending on the number of characters 554643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // retrieved and page complexity. For a typically sized page, expect 555643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // it to take on the order of milliseconds. 556643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // 557643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // If there is room, subframe text will be recursively appended. Each 558643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // frame will be separated by an empty line. 559643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebString contentAsText(size_t maxChars) const = 0; 560643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 561643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Returns HTML text for the contents of this frame. This is generated 562643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // from the DOM. 563643ca7872b450ea4efacab6188849e5aac2ba161Steve Block virtual WebString contentAsMarkup() const = 0; 564643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 565d0825bca7fe65beaee391d30da42e937db621564Steve Block // Returns a text representation of the render tree. This method is used 566d0825bca7fe65beaee391d30da42e937db621564Steve Block // to support layout tests. 5672bde8e466a4451c7319e3a072d118917957d6554Steve Block virtual WebString renderTreeAsText(bool showDebugInfo = false) const = 0; 568d0825bca7fe65beaee391d30da42e937db621564Steve Block 569d0825bca7fe65beaee391d30da42e937db621564Steve Block // Returns the counter value for the specified element. This method is 570d0825bca7fe65beaee391d30da42e937db621564Steve Block // used to support layout tests. 571d0825bca7fe65beaee391d30da42e937db621564Steve Block virtual WebString counterValueForElementById(const WebString& id) const = 0; 572d0825bca7fe65beaee391d30da42e937db621564Steve Block 5735ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen // Calls markerTextForListItem() defined in WebCore/rendering/RenderTreeAsText.h. 5745ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen virtual WebString markerTextForListItem(const WebElement&) const = 0; 5755e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block 5765e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block // Returns the number of page where the specified element will be put. 5775e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block // This method is used to support layout tests. 5785e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block virtual int pageNumberForElementById(const WebString& id, 5795e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block float pageWidthInPixels, 5805e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block float pageHeightInPixels) const = 0; 5815e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block 582dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // Returns the bounds rect for current selection. If selection is performed 583dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // on transformed text, the rect will still bound the selection but will 584dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // not be transformed itself. If no selection is present, the rect will be 585dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // empty ((0,0), (0,0)). 586dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual WebRect selectionBoundsRect() const = 0; 587dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 58868513a70bcd92384395513322f1b801e7bf9c729Steve Block // Only for testing purpose: 58968513a70bcd92384395513322f1b801e7bf9c729Steve Block // Returns true if selection.anchorNode has a marker on range from |from| with |length|. 59068513a70bcd92384395513322f1b801e7bf9c729Steve Block virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const = 0; 591bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen 592bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen // Pauses and samples an SVG animation. Returns false if there's no svg 593bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen // animation to pause. This is only for testing. 594bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen virtual bool pauseSVGAnimation(const WebString& animationId, 595bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen double time, 596bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen const WebString& elementId) = 0; 597a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 598a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch // Dumps the layer tree, used by the accelerated compositor, in 599a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch // text form. This is used only by layout tests. 6002bde8e466a4451c7319e3a072d118917957d6554Steve Block virtual WebString layerTreeAsText(bool showDebugInfo = false) const = 0; 601a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 602643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockprotected: 603643ca7872b450ea4efacab6188849e5aac2ba161Steve Block ~WebFrame() { } 604643ca7872b450ea4efacab6188849e5aac2ba161Steve Block}; 605643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 606643ca7872b450ea4efacab6188849e5aac2ba161Steve Block} // namespace WebKit 607643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 608643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#endif 609