From: Jim Porter Date: Sun, 23 Jun 2024 23:59:00 +0000 (-0700) Subject: Fix rescaling of images via 'text-scale-mode' in EWW X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8a0668dcd4dc3f22187f8e5b3d724f9e16937c58;p=emacs.git 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 3abcfe013d809a8194f5158877fd43f11d714fd5) --- diff --git a/lisp/net/eww.el b/lisp/net/eww.el index fd8f80065b1..94bfd333fa9 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -1371,12 +1371,16 @@ within text input fields." (goto-char (point-min)) (while-let ((match (text-property-search-forward 'display nil (lambda (_ value) (imagep value))))) - (let ((image (prop-match-value match))) - (unless (image-property image :original-scale) - (setf (image-property image :original-scale) - (or (image-property image :scale) 1))) + (let* ((image (prop-match-value match)) + (original-scale (or (image-property image :original-scale) + (setf (image-property image :original-scale) + (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) - (* (image-property image :original-scale) scaling))))))) + (* original-scale scaling))))))) (defun eww--url-at-point () "`thing-at-point' provider function."