OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions are | |
6 * met: | |
7 * | |
8 * * Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * * Redistributions in binary form must reproduce the above | |
11 * copyright notice, this list of conditions and the following disclaimer | |
12 * in the documentation and/or other materials provided with the | |
13 * distribution. | |
14 * * Neither the name of Google Inc. nor the names of its | |
15 * contributors may be used to endorse or promote products derived from | |
16 * this software without specific prior written permission. | |
17 * | |
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
29 */ | |
30 | |
31 #ifndef WebDocument_h | |
32 #define WebDocument_h | |
33 | |
34 #include "../platform/WebReferrerPolicy.h" | |
35 #include "../platform/WebVector.h" | |
36 #include "WebDraggableRegion.h" | |
37 #include "WebNode.h" | |
38 #include "WebSecurityOrigin.h" | |
39 | |
40 #if WEBKIT_IMPLEMENTATION | |
41 namespace WebCore { | |
42 class Document; | |
43 class DocumentType; | |
44 } | |
45 namespace WTF { template <typename T> class PassRefPtr; } | |
46 #endif | |
47 | |
48 namespace WebKit { | |
49 class WebAccessibilityObject; | |
50 class WebDocumentType; | |
51 class WebElement; | |
52 class WebFormElement; | |
53 class WebFrame; | |
54 class WebNodeCollection; | |
55 class WebNodeList; | |
56 class WebString; | |
57 class WebURL; | |
58 | |
59 // Provides readonly access to some properties of a DOM document. | |
60 class WebDocument : public WebNode { | |
61 public: | |
62 enum UserStyleLevel { | |
63 UserStyleUserLevel, | |
64 UserStyleAuthorLevel | |
65 }; | |
66 | |
67 WebDocument() { } | |
68 WebDocument(const WebDocument& e) : WebNode(e) { } | |
69 | |
70 WebDocument& operator=(const WebDocument& e) | |
71 { | |
72 WebNode::assign(e); | |
73 return *this; | |
74 } | |
75 void assign(const WebDocument& e) { WebNode::assign(e); } | |
76 | |
77 WEBKIT_EXPORT WebURL url() const; | |
78 // Note: Security checks should use the securityOrigin(), not url(). | |
79 WEBKIT_EXPORT WebSecurityOrigin securityOrigin() const; | |
80 | |
81 WEBKIT_EXPORT WebString encoding() const; | |
82 WEBKIT_EXPORT WebString contentLanguage() const; | |
83 | |
84 // The url of the OpenSearch Desription Document (if any). | |
85 WEBKIT_EXPORT WebURL openSearchDescriptionURL() const; | |
86 | |
87 // Returns the frame the document belongs to or 0 if the document is framele
ss. | |
88 WEBKIT_EXPORT WebFrame* frame() const; | |
89 WEBKIT_EXPORT bool isHTMLDocument() const; | |
90 WEBKIT_EXPORT bool isXHTMLDocument() const; | |
91 WEBKIT_EXPORT bool isPluginDocument() const; | |
92 WEBKIT_EXPORT WebURL baseURL() const; | |
93 WEBKIT_EXPORT WebURL firstPartyForCookies() const; | |
94 WEBKIT_EXPORT WebElement documentElement() const; | |
95 WEBKIT_EXPORT WebElement body() const; | |
96 WEBKIT_EXPORT WebElement head(); | |
97 WEBKIT_EXPORT WebString title() const; | |
98 WEBKIT_EXPORT WebNodeCollection all(); | |
99 WEBKIT_EXPORT void forms(WebVector<WebFormElement>&) const; | |
100 WEBKIT_EXPORT void images(WebVector<WebElement>&); | |
101 WEBKIT_EXPORT WebURL completeURL(const WebString&) const; | |
102 WEBKIT_EXPORT WebElement getElementById(const WebString&) const; | |
103 WEBKIT_EXPORT WebNode focusedNode() const; | |
104 WEBKIT_EXPORT WebDocumentType doctype() const; | |
105 WEBKIT_EXPORT void cancelFullScreen(); | |
106 WEBKIT_EXPORT WebElement fullScreenElement() const; | |
107 WEBKIT_EXPORT WebDOMEvent createEvent(const WebString& eventType); | |
108 WEBKIT_EXPORT WebReferrerPolicy referrerPolicy() const; | |
109 WEBKIT_EXPORT WebElement createElement(const WebString& tagName); | |
110 | |
111 // Accessibility support. These methods should only be called on the | |
112 // top-level document, because one accessibility cache spans all of | |
113 // the documents on the page. | |
114 | |
115 // Gets the accessibility object for this document. | |
116 WEBKIT_EXPORT WebAccessibilityObject accessibilityObject() const; | |
117 | |
118 // Gets the accessibility object for an object on this page by ID. | |
119 WEBKIT_EXPORT WebAccessibilityObject accessibilityObjectFromID(int axID) con
st; | |
120 // Inserts the given CSS source code as a user stylesheet in the document. | |
121 // Meant for programatic/one-off injection, as opposed to | |
122 // WebView::addUserStyleSheet which inserts styles for the lifetime of the | |
123 // WebView. | |
124 WEBKIT_EXPORT void insertUserStyleSheet(const WebString& sourceCode, UserSty
leLevel); | |
125 | |
126 WEBKIT_EXPORT WebVector<WebDraggableRegion> draggableRegions() const; | |
127 | |
128 #if WEBKIT_IMPLEMENTATION | |
129 WebDocument(const WTF::PassRefPtr<WebCore::Document>&); | |
130 WebDocument& operator=(const WTF::PassRefPtr<WebCore::Document>&); | |
131 operator WTF::PassRefPtr<WebCore::Document>() const; | |
132 #endif | |
133 }; | |
134 | |
135 } // namespace WebKit | |
136 | |
137 #endif | |
OLD | NEW |