Repository navigation
Conversation
hatton
commented
Oct 9, 2026
hatton
commented
Oct 9, 2026
Member
Author
|
[Claude Opus 5.5 from Hatton's machine during preflight] Consulted Devin on 2026-10-09 19:36 UTC up to commit |
A background picture meant to fill its picture area (bloom-canvas) showed a thin white line along one or more edges. The fit is "contain", and origami split positions are percentages, so a picture lined up with its pane is almost never an exact fit and the sliver left over shows the white page. Chrome also snaps an img to whole pixels before applying the editor's zoom, so the drawn picture can stop up to half a pixel short of its box. - adjustBackgroundImageSizeToFit makes the picture overhang each edge it reaches (or comes within 2px of filling) by kBackgroundImageBleedPx (1px), in both contain and cover modes; the bloom-canvas clips the overhang. Aspect ratio and crops are kept. - Pages fitted before this re-fit once when opened. - Fit Space counts as already done when the picture covers the whole bloom-canvas, is centred, and is enlarged no more than the bleed explains. - Overlay repositioning on an origami resize derives the size the picture was fitted to from its size and centred offset, so the overhang isn't taken for a stale size record. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
hatton
force-pushed
the
BL-17009-image-white-lines
branch
from
October 9, 2026 19:47
c2627f8 to
b4024cc
Compare
hatton
marked this pull request as ready for review
October 9, 2026 19:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[Claude Sonnet 5.5 from Hatton's machine during preflight]
Problem
When a picture is meant to fill its area, a thin white line often shows along one or more of its edges. It happens most after the author drags the origami splitter until the picture looks like it fills its pane, and with Fit Space / Expand to Fill Space. The line is most noticeable where the picture runs to the edge of the page.
Cause
Bloom fits a background picture inside its picture area (the
bloom-canvas) without cropping. Origami split positions are percentages, so the area is almost never exactly the picture's shape, and a sliver of 0.02–0.3px is left over. Fit Space had the same problem, because it sized to the whole-pixelclientWidth/clientHeight. On top of that, Chrome snaps animgto whole pixels in the page's own coordinates before it applies the Edit tab's zoom, so the drawn picture can stop up to another half pixel short of its box. Either way, the white page shows through.Fix
adjustBackgroundImageSizeToFitnow makes the picture overhang each edge of thebloom-canvasthat it reaches (or comes within 2px in total of filling) by 1px. Thebloom-canvasalready clips its contents (overflow: hidden), so the overhang is never seen. This applies in both fit modes (contain, and cover from Expand to Fill Space). The picture keeps its aspect ratio, and a cropped picture keeps its crop.Does every picture now lose a pixel on every side?
No.
Not addressed: where a picture runs to the edge of the page and that edge falls partway through a screen pixel, the last pixel column still comes out light gray. Chrome anti-aliases the white page background and the clipped picture separately at the same edge. Fixing it would mean changing the Edit tab's zoom or how the page clips its contents.
Risk Evaluation
The change runs through
adjustBackgroundImageSizeToFit, which every background picture passes through: page load (for pages that need the one-time re-fit), origami resizes, image changes, Fit Space and Expand to Fill Space. It changes the background element's stored geometry:left/topbecome about-1pxon edges it fills, andwidth/heightgrow by about 2px. Code that compares the background element's size with thebloom-canvasis where to look hardest: Fit Space's "already done" check and the overlay repositioning on an origami resize (CanvasElementResizeAdjustments.ts) are both updated for it. Rotation (imageContentTransform.ts) and the origami auto-fit (autoFitImageOverTextSplits.ts) use the element's aspect ratio, and the overhang doesn't change it.The one-time re-fit on load means each existing page with a fill-to-edge picture gets one saved change the first time it is opened in the Edit tab. After that, nothing changes on later visits.
Ecosystem Impact
basePage.lessgives every.bloom-canvasoverflow: hidden, so the overhang is clipped there too. I didn't view a published book.E2E Coverage
No e2e test covers this. The change is sub-pixel geometry, and the existing canvas e2e specs neither assert background-image geometry nor look at screenshots that fine. New unit tests cover the sizing rule, Fit Space's "already done" check (wide canvases, near misses, author crops, off-centre crops), and overlays keeping their place when an overhanging background's pane is widened. The behavior was checked by screenshotting every page of an affected book in a running Bloom before and after, and measuring each picture edge.
Notion Test Suite
None.
Preflight report: https://bloombooks.github.io/dev-process-artifacts/deciders/bloomdesktop-bl-17009-image-white-lines.html
Ref: https://issues.bloomlibrary.org/youtrack/issue/BL-17009
🤖 Generated with Claude Code
Devin review
This change is