2 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #include "WebDraggableRegion.h"
35 #include "WebExceptionCode.h"
38 #include "public/platform/WebReferrerPolicy.h"
39 #include "public/platform/WebSecurityOrigin.h"
40 #include "public/platform/WebVector.h"
42 #if BLINK_IMPLEMENTATION
43 namespace WTF
{ template <typename T
> class PassRefPtr
; }
48 template <class T
> class Local
;
56 class WebDocumentType
;
59 class WebElementCollection
;
63 // Provides readonly access to some properties of a DOM document.
64 class WebDocument
: public WebNode
{
67 WebDocument(const WebDocument
& e
) : WebNode(e
) { }
69 WebDocument
& operator=(const WebDocument
& e
)
74 void assign(const WebDocument
& e
) { WebNode::assign(e
); }
76 BLINK_EXPORT WebURL
url() const;
77 // Note: Security checks should use the securityOrigin(), not url().
78 BLINK_EXPORT WebSecurityOrigin
securityOrigin() const;
79 BLINK_EXPORT
bool isPrivilegedContext(WebString
& errorMessage
) const;
81 BLINK_EXPORT WebString
encoding() const;
82 BLINK_EXPORT WebString
contentLanguage() const;
83 BLINK_EXPORT WebString
referrer() const;
84 BLINK_EXPORT WebColor
themeColor() const;
85 // The url of the OpenSearch Desription Document (if any).
86 BLINK_EXPORT WebURL
openSearchDescriptionURL() const;
88 // Returns the frame the document belongs to or 0 if the document is frameless.
89 BLINK_EXPORT WebLocalFrame
* frame() const;
90 BLINK_EXPORT
bool isHTMLDocument() const;
91 BLINK_EXPORT
bool isXHTMLDocument() const;
92 BLINK_EXPORT
bool isPluginDocument() const;
93 BLINK_EXPORT WebURL
baseURL() const;
95 // The firstPartyForCookies is used to compute whether this document
96 // appears in a "third-party" context for the purpose of third-party
98 BLINK_EXPORT WebURL
firstPartyForCookies() const;
100 BLINK_EXPORT WebElement
documentElement() const;
101 BLINK_EXPORT WebElement
body() const;
102 BLINK_EXPORT WebElement
head();
103 BLINK_EXPORT WebString
title() const;
104 BLINK_EXPORT WebString
contentAsTextForTesting() const;
105 BLINK_EXPORT WebElementCollection
all();
106 BLINK_EXPORT
void forms(WebVector
<WebFormElement
>&) const;
107 BLINK_EXPORT WebURL
completeURL(const WebString
&) const;
108 BLINK_EXPORT WebElement
getElementById(const WebString
&) const;
109 BLINK_EXPORT WebElement
focusedElement() const;
110 BLINK_EXPORT WebDocumentType
doctype() const;
111 BLINK_EXPORT
void cancelFullScreen();
112 BLINK_EXPORT WebElement
fullScreenElement() const;
113 BLINK_EXPORT WebDOMEvent
createEvent(const WebString
& eventType
);
114 BLINK_EXPORT WebReferrerPolicy
referrerPolicy() const;
115 BLINK_EXPORT WebString
outgoingReferrer();
117 // Accessibility support. These methods should only be called on the
118 // top-level document, because one accessibility cache spans all of
119 // the documents on the page.
121 // Gets the accessibility object for this document.
122 BLINK_EXPORT WebAXObject
accessibilityObject() const;
124 // Gets the accessibility object for an object on this page by ID.
125 BLINK_EXPORT WebAXObject
accessibilityObjectFromID(int axID
) const;
126 // Inserts the given CSS source code as a stylesheet in the document.
127 BLINK_EXPORT
void insertStyleSheet(const WebString
& sourceCode
);
129 // Arranges to call WebFrameClient::didMatchCSS(frame(), ...) when one of
130 // the selectors matches or stops matching an element in this document.
131 // Each call to this method overrides any previous calls.
132 BLINK_EXPORT
void watchCSSSelectors(const WebVector
<WebString
>& selectors
);
134 BLINK_EXPORT WebVector
<WebDraggableRegion
> draggableRegions() const;
136 BLINK_EXPORT
v8::Local
<v8::Value
> registerEmbedderCustomElement(const WebString
& name
, v8::Local
<v8::Value
> options
, WebExceptionCode
&);
138 BLINK_EXPORT WebURL
manifestURL() const;
139 BLINK_EXPORT
bool manifestUseCredentials() const;
141 #if BLINK_IMPLEMENTATION
142 WebDocument(const PassRefPtrWillBeRawPtr
<Document
>&);
143 WebDocument
& operator=(const PassRefPtrWillBeRawPtr
<Document
>&);
144 operator PassRefPtrWillBeRawPtr
<Document
>() const;