Move URL from WebCore to WTF
[WebKit-https.git] / Source / WebKitLegacy / mac / DOM / DOMHTMLAnchorElement.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 "DOMHTMLAnchorElement.h"
27
28 #import "DOMNodeInternal.h"
29 #import "DOMPrivate.h"
30 #import "DOMTokenListInternal.h"
31 #import <WebCore/DOMTokenList.h>
32 #import "ExceptionHandlers.h"
33 #import <WebCore/HTMLAnchorElement.h>
34 #import <WebCore/HTMLNames.h>
35 #import <WebCore/JSExecState.h>
36 #import <WebCore/ThreadCheck.h>
37 #import <WebCore/WebScriptObjectPrivate.h>
38 #import <wtf/GetPtr.h>
39 #import <wtf/URL.h>
40
41 #define IMPL static_cast<WebCore::HTMLAnchorElement*>(reinterpret_cast<WebCore::Node*>(_internal))
42
43 @implementation DOMHTMLAnchorElement
44
45 - (NSString *)charset
46 {
47     WebCore::JSMainThreadNullState state;
48     return IMPL->getAttribute(WebCore::HTMLNames::charsetAttr);
49 }
50
51 - (void)setCharset:(NSString *)newCharset
52 {
53     WebCore::JSMainThreadNullState state;
54     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::charsetAttr, newCharset);
55 }
56
57 - (NSString *)coords
58 {
59     WebCore::JSMainThreadNullState state;
60     return IMPL->getAttribute(WebCore::HTMLNames::coordsAttr);
61 }
62
63 - (void)setCoords:(NSString *)newCoords
64 {
65     WebCore::JSMainThreadNullState state;
66     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::coordsAttr, newCoords);
67 }
68
69 #if ENABLE(DOWNLOAD_ATTRIBUTE)
70 - (NSString *)download
71 {
72     WebCore::JSMainThreadNullState state;
73     return IMPL->getAttribute(WebCore::HTMLNames::downloadAttr);
74 }
75
76 - (void)setDownload:(NSString *)newDownload
77 {
78     WebCore::JSMainThreadNullState state;
79     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::downloadAttr, newDownload);
80 }
81 #endif
82
83 - (NSString *)hreflang
84 {
85     WebCore::JSMainThreadNullState state;
86     return IMPL->getAttribute(WebCore::HTMLNames::hreflangAttr);
87 }
88
89 - (void)setHreflang:(NSString *)newHreflang
90 {
91     WebCore::JSMainThreadNullState state;
92     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::hreflangAttr, newHreflang);
93 }
94
95 - (NSString *)name
96 {
97     WebCore::JSMainThreadNullState state;
98     return IMPL->getNameAttribute();
99 }
100
101 - (void)setName:(NSString *)newName
102 {
103     WebCore::JSMainThreadNullState state;
104     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::nameAttr, newName);
105 }
106
107 - (NSString *)ping
108 {
109     WebCore::JSMainThreadNullState state;
110     return IMPL->getAttribute(WebCore::HTMLNames::pingAttr);
111 }
112
113 - (void)setPing:(NSString *)newPing
114 {
115     WebCore::JSMainThreadNullState state;
116     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::pingAttr, newPing);
117 }
118
119 - (NSString *)rel
120 {
121     WebCore::JSMainThreadNullState state;
122     return IMPL->getAttribute(WebCore::HTMLNames::relAttr);
123 }
124
125 - (void)setRel:(NSString *)newRel
126 {
127     WebCore::JSMainThreadNullState state;
128     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::relAttr, newRel);
129 }
130
131 - (NSString *)rev
132 {
133     WebCore::JSMainThreadNullState state;
134     return IMPL->getAttribute(WebCore::HTMLNames::revAttr);
135 }
136
137 - (void)setRev:(NSString *)newRev
138 {
139     WebCore::JSMainThreadNullState state;
140     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::revAttr, newRev);
141 }
142
143 - (NSString *)shape
144 {
145     WebCore::JSMainThreadNullState state;
146     return IMPL->getAttribute(WebCore::HTMLNames::shapeAttr);
147 }
148
149 - (void)setShape:(NSString *)newShape
150 {
151     WebCore::JSMainThreadNullState state;
152     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::shapeAttr, newShape);
153 }
154
155 - (NSString *)target
156 {
157     WebCore::JSMainThreadNullState state;
158     return IMPL->getAttribute(WebCore::HTMLNames::targetAttr);
159 }
160
161 - (void)setTarget:(NSString *)newTarget
162 {
163     WebCore::JSMainThreadNullState state;
164     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::targetAttr, newTarget);
165 }
166
167 - (NSString *)type
168 {
169     WebCore::JSMainThreadNullState state;
170     return IMPL->getAttribute(WebCore::HTMLNames::typeAttr);
171 }
172
173 - (void)setType:(NSString *)newType
174 {
175     WebCore::JSMainThreadNullState state;
176     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::typeAttr, newType);
177 }
178
179 - (NSString *)accessKey
180 {
181     WebCore::JSMainThreadNullState state;
182     return IMPL->getAttribute(WebCore::HTMLNames::accesskeyAttr);
183 }
184
185 - (void)setAccessKey:(NSString *)newAccessKey
186 {
187     WebCore::JSMainThreadNullState state;
188     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::accesskeyAttr, newAccessKey);
189 }
190
191 - (NSString *)text
192 {
193     WebCore::JSMainThreadNullState state;
194     return IMPL->text();
195 }
196
197 - (NSURL *)absoluteLinkURL
198 {
199     WebCore::JSMainThreadNullState state;
200     return [self _getURLAttribute:@"href"];
201 }
202
203 - (DOMTokenList *)relList
204 {
205     WebCore::JSMainThreadNullState state;
206     return kit(WTF::getPtr(IMPL->relList()));
207 }
208
209 - (NSString *)href
210 {
211     WebCore::JSMainThreadNullState state;
212     return IMPL->getURLAttribute(WebCore::HTMLNames::hrefAttr);
213 }
214
215 - (void)setHref:(NSString *)newHref
216 {
217     WebCore::JSMainThreadNullState state;
218     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::hrefAttr, newHref);
219 }
220
221 - (NSString *)origin
222 {
223     WebCore::JSMainThreadNullState state;
224     return IMPL->origin();
225 }
226
227 - (NSString *)protocol
228 {
229     WebCore::JSMainThreadNullState state;
230     return IMPL->protocol();
231 }
232
233 - (NSString *)host
234 {
235     WebCore::JSMainThreadNullState state;
236     return IMPL->host();
237 }
238
239 - (NSString *)hostname
240 {
241     WebCore::JSMainThreadNullState state;
242     return IMPL->hostname();
243 }
244
245 - (NSString *)port
246 {
247     WebCore::JSMainThreadNullState state;
248     return IMPL->port();
249 }
250
251 - (NSString *)pathname
252 {
253     WebCore::JSMainThreadNullState state;
254     return IMPL->pathname();
255 }
256
257 - (NSString *)search
258 {
259     WebCore::JSMainThreadNullState state;
260     return IMPL->search();
261 }
262
263 - (NSString *)hashName
264 {
265     WebCore::JSMainThreadNullState state;
266     return IMPL->hash();
267 }
268
269 @end