Skip to content

A cold turn of the iPad opens a whole spread, and turning back keeps his page - #324

Open
arimendelow wants to merge 4 commits into
mainfrom
gf-302-cold-rotation
Open

arimendelow wants to merge 4 commits into
mainfrom
gf-302-cold-rotation

Conversation

@arimendelow

@arimendelow arimendelow commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #302

Cold turn to landscape. Readium's default spread: .auto flipped on every turn of the iPad and reloaded the chapter's page. The restore then waited 3–10 s for that reload, and meanwhile the unfold's leaf finished its 2.6 s lift and stood still over the old portrait page with the right page blank. Gatefold lays out a reflowable spread itself, in CSS columns, so the spread is now .never for reflowable books; fixed-layout books keep Readium's default.

Rotate back. The reload opened at the chapter's first page, which caused the title-page flash. The off-by-one had a second cause: the page opened with margins for a placeholder width (a phone's) and kept them until the columns changed. So portrait was read with the wrong margins until the first turn on its side set the real ones, and back upright his words fell about a third of a page into another page. updateLayout now gives the page its margins when the width crosses one of their steps (wide or narrow page share, or Readium's gutter breakpoint), even with the same columns. Within a step nothing changes, so a live resize doesn't reflow on every width, and fixed-layout books skip it.

Tests (RotationMidTransitionUITests, shard ipad-rotate-midturn), judged in frames and reads:

  • testAColdTurnOnItsSideOpensAWholeSpreadWithNoStandingLeaf reads the display frames the risen leaf stood waiting (new UI-test probe reader.leafStoodFrames). It counts screenshot looks with a blank page or a standing grey band while the leaf stood, or after the reflow settled.
  • testTurnedOnItsSideAndBackHeIsOnHisPage counts chapter reloads (new probe reader.reflowFreshPages) and compares his first words before and after by hash.

Red and green probes (not-for-merge branches running only these two tests on a hosted runner):

Locally (iPad Pro 13 simulator): on main the leaf stood 70 frames with 5 standing looks, the page reloaded 2 times, and his first words started 350 characters in. With the fix: 0 frames, 0 reloads, offset 0.

This touches ReaderModel (place work for #259/#310 is in flight there): epubPreferences gains fixedLayout, and updateLayout gains the margins re-apply.

…er (#302)

The cold-turn check counted a look from before the turn as the whole spread. Two iPad tests now judge
the turn in frames and reads: the display frames the unfold's leaf stood risen waiting on its spread,
screenshot looks with a blank page or a standing grey band, the chapter's page loaded anew, and his
first words back upright. UI-test-only probes: reader.leafStoodFrames and reader.reflowFreshPages.
…his page (#302)

Readium's default spread (.auto) flipped on every turn of the iPad and reloaded the chapter's page: the
restore waited 3 to 10 s on the reload while the unfold's leaf stood risen over the old page with the
right page blank, and the reload opened at the chapter's first page, the title page that flashed on the
way back. Gatefold lays a reflowable spread out itself, so the spread is now .never (fixed-layout books
keep Readium's).

The page also opened with a placeholder width's margins (a phone's) and kept them until the columns
changed, so an iPad read in portrait with the wrong margins until its first turn on its side; turned
back, his words fell a third of a page down another page (16 became 17). A width change that calls for
new margins now applies them.
…a second (#302 review)

- The page gets new margins with the same columns only when the width crosses a step of the share or
  Readium's gutter, so a live resize no longer reflows on every width; fixed-layout books skip it, and
  the host settles a layout measured before it loaded.
- The display link counting the standing leaf runs only under UI tests.
- The cold-turn test allows the leaf a second of frames at the top of its rise (hosted runners: main
  226, the fix 22), waits for a reflow newer than the one before the turn, and keeps screenshots only
  on failure.
- ipad-rotate-midturn's timeout carries the two new tests.

This branch has not been deployed

No deployments
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.

Cold rotation to landscape: blank right page and a grey leaf strip stuck over the left page for 6 s+; rotate-back flashes the title page

1 participant