feat(render-pptx): keep provably no-op clips editable, align gradient stops and handler contracts#417
Open
DemchaAV wants to merge 1 commit into
Open
Conversation
… stops and handler contracts
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.
Why
Every clipped composite rendered as one raster picture, even when the clip could not visibly cut anything — the overwhelmingly common defensive-clip case (a rounded card whose padded content never reaches the corners). On the flagship deck that turned the bottom badges, the backend cards, and the engine grid into non-editable pictures, defeating the editable-deck promise for exactly the shapes a user reaches for first. Separately, a parity audit found PPTX gradients honouring partial stop offsets the PDF shading ignores, and
addHandlersilently accepting duplicates the PDF builder rejects.What
PptxClipSafetyproves a clip region cannot remove ink, in which case the raster fallback is skipped and the children render as native, editable shapes. The ink model is exact where it can be: smooth strokes and side borders bleed half their width past the fragment box; a projecting line cap bleeds ×√2; unstroked polygon fills stay inside (ShapePointclamps); an unstroked path fill is provable only when every segment coordinate — Bézier control points as a conservative hull — stays in the unit box, because the segment contract does not clamp them. Text gets a font-size-aware overhang guard. Everything else is unprovable and keeps the pixel-exact raster: stroked polygons/paths (mitred joins spike), table rows, transforms inside the region, polygon/path clip outlines, unknown payloads, NaN stroke widths. Rounded-rect containment forbids only the corner squares (per-corner radii honoured in the y-up convention); ellipse containment is a Minkowski test against the true ellipse.PptxGradientFill, matching what the PDF shading functions actually paint — partial-offset ramps now shade identically in both formats.Builder.addHandlerrejects a duplicate custom handler for the same payload type (PDF contract parity) and documents that custom handlers do not apply inside rasterized clip composites.DocumentColor.rgba's Javadoc names the PPTX behaviour.Verification
PptxClipSafetyTest(14 tests): exact-fit and padded safety, overflow/stroke-bleed/side-border/projecting-cap rejections, rounded and per-corner squares with a top-vs-bottom y-up discriminator, Minkowski ellipse, bounds-vs-path policy, miter and unclamped-path bail-outs, unknown-payload and transform bail-outs, nested-marker transparency.PptxClipRasterFallbackTestgains the no-op case (padded rounded card renders two native shapes, no composite) while the genuinely-cutting fixtures still raster;PptxAlphaTestpins native alpha for fills, strokes (at the XML level — POI'sgetLineColorhides the alpha its writer emits), and text runs; gradient-stop pinning and the duplicate-handler rejection are CT-level pinned.clean verifyacross core, render-pdf, render-docx, render-pptx, templates, testing, root, bundle, qa, coverage.