[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/15] xwidget: Remove title hack.
From: |
Ricardo Wurmus |
Subject: |
[PATCH 10/15] xwidget: Remove title hack. |
Date: |
Mon, 24 Oct 2016 18:40:56 +0200 |
* src/xwidget.c (xwidget-webkit-get-title): Remove procedure.
* lisp/xwidget.el (xwidget-webkit-get-title,
xwidget-webkit-execute-script-rv): Remove procedures.
---
lisp/xwidget.el | 24 ------------------------
src/xwidget.c | 22 ----------------------
2 files changed, 46 deletions(-)
diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index 37edd52..a1b9b50 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -37,7 +37,6 @@
(declare-function make-xwidget "xwidget.c"
(type title width height arguments &optional buffer))
(declare-function xwidget-buffer "xwidget.c" (xwidget))
-(declare-function xwidget-webkit-get-title "xwidget.c" (xwidget))
(declare-function xwidget-size-request "xwidget.c" (xwidget))
(declare-function xwidget-resize "xwidget.c" (xwidget new-width new-height))
(declare-function xwidget-webkit-execute-script "xwidget.c"
@@ -480,29 +479,6 @@ For example, use this to display an anchor."
(let ((url (kill-new (or rv ""))))
(message "url: %s" url)))))
-(defun xwidget-webkit-execute-script-rv (xw script &optional default)
- "Same as `xwidget-webkit-execute-script' but with return value.
-XW is the webkit instance. SCRIPT is the script to execute.
-DEFAULT is the default return value."
- ;; Notice the ugly "title" hack. It is needed because the Webkit
- ;; API at the time of writing didn't support returning values. This
- ;; is a wrapper for the title hack so it's easy to remove should
- ;; Webkit someday support JS return values or we find some other way
- ;; to access the DOM.
-
- ;; Reset webkit title. Not very nice.
- (let* ((emptytag "titlecantbewhitespaceohthehorror")
- title)
- (xwidget-webkit-execute-script xw (format "document.title=\"%s\";"
- (or default emptytag)))
- (xwidget-webkit-execute-script xw (format "document.title=%s;" script))
- (setq title (xwidget-webkit-get-title xw))
- (if (equal emptytag title)
- (setq title ""))
- (unless title
- (setq title default))
- title))
-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun xwidget-webkit-get-selection (proc)
"Get the webkit selection and pass it to PROC."
diff --git a/src/xwidget.c b/src/xwidget.c
index 8552810..dbd8fc1 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -709,27 +709,6 @@ argument procedure FUN.*/)
return Qnil;
}
-DEFUN ("xwidget-webkit-get-title",
- Fxwidget_webkit_get_title, Sxwidget_webkit_get_title,
- 1, 1, 0,
- doc: /* Return the title from the Webkit instance in XWIDGET.
-This can be used to work around the lack of a return value from the
-exec method. */ )
- (Lisp_Object xwidget)
-{
- /* TODO support multibyte strings. */
- WEBKIT_FN_INIT ();
- const gchar *str =
- webkit_web_view_get_title (WEBKIT_WEB_VIEW (xw->widget_osr));
- if (str == 0)
- {
- /* TODO maybe return Qnil instead. I suppose webkit returns
- null pointer when doc is not properly loaded or something. */
- return build_string ("");
- }
- return build_string (str);
-}
-
DEFUN ("xwidget-resize", Fxwidget_resize, Sxwidget_resize, 3, 3, 0,
doc: /* Resize XWIDGET. NEW_WIDTH, NEW_HEIGHT define the new size. */
)
(Lisp_Object xwidget, Lisp_Object new_width, Lisp_Object new_height)
@@ -975,7 +954,6 @@ syms_of_xwidget (void)
defsubr (&Sxwidget_webkit_goto_uri);
defsubr (&Sxwidget_webkit_execute_script);
- defsubr (&Sxwidget_webkit_get_title);
DEFSYM (Qwebkit, "webkit");
defsubr (&Sxwidget_size_request);
--
2.10.1
- [PATCH v2 00/15] xwidget webkit improvements, (continued)
- [PATCH v2 00/15] xwidget webkit improvements, Ricardo Wurmus, 2016/10/24
- [PATCH 01/15] xwidget: Use WebKit2 API, Ricardo Wurmus, 2016/10/24
- [PATCH 02/15] xwidget: Pass JavaScript return value to optional callback procedure, Ricardo Wurmus, 2016/10/24
- [PATCH 03/15] Remove scrolled window container around WebKit widget, Ricardo Wurmus, 2016/10/24
- [PATCH 04/15] xwidget: Do not use `xwidget-execute-script-rv' to insert string, Ricardo Wurmus, 2016/10/24
- [PATCH 05/15] xwidget: Get title via asynchronous JavaScript., Ricardo Wurmus, 2016/10/24
- [PATCH 06/15] xwidget: Simplify functions to scroll to elements, Ricardo Wurmus, 2016/10/24
- [PATCH 07/15] xwidget: Add function to find element by CSS selector, Ricardo Wurmus, 2016/10/24
- [PATCH 08/15] xwidget: Get selection with asynchronous JavaScript, Ricardo Wurmus, 2016/10/24
- [PATCH 09/15] xwidget: Get URL asynchronously., Ricardo Wurmus, 2016/10/24
- [PATCH 10/15] xwidget: Remove title hack.,
Ricardo Wurmus <=
- [PATCH 11/15] Let initial WebKit view fill window, Ricardo Wurmus, 2016/10/24
- [PATCH 12/15] Dynamically resize WebKit widget., Ricardo Wurmus, 2016/10/24
- [PATCH 13/15] Implement zoom for WebKit widget., Ricardo Wurmus, 2016/10/24
- [PATCH 14/15] xwidget: Bind "beginning-of-buffer" and "end-of-buffer", Ricardo Wurmus, 2016/10/24
- [PATCH 15/15] xwidget: Map "previous-line" and "next-line" to scroll, Ricardo Wurmus, 2016/10/24
- Re: [PATCH v2 00/15] xwidget webkit improvements, Paul Eggert, 2016/10/25