|
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 #include "config.h" |
|
32 #include "WebDocument.h" |
|
33 |
|
34 #include "Document.h" |
|
35 #include "Element.h" |
|
36 #include "HTMLAllCollection.h" |
|
37 #include "HTMLBodyElement.h" |
|
38 #include "HTMLCollection.h" |
|
39 #include "HTMLElement.h" |
|
40 #include "HTMLHeadElement.h" |
|
41 #include "NodeList.h" |
|
42 |
|
43 #include "WebElement.h" |
|
44 #include "WebFrameImpl.h" |
|
45 #include "WebNodeCollection.h" |
|
46 #include "WebNodeList.h" |
|
47 #include "WebURL.h" |
|
48 |
|
49 #include <wtf/PassRefPtr.h> |
|
50 |
|
51 using namespace WebCore; |
|
52 |
|
53 namespace WebKit { |
|
54 |
|
55 WebFrame* WebDocument::frame() const |
|
56 { |
|
57 return WebFrameImpl::fromFrame(constUnwrap<Document>()->frame()); |
|
58 } |
|
59 |
|
60 bool WebDocument::isHTMLDocument() const |
|
61 { |
|
62 return constUnwrap<Document>()->isHTMLDocument(); |
|
63 } |
|
64 |
|
65 bool WebDocument::isXHTMLDocument() const |
|
66 { |
|
67 return constUnwrap<Document>()->isXHTMLDocument(); |
|
68 } |
|
69 |
|
70 bool WebDocument::isPluginDocument() const |
|
71 { |
|
72 return constUnwrap<Document>()->isPluginDocument(); |
|
73 } |
|
74 |
|
75 WebURL WebDocument::baseURL() const |
|
76 { |
|
77 return constUnwrap<Document>()->baseURL(); |
|
78 } |
|
79 |
|
80 WebURL WebDocument::firstPartyForCookies() const |
|
81 { |
|
82 return constUnwrap<Document>()->firstPartyForCookies(); |
|
83 } |
|
84 |
|
85 WebElement WebDocument::documentElement() const |
|
86 { |
|
87 return WebElement(constUnwrap<Document>()->documentElement()); |
|
88 } |
|
89 |
|
90 WebElement WebDocument::body() const |
|
91 { |
|
92 return WebElement(constUnwrap<Document>()->body()); |
|
93 } |
|
94 |
|
95 WebElement WebDocument::head() |
|
96 { |
|
97 return WebElement(unwrap<Document>()->head()); |
|
98 } |
|
99 |
|
100 WebString WebDocument::title() const |
|
101 { |
|
102 return WebString(constUnwrap<Document>()->title()); |
|
103 } |
|
104 |
|
105 WebNodeCollection WebDocument::all() |
|
106 { |
|
107 return WebNodeCollection(unwrap<Document>()->all()); |
|
108 } |
|
109 |
|
110 WebURL WebDocument::completeURL(const WebString& partialURL) const |
|
111 { |
|
112 return constUnwrap<Document>()->completeURL(partialURL); |
|
113 } |
|
114 |
|
115 WebElement WebDocument::getElementById(const WebString& id) const |
|
116 { |
|
117 return WebElement(constUnwrap<Document>()->getElementById(id)); |
|
118 } |
|
119 |
|
120 WebNode WebDocument::focusedNode() const |
|
121 { |
|
122 return WebNode(constUnwrap<Document>()->focusedNode()); |
|
123 } |
|
124 |
|
125 WebDocument::WebDocument(const PassRefPtr<Document>& elem) |
|
126 : WebNode(elem) |
|
127 { |
|
128 } |
|
129 |
|
130 WebDocument& WebDocument::operator=(const PassRefPtr<Document>& elem) |
|
131 { |
|
132 m_private = elem; |
|
133 return *this; |
|
134 } |
|
135 |
|
136 WebDocument::operator PassRefPtr<Document>() const |
|
137 { |
|
138 return static_cast<Document*>(m_private.get()); |
|
139 } |
|
140 |
|
141 } // namespace WebKit |