tizen beta release
[profile/ivi/webkit-efl.git] / DerivedSources / WebKitDOM_Node_Custom.cpp
1 /*
2     Copyright (C) 2011 Samsung Electronics
3
4     This library is free software; you can redistribute it and/or
5     modify it under the terms of the GNU Lesser General Public
6     License as published by the Free Software Foundation; either
7     version 2.1 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     Lesser General Public License for more details.
13
14     You should have received a copy of the GNU Lesser General Public
15     License along with this library; if not, write to the Free Software
16     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17 */
18
19 #include "config.h"
20 #include "WebKitDOM_Node.h"
21 #include "WebKitDOM_Node_Private.h"
22
23 #include "Node.h"
24 #include <wtf/text/CString.h>
25 #include <wtf/GetPtr.h>
26 #include <wtf/RefPtr.h>
27
28
29 void ewk_webkitdom_node_insert_before(WebKitDOM_Node* self, WebKitDOM_Node* newChild, WebKitDOM_Node* refChild, WebKitDOM_Node* ret)
30 {
31     if (!self)
32         return;
33
34     WebCore::Node* coreObj = _to_webcore_node(self);
35     WebCore::Node* newChildCore = _to_webcore_node(newChild);
36     WebCore::Node* refChildCore = _to_webcore_node(refChild);
37
38     WebCore::ExceptionCode ec = 0;
39     if (coreObj->insertBefore( newChildCore, refChildCore, ec))
40     {
41         _copy_webkit_node(newChild, ret);
42         return;
43     }
44
45     _to_webkit_node(0, ret);
46 }
47
48 void ewk_webkitdom_node_append_child(WebKitDOM_Node* self, WebKitDOM_Node* newChild, WebKitDOM_Node* ret)
49 {
50     if (!self)
51         return;
52
53     WebCore::Node* coreObj = _to_webcore_node(self);
54     WebCore::Node* newChildCore = _to_webcore_node(newChild);
55
56     WebCore::ExceptionCode ec = 0;
57     if (coreObj->appendChild(newChildCore, ec))
58     {
59         _copy_webkit_node(newChild, ret);
60         return;
61     }
62
63     _to_webkit_node(0, ret);
64 }
65