[web] instantiateImageCodecWithSize hardcodes allowUpscaling: false, breaking ResizeImage(allowUpscaling: true)
维护者通常 1 天内回复
@sankalpsthakur 已经在做这个了。
开始于 2026年10月26日。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 85/100
调研方向
阅读 engine/src/flutter/lib/web_ui/lib/painting.dart 中 instantiateImageCodecWithSize 附近的代码以及相关的 getTargetSize 调用。然后移除 packages/flutter/test/painting/image_provider_resize_image_test.dart 中 ResizeImage 组周围针对浏览器的跳过逻辑,并运行 flutter test --platform chrome test/painting/image_provider_resize_image_test.dart。当 allowUpscaling: true 的测试用例在 Chrome 上以预期的图像尺寸通过时,即为完成。
由索引模型根据 Issue 内容生成。
描述
Description
In engine/src/flutter/lib/web_ui/lib/painting.dart, instantiateImageCodecWithSize invokes getTargetSize(width, height) (where ResizeImage has already enforced its own allowUpscaling parameter) and then passes a hardcoded allowUpscaling: false to engine.engineInstantiateImageCodec:
final TargetImageSize targetSize = getTargetSize(width, height);
return await engine.engineInstantiateImageCodec(
buffer._list!,
targetWidth: targetSize.width,
targetHeight: targetSize.height,
allowUpscaling: false,
);
On native (dart:ui), instantiateImageCodecWithSize scales to whatever TargetImageSize is returned by getTargetSize, leaving upscaling policy to the caller (ResizeImage.allowUpscaling). Because the web implementation hardcodes allowUpscaling: false, ResizeImage(..., allowUpscaling: true) clamps target dimensions back down to the intrinsic image size on web.
Note: packages/flutter/test/painting/image_provider_resize_image_test.dart (line 622) still skips its ResizeImage group on isBrowser referencing closed #73120.
Steps to Reproduce
- Remove
skip: isBrowseron line 622 ofpackages/flutter/test/painting/image_provider_resize_image_test.dart. - Run:
flutter test --platform chrome test/painting/image_provider_resize_image_test.dart
Expected Results
All ResizeImage tests pass on Chrome (both CanvasKit and Skwasm), upscaling images when allowUpscaling: true is specified.
Actual Results
16 allowUpscaling: true test cases fail because the decoded ui.Image remains at its intrinsic dimensions instead of scaling up to the size returned by getTargetSize.
- 主要语言
- Dart
- 星标
- 180k
- 派生
- 33.9k
- 平均合并
- 1 天 22 小时
- 30 天内合并 PR
- 281
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
flutter/flutter 的其他 Issue
-
[Packages] [flutter_shaders] InkWell shader golden test fails on Flutter stable and Master channels未关闭from: manual-qa
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 73/100
flutter/flutter#195399 · 1 条评论 ·
维护者通常 1 天内回复
-
P1 team-engine
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
P1 team-engine
难度 1/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
Remove `setFloat` usage from the framework可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭P1 team-engine
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
google/skills_lint.dart#165 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复
-
good first issue help wanted translation
难度 2/5 1-3 小时 新手友好度 86/100
blankframe-tech/ThrottleIQ#23 ·
维护者通常 5 天内回复
-
good first issue mobile P0 size:S
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 69/100
trufi-association/trufi-core#1024 ·
维护者通常 14 天内回复