GNU bug report logs - #51712
29.0.50; [PATCH] New function `xwidget-webkit-load-html'

Previous Next

Package: emacs;

Reported by: Po Lu <luangruo <at> yahoo.com>

Date: Tue, 9 Nov 2021 10:27:02 UTC

Severity: wishlist

Tags: patch

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 51712 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 51712 <at> debbugs.gnu.org
Subject: Re: bug#51712: 29.0.50; [PATCH] New function
 `xwidget-webkit-load-html'
Date: Tue, 09 Nov 2021 16:07:59 +0200
> From: Po Lu <luangruo <at> yahoo.com>
> Cc: 51712 <at> debbugs.gnu.org
> Date: Tue, 09 Nov 2021 21:42:06 +0800
> 
> >> +  text = ENCODE_UTF_8 (text);
> >> +  xw = XXWIDGET (xwidget);
> >> +
> >> +#ifdef USE_GTK
> >> +  data = SSDATA (text);
> >> +  uri = SSDATA (base_uri);
> >> +  webview = WEBKIT_WEB_VIEW (xw->widget_osr);
> >> +
> >> +  block_input ();
> >> +  webkit_web_view_load_html (webview, data, uri);
> >> +  unblock_input ();
> >> +#endif
> 
> > Hmm... if we only use TEXT and BASE-URI in the GTK build, why do we
> > encode them in the other builds?  Isn't that a waste of cycles?  IOW,
> > what does this function do if USE_GTK is not defined?
> 
> This feature isn't supported on macOS, but it's my hope that someone
> will port it to macOS in short order.

Then I'd suggest not to have it defined on non-GTK builds for now.  It
is confusing to have a function that silently does nothing (after
wasting some cycles).

> +@defun xwidget-webkit-load-html xwidget text &optional base-uri
> +Load @var{text} into @var{xwidget}, which should be a WebKit xwidget.
> +It treats @var{text} as HTML markup, which will be rendered by
> +@var{xwidget}.

I'd say that TEXT should be a string.  The name itself doesn't
necessarily say so.

> +Optional argument @var{base-uri}, which should be a string, specifies
> +the location of web resources, such as the resource @samp{foo.png} in
> +the HTML tag @samp{<img src="foo.png">}.  It defaults to
> +@samp{about:blank}.

Hmm... this is better, but at least I am still in the dark regarding
the need for this optional argument.  E.g., what would happen if you
use that tag, but don't specify the URI?

> +*** New function 'xwidget-webkit-load-html'.
> +This function is used to load HTML text into WebKit xwidgets, without
> +having to create a temporary file to store the markup.

This still leaves me wondering why the entry talks about temporary
files.
> +DEFUN ("xwidget-webkit-load-html", Fxwidget_webkit_load_html,
> +       Sxwidget_webkit_load_html, 2, 3, 0,
> +       doc: /* Make XWIDGET's WebKit widget render text.
                                                      ^^^^
"text" should be in CAPS.

Thanks.




This bug report was last modified 2 years and 251 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.