From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#51712: 29.0.50; [PATCH] New function `xwidget-webkit-load-html' Date: Tue, 09 Nov 2021 16:07:59 +0200 Message-ID: <831r3p5sn4.fsf@gnu.org> References: <878rxx8w1i.fsf.ref@yahoo.com> <878rxx8w1i.fsf@yahoo.com> <83h7cl5urs.fsf@gnu.org> <87y25x5tu9.fsf@yahoo.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40451"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 51712@debbugs.gnu.org To: Po Lu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 09 15:09:19 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mkRoN-000AIM-Eg for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Nov 2021 15:09:19 +0100 Original-Received: from localhost ([::1]:42342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mkRoL-0004Fy-VK for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Nov 2021 09:09:17 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:53736) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkRo6-00049J-Gt for bug-gnu-emacs@gnu.org; Tue, 09 Nov 2021 09:09:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49780) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mkRo6-0007Ag-7q for bug-gnu-emacs@gnu.org; Tue, 09 Nov 2021 09:09:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mkRo6-0000uy-0T for bug-gnu-emacs@gnu.org; Tue, 09 Nov 2021 09:09:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 09 Nov 2021 14:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51712 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 51712-submit@debbugs.gnu.org id=B51712.16364668983473 (code B ref 51712); Tue, 09 Nov 2021 14:09:01 +0000 Original-Received: (at 51712) by debbugs.gnu.org; 9 Nov 2021 14:08:18 +0000 Original-Received: from localhost ([127.0.0.1]:33093 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mkRnN-0000tv-Ir for submit@debbugs.gnu.org; Tue, 09 Nov 2021 09:08:17 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:52470) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mkRnL-0000tj-Qi for 51712@debbugs.gnu.org; Tue, 09 Nov 2021 09:08:16 -0500 Original-Received: from [2001:470:142:3::e] (port=40828 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkRnD-0006yL-Qw; Tue, 09 Nov 2021 09:08:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=HVeG6SvhVItOgG8g1yadRicOYCuCZ9rUb5+1Ln4TBFM=; b=Cww0BPIgaFeP QEC60qDg2njxPWV3f9fBvF2cKJ26LCj0LBjKsLQjZ2uxS14FuvF1FPpXN05DtPie+it6yHJ7BmNVV Z7StBbjmSXNVskxV2vF/iNKAgchbUWAGN2eFoYK0w7eoD1rqZyfc2RLLmZyy0W6P8IVEVLIFEexje xdBl/Px8Dkhr3aw85kGGLRmTSs/RXa2wWrHCFoQunhc/A4vHMNR5/p9yz+AnovL08iTz9oTes1Chb mNvU6ngmUV1+eod04y79wjDYqFoRLYnUtV0zOKCkYV/4skYCWLFMPT52eakBIuee8Qkurvhc0iJaP lkqVwV/bhG6Z/t88pyfD5w==; Original-Received: from [87.69.77.57] (port=4246 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkRnC-00018G-P2; Tue, 09 Nov 2021 09:08:07 -0500 In-Reply-To: <87y25x5tu9.fsf@yahoo.com> (message from Po Lu on Tue, 09 Nov 2021 21:42:06 +0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:219460 Archived-At: > From: Po Lu > Cc: 51712@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{}. 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.