Move URL from WebCore to WTF
[WebKit-https.git] / Source / WebKitLegacy / mac / DOM / DOMHTMLButtonElement.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 "DOMHTMLButtonElement.h"
27
28 #import "DOMHTMLFormElementInternal.h"
29 #import "DOMNodeInternal.h"
30 #import "DOMNodeListInternal.h"
31 #import "ExceptionHandlers.h"
32 #import <WebCore/HTMLButtonElement.h>
33 #import <WebCore/HTMLFormElement.h>
34 #import <WebCore/HTMLNames.h>
35 #import <WebCore/JSExecState.h>
36 #import <WebCore/NameNodeList.h>
37 #import <WebCore/NodeList.h>
38 #import <WebCore/ThreadCheck.h>
39 #import <WebCore/WebScriptObjectPrivate.h>
40 #import <wtf/GetPtr.h>
41 #import <wtf/URL.h>
42
43 #define IMPL static_cast<WebCore::HTMLButtonElement*>(reinterpret_cast<WebCore::Node*>(_internal))
44
45 @implementation DOMHTMLButtonElement
46
47 - (BOOL)autofocus
48 {
49     WebCore::JSMainThreadNullState state;
50     return IMPL->hasAttributeWithoutSynchronization(WebCore::HTMLNames::autofocusAttr);
51 }
52
53 - (void)setAutofocus:(BOOL)newAutofocus
54 {
55     WebCore::JSMainThreadNullState state;
56     IMPL->setBooleanAttribute(WebCore::HTMLNames::autofocusAttr, newAutofocus);
57 }
58
59 - (BOOL)disabled
60 {
61     WebCore::JSMainThreadNullState state;
62     return IMPL->hasAttributeWithoutSynchronization(WebCore::HTMLNames::disabledAttr);
63 }
64
65 - (void)setDisabled:(BOOL)newDisabled
66 {
67     WebCore::JSMainThreadNullState state;
68     IMPL->setBooleanAttribute(WebCore::HTMLNames::disabledAttr, newDisabled);
69 }
70
71 - (DOMHTMLFormElement *)form
72 {
73     WebCore::JSMainThreadNullState state;
74     return kit(WTF::getPtr(IMPL->form()));
75 }
76
77 - (NSString *)type
78 {
79     WebCore::JSMainThreadNullState state;
80     return IMPL->type();
81 }
82
83 - (void)setType:(NSString *)newType
84 {
85     WebCore::JSMainThreadNullState state;
86     IMPL->setType(newType);
87 }
88
89 - (NSString *)name
90 {
91     WebCore::JSMainThreadNullState state;
92     return IMPL->getNameAttribute();
93 }
94
95 - (void)setName:(NSString *)newName
96 {
97     WebCore::JSMainThreadNullState state;
98     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::nameAttr, newName);
99 }
100
101 - (NSString *)value
102 {
103     WebCore::JSMainThreadNullState state;
104     return IMPL->getAttribute(WebCore::HTMLNames::valueAttr);
105 }
106
107 - (void)setValue:(NSString *)newValue
108 {
109     WebCore::JSMainThreadNullState state;
110     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::valueAttr, newValue);
111 }
112
113 - (BOOL)willValidate
114 {
115     WebCore::JSMainThreadNullState state;
116     return IMPL->willValidate();
117 }
118
119 - (NSString *)accessKey
120 {
121     WebCore::JSMainThreadNullState state;
122     return IMPL->getAttribute(WebCore::HTMLNames::accesskeyAttr);
123 }
124
125 - (void)setAccessKey:(NSString *)newAccessKey
126 {
127     WebCore::JSMainThreadNullState state;
128     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::accesskeyAttr, newAccessKey);
129 }
130
131 - (void)click
132 {
133     WebCore::JSMainThreadNullState state;
134     IMPL->click();
135 }
136
137 @end