From: Eli Zaretskii Date: Fri, 6 Oct 2017 12:42:22 +0000 (+0300) Subject: Revert last change in 'shr-descend' X-Git-Tag: emacs-26.0.90~45^2~16 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e5bff696bcf5f54d2db9bcc8c5ce93083ac0a0d3;p=emacs.git Revert last change in 'shr-descend' * lisp/net/shr.el (shr-descend): Revert the part of the last change which introduced calls to shr-indirect-call into this function. Add a comment explaining the rationale for that. (Bug#28402) --- diff --git a/lisp/net/shr.el b/lisp/net/shr.el index fe5197b35f7..260ada54222 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -483,7 +483,11 @@ size, and full-buffer size." (apply 'shr-generic dom args))))) (defun shr-descend (dom) - (let ((tag-name (dom-tag dom)) + (let ((function + (intern (concat "shr-tag-" (symbol-name (dom-tag dom))) obarray)) + ;; Allow other packages to override (or provide) rendering + ;; of elements. + (external (cdr (assq (dom-tag dom) shr-external-rendering-functions))) (style (dom-attr dom 'style)) (shr-stylesheet shr-stylesheet) (shr-depth (1+ shr-depth)) @@ -498,7 +502,17 @@ size, and full-buffer size." (setq style nil))) ;; If we have a display:none, then just ignore this part of the DOM. (unless (equal (cdr (assq 'display shr-stylesheet)) "none") - (shr-indirect-call tag-name dom) + ;; We don't use shr-indirect-call here, since shr-descend is + ;; the central bit of shr.el, and should be as fast as + ;; possible. Having one more level of indirection with its + ;; negative effect on performance is deemed unjustified in + ;; this case. + (cond (external + (funcall external dom)) + ((fboundp function) + (funcall function dom)) + (t + (shr-generic dom))) (when (and shr-target-id (equal (dom-attr dom 'id) shr-target-id)) ;; If the element was empty, we don't have anything to put the