diff --git a/src/document/html/parser/general.c b/src/document/html/parser/general.c
index ee94aa33..672d27c7 100644
--- a/src/document/html/parser/general.c
+++ b/src/document/html/parser/general.c
@@ -366,8 +366,9 @@ imported:
done_string(&code);
if (!ret.length) return;
- format_html_part(html_context, ret.source, ret.source + ret.length,
- par_format.align, par_format.leftmargin, part->box.width,
+ part = format_html_part(html_context, ret.source,
+ ret.source + ret.length, par_format.align,
+ par_format.leftmargin, document->options.box.width,
document, part->box.x, part->box.y, NULL, part->link_num);
done_string(&ret);
diff --git a/src/ecmascript/spidermonkey/document.c b/src/ecmascript/spidermonkey/document.c
index 052ea113..961fa8d2 100644
--- a/src/ecmascript/spidermonkey/document.c
+++ b/src/ecmascript/spidermonkey/document.c
@@ -192,19 +192,25 @@ document_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
}
static JSBool document_write(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
+static JSBool document_writeln(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
const JSFunctionSpec document_funcs[] = {
{ "write", document_write, 1 },
+ { "writeln", document_writeln, 1 },
{ NULL }
};
static JSBool
document_write(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
-#ifdef CONFIG_LEDS
struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx);
-#endif
+ struct string *ret = interpreter->ret;
+ if (argc >= 1 && ret) {
+ unsigned char *code = jsval_to_string(ctx, &argv[0]);
+
+ add_to_string(ret, code);
+ }
/* XXX: I don't know about you, but I have *ENOUGH* of those 'Undefined
* function' errors, I want to see just the useful ones. So just
* lighting a led and going away, no muss, no fuss. --pasky */
@@ -220,3 +226,25 @@ document_write(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rv
return JS_TRUE;
}
+
+static JSBool
+document_writeln(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+{
+ struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx);
+ struct string *ret = interpreter->ret;
+
+ if (argc >= 1 && ret) {
+ unsigned char *code = jsval_to_string(ctx, &argv[0]);
+
+ add_to_string(ret, code);
+ add_char_to_string(ret, '\n');
+ }
+
+#ifdef CONFIG_LEDS
+ set_led_value(interpreter->vs->doc_view->session->status.ecmascript_led, 'J');
+#endif
+
+ boolean_to_jsval(ctx, rval, 0);
+
+ return JS_TRUE;
+}