File: WebKitDOMTestInterface.cpp

package info (click to toggle)
qtwebkit 2.3.4.dfsg-9.1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 290,564 kB
  • ctags: 273,642
  • sloc: cpp: 1,417,509; python: 85,048; ansic: 39,357; perl: 38,862; ruby: 10,313; objc: 9,505; xml: 8,679; asm: 3,864; yacc: 2,458; sh: 1,237; lex: 813; makefile: 592; java: 228; php: 79
file content (420 lines) | stat: -rw-r--r-- 16,543 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
/*
    This file is part of the WebKit open source project.
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/

#include "config.h"
#include "WebKitDOMTestInterface.h"

#include "DOMObjectCache.h"
#include "ExceptionCode.h"
#include "JSMainThreadExecState.h"
#include "TestSupplemental.h"
#include "WebKitDOMBinding.h"
#include "WebKitDOMNodePrivate.h"
#include "WebKitDOMTestInterfacePrivate.h"
#include "WebKitDOMTestObjPrivate.h"
#include "gobject/ConvertToUTF8String.h"
#include "webkitglobalsprivate.h"
#include <wtf/GetPtr.h>
#include <wtf/RefPtr.h>

#if ENABLE(Condition1) || ENABLE(Condition2)

namespace WebKit {

WebKitDOMTestInterface* kit(WebCore::TestInterface* obj)
{
    g_return_val_if_fail(obj, 0);

    if (gpointer ret = DOMObjectCache::get(obj))
        return static_cast<WebKitDOMTestInterface*>(ret);

    return static_cast<WebKitDOMTestInterface*>(DOMObjectCache::put(obj, WebKit::wrapTestInterface(obj)));
}

WebCore::TestInterface* core(WebKitDOMTestInterface* request)
{
    g_return_val_if_fail(request, 0);

    WebCore::TestInterface* coreObject = static_cast<WebCore::TestInterface*>(WEBKIT_DOM_OBJECT(request)->coreObject);
    g_return_val_if_fail(coreObject, 0);

    return coreObject;
}

WebKitDOMTestInterface* wrapTestInterface(WebCore::TestInterface* coreObject)
{
    g_return_val_if_fail(coreObject, 0);

    // We call ref() rather than using a C++ smart pointer because we can't store a C++ object
    // in a C-allocated GObject structure. See the finalize() code for the matching deref().
    coreObject->ref();

    return WEBKIT_DOM_TEST_INTERFACE(g_object_new(WEBKIT_TYPE_DOM_TEST_INTERFACE, "core-object", coreObject, NULL));
}

} // namespace WebKit

#endif // ENABLE(Condition1) || ENABLE(Condition2)

G_DEFINE_TYPE(WebKitDOMTestInterface, webkit_dom_test_interface, WEBKIT_TYPE_DOM_OBJECT)

enum {
    PROP_0,
    PROP_SUPPLEMENTAL_STR1,
    PROP_SUPPLEMENTAL_STR2,
    PROP_SUPPLEMENTAL_NODE,
};

static void webkit_dom_test_interface_finalize(GObject* object)
{
#if ENABLE(Condition1) || ENABLE(Condition2)
    WebKitDOMObject* domObject = WEBKIT_DOM_OBJECT(object);
    
    if (domObject->coreObject) {
        WebCore::TestInterface* coreObject = static_cast<WebCore::TestInterface*>(domObject->coreObject);

        WebKit::DOMObjectCache::forget(coreObject);
        coreObject->deref();

        domObject->coreObject = 0;
    }
#endif // ENABLE(Condition1) || ENABLE(Condition2)

    G_OBJECT_CLASS(webkit_dom_test_interface_parent_class)->finalize(object);
}

static void webkit_dom_test_interface_set_property(GObject* object, guint propertyId, const GValue* value, GParamSpec* pspec)
{
    WebCore::JSMainThreadNullState state;
#if ENABLE(Condition1) || ENABLE(Condition2)
    WebKitDOMTestInterface* self = WEBKIT_DOM_TEST_INTERFACE(object);
    WebCore::TestInterface* coreSelf = WebKit::core(self);
#endif // ENABLE(Condition1) || ENABLE(Condition2)
    switch (propertyId) {
    case PROP_SUPPLEMENTAL_STR2: {
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
        WebCore::TestSupplemental::setSupplementalStr2(coreSelf, WTF::String::fromUTF8(g_value_get_string(value)));
#else
        WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
        WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
#endif /* ENABLE(Condition11) || ENABLE(Condition12) */
#else
        WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
        WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
#endif /* ENABLE(Condition1) || ENABLE(Condition2) */
        break;
    }
    default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec);
        break;
    }
}


static void webkit_dom_test_interface_get_property(GObject* object, guint propertyId, GValue* value, GParamSpec* pspec)
{
    WebCore::JSMainThreadNullState state;
#if ENABLE(Condition1) || ENABLE(Condition2)
    WebKitDOMTestInterface* self = WEBKIT_DOM_TEST_INTERFACE(object);
    WebCore::TestInterface* coreSelf = WebKit::core(self);
#endif // ENABLE(Condition1) || ENABLE(Condition2)
    switch (propertyId) {
    case PROP_SUPPLEMENTAL_STR1: {
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
        g_value_take_string(value, convertToUTF8String(WebCore::TestSupplemental::supplementalStr1(coreSelf)));
#else
        WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
        WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
#endif /* ENABLE(Condition11) || ENABLE(Condition12) */
#else
        WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
        WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
#endif /* ENABLE(Condition1) || ENABLE(Condition2) */
        break;
    }
    case PROP_SUPPLEMENTAL_STR2: {
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
        g_value_take_string(value, convertToUTF8String(WebCore::TestSupplemental::supplementalStr2(coreSelf)));
#else
        WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
        WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
#endif /* ENABLE(Condition11) || ENABLE(Condition12) */
#else
        WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
        WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
#endif /* ENABLE(Condition1) || ENABLE(Condition2) */
        break;
    }
    case PROP_SUPPLEMENTAL_NODE: {
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
        RefPtr<WebCore::Node> ptr = WebCore::TestSupplemental::supplementalNode(coreSelf);
        g_value_set_object(value, WebKit::kit(ptr.get()));
#else
        WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
        WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
#endif /* ENABLE(Condition11) || ENABLE(Condition12) */
#else
        WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
        WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
#endif /* ENABLE(Condition1) || ENABLE(Condition2) */
        break;
    }
    default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec);
        break;
    }
}


static void webkit_dom_test_interface_constructed(GObject* object)
{

    if (G_OBJECT_CLASS(webkit_dom_test_interface_parent_class)->constructed)
        G_OBJECT_CLASS(webkit_dom_test_interface_parent_class)->constructed(object);
}

static void webkit_dom_test_interface_class_init(WebKitDOMTestInterfaceClass* requestClass)
{
    GObjectClass* gobjectClass = G_OBJECT_CLASS(requestClass);
    gobjectClass->finalize = webkit_dom_test_interface_finalize;
    gobjectClass->set_property = webkit_dom_test_interface_set_property;
    gobjectClass->get_property = webkit_dom_test_interface_get_property;
    gobjectClass->constructed = webkit_dom_test_interface_constructed;

    g_object_class_install_property(gobjectClass,
                                    PROP_SUPPLEMENTAL_STR1,
                                    g_param_spec_string("supplemental-str1", /* name */
                                                           "test_interface_supplemental-str1", /* short description */
                                                           "read-only  gchar* TestInterface.supplemental-str1", /* longer - could do with some extra doc stuff here */
                                                           "", /* default */
                                                           WEBKIT_PARAM_READABLE));
    g_object_class_install_property(gobjectClass,
                                    PROP_SUPPLEMENTAL_STR2,
                                    g_param_spec_string("supplemental-str2", /* name */
                                                           "test_interface_supplemental-str2", /* short description */
                                                           "read-write  gchar* TestInterface.supplemental-str2", /* longer - could do with some extra doc stuff here */
                                                           "", /* default */
                                                           WEBKIT_PARAM_READWRITE));
    g_object_class_install_property(gobjectClass,
                                    PROP_SUPPLEMENTAL_NODE,
                                    g_param_spec_object("supplemental-node", /* name */
                                                           "test_interface_supplemental-node", /* short description */
                                                           "read-write  WebKitDOMNode* TestInterface.supplemental-node", /* longer - could do with some extra doc stuff here */
                                                           WEBKIT_TYPE_DOM_NODE, /* gobject type */
                                                           WEBKIT_PARAM_READWRITE));


}

static void webkit_dom_test_interface_init(WebKitDOMTestInterface* request)
{
}

void
webkit_dom_test_interface_supplemental_method1(WebKitDOMTestInterface* self)
{
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
    g_return_if_fail(self);
    WebCore::JSMainThreadNullState state;
    WebCore::TestInterface* item = WebKit::core(self);
    WebCore::TestSupplemental::supplementalMethod1(item);
#else
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
#endif /* ENABLE(Condition11) || ENABLE(Condition12) */
#else
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
#endif /* ENABLE(Condition1) || ENABLE(Condition2) */
}

WebKitDOMTestObj*
webkit_dom_test_interface_supplemental_method2(WebKitDOMTestInterface* self, const gchar* strArg, WebKitDOMTestObj* objArg, GError** error)
{
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
    g_return_val_if_fail(self, 0);
    WebCore::JSMainThreadNullState state;
    WebCore::TestInterface* item = WebKit::core(self);
    g_return_val_if_fail(strArg, 0);
    g_return_val_if_fail(objArg, 0);
    WTF::String convertedStrArg = WTF::String::fromUTF8(strArg);
    WebCore::TestObj* convertedObjArg = 0;
    if (objArg) {
        convertedObjArg = WebKit::core(objArg);
        g_return_val_if_fail(convertedObjArg, 0);
    }
    WebCore::ExceptionCode ec = 0;
    RefPtr<WebCore::TestObj> gobjectResult = WTF::getPtr(WebCore::TestSupplemental::supplementalMethod2(item, convertedStrArg, convertedObjArg, ec));
    if (ec) {
        WebCore::ExceptionCodeDescription ecdesc(ec);
        g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
    }
    WebKitDOMTestObj* result = WebKit::kit(gobjectResult.get());
    return result;
#else
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
    return 0;
#endif /* ENABLE(Condition11) || ENABLE(Condition12) */
#else
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
    return 0;
#endif /* ENABLE(Condition1) || ENABLE(Condition2) */
}

void
webkit_dom_test_interface_supplemental_method4(WebKitDOMTestInterface* self)
{
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
    g_return_if_fail(self);
    WebCore::JSMainThreadNullState state;
    WebCore::TestInterface* item = WebKit::core(self);
    WebCore::TestSupplemental::supplementalMethod4(item);
#else
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
#endif /* ENABLE(Condition11) || ENABLE(Condition12) */
#else
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
#endif /* ENABLE(Condition1) || ENABLE(Condition2) */
}

gchar*
webkit_dom_test_interface_get_supplemental_str1(WebKitDOMTestInterface* self)
{
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
    g_return_val_if_fail(self, 0);
    WebCore::JSMainThreadNullState state;
    WebCore::TestInterface* item = WebKit::core(self);
    gchar* result = convertToUTF8String(WebCore::TestSupplemental::supplementalStr1(item));
    return result;
#else
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
    return 0;
#endif /* ENABLE(Condition11) || ENABLE(Condition12) */
#else
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
    return 0;
#endif /* ENABLE(Condition1) || ENABLE(Condition2) */
}

gchar*
webkit_dom_test_interface_get_supplemental_str2(WebKitDOMTestInterface* self)
{
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
    g_return_val_if_fail(self, 0);
    WebCore::JSMainThreadNullState state;
    WebCore::TestInterface* item = WebKit::core(self);
    gchar* result = convertToUTF8String(WebCore::TestSupplemental::supplementalStr2(item));
    return result;
#else
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
    return 0;
#endif /* ENABLE(Condition11) || ENABLE(Condition12) */
#else
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
    return 0;
#endif /* ENABLE(Condition1) || ENABLE(Condition2) */
}

void
webkit_dom_test_interface_set_supplemental_str2(WebKitDOMTestInterface* self, const gchar* value)
{
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
    g_return_if_fail(self);
    WebCore::JSMainThreadNullState state;
    WebCore::TestInterface* item = WebKit::core(self);
    g_return_if_fail(value);
    WTF::String convertedValue = WTF::String::fromUTF8(value);
    WebCore::TestSupplemental::setSupplementalStr2(item, convertedValue);
#else
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
#endif /* ENABLE(Condition11) || ENABLE(Condition12) */
#else
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
#endif /* ENABLE(Condition1) || ENABLE(Condition2) */
}

WebKitDOMNode*
webkit_dom_test_interface_get_supplemental_node(WebKitDOMTestInterface* self)
{
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
    g_return_val_if_fail(self, 0);
    WebCore::JSMainThreadNullState state;
    WebCore::TestInterface* item = WebKit::core(self);
    RefPtr<WebCore::Node> gobjectResult = WTF::getPtr(WebCore::TestSupplemental::supplementalNode(item));
    WebKitDOMNode* result = WebKit::kit(gobjectResult.get());
    return result;
#else
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
    return 0;
#endif /* ENABLE(Condition11) || ENABLE(Condition12) */
#else
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
    return 0;
#endif /* ENABLE(Condition1) || ENABLE(Condition2) */
}

void
webkit_dom_test_interface_set_supplemental_node(WebKitDOMTestInterface* self, WebKitDOMNode* value)
{
#if ENABLE(Condition1) || ENABLE(Condition2)
#if ENABLE(Condition11) || ENABLE(Condition12)
    g_return_if_fail(self);
    WebCore::JSMainThreadNullState state;
    WebCore::TestInterface* item = WebKit::core(self);
    g_return_if_fail(value);
    WebCore::Node* convertedValue = 0;
    if (value) {
        convertedValue = WebKit::core(value);
        g_return_if_fail(convertedValue);
    }
    WebCore::TestSupplemental::setSupplementalNode(item, convertedValue);
#else
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11")
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12")
#endif /* ENABLE(Condition11) || ENABLE(Condition12) */
#else
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1")
    WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2")
#endif /* ENABLE(Condition1) || ENABLE(Condition2) */
}