Skip to content

Fix BL-16811 Front cover and title page overwrite each other's title padding - #8342

Draft
JohnThomson wants to merge 1 commit into
Version6.5from
BL-16811-title-padding-per-page
Draft

Fix BL-16811 Front cover and title page overwrite each other's title padding#8342
JohnThomson wants to merge 1 commit into
Version6.5from
BL-16811-title-padding-per-page

Conversation

@JohnThomson

@JohnThomson JohnThomson commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

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 style attribute, and
style is synchronised across every copy of a data-book field 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 OverflowChecker re-measures and re-applies the padding
every 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-padForOverflow exists to prevent, on the most prominent text
in 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

  • A new _pageDependentAttributes set in BookData names the (data-book key, attribute) pairs
    whose 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.
  • Such a value is now saved in the data-div once per kind of xmatter page, as
    data-<attr>-<pagetype> (data-style-frontcover, data-style-titlepage). The plain attribute is
    still written too, holding the most recently saved value, so older Bloom versions and books that
    have no variant yet behave exactly as before.
  • Gathering keeps first-found-wins for every other attribute, but collects each xmatter page's own
    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.
  • Restoring routes the saved attribute list through ResolvePageDependentAttributes: an xmatter page
    gets 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.
  • Five new BookDataTests cover both save directions, a whole-book synchronize of a book whose two
    pages 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 Reviewable

@JohnThomson

Copy link
Copy Markdown
Contributor Author

[Claude Sonnet 5 from John Thomson's machine during preflight] Consulted Devin on 2026-09-10 (job pr-review-job-4d062ae4c9a64372b3461ddc3f9dfee6) up to commit e4bd0834e9087c84f4d623c4bedd8d91124d72ea.

Devin's review came back clean for that commit: no bugs, no Investigate flags, and no informational items. CI (pr-automation) passed, and no other review bot has posted. Nothing to mirror, so there are no finding threads on this PR.

@JohnThomson

Copy link
Copy Markdown
Contributor Author

[Claude Sonnet 5 from John Thomson's machine during preflight] Consulted Devin again on 2026-09-10 (job pr-review-job-596e233c45ac4eaca020edffbcd5f5c8) up to commit 88c06416b91f9b39564bb446a40bdd71e881c01f, after the follow-up commit.

Re-review clean — bots quiet: no bugs, no Investigate flags, no informational items. CI (pr-automation) passed again, and no other review bot has posted on this PR.

Comment thread src/BloomExe/Book/BookData.cs
@JohnThomson

Copy link
Copy Markdown
Contributor Author

[Claude Fable 5.1 from John Thomson's machine during preflight] Consulted Devin on 2026-09-11 (job pr-review-job-4e6f79a45b6d4fac86237b26af707c46) up to commit 194de7ec65df81712cb3d4630d34754e2b0515d5, after two readability refactors and a merge of Version6.5.

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 (pr-automation) passed; no other review bot has posted.

…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>
@JohnThomson
JohnThomson force-pushed the BL-16811-title-padding-per-page branch from 194de7e to a2dde80 Compare September 11, 2026 14:01
@JohnThomson
JohnThomson marked this pull request as ready for review September 11, 2026 14:01
@JohnThomson
JohnThomson marked this pull request as draft September 11, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant