Skip to content

fix(docx): say a shape container's layers are written inline only where they are - #903

Merged
DemchaAV merged 2 commits into
2.5-devfrom
fix/docx-report-container-layers
Oct 15, 2026
Merged

DemchaAV merged 2 commits into
2.5-devfrom
fix/docx-report-container-layers

Conversation

@DemchaAV

@DemchaAV DemchaAV commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Why

Every shape container not written as a panel got the report note APPROXIMATED "its layers are written inline, one after another in source order", whatever it held. It was the most frequent note in the corpus (186 of 1332). It is true of a container holding text or an inline picture, which the export writes in the flow, one layer after another, rather than over its outline. It is false of a container whose layers are all drawing — a tile, an icon, a badge holding its glyph — since each of those layers is drawn where the page draws it and nothing is written in the flow.

Measured on the corpus, by what each noted container holds:

Container holds Notes Written in the flow
drawings only (ShapeNode, a stack of Paths, an ellipse) 49 nothing
a picture drawn over the badge or plate (icons) 22 nothing
anything, composed in a table cell its table draws 15 nothing
text, with or without pictures 96 the text
a picture written inline (a profile photo, a logo) 4 the picture

What changed

  • writeShapeContainer no longer notes the container before its layers. The note (reportLayersWrittenInline) is written:
    • after the layers, when blocksWritten grew, the counter that already decides whether the container's edges are space in the flow;
    • or when a layer's text was moved into an earlier layer's stand-in (holdsMovedContent), where it is written in the flow though the container's own layer writes nothing;
    • or when the page stacks the layers in another order than they are given, by their z-index (paintsOutOfSourceOrder, against inPaintOrder): the export draws them in the order given, so a dot laid under a disc comes out over it;
    • and, as before, before the layers of a band (writeOverlayBand).
  • blocksWritten counts every paragraph and table newBodyParagraph/newTable makes, a table cell's included, so a container holding text in a composed cell keeps its note.
  • Off the band path, the note now follows its children's notes in the report rather than preceding them. The once-per-export docx.export.shape-container-fallback warning stays where it was, so a container whose clip cuts still logs it.
  • The DOCX recipe and the ledger entry for ShapeContainerNode.layers say where the note is written.

Verification

  • Corpus. All 62 DOCX are byte-identical to 2.5-dev's, since only the report changes. Notes go from 1332 to 1246; the 86 gone are exactly the three "nothing" rows above, and no note is added.
  • Tests.
    • DocxDrawingsTest.aContainerWhoseLayersAreAllDrawnIsNotSaidToWriteThemInline exports four containers: a tile in a layer stack, a tile composed in a table cell, a text container and a header band beside its badge. It asserts the seven drawings are written and that exactly the text container and the band carry the note; with the note written for every container, the stack's tile, the band's badge and the cell's tile get it too.
    • DocxStandInMoveTest.aShapeContainerWhoseTextMovesIntoAStandInIsStillSaidToWriteItsLayersInline has a chip taller than the stand-in, whose subtitle moves into the strip under the name, the premise it checks. The chip keeps its note.
    • DocxDrawingsTest.aContainerWhoseLayersThePageStacksInAnotherOrderIsStillNamed has a disc over a dot by z-index, given the other way round. The container keeps its note.
    • DocxClipReportTest.aPhotoFillingItsCircleIsCroppedToIt still pins the note on a photo written in the flow.
  • Sabotage. All 6 caught: the note written for every container, never on the flow path, never for a band, never for moved text, z-order ignored, and nothing moved into a stand-in, which the stand-in test's premise catches.
  • Gate. ./mvnw -B -ntp clean verify → BUILD SUCCESS (render-docx 1584, qa 1820).

Lane: render-docx — report notes only; the Word file is unchanged

…re they are

Every shape container not written as a panel was noted "its layers are
written inline, one after another in source order", whatever it held. A
tile, an icon or a badge holding its glyph writes nothing in the flow:
each layer is drawn where the page draws it, and nothing of its layering
is lost. The note is now written after the layers, where one of them was
written in the flow, and for a band, which always writes its text.

A chip whose text moves into an earlier layer's stand-in keeps the note, and
the once-per-export fallback warning is logged with it.
… order

A drawing-only shape container whose layers the page stacks by their
z-index in another order than they are given is drawn in the order
given: a dot laid under a disc comes out over it. Its note stays, and the
once-per-export fallback warning is logged where it was, before the
layers, so a container whose clip cuts still logs it.

The stand-in test now checks its premise, the subtitle written under the
name in the strip; the drawing test counts its seven drawings.
@DemchaAV
DemchaAV merged commit 6e16eb8 into 2.5-dev Oct 15, 2026
13 checks passed
@DemchaAV
DemchaAV deleted the fix/docx-report-container-layers branch October 15, 2026 06:38
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