1/*
2 * This file is part of the WebKit open source project.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20#include "config.h"
21#include "WebKitDOMHTMLTextAreaElement.h"
22
23#include <WebCore/CSSImportRule.h>
24#include "DOMObjectCache.h"
25#include <WebCore/DOMException.h>
26#include <WebCore/Document.h>
27#include "GObjectEventListener.h"
28#include <WebCore/HTMLNames.h>
29#include <WebCore/JSExecState.h>
30#include "WebKitDOMEventPrivate.h"
31#include "WebKitDOMEventTarget.h"
32#include "WebKitDOMHTMLFormElementPrivate.h"
33#include "WebKitDOMHTMLTextAreaElementPrivate.h"
34#include "WebKitDOMNodeListPrivate.h"
35#include "WebKitDOMNodePrivate.h"
36#include "WebKitDOMPrivate.h"
37#include "ConvertToUTF8String.h"
38#include <wtf/GetPtr.h>
39#include <wtf/RefPtr.h>
40
41G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
42
43namespace WebKit {
44
45WebKitDOMHTMLTextAreaElement* kit(WebCore::HTMLTextAreaElement* obj)
46{
47 return WEBKIT_DOM_HTML_TEXT_AREA_ELEMENT(kit(static_cast<WebCore::Node*>(obj)));
48}
49
50WebCore::HTMLTextAreaElement* core(WebKitDOMHTMLTextAreaElement* request)
51{
52 return request ? static_cast<WebCore::HTMLTextAreaElement*>(WEBKIT_DOM_OBJECT(request)->coreObject) : 0;
53}
54
55WebKitDOMHTMLTextAreaElement* wrapHTMLTextAreaElement(WebCore::HTMLTextAreaElement* coreObject)
56{
57 ASSERT(coreObject);
58 return WEBKIT_DOM_HTML_TEXT_AREA_ELEMENT(g_object_new(WEBKIT_DOM_TYPE_HTML_TEXT_AREA_ELEMENT, "core-object", coreObject, nullptr));
59}
60
61} // namespace WebKit
62
63static gboolean webkit_dom_html_text_area_element_dispatch_event(WebKitDOMEventTarget* target, WebKitDOMEvent* event, GError** error)
64{
65 WebCore::Event* coreEvent = WebKit::core(event);
66 if (!coreEvent)
67 return false;
68 WebCore::HTMLTextAreaElement* coreTarget = static_cast<WebCore::HTMLTextAreaElement*>(WEBKIT_DOM_OBJECT(target)->coreObject);
69
70 auto result = coreTarget->dispatchEventForBindings(*coreEvent);
71 if (result.hasException()) {
72 auto description = WebCore::DOMException::description(result.releaseException().code());
73 g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), description.legacyCode, description.name);
74 return false;
75 }
76 return result.releaseReturnValue();
77}
78
79static gboolean webkit_dom_html_text_area_element_add_event_listener(WebKitDOMEventTarget* target, const char* eventName, GClosure* handler, gboolean useCapture)
80{
81 WebCore::HTMLTextAreaElement* coreTarget = static_cast<WebCore::HTMLTextAreaElement*>(WEBKIT_DOM_OBJECT(target)->coreObject);
82 return WebKit::GObjectEventListener::addEventListener(G_OBJECT(target), coreTarget, eventName, handler, useCapture);
83}
84
85static gboolean webkit_dom_html_text_area_element_remove_event_listener(WebKitDOMEventTarget* target, const char* eventName, GClosure* handler, gboolean useCapture)
86{
87 WebCore::HTMLTextAreaElement* coreTarget = static_cast<WebCore::HTMLTextAreaElement*>(WEBKIT_DOM_OBJECT(target)->coreObject);
88 return WebKit::GObjectEventListener::removeEventListener(G_OBJECT(target), coreTarget, eventName, handler, useCapture);
89}
90
91static void webkit_dom_html_text_area_element_dom_event_target_init(WebKitDOMEventTargetIface* iface)
92{
93 iface->dispatch_event = webkit_dom_html_text_area_element_dispatch_event;
94 iface->add_event_listener = webkit_dom_html_text_area_element_add_event_listener;
95 iface->remove_event_listener = webkit_dom_html_text_area_element_remove_event_listener;
96}
97
98G_DEFINE_TYPE_WITH_CODE(WebKitDOMHTMLTextAreaElement, webkit_dom_html_text_area_element, WEBKIT_DOM_TYPE_HTML_ELEMENT, G_IMPLEMENT_INTERFACE(WEBKIT_DOM_TYPE_EVENT_TARGET, webkit_dom_html_text_area_element_dom_event_target_init))
99
100enum {
101 DOM_HTML_TEXT_AREA_ELEMENT_PROP_0,
102 DOM_HTML_TEXT_AREA_ELEMENT_PROP_AUTOFOCUS,
103 DOM_HTML_TEXT_AREA_ELEMENT_PROP_DISABLED,
104 DOM_HTML_TEXT_AREA_ELEMENT_PROP_FORM,
105 DOM_HTML_TEXT_AREA_ELEMENT_PROP_NAME,
106 DOM_HTML_TEXT_AREA_ELEMENT_PROP_READ_ONLY,
107 DOM_HTML_TEXT_AREA_ELEMENT_PROP_ROWS,
108 DOM_HTML_TEXT_AREA_ELEMENT_PROP_COLS,
109 DOM_HTML_TEXT_AREA_ELEMENT_PROP_TYPE,
110 DOM_HTML_TEXT_AREA_ELEMENT_PROP_DEFAULT_VALUE,
111 DOM_HTML_TEXT_AREA_ELEMENT_PROP_VALUE,
112 DOM_HTML_TEXT_AREA_ELEMENT_PROP_WILL_VALIDATE,
113 DOM_HTML_TEXT_AREA_ELEMENT_PROP_SELECTION_START,
114 DOM_HTML_TEXT_AREA_ELEMENT_PROP_SELECTION_END,
115};
116
117static void webkit_dom_html_text_area_element_set_property(GObject* object, guint propertyId, const GValue* value, GParamSpec* pspec)
118{
119 WebKitDOMHTMLTextAreaElement* self = WEBKIT_DOM_HTML_TEXT_AREA_ELEMENT(object);
120
121 switch (propertyId) {
122 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_AUTOFOCUS:
123 webkit_dom_html_text_area_element_set_autofocus(self, g_value_get_boolean(value));
124 break;
125 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_DISABLED:
126 webkit_dom_html_text_area_element_set_disabled(self, g_value_get_boolean(value));
127 break;
128 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_NAME:
129 webkit_dom_html_text_area_element_set_name(self, g_value_get_string(value));
130 break;
131 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_READ_ONLY:
132 webkit_dom_html_text_area_element_set_read_only(self, g_value_get_boolean(value));
133 break;
134 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_ROWS:
135 webkit_dom_html_text_area_element_set_rows(self, g_value_get_long(value));
136 break;
137 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_COLS:
138 webkit_dom_html_text_area_element_set_cols(self, g_value_get_long(value));
139 break;
140 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_DEFAULT_VALUE:
141 webkit_dom_html_text_area_element_set_default_value(self, g_value_get_string(value));
142 break;
143 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_VALUE:
144 webkit_dom_html_text_area_element_set_value(self, g_value_get_string(value));
145 break;
146 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_SELECTION_START:
147 webkit_dom_html_text_area_element_set_selection_start(self, g_value_get_long(value));
148 break;
149 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_SELECTION_END:
150 webkit_dom_html_text_area_element_set_selection_end(self, g_value_get_long(value));
151 break;
152 default:
153 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec);
154 break;
155 }
156}
157
158static void webkit_dom_html_text_area_element_get_property(GObject* object, guint propertyId, GValue* value, GParamSpec* pspec)
159{
160 WebKitDOMHTMLTextAreaElement* self = WEBKIT_DOM_HTML_TEXT_AREA_ELEMENT(object);
161
162 switch (propertyId) {
163 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_AUTOFOCUS:
164 g_value_set_boolean(value, webkit_dom_html_text_area_element_get_autofocus(self));
165 break;
166 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_DISABLED:
167 g_value_set_boolean(value, webkit_dom_html_text_area_element_get_disabled(self));
168 break;
169 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_FORM:
170 g_value_set_object(value, webkit_dom_html_text_area_element_get_form(self));
171 break;
172 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_NAME:
173 g_value_take_string(value, webkit_dom_html_text_area_element_get_name(self));
174 break;
175 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_READ_ONLY:
176 g_value_set_boolean(value, webkit_dom_html_text_area_element_get_read_only(self));
177 break;
178 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_ROWS:
179 g_value_set_long(value, webkit_dom_html_text_area_element_get_rows(self));
180 break;
181 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_COLS:
182 g_value_set_long(value, webkit_dom_html_text_area_element_get_cols(self));
183 break;
184 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_TYPE:
185 g_value_take_string(value, webkit_dom_html_text_area_element_get_area_type(self));
186 break;
187 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_DEFAULT_VALUE:
188 g_value_take_string(value, webkit_dom_html_text_area_element_get_default_value(self));
189 break;
190 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_VALUE:
191 g_value_take_string(value, webkit_dom_html_text_area_element_get_value(self));
192 break;
193 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_WILL_VALIDATE:
194 g_value_set_boolean(value, webkit_dom_html_text_area_element_get_will_validate(self));
195 break;
196 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_SELECTION_START:
197 g_value_set_long(value, webkit_dom_html_text_area_element_get_selection_start(self));
198 break;
199 case DOM_HTML_TEXT_AREA_ELEMENT_PROP_SELECTION_END:
200 g_value_set_long(value, webkit_dom_html_text_area_element_get_selection_end(self));
201 break;
202 default:
203 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec);
204 break;
205 }
206}
207
208static void webkit_dom_html_text_area_element_class_init(WebKitDOMHTMLTextAreaElementClass* requestClass)
209{
210 GObjectClass* gobjectClass = G_OBJECT_CLASS(requestClass);
211 gobjectClass->set_property = webkit_dom_html_text_area_element_set_property;
212 gobjectClass->get_property = webkit_dom_html_text_area_element_get_property;
213
214 g_object_class_install_property(
215 gobjectClass,
216 DOM_HTML_TEXT_AREA_ELEMENT_PROP_AUTOFOCUS,
217 g_param_spec_boolean(
218 "autofocus",
219 "HTMLTextAreaElement:autofocus",
220 "read-write gboolean HTMLTextAreaElement:autofocus",
221 FALSE,
222 WEBKIT_PARAM_READWRITE));
223
224 g_object_class_install_property(
225 gobjectClass,
226 DOM_HTML_TEXT_AREA_ELEMENT_PROP_DISABLED,
227 g_param_spec_boolean(
228 "disabled",
229 "HTMLTextAreaElement:disabled",
230 "read-write gboolean HTMLTextAreaElement:disabled",
231 FALSE,
232 WEBKIT_PARAM_READWRITE));
233
234 g_object_class_install_property(
235 gobjectClass,
236 DOM_HTML_TEXT_AREA_ELEMENT_PROP_FORM,
237 g_param_spec_object(
238 "form",
239 "HTMLTextAreaElement:form",
240 "read-only WebKitDOMHTMLFormElement* HTMLTextAreaElement:form",
241 WEBKIT_DOM_TYPE_HTML_FORM_ELEMENT,
242 WEBKIT_PARAM_READABLE));
243
244 g_object_class_install_property(
245 gobjectClass,
246 DOM_HTML_TEXT_AREA_ELEMENT_PROP_NAME,
247 g_param_spec_string(
248 "name",
249 "HTMLTextAreaElement:name",
250 "read-write gchar* HTMLTextAreaElement:name",
251 "",
252 WEBKIT_PARAM_READWRITE));
253
254 g_object_class_install_property(
255 gobjectClass,
256 DOM_HTML_TEXT_AREA_ELEMENT_PROP_READ_ONLY,
257 g_param_spec_boolean(
258 "read-only",
259 "HTMLTextAreaElement:read-only",
260 "read-write gboolean HTMLTextAreaElement:read-only",
261 FALSE,
262 WEBKIT_PARAM_READWRITE));
263
264 g_object_class_install_property(
265 gobjectClass,
266 DOM_HTML_TEXT_AREA_ELEMENT_PROP_ROWS,
267 g_param_spec_long(
268 "rows",
269 "HTMLTextAreaElement:rows",
270 "read-write glong HTMLTextAreaElement:rows",
271 G_MINLONG, G_MAXLONG, 0,
272 WEBKIT_PARAM_READWRITE));
273
274 g_object_class_install_property(
275 gobjectClass,
276 DOM_HTML_TEXT_AREA_ELEMENT_PROP_COLS,
277 g_param_spec_long(
278 "cols",
279 "HTMLTextAreaElement:cols",
280 "read-write glong HTMLTextAreaElement:cols",
281 G_MINLONG, G_MAXLONG, 0,
282 WEBKIT_PARAM_READWRITE));
283
284 g_object_class_install_property(
285 gobjectClass,
286 DOM_HTML_TEXT_AREA_ELEMENT_PROP_TYPE,
287 g_param_spec_string(
288 "type",
289 "HTMLTextAreaElement:type",
290 "read-only gchar* HTMLTextAreaElement:type",
291 "",
292 WEBKIT_PARAM_READABLE));
293
294 g_object_class_install_property(
295 gobjectClass,
296 DOM_HTML_TEXT_AREA_ELEMENT_PROP_DEFAULT_VALUE,
297 g_param_spec_string(
298 "default-value",
299 "HTMLTextAreaElement:default-value",
300 "read-write gchar* HTMLTextAreaElement:default-value",
301 "",
302 WEBKIT_PARAM_READWRITE));
303
304 g_object_class_install_property(
305 gobjectClass,
306 DOM_HTML_TEXT_AREA_ELEMENT_PROP_VALUE,
307 g_param_spec_string(
308 "value",
309 "HTMLTextAreaElement:value",
310 "read-write gchar* HTMLTextAreaElement:value",
311 "",
312 WEBKIT_PARAM_READWRITE));
313
314 g_object_class_install_property(
315 gobjectClass,
316 DOM_HTML_TEXT_AREA_ELEMENT_PROP_WILL_VALIDATE,
317 g_param_spec_boolean(
318 "will-validate",
319 "HTMLTextAreaElement:will-validate",
320 "read-only gboolean HTMLTextAreaElement:will-validate",
321 FALSE,
322 WEBKIT_PARAM_READABLE));
323
324 g_object_class_install_property(
325 gobjectClass,
326 DOM_HTML_TEXT_AREA_ELEMENT_PROP_SELECTION_START,
327 g_param_spec_long(
328 "selection-start",
329 "HTMLTextAreaElement:selection-start",
330 "read-write glong HTMLTextAreaElement:selection-start",
331 G_MINLONG, G_MAXLONG, 0,
332 WEBKIT_PARAM_READWRITE));
333
334 g_object_class_install_property(
335 gobjectClass,
336 DOM_HTML_TEXT_AREA_ELEMENT_PROP_SELECTION_END,
337 g_param_spec_long(
338 "selection-end",
339 "HTMLTextAreaElement:selection-end",
340 "read-write glong HTMLTextAreaElement:selection-end",
341 G_MINLONG, G_MAXLONG, 0,
342 WEBKIT_PARAM_READWRITE));
343}
344
345static void webkit_dom_html_text_area_element_init(WebKitDOMHTMLTextAreaElement* request)
346{
347 UNUSED_PARAM(request);
348}
349
350void webkit_dom_html_text_area_element_select(WebKitDOMHTMLTextAreaElement* self)
351{
352 WebCore::JSMainThreadNullState state;
353 g_return_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self));
354 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
355 item->select();
356}
357
358void webkit_dom_html_text_area_element_set_selection_range(WebKitDOMHTMLTextAreaElement* self, glong start, glong end, const gchar* direction)
359{
360 WebCore::JSMainThreadNullState state;
361 g_return_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self));
362 g_return_if_fail(direction);
363 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
364 WTF::String convertedDirection = WTF::String::fromUTF8(direction);
365 item->setSelectionRange(start, end, convertedDirection);
366}
367
368gboolean webkit_dom_html_text_area_element_get_autofocus(WebKitDOMHTMLTextAreaElement* self)
369{
370 WebCore::JSMainThreadNullState state;
371 g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self), FALSE);
372 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
373 gboolean result = item->hasAttributeWithoutSynchronization(WebCore::HTMLNames::autofocusAttr);
374 return result;
375}
376
377void webkit_dom_html_text_area_element_set_autofocus(WebKitDOMHTMLTextAreaElement* self, gboolean value)
378{
379 WebCore::JSMainThreadNullState state;
380 g_return_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self));
381 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
382 item->setBooleanAttribute(WebCore::HTMLNames::autofocusAttr, value);
383}
384
385gboolean webkit_dom_html_text_area_element_get_disabled(WebKitDOMHTMLTextAreaElement* self)
386{
387 WebCore::JSMainThreadNullState state;
388 g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self), FALSE);
389 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
390 gboolean result = item->hasAttributeWithoutSynchronization(WebCore::HTMLNames::disabledAttr);
391 return result;
392}
393
394void webkit_dom_html_text_area_element_set_disabled(WebKitDOMHTMLTextAreaElement* self, gboolean value)
395{
396 WebCore::JSMainThreadNullState state;
397 g_return_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self));
398 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
399 item->setBooleanAttribute(WebCore::HTMLNames::disabledAttr, value);
400}
401
402WebKitDOMHTMLFormElement* webkit_dom_html_text_area_element_get_form(WebKitDOMHTMLTextAreaElement* self)
403{
404 WebCore::JSMainThreadNullState state;
405 g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self), 0);
406 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
407 RefPtr<WebCore::HTMLFormElement> gobjectResult = WTF::getPtr(item->form());
408 return WebKit::kit(gobjectResult.get());
409}
410
411gchar* webkit_dom_html_text_area_element_get_name(WebKitDOMHTMLTextAreaElement* self)
412{
413 WebCore::JSMainThreadNullState state;
414 g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self), 0);
415 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
416 gchar* result = convertToUTF8String(item->getNameAttribute());
417 return result;
418}
419
420void webkit_dom_html_text_area_element_set_name(WebKitDOMHTMLTextAreaElement* self, const gchar* value)
421{
422 WebCore::JSMainThreadNullState state;
423 g_return_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self));
424 g_return_if_fail(value);
425 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
426 WTF::String convertedValue = WTF::String::fromUTF8(value);
427 item->setAttributeWithoutSynchronization(WebCore::HTMLNames::nameAttr, convertedValue);
428}
429
430gboolean webkit_dom_html_text_area_element_get_read_only(WebKitDOMHTMLTextAreaElement* self)
431{
432 WebCore::JSMainThreadNullState state;
433 g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self), FALSE);
434 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
435 gboolean result = item->hasAttributeWithoutSynchronization(WebCore::HTMLNames::readonlyAttr);
436 return result;
437}
438
439void webkit_dom_html_text_area_element_set_read_only(WebKitDOMHTMLTextAreaElement* self, gboolean value)
440{
441 WebCore::JSMainThreadNullState state;
442 g_return_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self));
443 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
444 item->setBooleanAttribute(WebCore::HTMLNames::readonlyAttr, value);
445}
446
447glong webkit_dom_html_text_area_element_get_rows(WebKitDOMHTMLTextAreaElement* self)
448{
449 WebCore::JSMainThreadNullState state;
450 g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self), 0);
451 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
452 glong result = item->rows();
453 return result;
454}
455
456void webkit_dom_html_text_area_element_set_rows(WebKitDOMHTMLTextAreaElement* self, glong value)
457{
458 WebCore::JSMainThreadNullState state;
459 g_return_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self));
460 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
461 item->setRows(value);
462}
463
464glong webkit_dom_html_text_area_element_get_cols(WebKitDOMHTMLTextAreaElement* self)
465{
466 WebCore::JSMainThreadNullState state;
467 g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self), 0);
468 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
469 glong result = item->cols();
470 return result;
471}
472
473void webkit_dom_html_text_area_element_set_cols(WebKitDOMHTMLTextAreaElement* self, glong value)
474{
475 WebCore::JSMainThreadNullState state;
476 g_return_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self));
477 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
478 item->setCols(value);
479}
480
481gchar* webkit_dom_html_text_area_element_get_area_type(WebKitDOMHTMLTextAreaElement* self)
482{
483 WebCore::JSMainThreadNullState state;
484 g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self), 0);
485 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
486 gchar* result = convertToUTF8String(item->type());
487 return result;
488}
489
490gchar* webkit_dom_html_text_area_element_get_default_value(WebKitDOMHTMLTextAreaElement* self)
491{
492 WebCore::JSMainThreadNullState state;
493 g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self), 0);
494 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
495 gchar* result = convertToUTF8String(item->defaultValue());
496 return result;
497}
498
499void webkit_dom_html_text_area_element_set_default_value(WebKitDOMHTMLTextAreaElement* self, const gchar* value)
500{
501 WebCore::JSMainThreadNullState state;
502 g_return_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self));
503 g_return_if_fail(value);
504 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
505 WTF::String convertedValue = WTF::String::fromUTF8(value);
506 item->setDefaultValue(convertedValue);
507}
508
509gchar* webkit_dom_html_text_area_element_get_value(WebKitDOMHTMLTextAreaElement* self)
510{
511 WebCore::JSMainThreadNullState state;
512 g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self), 0);
513 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
514 gchar* result = convertToUTF8String(item->value());
515 return result;
516}
517
518void webkit_dom_html_text_area_element_set_value(WebKitDOMHTMLTextAreaElement* self, const gchar* value)
519{
520 WebCore::JSMainThreadNullState state;
521 g_return_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self));
522 g_return_if_fail(value);
523 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
524 WTF::String convertedValue = WTF::String::fromUTF8(value);
525 item->setValue(convertedValue);
526}
527
528gboolean webkit_dom_html_text_area_element_get_will_validate(WebKitDOMHTMLTextAreaElement* self)
529{
530 WebCore::JSMainThreadNullState state;
531 g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self), FALSE);
532 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
533 gboolean result = item->willValidate();
534 return result;
535}
536
537glong webkit_dom_html_text_area_element_get_selection_start(WebKitDOMHTMLTextAreaElement* self)
538{
539 WebCore::JSMainThreadNullState state;
540 g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self), 0);
541 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
542 glong result = item->selectionStart();
543 return result;
544}
545
546void webkit_dom_html_text_area_element_set_selection_start(WebKitDOMHTMLTextAreaElement* self, glong value)
547{
548 WebCore::JSMainThreadNullState state;
549 g_return_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self));
550 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
551 item->setSelectionStart(value);
552}
553
554glong webkit_dom_html_text_area_element_get_selection_end(WebKitDOMHTMLTextAreaElement* self)
555{
556 WebCore::JSMainThreadNullState state;
557 g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self), 0);
558 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
559 glong result = item->selectionEnd();
560 return result;
561}
562
563void webkit_dom_html_text_area_element_set_selection_end(WebKitDOMHTMLTextAreaElement* self, glong value)
564{
565 WebCore::JSMainThreadNullState state;
566 g_return_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(self));
567 WebCore::HTMLTextAreaElement* item = WebKit::core(self);
568 item->setSelectionEnd(value);
569}
570
571gboolean webkit_dom_html_text_area_element_is_edited(WebKitDOMHTMLTextAreaElement* area)
572{
573 g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(area), FALSE);
574
575 return WebKit::core(area)->lastChangeWasUserEdit();
576}
577G_GNUC_END_IGNORE_DEPRECATIONS;
578