1 /* 2 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: 7 * 8 * * Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * * Redistributions in binary form must reproduce the above 11 * copyright notice, this list of conditions and the following disclaimer 12 * in the documentation and/or other materials provided with the 13 * distribution. 14 * * Neither the name of Google Inc. nor the names of its 15 * contributors may be used to endorse or promote products derived from 16 * this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 #ifndef WebDocument_h 32 #define WebDocument_h 33 34 #include "WebNode.h" 35 36 #if WEBKIT_IMPLEMENTATION 37 namespace WebCore { 38 class Document; 39 class DocumentType; 40 } 41 namespace WTF { template <typename T> class PassRefPtr; } 42 #endif 43 44 namespace WebKit { 45 class WebAccessibilityObject; 46 class WebDocumentType; 47 class WebElement; 48 class WebFrame; 49 class WebNodeCollection; 50 class WebNodeList; 51 class WebString; 52 class WebURL; 53 54 // Provides readonly access to some properties of a DOM document. 55 class WebDocument : public WebNode { 56 public: 57 WebDocument() { } 58 WebDocument(const WebDocument& e) : WebNode(e) { } 59 60 WebDocument& operator=(const WebDocument& e) 61 { 62 WebNode::assign(e); 63 return *this; 64 } 65 void assign(const WebDocument& e) { WebNode::assign(e); } 66 67 // Returns the frame the document belongs to or 0 if the document is frameless. 68 WEBKIT_API WebFrame* frame() const; 69 WEBKIT_API bool isHTMLDocument() const; 70 WEBKIT_API bool isXHTMLDocument() const; 71 WEBKIT_API bool isPluginDocument() const; 72 WEBKIT_API WebURL baseURL() const; 73 WEBKIT_API WebURL firstPartyForCookies() const; 74 WEBKIT_API WebElement documentElement() const; 75 WEBKIT_API WebElement body() const; 76 WEBKIT_API WebElement head(); 77 WEBKIT_API WebString title() const; 78 WEBKIT_API WebNodeCollection all(); 79 WEBKIT_API WebURL completeURL(const WebString&) const; 80 WEBKIT_API WebElement getElementById(const WebString&) const; 81 WEBKIT_API WebNode focusedNode() const; 82 WEBKIT_API WebDocumentType doctype() const; 83 WEBKIT_API WebAccessibilityObject accessibilityObject() const; 84 85 #if WEBKIT_IMPLEMENTATION 86 WebDocument(const WTF::PassRefPtr<WebCore::Document>&); 87 WebDocument& operator=(const WTF::PassRefPtr<WebCore::Document>&); 88 operator WTF::PassRefPtr<WebCore::Document>() const; 89 #endif 90 }; 91 92 } // namespace WebKit 93 94 #endif 95