Skip to content

[wimp] Adds wimp-heavy variant for non-chrome browsers - #189953

Merged
auto-submit[bot] merged 7 commits into
flutter:masterfrom
gaaclarke:wimp-heavy
Oct 23, 2026
Merged

auto-submit[bot] merged 7 commits into
flutter:masterfrom
gaaclarke:wimp-heavy

Conversation

@gaaclarke

@gaaclarke gaaclarke commented Jul 23, 2026 •

Copy link
Copy Markdown
Member

issue: #187212

This gets wimp_heavy loading on firefox. There are still some webgl errors though.

video

Before this change nothing rendered for counter, now it works as long as you don't hover over the floating button.

firefox.mov

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jul 23, 2026
@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@gaaclarke gaaclarke changed the title Wimp heavy [wimp] Adds wimp-heavy variant for non-chrome browsers Jul 23, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces support for a heavy variant of the Wimp renderer, 'wimp_heavy', by updating build targets, artifact copying steps, and the Web SDK configuration. Additionally, the loader logic in 'skwasm_loader.js' is updated to resolve 'wimp_heavy' when a heavy build is required and Wimp is enabled. Feedback suggests using optional chaining on the 'config' object in the loader to prevent potential runtime errors if 'config' is undefined.

const needsHeavy = (!browserEnvironment.hasImageCodecs || !browserEnvironment.hasChromiumBreakIterators)
const fileStem = needsHeavy
? 'skwasm_heavy'
? (config.enableWimp ? 'wimp_heavy' : 'skwasm_heavy')

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.

medium

To prevent potential runtime errors if the config object is null or undefined (for example, in certain test environments or custom embeddings), consider using optional chaining (config?.enableWimp) when checking the configuration.

Suggested change
? (config.enableWimp ? 'wimp_heavy' : 'skwasm_heavy')
? (config?.enableWimp ? 'wimp_heavy' : 'skwasm_heavy')

@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. platform-web Web applications specifically team-web Owned by Web platform team labels Jul 23, 2026

@eyebrowsoffire eyebrowsoffire 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.

We will actually need some kind of solution for how to deal with image decoding. As of right now, just flipping the heavy flag just compiles in SkAnimatedImage, which will have skia do image decoding for us on non-Chrome browsers. But that just produces an SkImage, which is incompatible with wimp, and will basically cause things to crash if the web engine attempts to render an image this way.

The reason the "light" version of skwasm/wimp gets away with this is because on Chrome, all code paths on the dart side use the browser-based ImageDecoder API to produce an ImageBitmap and so the animated image path is never used. I think the newest versions of Firefox and Safari support this API now, so theoretically we could do the same there, but in practice we haven't turned that on on the dart side for browsers other than Chrome. In the past we used to feature gate things by the existence of the browser API rather than explicitly turning it on per-browser, but we got burned by that when browsers would release a buggy version of their API that we hadn't vetted yet and we were left scrambling to put a patch in to disable it.

If it turns out that both Firefox's and Safari's ImageDecoder APIs are actually ready for prime time and available in all supported versions of our browser, we could consider completely removing the SkAnimatedImage path and then it's one less vector to worry about for the heavy vs. light conversation. But we'll need to talk to the other web folks to move forward on that and make sure we change things on the dart side to always use the browser-based ImageDecoder API.

@gaaclarke

Copy link
Copy Markdown
Member Author

@eyebrowsoffire okay, that probably explains the weird errors I've been trying to get to the bottom of.

If it turns out that both Firefox's and Safari's ImageDecoder APIs are actually ready for prime time

I don't actually think that is the case for Safari: https://developer.mozilla.org/en-US/docs/Web/API/ImageDecoder

It is an explicit omission on safari.

@gaaclarke

Copy link
Copy Markdown
Member Author

@eyebrowsoffire I'll look into the ImageDecoder in a separate PR. This actually renders something in firefox, whereas before this it rendered nothing.

@gaaclarke
gaaclarke requested a review from eyebrowsoffire July 23, 2026 22:50
@gaaclarke

Copy link
Copy Markdown
Member Author

@eyebrowsoffire okay, that probably explains the weird errors I've been trying to get to the bottom of.

Actually the problem was the one fixed in #189958. Firefox webgl2 is stricter in this case.

@gaaclarke

Copy link
Copy Markdown
Member Author

Chatted with @eyebrowsoffire offline. He would like a fallback path for image decoding and enabling some felt integration tests as part of this pr.

His notes:

This is the spot in the code where we decide what kind of image decoding strategy to use: https://github.com/flutter/flutter/blob/master/engine/src/flutter/lib/web_ui/lib/src/engine/skwasm/skwasm_impl/renderer.dart#L355

We'll need some way to determine whether the underlying skwasm/wimp binary supports animated image codec, and then bail out to the dom encoder if it doesn't (which will probably just give us a still of the animated image, which seems like a pretty reasonable fallback)

As for enabling unit tests, we'll probably want to add two configs similar to this one, but one on firefox and one on safari: https://github.com/flutter/flutter/blob/master/engine/src/flutter/lib/web_ui/test/felt_config.yaml#L150
Once you've added it to felt_config.yaml you can run felt generate-builder-json and it will modify the appropriate engine_v2 json file to add the test suites to our CI runs

Also, once you've added it to felt_config.yaml you could do like felt test --suite=firefox-dart2wasm-wimp-ui to actually run the unit tests (you'll have to build wimp_heavy and all that first)

In terms of a mechanism for exposing whether the binary actually supports the animated image path, it's going to look similar to the way we expose the skwasmIsHeavy function: https://github.com/flutter/flutter/blob/master/engine/src/flutter/skwasm/text/paragraph_builder_client_icu.cc#L12

We're basically decoupling the idea of "heavy" to mean "has builtin ICU support" and "has animated image support". Previously, heavy just meant both of these, but now the wimp_heavy is going to have builtin ICU support but no animated image support.

@gaaclarke

Copy link
Copy Markdown
Member Author

rebasing to get our opengles fix (#189958)

@flutter-dashboard

Copy link
Copy Markdown

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@gaaclarke
gaaclarke force-pushed the wimp-heavy branch 2 times, most recently from 4d7cf65 to d6bd418 Compare September 11, 2026 22:07
@gaaclarke

Copy link
Copy Markdown
Member Author

As for enabling unit tests, we'll probably want to add two configs similar to this one, but one on firefox and one on safari: https://github.com/flutter/flutter/blob/master/engine/src/flutter/lib/web_ui/test/felt_config.yaml#L150
Once you've added it to felt_config.yaml you can run felt generate-builder-json and it will modify the appropriate engine_v2 json file to add the test suites to our CI runs

@eyebrowsoffire I'm circling back to this. In 2b5ef64fc41 you mention "Firefox+ui doesn't work because our Linux bots have no GPU and therefore no WebGL2 support, so that one is disabled." You can see that in the diff too here.

It sounds like there is no existing CI setup that can run wimp on firefox? What are your expectations for this PR with respect to felt testing?

@gaaclarke

Copy link
Copy Markdown
Member Author

@eyebrowsoffire okay, I've stubbed in the image decoding and added a felt test config.

The image decoding returns a static image for animated images on safari and returns an empty image on firefox. I didn't dig deep into why, but they don't crash as requested.

The tests don't all pass, this appears to be an existing bug we can address in future PRs.

The tests aren't tied to CI, this matches the behavior of existing comparable test suites. Hopefully we can get them running on CI in the future but that seems out of scope of this PR considering it wasn't tackled yet in other suites, like firefox-dart2wasm-skwasm-ui

@eyebrowsoffire eyebrowsoffire 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.

This is looking good, but I think there's something slightly wrong with the boolean logic on the codec stuff.

# Conflicts:
#	engine/src/flutter/lib/web_ui/test/felt_config.yaml

@eyebrowsoffire eyebrowsoffire 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.

LGTM!

@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 23, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Oct 23, 2026
Merged via the queue into flutter:master with commit 93197e2 Oct 23, 2026
23 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 23, 2026
suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
issue: flutter#187212

This gets wimp_heavy loading on firefox. There are still some webgl
errors though.

## video 
Before this change nothing rendered for counter, now it works as long as
you don't hover over the floating button.


https://github.com/user-attachments/assets/e68facbe-50a4-4d19-80a3-6967aba2691f

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

If this change needs to override an active code freeze, provide a
comment explaining why. The code freeze workflow can be overridden by
code reviewers. See pinned issues for any active code freezes with
guidance.

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD engine flutter/engine related. See also e: labels. platform-web Web applications specifically team-web Owned by Web platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants