GNU bug report logs - #71666
30.0.50; [PATCH] Fix zooming images with SHR

Previous Next

Package: emacs;

Reported by: Jim Porter <jporterbugs <at> gmail.com>

Date: Thu, 20 Jun 2024 04:48:02 UTC

Severity: normal

Tags: patch

Merged with 63344

Found in versions 29.0.90, 30.0.50

Done: Jim Porter <jporterbugs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jim Porter <jporterbugs <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 71666 <at> debbugs.gnu.org
Subject: bug#71666: 30.0.50; [PATCH] Fix zooming images with SHR
Date: Sun, 23 Jun 2024 15:24:47 -0700
[Message part 1 (text/plain, inline)]
On 6/22/2024 11:14 PM, Jim Porter wrote:
> I agree completely, and I'm working on a patch to that effect. :)
> 
> I think the problem you mention is a combination of some bugs I'm 
> working on fixing now, and like you say, 'shr-zoom-image' not providing 
> enough feedback about what's happening. It just says it's fetching the 
> image (this is also probably a bug; why fetch the image from the web 
> when we're just resizing it?).
> 
> Since I'm most of the way done with this additional patch, I'll leave 
> this bug open for now.

This ended up fairly complex, so I've split the patch into sub-parts to 
(I hope) make the changes easier to follow. There are four distinct, but 
related, improvements here:

1. Previously, SHR sliced images whenever you requested "original" zoom. 
But it would really be useful to slice images based on the size they'll 
be displayed at: a tiny image at "original" zoom doesn't need sliced, 
but a tall image at default zoom would benefit from slicing. So now SHR 
checks the height of the image to determine when to slice (you can also 
turn off slicing entirely, since you don't need it if you use 
'pixel-scroll-precision-mode').

2. When zooming, SHR lost track of the width and height of the image 
specified in the HTML like <img src="..." width="M" height="N">. I fixed 
that, and also cleaned up a bit of the code where we had a list that was 
simultaneously an alist and a plist (I converted it to a plist since 
more code used that form).

3. After much archaeology through old Gnus commits, I think I understand 
what each zoom level does, so I've fixed them. I've also added a new 
zoom level that zooms to the image's default size, ignoring HTML 
attributes. That's how the default and "full" zoom levels worked before 
my fix, so if someone wants the old behavior (I'd probably use it), 
there it is. I also made 'shr-zoom-image' display a message telling 
users the new zoom level.

4. Finally, every time you called 'shr-zoom-image', it would reload the 
image from the web. That shouldn't be necessary since there's a local 
cache. Now we use the cache when possible; easy enough.
[0001-Slice-images-based-on-their-height-in-SHR-not-their-.patch (text/plain, attachment)]
[0002-In-SHR-keep-track-of-image-sizes-as-specified-by-the.patch (text/plain, attachment)]
[0003-Fix-the-different-image-zoom-levels-in-SHR-to-work-a.patch (text/plain, attachment)]
[0004-In-SHR-load-from-URL-cache-if-possible-when-zooming-.patch (text/plain, attachment)]

This bug report was last modified 320 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.