Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Follow-up pushed: 4a83329 and a91ec03.
Tested: |
|
Thanks! This overlaps #1726 (same #1662 Text Shadow button, same lines in Come say hi on Discord if you haven't already: https://discord.gg/artcraft |
…hadows (storytold#1662) The Font group had no shadow toggle although `format.textShadow` is registered under Home › Font. It now sits between Underline and Strikethrough, as in PowerPoint, and lights up from `format.state`'s new `shadow` key, which reads the resolved run, so a shadow from the layout or master counts. Turning such a shadow off did nothing: a run's `shadow: None` means "inherit". A run can now carry its own empty effect list (`RunProps::no_effects`, PPTX `<a:effectLst/>` in `a:rPr`), which stops shadows, glows, reflections and soft edges from inheriting. Turning the shadow off sets it and copies the other effects the text shows onto the run, so only the shadow goes away. PPTX import and export keep the empty list.
…yle need filters `text_has_effects` missed a shadow or glow that text inherits from its paragraph's `a:pPr/a:defRPr` or the presentation's default text style. Such a slide was drawn on the multi-threaded vello_cpu dispatcher, which panics on filter layers; the render guard caught it and the slide came out blank. Found by the new Text Shadow UI test.
…st always replaces the inherited one Review follow-up for storytold#1662: - Turning off an inherited shadow copied the first selected run's other effects onto every run. `format.textShadow` now goes through the new `format_run_inherited`, which gives each run what its own paragraph inherits (defRPr and list styles, resolved before the edit) across text ranges, shapes and table cells. A run only gets its own effect list when it actually inherits a shadow. - PPTX import set the override only for an empty `a:effectLst`, so a run that kept a glow got the inherited shadow back after a save and reopen. Any run `a:effectLst` now replaces the inherited list, as in DrawingML. The field is renamed `RunProps::own_effects` to match. - Tests: per-run effects across shapes and paragraphs (engine), a non-empty run effect list round trip (pptx), and a kittest UI test that clicks Home > Font > Text Shadow on text with an inherited shadow.
Rebasing onto main brought `alt_lang` and `normalize_height` into `RunProps::inherit`, which pushed it over clippy's cognitive-complexity limit (31/30). The effect-list part (skipped when the run has its own `a:effectLst`) moves to `RunProps::inherit_effects`; behaviour is unchanged.
a91ec03 to
45e08ed
Compare
…adow Turning the shadow on stored only the shadow on the run. The editor still showed an inherited glow, but the run's `a:effectLst` was written with the shadow alone and, since a run's list replaces the inherited one, the glow was gone when the file was reopened. Turning the shadow on next to inherited effects now gives the run its own effect list with them copied in, as turning an inherited shadow off already did (`own_effect_list`, shared by both). Test: `text_shadow_on_keeps_an_inherited_glow_through_save_and_reopen` fails without the fix.
|
Thanks. I compared the two. #1726 adds the same button and
If you'd rather merge #1726, I'm happy to rebase onto it and send just these cases and their tests as a follow-up. FYI, CI on this PR is still waiting for workflow approval, so it hasn't run yet. |
eliets2
left a comment
There was a problem hiding this comment.
First-pass review notes (automated; combined from specialist angles: tests, docs and text). Please treat as suggestions and verify before acting.
Summary: This adds a Text Shadow toggle to Home › Font that reflects and can turn off an inherited text shadow, by giving runs their own effect list that replaces inherited effects, preserving other inherited effects when toggling, round-tripping that list in PPTX, and fixing filter detection for shadows/glows from paragraph or default text styles.
Logical units:
- Ribbon Text Shadow button in
ui-egui/ribbon/home.rs format.stateshadow reporting inengine/cmd/format/painter.rsRunProps::own_effectsmodel inmodel/text.rs- Toggle command logic in
engine/cmd/format/text_effects.rsandengine/cmd/text/formatting.rs - PPTX read/write of
a:effectLstinpptx/read/dml.rsandpptx/write/dml.rs needs_filtersfix inrender/slide.rs
Findings:
- [tests]
crates/engine/src/cmd/text/formatting.rs,format_runs/format_alltable branch: the new per-cellinherited_by_paragraphcode forShapeKind::Tablehas no test, and existing tests only cover shapes and text ranges. Add a test with a table cell inheriting a shadow/glow viadefRPrand togglingformat.textShadowoff. - [docs]
crates/model/src/text.rs,RunProps::own_effectsdoc: the doc lists shadow, glow, reflection and soft edge as non-inherited but omits inner shadow, unlikeinherit_effectsin the same file andown_effect_listincrates/engine/src/cmd/format. Add inner shadow to theown_effectsdoc list.
Overlaps: The description notes the Font dialog option and the Format Shape pane inherited-effects display (#1661, open PR #1685) are not part of this PR; no other overlaps are listed.
Verdict: needs changes — (1) add the missing table-cell test for the new table branch, (2) fix the own_effects doc to include inner shadow, (3) no other findings were reported.
|
Thanks for the notes. Both are fixed in 3f77e3f:
|
- New engine test turns off a shadow that table cells inherit through their paragraphs' defRPr: each selected cell keeps its own inherited glow (or none), unselected cells are untouched, and a cell that inherits no shadow gets no effect list. - RunProps::own_effects and inherit_effects docs name the inner shadow too.
There was a problem hiding this comment.
AI-generated review (Claude Opus 5.5). Not a maintainer decision.
Changes needed:
Adds a Text Shadow toggle to Home › Font, reports shadow state from the resolved run, and lets a run's own effect list replace inherited effects so an inherited shadow can be turned off and saved as such.
- crates/render/src/slide.rs: this push drops the defRPr and default-text-style sources from text_has_effects, together with their test. Text whose glow or shadow comes only from those sources depends on a separate change for filter detection.
- crates/ui-egui/src/ribbon/text_shadow_tests.rs:21-31: the harness now inherits the shadow from the text body's list style rather than the paragraph's defRPr. The UI test therefore no longer exercises the defRPr inheritance path.
- crates/model/src/text.rs: own_effects replacing the inherited effect list as a whole matches how a run's a:effectLst works in PPTX. Other formatting still inherits.
- crates/engine/src/cmd/text/formatting.rs: inherited effects are resolved per paragraph and per table cell, so mixed selections keep each run's own glow or reflection when the shadow is turned off.
Claims checked:
- unverified: The Home › Font group gains a Text Shadow toggle between Underline and Strikethrough that lights up from format.state. (crates/ui-egui/src/ribbon/home.rs: file is in the PR, but its contents could not be read here. Only crates/ui-egui/src/ribbon/text_shadow_tests.rs changed in this push.)
- unverified: format.state reports shadow from the resolved run, so inherited shadows count. (crates/engine/src/cmd/format/painter.rs: could not be read. crates/ui-egui/src/ribbon/text_shadow_tests.rs:21-31 sets up a list-style shadow for this check.)
- unverified: Turning off an inherited shadow sets own_effects and copies the run's other inherited effects. Turning a shadow on next to inherited effects copies them too, resolved per paragraph. (crates/engine/src/cmd/format/text_effects.rs and crates/engine/src/cmd/text/formatting.rs: could not be read in this…
- unverified: A run's a:effectLst, empty or not, is read as own_effects and written back. (crates/pptx/src/read/dml.rs and crates/pptx/src/write/dml.rs: could not be read. A roundtrip test is listed in crates/pptx/tests/it/roundtrip.rs.)
Reviewed at 540b792.
Recommendation: update the pull request; it will be reviewed again.
The `needs_filters` change (71ba9fe) fixes a blank slide that `main` already draws for any text whose shadow or glow comes only from a paragraph's `defRPr` or the presentation's default text style. It doesn't depend on the Text Shadow button, so it goes to its own pull request with its test, and this commit takes it out of this one. The ribbon test took its inherited shadow from `defRPr`, so its slide hit that render panic, and the UI soak test, which requires no caught render panics in the process, failed after it. The test now takes the shadow from the text box's list style (`a:lstStyle`), which `needs_filters` already covers on `main`. It still checks that the inherited shadow lights the button, that one click turns it off with the run's own effect list, and that a second click sets the run's own shadow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review. Pushed 540b792 and opened #2083. Point by point: Overlap with #1726. Since I compared the two on Nov 3, #1726 has added 0061d28. Turning off an inherited shadow now works in its editor, through a
#1726 also conflicts with My recommendation: land this PR for the button, Render fix (
Effects inherit as one list: same reason. A run's own list stops all inherited effects, and every other property still inherits. Other run-effect commands: on Tested after 540b792: |
…yle need filters `text_has_effects` missed a shadow or glow that text inherits from its paragraph's `a:pPr/a:defRPr` or the presentation's default text style. Such a slide was drawn on the multi-threaded vello_cpu dispatcher, which panics on filter layers; the render guard caught it and the slide came out blank. Found by the Text Shadow UI test in #1691. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Font group on the Home tab had no Text Shadow button, even though
format.textShadowis registered under Home › Font, so there was no way to turn a text shadow on or off from the interface.What was wrong
format.statehad no shadow key, so a button could not show the current state.RunProps::shadow == Nonemeans "inherit", soformat.textShadow {on: false}left the run unchanged and the shadow still drew.What changed
ui-egui/ribbon/home.rs): a Text Shadow toggle between Underline and Strikethrough, as in PowerPoint, using the existingTextShadowicon. It lights up fromformat.state.engine/cmd/format/painter.rs):format.statereportsshadowfrom the resolved run, so inherited shadows count.model/text.rs): newRunProps::own_effects. The run carries its own, possibly empty, effect list, which replaces the inherited one: shadow, inner shadow, glow, reflection and soft edge are not inherited. Other formatting still inherits.engine/cmd/format/text_effects.rs,engine/cmd/text/formatting.rs): turning off a shadow a run inherits setsown_effectsand copies the other effects that run inherits onto it, so only the shadow goes away. PowerPoint does the same with the run's owna:effectLst. Turning a shadow on next to inherited effects copies them onto the run the same way, so the saveda:effectLstkeeps them. Each run's inherited effects are resolved from its own paragraph (newformat_run_inherited), so mixed selections keep their own effects.pptx/read/dml.rs,pptx/write/dml.rs): a run'sa:effectLst(empty or not) is read asown_effectsand written back. Before, such runs imported from PowerPoint lost their override and showed the inherited effects as well.needs_filtersfix for text whose shadow or glow comes only fromdefRPror the default text style (a blank slide onmain) is now in its own PR, render: text effects from a paragraph's defRPr or the default text style need filters #2083.The Font dialog option and the Format Shape pane's inherited-effects display (#1661, open PR #1685) are not part of this PR.
How it was tested
model:a_run_without_effects_inherits_no_shadow(inherit skips effects, other props still inherit, and a list style's empty list hides the master's effects).engine:text_shadow_off_keeps_each_runs_own_inherited_effects(per-run effects across shapes and across paragraphs of one range).engine:text_shadow_off_in_a_table_uses_each_cells_inherited_effects(table cells each use their own inherited effects, and only the selected cells change; fails when cells get no inherited props or all get the first cell's).engine:text_shadow_inherited_from_the_layout_shows_and_toggles(shadow set on the sample's layout title in master view. On the slide,format.statereports it, the toggle turns it off and on again, and undo restores the run).engine:text_shadow_on_keeps_an_inherited_glow_through_save_and_reopen(shadow turned on over a paragraph-level glow; the glow is still there after a PPTX save and reopen; fails without the fix).pptx:empty_run_effect_list_round_tripsandrun_effect_list_with_effects_keeps_replacing_the_inherited_one.ui-egui:ribbon::text_shadow_testsclicks Home › Font › Text Shadow on text that inherits a shadow from its list style and checks the state the button is drawn from.cargo teston deckcraft-model, -pptx, -engine and -ui-egui: all pass.cargo clippy -D warnings --all-targetson those crates andcargo fmt --checkare clean.Fixes #1662
Summary by CodeRabbit