Fix BL-16811 Front cover and title page overwrite each other's title padding - #8342
Fix BL-16811 Front cover and title page overwrite each other's title padding#8342JohnThomson wants to merge 1 commit into
Conversation
|
[Claude Sonnet 5 from John Thomson's machine during preflight] Consulted Devin on 2026-09-10 (job Devin's review came back clean for that commit: no bugs, no Investigate flags, and no informational items. CI ( |
|
[Claude Sonnet 5 from John Thomson's machine during preflight] Consulted Devin again on 2026-09-10 (job Re-review clean — bots quiet: no bugs, no Investigate flags, no informational items. CI ( |
|
[Claude Fable 5.1 from John Thomson's machine during preflight] Consulted Devin on 2026-09-11 (job It raised one Bug about a book with per-page title padding being edited in an older Bloom and then reopened here; assessed as not an issue (this build's stored per-page values are the better choice, and the editor re-measures on the next visit), reasoning on the thread, resolved. No Investigate flags, no informational items. CI ( |
…padding The book title appears on both the front cover and the title page, and each copy needs a different measured padding-bottom so its descenders are not clipped. BookData synchronised the style attribute across every copy of a data-book field through one data-div entry, so whichever page was visited last overwrote the other, and the published cover title could lose its descender room. The two pages also re-dirtied the book on every visit. BookData now treats (bookTitle, style) as a page-dependent attribute: the value is saved in the data-div once per kind of xmatter page, as data-style-frontcover and data-style-titlepage, alongside the plain style attribute that older Bloom versions and books without variants still use. Gathering collects each xmatter page's own variant (and seeds the other pages' variants from the data-div when a single page is saved), and restoring gives each page its own variant, falling back to the plain value. The cover image, custom-layout pages, and ordinary pages are unaffected. Five new BookDataTests cover both save directions, whole-book sync, the legacy upgrade path, and an ordinary page. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
194de7e to
a2dde80
Compare
Problem
The book title appears on both the front cover and the title page, and each needs a different
bottom padding so its descenders are not clipped — about 3px on the cover, 0px on the title page
at the default type sizes. Bloom keeps that padding in the editable's
styleattribute, andstyleis synchronised across every copy of adata-bookfield through a single data-div entry.So the two pages overwrite each other, and whichever was visited more recently wins; the other one
is saved with a value that is wrong for it.
You never see it in the editor, because
OverflowCheckerre-measures and re-applies the paddingevery time a page loads. But the saved value is what gets published, and BloomPUB, ePUB, Bloom
Reader and BloomLibrary have no OverflowChecker — they render what is in the file. A book published
while the front cover holds the title page's value loses the descender room on its cover title,
which is exactly the clipping
bloom-padForOverflowexists to prevent, on the most prominent textin the book. A side effect of the same ping-pong: those two pages really do change every time they
are looked at, so a book shows as modified after merely being browsed — spurious checkouts in a
Team Collection.
Fix
_pageDependentAttributesset inBookDatanames the (data-book key, attribute) pairswhose value legitimately differs from one xmatter page to another. It currently holds exactly one
pair,
(bookTitle, style); every other key and attribute is untouched by the mechanism.data-<attr>-<pagetype>(data-style-frontcover,data-style-titlepage). The plain attribute isstill written too, holding the most recently saved value, so older Bloom versions and books that
have no variant yet behave exactly as before.
variant instead of letting the first element found decide for all of them (and, when the data-div
has no plain value recorded yet, fills that in from a page too, so the fallback is never left
empty). When we read from a single edited page — where the data-div is not part of what we read —
the other pages' variants are seeded from the data-div, so saving one page cannot forget the
others.
ResolvePageDependentAttributes: an xmatter pagegets its own variant under the plain attribute name and never another page's; the data-div gets the
variants verbatim; and anything not on an xmatter page (an ordinary content page, the data-div copy
of a book saved by an older Bloom) gets just the plain attribute. The existing custom-layout-page
exclusions (BL-16357, BL-9460) are untouched.
BookDataTestscover both save directions, a whole-book synchronize of a book whose twopages disagree, the legacy upgrade path where the data-div has only the plain value, and a title on
an ordinary page with no
data-xmatter-page.Ref: https://issues.bloomlibrary.org/youtrack/issue/BL-16811
Devin review
This change is