Fix rescaling of images via 'text-scale-mode' in EWW

* lisp/net/eww.el (eww--rescale-images): Handle a :scale of 'default'
(bug#71741).

(cherry picked from commit 3abcfe013d)
This commit is contained in:
Jim Porter 2024-06-23 16:59:00 -07:00
parent 0e43606b20
commit a4ca30ac2e

View file

@ -1371,12 +1371,16 @@ within text input fields."
(goto-char (point-min)) (goto-char (point-min))
(while-let ((match (text-property-search-forward (while-let ((match (text-property-search-forward
'display nil (lambda (_ value) (imagep value))))) 'display nil (lambda (_ value) (imagep value)))))
(let ((image (prop-match-value match))) (let* ((image (prop-match-value match))
(unless (image-property image :original-scale) (original-scale (or (image-property image :original-scale)
(setf (image-property image :original-scale) (setf (image-property image :original-scale)
(or (image-property image :scale) 1))) (or (image-property image :scale)
'default)))))
(when (eq original-scale 'default)
(setq original-scale (image-compute-scaling-factor
image-scaling-factor)))
(setf (image-property image :scale) (setf (image-property image :scale)
(* (image-property image :original-scale) scaling))))))) (* original-scale scaling)))))))
(defun eww--url-at-point () (defun eww--url-at-point ()
"`thing-at-point' provider function." "`thing-at-point' provider function."