From b242f5acf58b8ad2ab12ecd72f9b7c6c12641168 Mon Sep 17 00:00:00 2001 From: Drew Dibble Date: Mon, 9 Nov 2026 16:50:36 -0700 Subject: [PATCH] Fit to Artwork Bounds: a change in place is measured again; the fix's evidence names EPS export A new test changes the document in place (Arc::make_mut, with no other holder and no change of revision) and checks the answer is measured again: keyed on the document's address alone, it would keep the old answer. The kept answer's doc says what it holds after the measure, and that the fonts set the bounds of all type. Should measuring ever ask again while it runs, it is measured without being kept, rather than borrowed twice. The stack overflow fixed in d5d04f868 also hit EPS export, and the parity rows now say so. Two test docs are corrected: the fill-only clipping is an older bug on main, and the outline-view difference runs both ways on a few dozen hairline pixels. --- crates/engine/src/doc_state.rs | 13 ++++++++++--- crates/engine/src/tests/panelcmds.rs | 16 ++++++++++++++++ crates/render/src/fx/tests.rs | 2 +- crates/render/src/tests/changed.rs | 9 +++++---- docs/target-app-parity.md | 4 ++-- 5 files changed, 34 insertions(+), 10 deletions(-) diff --git a/crates/engine/src/doc_state.rs b/crates/engine/src/doc_state.rs index 8c8079fd91..736b873d06 100644 --- a/crates/engine/src/doc_state.rs +++ b/crates/engine/src/doc_state.rs @@ -128,7 +128,9 @@ struct EmptyArtboards { /// Whether an unlocked artboard of those asked about has art that Fit to Artwork Bounds fits it /// to, with what was measured: the document (held as [`EmptyArtboards::doc`] holds it), the -/// artboards, and the generations of what the measure reads outside the document. +/// artboards, and the generations of what the measure reads outside the document. One is kept for +/// each open document, and its weak reference keeps the measured document's allocation (not its +/// contents) until the next measure or until the document closes. #[derive(Clone, Debug)] struct ArtToFit { doc: std::sync::Weak, @@ -344,13 +346,18 @@ impl DocState { /// answer is kept for this version of the document and those artboards, and a change of the /// selection or the view keeps it. It is measured again when what the measure reads outside the /// document changes: the installed plug-ins, whose effects draw art, and the installed fonts, - /// which set type drawn by its effects' art (an envelope, a 3D effect). + /// which set the bounds of all type. pub fn any_art_to_fit(&self, indices: &[usize]) -> bool { self.any_art_to_fit_with(indices, (vectorcraft_plugins::registry::revision(), vectorcraft_text::FontDb::global().generation())) } /// [`Self::any_art_to_fit`], with `outside` the generations of the plug-ins and the fonts. pub(crate) fn any_art_to_fit_with(&self, indices: &[usize], outside: (u64, u64)) -> bool { - let mut last = self.art_to_fit.borrow_mut(); + // Measuring runs renderer and plug-in code; should it ever ask again while measuring, it + // is measured without being kept rather than borrowed twice. + let Ok(mut last) = self.art_to_fit.try_borrow_mut() else { + let mut r = vectorcraft_render::Renderer::new(); + return indices.iter().filter_map(|i| self.doc.artboards.get(*i)).any(|a| !a.locked && r.art_bounds_on(&self.doc, a.rect).is_some()); + }; if let Some(k) = last.as_ref() && std::ptr::eq(k.doc.as_ptr(), Arc::as_ptr(&self.doc)) && k.indices == indices diff --git a/crates/engine/src/tests/panelcmds.rs b/crates/engine/src/tests/panelcmds.rs index 8dda7196c6..239d6bee7b 100644 --- a/crates/engine/src/tests/panelcmds.rs +++ b/crates/engine/src/tests/panelcmds.rs @@ -1818,6 +1818,22 @@ fn art_to_fit_is_measured_once_for_a_version_of_the_document() { assert_eq!(art_to_fit_counted(&s, &[1], (1, 1)), (false, 0)); } +/// A change made to the document in place (`Arc::make_mut`, with no other holder and no change +/// of revision) is measured again: the kept answer holds the document it measured weakly, so a +/// changed document is a new allocation, not the old address. +#[test] +fn art_to_fit_follows_a_change_in_place() { + let mut s = row_of_artboards(2); + box_at(&mut s, 10.0, 20.0); + assert_eq!(art_to_fit_counted(&s, &[0], (0, 0)), (true, 1), "art on artboard 1"); + let st = s.doc_mut().unwrap(); + assert_eq!(Arc::strong_count(&st.doc), 1, "the undo history holds the document before the edit"); + let (revision, empty_spot) = (st.revision, st.doc.artboards[1].rect); + Arc::make_mut(&mut st.doc).artboards[0].rect = empty_spot; + assert_eq!(st.revision, revision); + assert_eq!(art_to_fit_counted(&s, &[0], (0, 0)), (false, 1), "artboard 1 moved off the art"); +} + /// The enabled state follows an edit, an undo, a redo, an added and a removed artboard, a locked /// artboard, and each change measures the document once. #[test] diff --git a/crates/render/src/fx/tests.rs b/crates/render/src/fx/tests.rs index 31ffc63513..560a3675cc 100644 --- a/crates/render/src/fx/tests.rs +++ b/crates/render/src/fx/tests.rs @@ -1755,7 +1755,7 @@ fn an_image_inner_glow_follows_its_visible_pixels() { /// only a fill and a raster effect draws from that art, where without the 3D effect it draws as a /// path, whose raster effects are clipped to the path's own geometry: there Roughen's spikes are /// cut off, so the two differ in a few pixels at the edge and match inside the path. That clipping -/// is a known bug of drawing without the 3D effect, older than this test, not the design. Either +/// is an older bug on main of drawing without the 3D effect, not the design. Either /// way the raster effect reaches past what the object draws without it. #[test] fn a_3d_effect_that_builds_nothing_draws_the_item_as_without_it() { diff --git a/crates/render/src/tests/changed.rs b/crates/render/src/tests/changed.rs index 5d6272eca1..27c299c49c 100644 --- a/crates/render/src/tests/changed.rs +++ b/crates/render/src/tests/changed.rs @@ -616,10 +616,11 @@ fn a_trace_objects_new_first_member_is_its_source() { } /// Recoloring a traced shape changes only the shape, as the free measure and the renderer that drew -/// the trace object in its view measure it. The area is bounded, not drawn again and compared: in -/// this view (outlines with the source image) a partial render of the outlines differs from the -/// whole by one in alpha on 37 pixels (230 against 229), which is older than this test and has -/// nothing to do with what changed (the recolor changes no pixel in this view). +/// the trace object in its view measure it. Through the renderer the area is bounded, not drawn +/// again and compared: in this view (outlines with the source image) a partial render of the +/// outlines differs from the whole by one in alpha on a few dozen hairline pixels, either way, +/// which is older than this test and has nothing to do with what changed (the recolor changes no +/// pixel in this view). #[test] fn recolouring_a_traced_shape_changes_only_the_shape() { let (old, _, _, shape) = traced("outlinesWithSourceImage"); diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index b8d7604ed6..a93770b88a 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -41,7 +41,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard | Date | Change | Summary | |---|---|---| -| 2026-11-09 | minor | Canvas: a 3D effect (Extrude & Bevel, Inflate, Rotate, Revolve) changed on type or a group draws again where its art was and is, measured by that art; the canvas measures through its renderer and draws the part with the art it made to measure it. Exports and Object › Rasterize take the solid of 3D type. Fit to Artwork Bounds and per-artboard SVG export measure every artboard through one renderer, building each solid once. A 3D effect on a fill or stroke that builds nothing (Revolve after Roughen) no longer overflows the stack on the canvas, in Object › Rasterize and in raster exports: the fill or stroke draws as without it. Tests `tests::changed::a_3d_effect_changed_on_type_or_a_group_changes_where_its_solid_was`, `fx::tests::a_renderer_measures_the_art_on_each_artboard_building_each_solid_once`, `canvas::tests::an_edit_to_a_3d_effect_redraws_with_the_art_measured`, `fx::tests::a_3d_effect_that_builds_nothing_draws_the_item_as_without_it`. Scores and estimates unchanged. | +| 2026-11-09 | minor | Canvas: a 3D effect (Extrude & Bevel, Inflate, Rotate, Revolve) changed on type or a group draws again where its art was and is, measured by that art; the canvas measures through its renderer and draws the part with the art it made to measure it. Exports and Object › Rasterize take the solid of 3D type. Fit to Artwork Bounds and per-artboard SVG export measure every artboard through one renderer, building each solid once. A 3D effect on a fill or stroke that builds nothing (Revolve after Roughen) no longer overflows the stack on the canvas, in Object › Rasterize and in raster and EPS exports: the fill or stroke draws as without it. Tests `tests::changed::a_3d_effect_changed_on_type_or_a_group_changes_where_its_solid_was`, `fx::tests::a_renderer_measures_the_art_on_each_artboard_building_each_solid_once`, `canvas::tests::an_edit_to_a_3d_effect_redraws_with_the_art_measured`, `fx::tests::a_3d_effect_that_builds_nothing_draws_the_item_as_without_it`. Scores and estimates unchanged. | | 2026-11-07 | minor | File formats and Type core (#6147): `.ai`/EPS type keeps its paragraphs' tab stops (positions and alignments; leaders aren't read; at most 1,024 a paragraph and 2^20 a story), and right-aligned area type sets the text after a line's last tab against the right edge, the text before it at its stops; centred and justified lines are aligned as a whole as before; evidence added. Scores and estimates unchanged. | | 2026-11-07 | minor | File formats and Type core (#6137): `.ai`/EPS type from the text document keeps auto leading per line, its hyphenation options, may show more of the last lines the file sets in an area frame of its own, when growing the frame by its lines' deepest descent plus 0.05 pt shows them, and a line a soft return ends is justified; evidence added. Limits: frames grow only for area type of one frame, horizontal, by its lines' deepest descent plus 0.05 pt; type in a font that isn't installed, and hyphenation in a language that isn't imported, still lay out differently. Scores and estimates unchanged. | | 2026-11-08 | minor | Style panels: a double-click on a user character style's row opens its Character Style Options (`ui.charStyleOptions`), and on a paragraph style's row its Paragraph Style Options (rename); the Character Style Options dialog keeps a fixed width and scrolls its sections in a shorter window, so OK and Cancel stay on screen. Tests `panels::text_styles::tests::double_clicking_a_character_style_row_opens_its_options` and `dialogs::char_style_options::tests::the_sections_scroll_in_a_window_shorter_than_the_general_list`. Scores and estimates unchanged. | @@ -1912,7 +1912,7 @@ Edit › Copy and Cut put the selected ruler guides on the clipboard, with the s | Date | Change | Summary | |---|---|---| | 2026-11-10 | minor | Raster effects: the Effect Gallery shows a thumbnail of each filter and a preview of the visible stack (or the filter being browsed) inside the dialog, both an original landscape drawing passed through the filter ([Filter Gallery overview](https://helpx.adobe.com/photoshop/desktop/effects-filters/get-started-with-filters/filter-gallery.html)); 52% → 55%, 1–2 h → none (estimated). The canvas preview and one-undo OK are unchanged. Headline numbers unchanged. | -| 2026-11-09 | minor | Canvas: a 3D effect changed on type or a group redraws where its solid was, measured by the effect's art through the renderer that drew the frame; exports and Object › Rasterize take the solid of 3D type; Fit to Artwork Bounds and per-artboard SVG export measure all artboards through one renderer; a 3D effect on a fill or stroke that builds nothing no longer overflows the stack on the canvas, in Object › Rasterize and in raster exports (evidence in Feature revisions). Scores and estimates unchanged. | +| 2026-11-09 | minor | Canvas: a 3D effect changed on type or a group redraws where its solid was, measured by the effect's art through the renderer that drew the frame; exports and Object › Rasterize take the solid of 3D type; Fit to Artwork Bounds and per-artboard SVG export measure all artboards through one renderer; a 3D effect on a fill or stroke that builds nothing no longer overflows the stack on the canvas, in Object › Rasterize and in raster and EPS exports (evidence in Feature revisions). Scores and estimates unchanged. | | 2026-11-09 | minor | Type advanced: Auto Spell Check (`edit.autoSpellCheck`), #4936; evidence added; the dialogs and the right-click Spelling menu remain; scores and hours unchanged. | | 2026-11-09 | minor | Bundled content: built-in UI Frames symbol library (Panel, Button, Bar with default 9-slice); symbol libraries evidence updated; ~30% → ~32%; more built-in symbol libraries remain. | | 2026-11-09 | minor | Symbols: on-canvas dynamic part appearance takes gradient/pattern fill and stroke and opacity/blend; evidence updated; area ~87% → ~88%; strokes remaining no longer lists Overlap/auto corners. |