aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2021-11-07 14:41:43 +0100
committerLars Ingebrigtsen2021-11-07 14:41:43 +0100
commit48a9621db7922a7da19ce401b40955fd9871e85e (patch)
tree567235f8e0e1b9abf2dea3d49da1c07ab4fd5d1e /src
parentcbc14f9b4eb95268417d5baebd18b55fc70da7f1 (diff)
downloademacs-48a9621db7922a7da19ce401b40955fd9871e85e.tar.gz
emacs-48a9621db7922a7da19ce401b40955fd9871e85e.zip
Fix xwidget-webkit-goto-history
* src/xwidget.c (xwidget-webkit-goto-history): Use WebKitBackForwardList and XFIXNUM instead of XFIXNAT (bug#51651).
Diffstat (limited to 'src')
-rw-r--r--src/xwidget.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/xwidget.c b/src/xwidget.c
index fb4619ee34d..b0700b61e54 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -1540,7 +1540,11 @@ DEFUN ("xwidget-webkit-goto-uri",
1540DEFUN ("xwidget-webkit-goto-history", 1540DEFUN ("xwidget-webkit-goto-history",
1541 Fxwidget_webkit_goto_history, Sxwidget_webkit_goto_history, 1541 Fxwidget_webkit_goto_history, Sxwidget_webkit_goto_history,
1542 2, 2, 0, 1542 2, 2, 0,
1543 doc: /* Make the XWIDGET webkit load REL-POS (-1, 0, 1) page in browse history. */) 1543 doc: /* Make the XWIDGET webkit the REL-POSth element in load history.
1544
1545If REL-POS is 0, the widget will be just reload the current element in
1546history. If REL-POS is more or less than 0, the widget will load the
1547REL-POSth element around the current spot in the load history. */)
1544 (Lisp_Object xwidget, Lisp_Object rel_pos) 1548 (Lisp_Object xwidget, Lisp_Object rel_pos)
1545{ 1549{
1546 WEBKIT_FN_INIT (); 1550 WEBKIT_FN_INIT ();
@@ -1550,11 +1554,20 @@ DEFUN ("xwidget-webkit-goto-history",
1550 1554
1551#ifdef USE_GTK 1555#ifdef USE_GTK
1552 WebKitWebView *wkwv = WEBKIT_WEB_VIEW (xw->widget_osr); 1556 WebKitWebView *wkwv = WEBKIT_WEB_VIEW (xw->widget_osr);
1553 switch (XFIXNAT (rel_pos)) 1557 WebKitBackForwardList *list;
1558 WebKitBackForwardListItem *it;
1559
1560 if (XFIXNUM (rel_pos) == 0)
1561 webkit_web_view_reload (wkwv);
1562 else
1554 { 1563 {
1555 case -1: webkit_web_view_go_back (wkwv); break; 1564 list = webkit_web_view_get_back_forward_list (wkwv);
1556 case 0: webkit_web_view_reload (wkwv); break; 1565 it = webkit_back_forward_list_get_nth_item (list, XFIXNUM (rel_pos));
1557 case 1: webkit_web_view_go_forward (wkwv); break; 1566
1567 if (!it)
1568 error ("There is no item at this index");
1569
1570 webkit_web_view_go_to_back_forward_list_item (wkwv, it);
1558 } 1571 }
1559#elif defined NS_IMPL_COCOA 1572#elif defined NS_IMPL_COCOA
1560 nsxwidget_webkit_goto_history (xw, XFIXNAT (rel_pos)); 1573 nsxwidget_webkit_goto_history (xw, XFIXNAT (rel_pos));