From a2f3d51f70efa1b65c9308e3445ada16d4211586 Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Sun, 23 Jun 2024 16:59:00 -0700 Subject: [PATCH 1/2] Fix rescaling of images via 'text-scale-mode' in EWW * lisp/net/eww.el (eww--rescale-images): Handle a :scale of 'default' (bug#71741). --- lisp/net/eww.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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 @@ eww--rescale-images (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." -- 2.25.1