mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
[quickjs] form.c
This commit is contained in:
parent
a66a4bf995
commit
26a319e581
@ -1,6 +1,10 @@
|
|||||||
#ifndef EL__DOCUMENT_FORMS_H
|
#ifndef EL__DOCUMENT_FORMS_H
|
||||||
#define EL__DOCUMENT_FORMS_H
|
#define EL__DOCUMENT_FORMS_H
|
||||||
|
|
||||||
|
#ifdef CONFIG_QUICKJS
|
||||||
|
#include <quickjs/quickjs.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "util/lists.h"
|
#include "util/lists.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -42,7 +46,11 @@ struct form {
|
|||||||
enum form_method method;
|
enum form_method method;
|
||||||
|
|
||||||
#ifdef CONFIG_ECMASCRIPT
|
#ifdef CONFIG_ECMASCRIPT
|
||||||
|
#ifdef CONFIG_QUICKJS
|
||||||
|
JSValue ecmascript_obj;
|
||||||
|
#else
|
||||||
void *ecmascript_obj;
|
void *ecmascript_obj;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LIST_OF(struct el_form_control) items;
|
LIST_OF(struct el_form_control) items;
|
||||||
|
1090
src/ecmascript/quickjs/form.c
Normal file
1090
src/ecmascript/quickjs/form.c
Normal file
File diff suppressed because it is too large
Load Diff
10
src/ecmascript/quickjs/form.h
Normal file
10
src/ecmascript/quickjs/form.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#ifndef EL__ECMASCRIPT_QUICKJS_FORM_H
|
||||||
|
#define EL__ECMASCRIPT_QUICKJS_FORM_H
|
||||||
|
|
||||||
|
#include <quickjs/quickjs.h>
|
||||||
|
|
||||||
|
struct form;
|
||||||
|
|
||||||
|
JSValue js_get_form_object(JSContext *ctx, JSValueConst jsdoc, struct form *form);
|
||||||
|
|
||||||
|
#endif
|
@ -22,7 +22,7 @@
|
|||||||
#include "ecmascript/ecmascript.h"
|
#include "ecmascript/ecmascript.h"
|
||||||
#include "ecmascript/quickjs.h"
|
#include "ecmascript/quickjs.h"
|
||||||
#include "ecmascript/quickjs/document.h"
|
#include "ecmascript/quickjs/document.h"
|
||||||
//#include "ecmascript/quickjs/form.h"
|
#include "ecmascript/quickjs/form.h"
|
||||||
#include "ecmascript/quickjs/forms.h"
|
#include "ecmascript/quickjs/forms.h"
|
||||||
//#include "ecmascript/quickjs/input.h"
|
//#include "ecmascript/quickjs/input.h"
|
||||||
#include "ecmascript/quickjs/window.h"
|
#include "ecmascript/quickjs/window.h"
|
||||||
@ -52,13 +52,6 @@
|
|||||||
|
|
||||||
static JSClassID js_forms_class_id;
|
static JSClassID js_forms_class_id;
|
||||||
|
|
||||||
JSValue
|
|
||||||
js_get_form_object(JSContext *ctx, JSValue jsdoc, struct form *form)
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
return JS_NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find the form whose name is @name, which should normally be a
|
/* Find the form whose name is @name, which should normally be a
|
||||||
* string (but might not be). */
|
* string (but might not be). */
|
||||||
static JSValue
|
static JSValue
|
||||||
|
@ -1 +1 @@
|
|||||||
srcs += files('attr.c', 'attributes.c', 'collection.c', 'console.c', 'element.c', 'forms.c', 'history.c', 'implementation.c', 'localstorage.c', 'location.c', 'navigator.c', 'nodelist.c', 'screen.c', 'unibar.c', 'window.c')
|
srcs += files('attr.c', 'attributes.c', 'collection.c', 'console.c', 'element.c', 'form.c', 'forms.c', 'history.c', 'implementation.c', 'localstorage.c', 'location.c', 'navigator.c', 'nodelist.c', 'screen.c', 'unibar.c', 'window.c')
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
#ifndef EL__VIEWER_TEXT_FORM_H
|
#ifndef EL__VIEWER_TEXT_FORM_H
|
||||||
#define EL__VIEWER_TEXT_FORM_H
|
#define EL__VIEWER_TEXT_FORM_H
|
||||||
|
|
||||||
|
#ifdef CONFIG_QUICKJS
|
||||||
|
#include <quickjs/quickjs.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "document/forms.h"
|
#include "document/forms.h"
|
||||||
#include "util/lists.h" /* LIST_HEAD */
|
#include "util/lists.h" /* LIST_HEAD */
|
||||||
#include "viewer/action.h"
|
#include "viewer/action.h"
|
||||||
@ -33,8 +37,12 @@ struct form_view {
|
|||||||
* ECMAScript code accesses it. It is freed automatically by the
|
* ECMAScript code accesses it. It is freed automatically by the
|
||||||
* garbage-collecting code when the ECMAScript context is over (usually
|
* garbage-collecting code when the ECMAScript context is over (usually
|
||||||
* when the document is destroyed). */
|
* when the document is destroyed). */
|
||||||
|
#ifdef CONFIG_QUICKJS
|
||||||
|
JSValue ecmascript_obj;
|
||||||
|
#else
|
||||||
void *ecmascript_obj;
|
void *ecmascript_obj;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct form_state {
|
struct form_state {
|
||||||
@ -84,8 +92,12 @@ struct form_state {
|
|||||||
* ECMAScript code accesses it. It is freed automatically by the
|
* ECMAScript code accesses it. It is freed automatically by the
|
||||||
* garbage-collecting code when the ECMAScript context is over (usually
|
* garbage-collecting code when the ECMAScript context is over (usually
|
||||||
* when the document is destroyed). */
|
* when the document is destroyed). */
|
||||||
|
#ifdef CONFIG_QUICKJS
|
||||||
|
JSValue ecmascript_obj;
|
||||||
|
#else
|
||||||
void *ecmascript_obj;
|
void *ecmascript_obj;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct submitted_value {
|
struct submitted_value {
|
||||||
|
@ -131,8 +131,11 @@ copy_vs(struct view_state *dst, struct view_state *src)
|
|||||||
struct form_state *srcfs = &src->form_info[i];
|
struct form_state *srcfs = &src->form_info[i];
|
||||||
struct form_state *dstfs = &dst->form_info[i];
|
struct form_state *dstfs = &dst->form_info[i];
|
||||||
|
|
||||||
#if defined(CONFIG_ECMASCRIPT_SMJS) || defined(CONFIG_QUICKJS)
|
#ifdef CONFIG_ECMASCRIPT_SMJS
|
||||||
dstfs->ecmascript_obj = NULL;
|
dstfs->ecmascript_obj = nullptr;
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_QUICKJS
|
||||||
|
dstfs->ecmascript_obj = JS_NULL;
|
||||||
#endif
|
#endif
|
||||||
if (srcfs->value)
|
if (srcfs->value)
|
||||||
dstfs->value = stracpy(srcfs->value);
|
dstfs->value = stracpy(srcfs->value);
|
||||||
|
Loading…
Reference in New Issue
Block a user