Move URL from WebCore to WTF
[WebKit-https.git] / Source / WebKitLegacy / mac / DOM / DOMHTMLObjectElement.mm
1 /*
2  * Copyright (C) 2004-2016 Apple 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
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #import "DOMHTMLObjectElement.h"
27
28 #import "DOMDocumentInternal.h"
29 #import "DOMHTMLFormElementInternal.h"
30 #import "DOMNodeInternal.h"
31 #import "DOMPrivate.h"
32 #import <WebCore/Document.h>
33 #import "ExceptionHandlers.h"
34 #import <WebCore/HTMLFormElement.h>
35 #import <WebCore/HTMLNames.h>
36 #import <WebCore/HTMLObjectElement.h>
37 #import <WebCore/JSExecState.h>
38 #import <WebCore/RenderElement.h>
39 #import <WebCore/ThreadCheck.h>
40 #import <WebCore/WebScriptObjectPrivate.h>
41 #import <wtf/GetPtr.h>
42 #import <wtf/URL.h>
43
44 #define IMPL static_cast<WebCore::HTMLObjectElement*>(reinterpret_cast<WebCore::Node*>(_internal))
45
46 @implementation DOMHTMLObjectElement
47
48 - (DOMHTMLFormElement *)form
49 {
50     WebCore::JSMainThreadNullState state;
51     return kit(WTF::getPtr(IMPL->form()));
52 }
53
54 - (NSString *)code
55 {
56     WebCore::JSMainThreadNullState state;
57     return IMPL->getAttribute(WebCore::HTMLNames::codeAttr);
58 }
59
60 - (void)setCode:(NSString *)newCode
61 {
62     WebCore::JSMainThreadNullState state;
63     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::codeAttr, newCode);
64 }
65
66 - (NSString *)align
67 {
68     WebCore::JSMainThreadNullState state;
69     return IMPL->getAttribute(WebCore::HTMLNames::alignAttr);
70 }
71
72 - (void)setAlign:(NSString *)newAlign
73 {
74     WebCore::JSMainThreadNullState state;
75     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::alignAttr, newAlign);
76 }
77
78 - (NSString *)archive
79 {
80     WebCore::JSMainThreadNullState state;
81     return IMPL->getAttribute(WebCore::HTMLNames::archiveAttr);
82 }
83
84 - (void)setArchive:(NSString *)newArchive
85 {
86     WebCore::JSMainThreadNullState state;
87     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::archiveAttr, newArchive);
88 }
89
90 - (NSString *)border
91 {
92     WebCore::JSMainThreadNullState state;
93     return IMPL->getAttribute(WebCore::HTMLNames::borderAttr);
94 }
95
96 - (void)setBorder:(NSString *)newBorder
97 {
98     WebCore::JSMainThreadNullState state;
99     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::borderAttr, newBorder);
100 }
101
102 - (NSString *)codeBase
103 {
104     WebCore::JSMainThreadNullState state;
105     return IMPL->getAttribute(WebCore::HTMLNames::codebaseAttr);
106 }
107
108 - (void)setCodeBase:(NSString *)newCodeBase
109 {
110     WebCore::JSMainThreadNullState state;
111     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::codebaseAttr, newCodeBase);
112 }
113
114 - (NSString *)codeType
115 {
116     WebCore::JSMainThreadNullState state;
117     return IMPL->getAttribute(WebCore::HTMLNames::codetypeAttr);
118 }
119
120 - (void)setCodeType:(NSString *)newCodeType
121 {
122     WebCore::JSMainThreadNullState state;
123     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::codetypeAttr, newCodeType);
124 }
125
126 - (NSString *)data
127 {
128     WebCore::JSMainThreadNullState state;
129     return IMPL->getURLAttribute(WebCore::HTMLNames::dataAttr);
130 }
131
132 - (void)setData:(NSString *)newData
133 {
134     WebCore::JSMainThreadNullState state;
135     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::dataAttr, newData);
136 }
137
138 - (BOOL)declare
139 {
140     WebCore::JSMainThreadNullState state;
141     return IMPL->hasAttributeWithoutSynchronization(WebCore::HTMLNames::declareAttr);
142 }
143
144 - (void)setDeclare:(BOOL)newDeclare
145 {
146     WebCore::JSMainThreadNullState state;
147     IMPL->setBooleanAttribute(WebCore::HTMLNames::declareAttr, newDeclare);
148 }
149
150 - (NSString *)height
151 {
152     WebCore::JSMainThreadNullState state;
153     return IMPL->getAttribute(WebCore::HTMLNames::heightAttr);
154 }
155
156 - (void)setHeight:(NSString *)newHeight
157 {
158     WebCore::JSMainThreadNullState state;
159     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::heightAttr, newHeight);
160 }
161
162 - (int)hspace
163 {
164     WebCore::JSMainThreadNullState state;
165     return IMPL->getIntegralAttribute(WebCore::HTMLNames::hspaceAttr);
166 }
167
168 - (void)setHspace:(int)newHspace
169 {
170     WebCore::JSMainThreadNullState state;
171     IMPL->setIntegralAttribute(WebCore::HTMLNames::hspaceAttr, newHspace);
172 }
173
174 - (NSString *)name
175 {
176     WebCore::JSMainThreadNullState state;
177     return IMPL->getNameAttribute();
178 }
179
180 - (void)setName:(NSString *)newName
181 {
182     WebCore::JSMainThreadNullState state;
183     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::nameAttr, newName);
184 }
185
186 - (NSString *)standby
187 {
188     WebCore::JSMainThreadNullState state;
189     return IMPL->getAttribute(WebCore::HTMLNames::standbyAttr);
190 }
191
192 - (void)setStandby:(NSString *)newStandby
193 {
194     WebCore::JSMainThreadNullState state;
195     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::standbyAttr, newStandby);
196 }
197
198 - (NSString *)type
199 {
200     WebCore::JSMainThreadNullState state;
201     return IMPL->getAttribute(WebCore::HTMLNames::typeAttr);
202 }
203
204 - (void)setType:(NSString *)newType
205 {
206     WebCore::JSMainThreadNullState state;
207     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::typeAttr, newType);
208 }
209
210 - (NSString *)useMap
211 {
212     WebCore::JSMainThreadNullState state;
213     return IMPL->getAttribute(WebCore::HTMLNames::usemapAttr);
214 }
215
216 - (void)setUseMap:(NSString *)newUseMap
217 {
218     WebCore::JSMainThreadNullState state;
219     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::usemapAttr, newUseMap);
220 }
221
222 - (int)vspace
223 {
224     WebCore::JSMainThreadNullState state;
225     return IMPL->getIntegralAttribute(WebCore::HTMLNames::vspaceAttr);
226 }
227
228 - (void)setVspace:(int)newVspace
229 {
230     WebCore::JSMainThreadNullState state;
231     IMPL->setIntegralAttribute(WebCore::HTMLNames::vspaceAttr, newVspace);
232 }
233
234 - (NSString *)width
235 {
236     WebCore::JSMainThreadNullState state;
237     return IMPL->getAttribute(WebCore::HTMLNames::widthAttr);
238 }
239
240 - (void)setWidth:(NSString *)newWidth
241 {
242     WebCore::JSMainThreadNullState state;
243     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::widthAttr, newWidth);
244 }
245
246 - (DOMDocument *)contentDocument
247 {
248     WebCore::JSMainThreadNullState state;
249     return kit(WTF::getPtr(IMPL->contentDocument()));
250 }
251
252 - (NSURL *)absoluteImageURL
253 {
254     WebCore::JSMainThreadNullState state;
255     if (!IMPL->renderer() || !IMPL->renderer()->isImage())
256         return nil;
257     return [self _getURLAttribute:@"data"];
258 }
259
260 @end