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 #include "sky/engine/public/web/WebDocument.h" | |
32 | |
33 #include "sky/engine/bindings/exception_state.h" | |
34 #include "sky/engine/core/animation/AnimationTimeline.h" | |
35 #include "sky/engine/core/css/StyleSheetContents.h" | |
36 #include "sky/engine/core/dom/Document.h" | |
37 #include "sky/engine/core/dom/Element.h" | |
38 #include "sky/engine/core/dom/StyleEngine.h" | |
39 #include "sky/engine/core/events/Event.h" | |
40 #include "sky/engine/core/html/HTMLElement.h" | |
41 #include "sky/engine/core/rendering/RenderObject.h" | |
42 #include "sky/engine/core/rendering/RenderView.h" | |
43 #include "sky/engine/public/platform/WebURL.h" | |
44 #include "sky/engine/public/web/WebElement.h" | |
45 #include "sky/engine/web/WebLocalFrameImpl.h" | |
46 #include "sky/engine/wtf/PassRefPtr.h" | |
47 | |
48 namespace blink { | |
49 | |
50 WebURL WebDocument::url() const | |
51 { | |
52 return constUnwrap<Document>()->url(); | |
53 } | |
54 | |
55 WebString WebDocument::encoding() const | |
56 { | |
57 return constUnwrap<Document>()->encodingName(); | |
58 } | |
59 | |
60 WebString WebDocument::contentLanguage() const | |
61 { | |
62 return constUnwrap<Document>()->contentLanguage(); | |
63 } | |
64 | |
65 WebString WebDocument::referrer() const | |
66 { | |
67 return constUnwrap<Document>()->referrer(); | |
68 } | |
69 | |
70 WebURL WebDocument::openSearchDescriptionURL() const | |
71 { | |
72 return const_cast<Document*>(constUnwrap<Document>())->openSearchDescription
URL(); | |
73 } | |
74 | |
75 WebLocalFrame* WebDocument::frame() const | |
76 { | |
77 return WebLocalFrameImpl::fromFrame(constUnwrap<Document>()->frame()); | |
78 } | |
79 | |
80 WebString WebDocument::title() const | |
81 { | |
82 return WebString(constUnwrap<Document>()->title()); | |
83 } | |
84 | |
85 WebURL WebDocument::completeURL(const WebString& partialURL) const | |
86 { | |
87 return constUnwrap<Document>()->completeURL(partialURL); | |
88 } | |
89 | |
90 WebElement WebDocument::getElementById(const WebString& id) const | |
91 { | |
92 return WebElement(constUnwrap<Document>()->getElementById(id)); | |
93 } | |
94 | |
95 WebElement WebDocument::focusedElement() const | |
96 { | |
97 return WebElement(constUnwrap<Document>()->focusedElement()); | |
98 } | |
99 | |
100 WebReferrerPolicy WebDocument::referrerPolicy() const | |
101 { | |
102 return static_cast<WebReferrerPolicy>(constUnwrap<Document>()->referrerPolic
y()); | |
103 } | |
104 | |
105 WebElement WebDocument::createElement(const WebString& tagName) | |
106 { | |
107 TrackExceptionState exceptionState; | |
108 WebElement element(unwrap<Document>()->createElement(tagName, exceptionState
)); | |
109 if (exceptionState.had_exception()) | |
110 return WebElement(); | |
111 return element; | |
112 } | |
113 | |
114 WebDocument::WebDocument(const PassRefPtr<Document>& elem) | |
115 : WebNode(elem) | |
116 { | |
117 } | |
118 | |
119 WebDocument& WebDocument::operator=(const PassRefPtr<Document>& elem) | |
120 { | |
121 m_private = elem; | |
122 return *this; | |
123 } | |
124 | |
125 WebDocument::operator PassRefPtr<Document>() const | |
126 { | |
127 return toDocument(m_private.get()); | |
128 } | |
129 | |
130 } // namespace blink | |
OLD | NEW |