Skip to content

Image Editor: Remove the internal list of transform operations - #86707

Merged
andrewserong merged 2 commits into
trunkfrom
remove/image-editor-transform-operations
Nov 19, 2026
Merged

andrewserong merged 2 commits into
trunkfrom
remove/image-editor-transform-operations

Conversation

@ramonjd

@ramonjd ramonjd commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

What?

Part of:

Removes the image editor's internal list of transform operations: TransformOperation, the reducer's APPLY_OPERATION action, and applyOperationToState and stateFromPipeline in src/core/transforms/pipeline.ts, with their tests. None of it was exported, and nothing outside its own tests used it.

Also shortens two comments in src/core/types.ts: the Camera type's, and the internal state's, which repeated each public field's comment in different words.

Why?

The list was kept for applying edits from code. #86665 does that with applyImageEdit, against the same ImageEdit that getImageEdit returns. The list's rotate and flip were relative, so replaying it on an already edited state applied them twice.

Testing Instructions

No behaviour changes. Open the media editor, then rotate, flip, crop and save as usual.

TransformOperation, the APPLY_OPERATION action and the pipeline helpers that replayed them were kept for applying edits from code. Nothing outside their own tests used them, and applyImageEdit now does that job against the same ImageEdit that getImageEdit returns. Their rotate and flip were relative, so replaying a list on an edited state applied it twice.
The Camera comment explained what a matrix is not. The internal state repeated each public field's comment in different words; it now points to ImageEditorState and keeps only the base pan, zoom and rotation, which are its own.
@ramonjd ramonjd added [Type] Code Quality Issues or PRs that relate to code quality [Package] Image Editor Related to packages/image-editor labels Nov 12, 2026
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

📦 Bundle size

Size Change: -116 B (0%)

Total Size: 8.64 MB

📦 View Changed
Filename Size Change
build/scripts/editor/index.min.js 569 kB -116 B (-0.02%)

d5b7147 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric f6a4099 trunk % Change
timeToFirstByte 42.3 ms +6.38% -2.48% 41.95 ms +8.94% -3.69% 0.83%
largestContentfulPaint 68 ms +2.94% -5.88% 66 ms +9.09% -3.03% 3.03%
lcpMinusTtfb 23.55 ms +18.68% -4.25% 23.6 ms +8.05% -6.57% -0.21%
wpBeforeTemplate 21.78 ms +3.63% -3.08% 21.1 ms +11.23% -2.13% 3.22%
wpTemplate 17.53 ms +4.62% -5.53% 17.5 ms +3.49% -6.17% 0.17%
wpTotal 39 ms +6.67% -2.64% 38.86 ms +8.41% -4.17% 0.36%
wpMemoryUsage 7.72 MB +0% -0% 7.68 MB +0% -0% 0.43%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric f6a4099 trunk % Change
timeToFirstByte 35.2 ms +2.84% -1.28% 35.2 ms +2.27% -2.98% 0%
largestContentfulPaint 64 ms +0% -0% 64 ms +0% -0% 0%
lcpMinusTtfb 28.95 ms +4.66% -3.97% 28.8 ms +4.69% -2.08% 0.52%
wpBeforeTemplate 18.7 ms +4.97% -2.35% 18.56 ms +4.09% -0.7% 0.75%
wpTemplate 13.61 ms +1.62% -5.22% 13.62 ms +2.5% -6.9% -0.07%
wpTotal 32.29 ms +3.5% -1.11% 32.53 ms +1.97% -3.54% -0.74%
wpMemoryUsage 6.41 MB +0% -0% 6.37 MB +0% -0% 0.53%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric f6a4099 trunk % Change
mediaProcessingJpeg 332.46 ms +1.99% -0.56% 338.99 ms +0.57% -0.71% -1.93%
mediaProcessingAvif 4918.51 ms +0.2% -0.2% 4905.9 ms +1.18% -0.37% 0.26%
mediaProcessingJpegToAvif 3346.12 ms +0.82% -0.2% 3403.05 ms +0.73% -1.61% -1.67%

media-upload

Metric f6a4099 trunk % Change
jpegUploadProcessing 1456.82 ms +1.95% -1.14% 1439.39 ms +0.8% -0.71% 1.21%
pngUploadProcessing 221.36 ms +4.06% -4.47% 229.23 ms +1.86% -5.48% -3.43%
largeJpegUploadProcessing 1441.71 ms +0.31% -1.28% 1439.68 ms +1.02% -0.43% 0.14%
multipleImageUploadProcessing 1509.49 ms +0.31% -0.83% 1507.69 ms +0.09% -0.36% 0.12%

post-editor

Metric f6a4099 trunk % Change
serverResponse 316.8 ms +3.36% -8.61% 332.22 ms +1.55% -1.74% -4.64%
firstPaint 321.15 ms +10.43% -4.67% 326.98 ms +9.9% -5.97% -1.78%
domContentLoaded 638.74 ms +17.62% -1.64% 641.88 ms +0.62% -1.2% -0.49%
loaded 639.61 ms +17.62% -1.66% 642.79 ms +0.61% -1.22% -0.49%
firstContentfulPaint 357.24 ms +23.59% -0.93% 364.45 ms +0.47% -1.62% -1.98%
firstBlock 1708.09 ms +5.13% -0.92% 1700.42 ms +2.01% -0.69% 0.45%
type 14.12 ms +9.92% -5.03% 15.04 ms +12.3% -4.06% -6.12%
typeWithoutInspector 15.02 ms +4.73% -12.38% 14.88 ms +11.69% -10.62% 0.94%
typeWithTopToolbar 19.01 ms +7.36% -6.42% 18.61 ms +14.24% -5.86% 2.15%
typeContainer 7.11 ms +8.16% -12.38% 7.09 ms +11.42% -10.86% 0.28%
focus 98.12 ms +5.22% -4.45% 91.95 ms +13.71% -5.66% 6.71%
firstFocus 200.12 ms +0% -0% 198.21 ms +0% -0% 0.96%
selectAll 322.18 ms +0.89% -3.09% 300.75 ms +1.1% -0.93% 7.13%
undo 24.75 ms +6.51% -5.45% 23.02 ms +4.43% -4.74% 7.52%
listViewOpen 62.78 ms +8.65% -6.82% 63.27 ms +7.51% -6.91% -0.77%
inserterOpen 33.93 ms +4.66% -4.8% 31.69 ms +8.39% -3.91% 7.07%
inserterHover 9.3 ms +12.37% -8.39% 9.21 ms +6.51% -8.03% 0.98%
inserterSearch 6.78 ms +3.69% -3.69% 6.55 ms +14.35% -4.12% 3.51%
loadPatterns 518.73 ms +3.23% -1.47% 510.99 ms +2.17% -5.57% 1.51%
wpTotal 307.99 ms +3.49% -8.78% 323.18 ms +1.41% -1.62% -4.7%
wpMemoryUsage 14.77 MB +0% -0% 14.74 MB +0% -0% 0.24%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric f6a4099 trunk % Change
serverResponse 402.68 ms +0.52% -9.2% 384.72 ms +4.76% -5.6% 4.67%
firstPaint 438.27 ms +6.63% -12.03% 454.79 ms +3.64% -12.82% -3.63%
domContentLoaded 826.11 ms +7.26% -0.76% 818.52 ms +0.97% -1.08% 0.93%
loaded 827.14 ms +7.28% -0.77% 819.71 ms +0.97% -1.11% 0.91%
firstContentfulPaint 465.72 ms +10.65% -2.14% 459.04 ms +2.68% -2.59% 1.46%
firstBlock 2471.01 ms +2.73% -1.57% 2433.23 ms +0.52% -0.99% 1.55%
type 16.92 ms +9.99% -3.07% 17.06 ms +15.65% -5.45% -0.82%
navigate 111.6 ms +1.74% -1.02% 106.61 ms +4.46% -0.88% 4.68%
loadPatterns 1293.4 ms +7.39% -7.69% 1187.65 ms +17.29% -14.94% 8.9%
loadPages 907.17 ms +3.8% -0.39% 919.89 ms +2.17% -1.27% -1.38%
wpTotal 392.2 ms +0.39% -9.47% 374.06 ms +4.89% -5.74% 4.85%
wpMemoryUsage 12.79 MB +0% -0% 12.75 MB +0% -0% 0.27%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

d5b7147 Run

🏁 Flaky tests

Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in /test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

  Object {
    "attributeKey": "content",
    "blockIndex": 0,
    "content": "abcdef",
-   "endOffset": 3,
-   "offset": 3,
+   "endOffset": 1,
+   "offset": 1,
  }

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts:363:5

d5b7147 Run

@ramonjd ramonjd self-assigned this Nov 12, 2026
@ramonjd
ramonjd marked this pull request as ready for review November 12, 2026 03:20

@andrewserong andrewserong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a clean removal to me, and we can follow-up on the shape of applyImageEdit separately in #86665 (generally looking good to me, just had a question about if we should allow containment by default to make it a little easier for consumers to work with).

@andrewserong
andrewserong merged commit 54f73cb into trunk Nov 19, 2026
120 of 121 checks passed
@andrewserong
andrewserong deleted the remove/image-editor-transform-operations branch November 19, 2026 05:50
@github-actions github-actions Bot added this to the Gutenberg 24.6 milestone Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Image Editor Related to packages/image-editor [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants