1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[spidermonkey] cell_width and cell_height in screen

This commit is contained in:
Witold Filipczyk 2024-01-27 12:34:03 +01:00
parent 89955cc13a
commit 06ffcc8085

View File

@ -116,15 +116,14 @@ screen_get_property_availHeight(JSContext *ctx, unsigned int argc, JS::Value *vp
#endif #endif
return false; return false;
} }
vs = interpreter->vs; vs = interpreter->vs;
if (!vs) { if (!vs) {
#ifdef ECMASCRIPT_DEBUG #ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__); fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif #endif
return false; return false;
} }
struct document_view *doc_view = vs->doc_view; struct document_view *doc_view = vs->doc_view;
if (!doc_view) { if (!doc_view) {
@ -133,8 +132,12 @@ screen_get_property_availHeight(JSContext *ctx, unsigned int argc, JS::Value *vp
#endif #endif
return false; return false;
} }
struct session *ses = doc_view->session;
args.rval().setInt32(doc_view->box.height * 16); if (!ses) {
return false;
}
args.rval().setInt32(doc_view->box.height * ses->tab->term->cell_height);
return true; return true;
} }
@ -169,15 +172,14 @@ screen_get_property_availWidth(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif #endif
return false; return false;
} }
vs = interpreter->vs; vs = interpreter->vs;
if (!vs) { if (!vs) {
#ifdef ECMASCRIPT_DEBUG #ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__); fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif #endif
return false; return false;
} }
struct document_view *doc_view = vs->doc_view; struct document_view *doc_view = vs->doc_view;
if (!doc_view) { if (!doc_view) {
@ -186,8 +188,12 @@ screen_get_property_availWidth(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif #endif
return false; return false;
} }
struct session *ses = doc_view->session;
args.rval().setInt32(doc_view->box.width * 8); if (!ses) {
return false;
}
args.rval().setInt32(doc_view->box.width * ses->tab->term->cell_width);
return true; return true;
} }
@ -210,7 +216,6 @@ screen_get_property_height(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif #endif
return false; return false;
} }
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp); struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the /* This can be called if @obj if not itself an instance of the
@ -222,15 +227,14 @@ screen_get_property_height(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif #endif
return false; return false;
} }
vs = interpreter->vs; vs = interpreter->vs;
if (!vs) { if (!vs) {
#ifdef ECMASCRIPT_DEBUG #ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__); fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif #endif
return false; return false;
} }
struct document_view *doc_view = vs->doc_view; struct document_view *doc_view = vs->doc_view;
if (!doc_view) { if (!doc_view) {
@ -239,7 +243,6 @@ screen_get_property_height(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif #endif
return false; return false;
} }
struct session *ses = doc_view->session; struct session *ses = doc_view->session;
if (!ses) { if (!ses) {
@ -248,8 +251,7 @@ screen_get_property_height(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif #endif
return false; return false;
} }
args.rval().setInt32(ses->tab->term->height * ses->tab->term->cell_height);
args.rval().setInt32(ses->tab->term->height * 16);
return true; return true;
} }
@ -272,7 +274,6 @@ screen_get_property_width(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif #endif
return false; return false;
} }
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp); struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the /* This can be called if @obj if not itself an instance of the
@ -284,15 +285,14 @@ screen_get_property_width(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif #endif
return false; return false;
} }
vs = interpreter->vs; vs = interpreter->vs;
if (!vs) { if (!vs) {
#ifdef ECMASCRIPT_DEBUG #ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__); fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
#endif #endif
return false; return false;
} }
struct document_view *doc_view = vs->doc_view; struct document_view *doc_view = vs->doc_view;
if (!doc_view) { if (!doc_view) {
@ -301,7 +301,6 @@ screen_get_property_width(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif #endif
return false; return false;
} }
struct session *ses = doc_view->session; struct session *ses = doc_view->session;
if (!ses) { if (!ses) {
@ -310,8 +309,7 @@ screen_get_property_width(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif #endif
return false; return false;
} }
args.rval().setInt32(ses->tab->term->width * ses->tab->term->cell_width);
args.rval().setInt32(ses->tab->term->width * 8);
return true; return true;
} }