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 <WebCore/EventListener.h> 31 #include <WebCore/HTMLFrameSetElement.h> 32 #include <WebCore/HTMLNames.h> 33 #include <WebCore/EventNames.h> 34 #include <WebCore/JSMainThreadExecState.h> 35 36 #include <wtf/RefPtr.h> 37 #include <wtf/GetPtr.h> 38 39 #include "JavaDOMUtils.h" 40 #include <wtf/java/JavaEnv.h> 41 42 using namespace WebCore; 43 44 extern "C" { 45 46 #define IMPL (static_cast<HTMLFrameSetElement*>(jlong_to_ptr(peer))) 47 48 49 // Attributes 50 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_getColsImpl(JNIEnv* env, jclass, jlong peer) 51 { 52 WebCore::JSMainThreadNullState state; 53 return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::colsAttr)); 54 } 55 56 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_setColsImpl(JNIEnv* env, jclass, jlong peer, jstring value) 57 { 58 WebCore::JSMainThreadNullState state; 59 IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::colsAttr, String(env, value)); 60 } 61 62 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_getRowsImpl(JNIEnv* env, jclass, jlong peer) 63 { 64 WebCore::JSMainThreadNullState state; 65 return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::rowsAttr)); 66 } 67 68 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_setRowsImpl(JNIEnv* env, jclass, jlong peer, jstring value) 69 { 70 WebCore::JSMainThreadNullState state; 71 IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::rowsAttr, String(env, value)); 72 } 73 74 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_getOnblurImpl(JNIEnv* env, jclass, jlong peer) 75 { 76 WebCore::JSMainThreadNullState state; 77 return JavaReturn<EventListener>(env, WTF::getPtr(IMPL->attributeEventListener(eventNames().blurEvent, mainThreadNormalWorld()))); 78 } 79 80 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_setOnblurImpl(JNIEnv*, jclass, jlong peer, jlong value) 81 { 82 WebCore::JSMainThreadNullState state; 83 IMPL->setAttributeEventListener(eventNames().blurEvent, static_cast<EventListener*>(jlong_to_ptr(value)), mainThreadNormalWorld()); 84 } 85 86 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_getOnerrorImpl(JNIEnv* env, jclass, jlong peer) 87 { 88 WebCore::JSMainThreadNullState state; 89 return JavaReturn<EventListener>(env, WTF::getPtr(IMPL->attributeEventListener(eventNames().errorEvent, mainThreadNormalWorld()))); 90 } 91 92 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_setOnerrorImpl(JNIEnv*, jclass, jlong peer, jlong value) 93 { 94 WebCore::JSMainThreadNullState state; 95 IMPL->setAttributeEventListener(eventNames().errorEvent, static_cast<EventListener*>(jlong_to_ptr(value)), mainThreadNormalWorld()); 96 } 97 98 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_getOnfocusImpl(JNIEnv* env, jclass, jlong peer) 99 { 100 WebCore::JSMainThreadNullState state; 101 return JavaReturn<EventListener>(env, WTF::getPtr(IMPL->attributeEventListener(eventNames().focusEvent, mainThreadNormalWorld()))); 102 } 103 104 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_setOnfocusImpl(JNIEnv*, jclass, jlong peer, jlong value) 105 { 106 WebCore::JSMainThreadNullState state; 107 IMPL->setAttributeEventListener(eventNames().focusEvent, static_cast<EventListener*>(jlong_to_ptr(value)), mainThreadNormalWorld()); 108 } 109 110 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_getOnfocusinImpl(JNIEnv* env, jclass, jlong peer) 111 { 112 WebCore::JSMainThreadNullState state; 113 return JavaReturn<EventListener>(env, WTF::getPtr(IMPL->attributeEventListener(eventNames().focusinEvent, mainThreadNormalWorld()))); 114 } 115 116 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_setOnfocusinImpl(JNIEnv*, jclass, jlong peer, jlong value) 117 { 118 WebCore::JSMainThreadNullState state; 119 IMPL->setAttributeEventListener(eventNames().focusinEvent, static_cast<EventListener*>(jlong_to_ptr(value)), mainThreadNormalWorld()); 120 } 121 122 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_getOnfocusoutImpl(JNIEnv* env, jclass, jlong peer) 123 { 124 WebCore::JSMainThreadNullState state; 125 return JavaReturn<EventListener>(env, WTF::getPtr(IMPL->attributeEventListener(eventNames().focusoutEvent, mainThreadNormalWorld()))); 126 } 127 128 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_setOnfocusoutImpl(JNIEnv*, jclass, jlong peer, jlong value) 129 { 130 WebCore::JSMainThreadNullState state; 131 IMPL->setAttributeEventListener(eventNames().focusoutEvent, static_cast<EventListener*>(jlong_to_ptr(value)), mainThreadNormalWorld()); 132 } 133 134 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_getOnloadImpl(JNIEnv* env, jclass, jlong peer) 135 { 136 WebCore::JSMainThreadNullState state; 137 return JavaReturn<EventListener>(env, WTF::getPtr(IMPL->attributeEventListener(eventNames().loadEvent, mainThreadNormalWorld()))); 138 } 139 140 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_setOnloadImpl(JNIEnv*, jclass, jlong peer, jlong value) 141 { 142 WebCore::JSMainThreadNullState state; 143 IMPL->setAttributeEventListener(eventNames().loadEvent, static_cast<EventListener*>(jlong_to_ptr(value)), mainThreadNormalWorld()); 144 } 145 146 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_getOnresizeImpl(JNIEnv* env, jclass, jlong peer) 147 { 148 WebCore::JSMainThreadNullState state; 149 return JavaReturn<EventListener>(env, WTF::getPtr(IMPL->attributeEventListener(eventNames().resizeEvent, mainThreadNormalWorld()))); 150 } 151 152 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_setOnresizeImpl(JNIEnv*, jclass, jlong peer, jlong value) 153 { 154 WebCore::JSMainThreadNullState state; 155 IMPL->setAttributeEventListener(eventNames().resizeEvent, static_cast<EventListener*>(jlong_to_ptr(value)), mainThreadNormalWorld()); 156 } 157 158 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_getOnscrollImpl(JNIEnv* env, jclass, jlong peer) 159 { 160 WebCore::JSMainThreadNullState state; 161 return JavaReturn<EventListener>(env, WTF::getPtr(IMPL->attributeEventListener(eventNames().scrollEvent, mainThreadNormalWorld()))); 162 } 163 164 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_setOnscrollImpl(JNIEnv*, jclass, jlong peer, jlong value) 165 { 166 WebCore::JSMainThreadNullState state; 167 IMPL->setAttributeEventListener(eventNames().scrollEvent, static_cast<EventListener*>(jlong_to_ptr(value)), mainThreadNormalWorld()); 168 } 169 170 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_getOnbeforeunloadImpl(JNIEnv* env, jclass, jlong peer) 171 { 172 WebCore::JSMainThreadNullState state; 173 return JavaReturn<EventListener>(env, WTF::getPtr(IMPL->attributeEventListener(eventNames().beforeunloadEvent, mainThreadNormalWorld()))); 174 } 175 176 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_setOnbeforeunloadImpl(JNIEnv*, jclass, jlong peer, jlong value) 177 { 178 WebCore::JSMainThreadNullState state; 179 IMPL->setAttributeEventListener(eventNames().beforeunloadEvent, static_cast<EventListener*>(jlong_to_ptr(value)), mainThreadNormalWorld()); 180 } 181 182 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_getOnhashchangeImpl(JNIEnv* env, jclass, jlong peer) 183 { 184 WebCore::JSMainThreadNullState state; 185 return JavaReturn<EventListener>(env, WTF::getPtr(IMPL->attributeEventListener(eventNames().hashchangeEvent, mainThreadNormalWorld()))); 186 } 187 188 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_setOnhashchangeImpl(JNIEnv*, jclass, jlong peer, jlong value) 189 { 190 WebCore::JSMainThreadNullState state; 191 IMPL->setAttributeEventListener(eventNames().hashchangeEvent, static_cast<EventListener*>(jlong_to_ptr(value)), mainThreadNormalWorld()); 192 } 193 194 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_getOnmessageImpl(JNIEnv* env, jclass, jlong peer) 195 { 196 WebCore::JSMainThreadNullState state; 197 return JavaReturn<EventListener>(env, WTF::getPtr(IMPL->attributeEventListener(eventNames().messageEvent, mainThreadNormalWorld()))); 198 } 199 200 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_setOnmessageImpl(JNIEnv*, jclass, jlong peer, jlong value) 201 { 202 WebCore::JSMainThreadNullState state; 203 IMPL->setAttributeEventListener(eventNames().messageEvent, static_cast<EventListener*>(jlong_to_ptr(value)), mainThreadNormalWorld()); 204 } 205 206 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_getOnofflineImpl(JNIEnv* env, jclass, jlong peer) 207 { 208 WebCore::JSMainThreadNullState state; 209 return JavaReturn<EventListener>(env, WTF::getPtr(IMPL->attributeEventListener(eventNames().offlineEvent, mainThreadNormalWorld()))); 210 } 211 212 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_setOnofflineImpl(JNIEnv*, jclass, jlong peer, jlong value) 213 { 214 WebCore::JSMainThreadNullState state; 215 IMPL->setAttributeEventListener(eventNames().offlineEvent, static_cast<EventListener*>(jlong_to_ptr(value)), mainThreadNormalWorld()); 216 } 217 218 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_getOnonlineImpl(JNIEnv* env, jclass, jlong peer) 219 { 220 WebCore::JSMainThreadNullState state; 221 return JavaReturn<EventListener>(env, WTF::getPtr(IMPL->attributeEventListener(eventNames().onlineEvent, mainThreadNormalWorld()))); 222 } 223 224 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_setOnonlineImpl(JNIEnv*, jclass, jlong peer, jlong value) 225 { 226 WebCore::JSMainThreadNullState state; 227 IMPL->setAttributeEventListener(eventNames().onlineEvent, static_cast<EventListener*>(jlong_to_ptr(value)), mainThreadNormalWorld()); 228 } 229 230 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_getOnpagehideImpl(JNIEnv* env, jclass, jlong peer) 231 { 232 WebCore::JSMainThreadNullState state; 233 return JavaReturn<EventListener>(env, WTF::getPtr(IMPL->attributeEventListener(eventNames().pagehideEvent, mainThreadNormalWorld()))); 234 } 235 236 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_setOnpagehideImpl(JNIEnv*, jclass, jlong peer, jlong value) 237 { 238 WebCore::JSMainThreadNullState state; 239 IMPL->setAttributeEventListener(eventNames().pagehideEvent, static_cast<EventListener*>(jlong_to_ptr(value)), mainThreadNormalWorld()); 240 } 241 242 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_getOnpageshowImpl(JNIEnv* env, jclass, jlong peer) 243 { 244 WebCore::JSMainThreadNullState state; 245 return JavaReturn<EventListener>(env, WTF::getPtr(IMPL->attributeEventListener(eventNames().pageshowEvent, mainThreadNormalWorld()))); 246 } 247 248 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_setOnpageshowImpl(JNIEnv*, jclass, jlong peer, jlong value) 249 { 250 WebCore::JSMainThreadNullState state; 251 IMPL->setAttributeEventListener(eventNames().pageshowEvent, static_cast<EventListener*>(jlong_to_ptr(value)), mainThreadNormalWorld()); 252 } 253 254 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_getOnpopstateImpl(JNIEnv* env, jclass, jlong peer) 255 { 256 WebCore::JSMainThreadNullState state; 257 return JavaReturn<EventListener>(env, WTF::getPtr(IMPL->attributeEventListener(eventNames().popstateEvent, mainThreadNormalWorld()))); 258 } 259 260 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_setOnpopstateImpl(JNIEnv*, jclass, jlong peer, jlong value) 261 { 262 WebCore::JSMainThreadNullState state; 263 IMPL->setAttributeEventListener(eventNames().popstateEvent, static_cast<EventListener*>(jlong_to_ptr(value)), mainThreadNormalWorld()); 264 } 265 266 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_getOnstorageImpl(JNIEnv* env, jclass, jlong peer) 267 { 268 WebCore::JSMainThreadNullState state; 269 return JavaReturn<EventListener>(env, WTF::getPtr(IMPL->attributeEventListener(eventNames().storageEvent, mainThreadNormalWorld()))); 270 } 271 272 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_setOnstorageImpl(JNIEnv*, jclass, jlong peer, jlong value) 273 { 274 WebCore::JSMainThreadNullState state; 275 IMPL->setAttributeEventListener(eventNames().storageEvent, static_cast<EventListener*>(jlong_to_ptr(value)), mainThreadNormalWorld()); 276 } 277 278 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_getOnunloadImpl(JNIEnv* env, jclass, jlong peer) 279 { 280 WebCore::JSMainThreadNullState state; 281 return JavaReturn<EventListener>(env, WTF::getPtr(IMPL->attributeEventListener(eventNames().unloadEvent, mainThreadNormalWorld()))); 282 } 283 284 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLFrameSetElementImpl_setOnunloadImpl(JNIEnv*, jclass, jlong peer, jlong value) 285 { 286 WebCore::JSMainThreadNullState state; 287 IMPL->setAttributeEventListener(eventNames().unloadEvent, static_cast<EventListener*>(jlong_to_ptr(value)), mainThreadNormalWorld()); 288 } 289 290 }