1 /* 2 * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 #undef IMPL 27 28 #include "config.h" 29 30 #include "DOMException.h" 31 #include <WebCore/HTMLCollection.h> 32 #include <WebCore/HTMLElement.h> 33 #include <WebCore/HTMLNames.h> 34 #include <WebCore/HTMLTableSectionElement.h> 35 #include <WebCore/JSMainThreadExecState.h> 36 37 #include <wtf/RefPtr.h> 38 #include <wtf/GetPtr.h> 39 40 #include "JavaDOMUtils.h" 41 #include <wtf/java/JavaEnv.h> 42 43 using namespace WebCore; 44 45 extern "C" { 46 47 #define IMPL (static_cast<HTMLTableSectionElement*>(jlong_to_ptr(peer))) 48 49 50 // Attributes 51 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLTableSectionElementImpl_getAlignImpl(JNIEnv* env, jclass, jlong peer) 52 { 53 WebCore::JSMainThreadNullState state; 54 return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::alignAttr)); 55 } 56 57 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLTableSectionElementImpl_setAlignImpl(JNIEnv* env, jclass, jlong peer, jstring value) 58 { 59 WebCore::JSMainThreadNullState state; 60 IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::alignAttr, String(env, value)); 61 } 62 63 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLTableSectionElementImpl_getChImpl(JNIEnv* env, jclass, jlong peer) 64 { 65 WebCore::JSMainThreadNullState state; 66 return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::charAttr)); 67 } 68 69 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLTableSectionElementImpl_setChImpl(JNIEnv* env, jclass, jlong peer, jstring value) 70 { 71 WebCore::JSMainThreadNullState state; 72 IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::charAttr, String(env, value)); 73 } 74 75 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLTableSectionElementImpl_getChOffImpl(JNIEnv* env, jclass, jlong peer) 76 { 77 WebCore::JSMainThreadNullState state; 78 return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::charoffAttr)); 79 } 80 81 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLTableSectionElementImpl_setChOffImpl(JNIEnv* env, jclass, jlong peer, jstring value) 82 { 83 WebCore::JSMainThreadNullState state; 84 IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::charoffAttr, String(env, value)); 85 } 86 87 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLTableSectionElementImpl_getVAlignImpl(JNIEnv* env, jclass, jlong peer) 88 { 89 WebCore::JSMainThreadNullState state; 90 return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::valignAttr)); 91 } 92 93 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLTableSectionElementImpl_setVAlignImpl(JNIEnv* env, jclass, jlong peer, jstring value) 94 { 95 WebCore::JSMainThreadNullState state; 96 IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::valignAttr, String(env, value)); 97 } 98 99 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLTableSectionElementImpl_getRowsImpl(JNIEnv* env, jclass, jlong peer) 100 { 101 WebCore::JSMainThreadNullState state; 102 return JavaReturn<HTMLCollection>(env, WTF::getPtr(IMPL->rows())); 103 } 104 105 106 // Functions 107 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLTableSectionElementImpl_insertRowImpl(JNIEnv* env, jclass, jlong peer 108 , jint index) 109 { 110 WebCore::JSMainThreadNullState state; 111 return JavaReturn<HTMLElement>(env, WTF::getPtr(raiseOnDOMError(env, IMPL->insertRow(index)))); 112 } 113 114 115 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLTableSectionElementImpl_deleteRowImpl(JNIEnv* env, jclass, jlong peer 116 , jint index) 117 { 118 WebCore::JSMainThreadNullState state; 119 raiseOnDOMError(env, IMPL->deleteRow(index)); 120 } 121 122 123 }