1 /* 2 * Copyright (c) 2013, 2018, 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/HTMLTableRowElement.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<HTMLTableRowElement*>(jlong_to_ptr(peer))) 48 49 50 // Attributes 51 JNIEXPORT jint JNICALL Java_com_sun_webkit_dom_HTMLTableRowElementImpl_getRowIndexImpl(JNIEnv*, jclass, jlong peer) 52 { 53 WebCore::JSMainThreadNullState state; 54 return IMPL->rowIndex(); 55 } 56 57 JNIEXPORT jint JNICALL Java_com_sun_webkit_dom_HTMLTableRowElementImpl_getSectionRowIndexImpl(JNIEnv*, jclass, jlong peer) 58 { 59 WebCore::JSMainThreadNullState state; 60 return IMPL->sectionRowIndex(); 61 } 62 63 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLTableRowElementImpl_getCellsImpl(JNIEnv* env, jclass, jlong peer) 64 { 65 WebCore::JSMainThreadNullState state; 66 return JavaReturn<HTMLCollection>(env, WTF::getPtr(IMPL->cells())); 67 } 68 69 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLTableRowElementImpl_getAlignImpl(JNIEnv* env, jclass, jlong peer) 70 { 71 WebCore::JSMainThreadNullState state; 72 return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::alignAttr)); 73 } 74 75 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLTableRowElementImpl_setAlignImpl(JNIEnv* env, jclass, jlong peer, jstring value) 76 { 77 WebCore::JSMainThreadNullState state; 78 IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::alignAttr, String(env, value)); 79 } 80 81 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLTableRowElementImpl_getBgColorImpl(JNIEnv* env, jclass, jlong peer) 82 { 83 WebCore::JSMainThreadNullState state; 84 return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::bgcolorAttr)); 85 } 86 87 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLTableRowElementImpl_setBgColorImpl(JNIEnv* env, jclass, jlong peer, jstring value) 88 { 89 WebCore::JSMainThreadNullState state; 90 IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::bgcolorAttr, String(env, value)); 91 } 92 93 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLTableRowElementImpl_getChImpl(JNIEnv* env, jclass, jlong peer) 94 { 95 WebCore::JSMainThreadNullState state; 96 return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::charAttr)); 97 } 98 99 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLTableRowElementImpl_setChImpl(JNIEnv* env, jclass, jlong peer, jstring value) 100 { 101 WebCore::JSMainThreadNullState state; 102 IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::charAttr, String(env, value)); 103 } 104 105 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLTableRowElementImpl_getChOffImpl(JNIEnv* env, jclass, jlong peer) 106 { 107 WebCore::JSMainThreadNullState state; 108 return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::charoffAttr)); 109 } 110 111 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLTableRowElementImpl_setChOffImpl(JNIEnv* env, jclass, jlong peer, jstring value) 112 { 113 WebCore::JSMainThreadNullState state; 114 IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::charoffAttr, String(env, value)); 115 } 116 117 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLTableRowElementImpl_getVAlignImpl(JNIEnv* env, jclass, jlong peer) 118 { 119 WebCore::JSMainThreadNullState state; 120 return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::valignAttr)); 121 } 122 123 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLTableRowElementImpl_setVAlignImpl(JNIEnv* env, jclass, jlong peer, jstring value) 124 { 125 WebCore::JSMainThreadNullState state; 126 IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::valignAttr, String(env, value)); 127 } 128 129 130 // Functions 131 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLTableRowElementImpl_insertCellImpl(JNIEnv* env, jclass, jlong peer 132 , jint index) 133 { 134 WebCore::JSMainThreadNullState state; 135 return JavaReturn<HTMLElement>(env, WTF::getPtr(raiseOnDOMError(env, IMPL->insertCell(index)))); 136 } 137 138 139 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLTableRowElementImpl_deleteCellImpl(JNIEnv* env, jclass, jlong peer 140 , jint index) 141 { 142 WebCore::JSMainThreadNullState state; 143 raiseOnDOMError(env, IMPL->deleteCell(index)); 144 } 145 146 147 }