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 <WebCore/Document.h>
  31 #include <WebCore/HTMLFormElement.h>
  32 #include <WebCore/HTMLNames.h>
  33 #include <WebCore/HTMLObjectElement.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<HTMLObjectElement*>(jlong_to_ptr(peer)))
  47 
  48 
  49 // Attributes
  50 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_getFormImpl(JNIEnv* env, jclass, jlong peer)
  51 {
  52     WebCore::JSMainThreadNullState state;
  53     return JavaReturn<HTMLFormElement>(env, WTF::getPtr(IMPL->form()));
  54 }
  55 
  56 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_getCodeImpl(JNIEnv* env, jclass, jlong peer)
  57 {
  58     WebCore::JSMainThreadNullState state;
  59     return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::codeAttr));
  60 }
  61 
  62 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_setCodeImpl(JNIEnv* env, jclass, jlong peer, jstring value)
  63 {
  64     WebCore::JSMainThreadNullState state;
  65     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::codeAttr, String(env, value));
  66 }
  67 
  68 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_getAlignImpl(JNIEnv* env, jclass, jlong peer)
  69 {
  70     WebCore::JSMainThreadNullState state;
  71     return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::alignAttr));
  72 }
  73 
  74 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_setAlignImpl(JNIEnv* env, jclass, jlong peer, jstring value)
  75 {
  76     WebCore::JSMainThreadNullState state;
  77     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::alignAttr, String(env, value));
  78 }
  79 
  80 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_getArchiveImpl(JNIEnv* env, jclass, jlong peer)
  81 {
  82     WebCore::JSMainThreadNullState state;
  83     return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::archiveAttr));
  84 }
  85 
  86 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_setArchiveImpl(JNIEnv* env, jclass, jlong peer, jstring value)
  87 {
  88     WebCore::JSMainThreadNullState state;
  89     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::archiveAttr, String(env, value));
  90 }
  91 
  92 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_getBorderImpl(JNIEnv* env, jclass, jlong peer)
  93 {
  94     WebCore::JSMainThreadNullState state;
  95     return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::borderAttr));
  96 }
  97 
  98 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_setBorderImpl(JNIEnv* env, jclass, jlong peer, jstring value)
  99 {
 100     WebCore::JSMainThreadNullState state;
 101     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::borderAttr, String(env, value));
 102 }
 103 
 104 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_getCodeBaseImpl(JNIEnv* env, jclass, jlong peer)
 105 {
 106     WebCore::JSMainThreadNullState state;
 107     return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::codebaseAttr));
 108 }
 109 
 110 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_setCodeBaseImpl(JNIEnv* env, jclass, jlong peer, jstring value)
 111 {
 112     WebCore::JSMainThreadNullState state;
 113     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::codebaseAttr, String(env, value));
 114 }
 115 
 116 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_getCodeTypeImpl(JNIEnv* env, jclass, jlong peer)
 117 {
 118     WebCore::JSMainThreadNullState state;
 119     return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::codetypeAttr));
 120 }
 121 
 122 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_setCodeTypeImpl(JNIEnv* env, jclass, jlong peer, jstring value)
 123 {
 124     WebCore::JSMainThreadNullState state;
 125     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::codetypeAttr, String(env, value));
 126 }
 127 
 128 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_getDataImpl(JNIEnv* env, jclass, jlong peer)
 129 {
 130     WebCore::JSMainThreadNullState state;
 131     return JavaReturn<String>(env, IMPL->getURLAttribute(WebCore::HTMLNames::dataAttr));
 132 }
 133 
 134 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_setDataImpl(JNIEnv* env, jclass, jlong peer, jstring value)
 135 {
 136     WebCore::JSMainThreadNullState state;
 137     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::dataAttr, String(env, value));
 138 }
 139 
 140 JNIEXPORT jboolean JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_getDeclareImpl(JNIEnv*, jclass, jlong peer)
 141 {
 142     WebCore::JSMainThreadNullState state;
 143     return IMPL->hasAttribute(WebCore::HTMLNames::declareAttr);
 144 }
 145 
 146 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_setDeclareImpl(JNIEnv*, jclass, jlong peer, jboolean value)
 147 {
 148     WebCore::JSMainThreadNullState state;
 149     IMPL->setBooleanAttribute(WebCore::HTMLNames::declareAttr, value);
 150 }
 151 
 152 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_getHeightImpl(JNIEnv* env, jclass, jlong peer)
 153 {
 154     WebCore::JSMainThreadNullState state;
 155     return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::heightAttr));
 156 }
 157 
 158 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_setHeightImpl(JNIEnv* env, jclass, jlong peer, jstring value)
 159 {
 160     WebCore::JSMainThreadNullState state;
 161     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::heightAttr, String(env, value));
 162 }
 163 
 164 JNIEXPORT jint JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_getHspaceImpl(JNIEnv*, jclass, jlong peer)
 165 {
 166     WebCore::JSMainThreadNullState state;
 167     return IMPL->getIntegralAttribute(WebCore::HTMLNames::hspaceAttr);
 168 }
 169 
 170 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_setHspaceImpl(JNIEnv*, jclass, jlong peer, jint value)
 171 {
 172     WebCore::JSMainThreadNullState state;
 173     IMPL->setIntegralAttribute(WebCore::HTMLNames::hspaceAttr, value);
 174 }
 175 
 176 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_getNameImpl(JNIEnv* env, jclass, jlong peer)
 177 {
 178     WebCore::JSMainThreadNullState state;
 179     return JavaReturn<String>(env, IMPL->getNameAttribute());
 180 }
 181 
 182 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_setNameImpl(JNIEnv* env, jclass, jlong peer, jstring value)
 183 {
 184     WebCore::JSMainThreadNullState state;
 185     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::nameAttr, String(env, value));
 186 }
 187 
 188 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_getStandbyImpl(JNIEnv* env, jclass, jlong peer)
 189 {
 190     WebCore::JSMainThreadNullState state;
 191     return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::standbyAttr));
 192 }
 193 
 194 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_setStandbyImpl(JNIEnv* env, jclass, jlong peer, jstring value)
 195 {
 196     WebCore::JSMainThreadNullState state;
 197     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::standbyAttr, String(env, value));
 198 }
 199 
 200 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_getTypeImpl(JNIEnv* env, jclass, jlong peer)
 201 {
 202     WebCore::JSMainThreadNullState state;
 203     return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::typeAttr));
 204 }
 205 
 206 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_setTypeImpl(JNIEnv* env, jclass, jlong peer, jstring value)
 207 {
 208     WebCore::JSMainThreadNullState state;
 209     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::typeAttr, String(env, value));
 210 }
 211 
 212 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_getUseMapImpl(JNIEnv* env, jclass, jlong peer)
 213 {
 214     WebCore::JSMainThreadNullState state;
 215     return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::usemapAttr));
 216 }
 217 
 218 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_setUseMapImpl(JNIEnv* env, jclass, jlong peer, jstring value)
 219 {
 220     WebCore::JSMainThreadNullState state;
 221     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::usemapAttr, String(env, value));
 222 }
 223 
 224 JNIEXPORT jint JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_getVspaceImpl(JNIEnv*, jclass, jlong peer)
 225 {
 226     WebCore::JSMainThreadNullState state;
 227     return IMPL->getIntegralAttribute(WebCore::HTMLNames::vspaceAttr);
 228 }
 229 
 230 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_setVspaceImpl(JNIEnv*, jclass, jlong peer, jint value)
 231 {
 232     WebCore::JSMainThreadNullState state;
 233     IMPL->setIntegralAttribute(WebCore::HTMLNames::vspaceAttr, value);
 234 }
 235 
 236 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_getWidthImpl(JNIEnv* env, jclass, jlong peer)
 237 {
 238     WebCore::JSMainThreadNullState state;
 239     return JavaReturn<String>(env, IMPL->getAttribute(WebCore::HTMLNames::widthAttr));
 240 }
 241 
 242 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_setWidthImpl(JNIEnv* env, jclass, jlong peer, jstring value)
 243 {
 244     WebCore::JSMainThreadNullState state;
 245     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::widthAttr, String(env, value));
 246 }
 247 
 248 JNIEXPORT jboolean JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_getWillValidateImpl(JNIEnv*, jclass, jlong peer)
 249 {
 250     WebCore::JSMainThreadNullState state;
 251     return IMPL->willValidate();
 252 }
 253 
 254 JNIEXPORT jstring JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_getValidationMessageImpl(JNIEnv* env, jclass, jlong peer)
 255 {
 256     WebCore::JSMainThreadNullState state;
 257     return JavaReturn<String>(env, IMPL->validationMessage());
 258 }
 259 
 260 JNIEXPORT jlong JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_getContentDocumentImpl(JNIEnv* env, jclass, jlong peer)
 261 {
 262     WebCore::JSMainThreadNullState state;
 263     return JavaReturn<Document>(env, WTF::getPtr(IMPL->contentDocument()));
 264 }
 265 
 266 
 267 // Functions
 268 JNIEXPORT jboolean JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_checkValidityImpl(JNIEnv*, jclass, jlong peer)
 269 {
 270     WebCore::JSMainThreadNullState state;
 271     return IMPL->checkValidity();
 272 }
 273 
 274 
 275 JNIEXPORT void JNICALL Java_com_sun_webkit_dom_HTMLObjectElementImpl_setCustomValidityImpl(JNIEnv* env, jclass, jlong peer
 276     , jstring error)
 277 {
 278     WebCore::JSMainThreadNullState state;
 279     IMPL->setCustomValidity(String(env, error));
 280 }
 281 
 282 
 283 }