Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[canvaskit] Refactor HtmlImageCodec to generalize to different renderers #52905

Merged
merged 5 commits into from
May 20, 2024

Conversation

harryterkelsen
Copy link
Contributor

Refactor HtmlImageCodec to decouple it from the html renderer so other renderers can create a ui.Image via Image.decode().

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

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

@github-actions github-actions bot added the platform-web Code specifically for the web engine label May 17, 2024
@harryterkelsen harryterkelsen requested a review from yjbanov May 17, 2024 22:43
Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

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

lgtm

final bool _supportsDecode = _jsImageDecodeFunction != null;

// TODO(mdebbar): Deprecate this and remove it.
// https://github.com/flutter/flutter/issues/127395
typedef WebOnlyImageCodecChunkCallback = ui_web.ImageCodecChunkCallback;

class HtmlCodec implements ui.Codec {
HtmlCodec(this.src, {this.chunkCallback});
abstract class HTMLImageElementCodec implements ui.Codec {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I think the style guide prefers Html rather than HTML.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@harryterkelsen harryterkelsen merged commit fd24d40 into flutter:main May 20, 2024
26 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 21, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 21, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 21, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 21, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 21, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 21, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 21, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 21, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 21, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 21, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 21, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 21, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 21, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 21, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request May 21, 2024
…148766)

flutter/engine@c2ef01f...8a352f0

2024-05-21 skia-flutter-autoroll@skia.org Roll Skia from c6bb2106c13b to e0881f06f94a (1 revision) (flutter/engine#52954)
2024-05-21 skia-flutter-autoroll@skia.org Roll Dart SDK from cb763e4dad50 to dd768e0d1890 (1 revision) (flutter/engine#52953)
2024-05-21 skia-flutter-autoroll@skia.org Roll Skia from 2102f791405c to c6bb2106c13b (1 revision) (flutter/engine#52952)
2024-05-21 skia-flutter-autoroll@skia.org Roll Skia from 1a52d4d5f45e to 2102f791405c (1 revision) (flutter/engine#52951)
2024-05-21 skia-flutter-autoroll@skia.org Roll Skia from 97d3b45d6b00 to 1a52d4d5f45e (1 revision) (flutter/engine#52947)
2024-05-21 skia-flutter-autoroll@skia.org Roll Dart SDK from d1a786ef6888 to cb763e4dad50 (1 revision) (flutter/engine#52950)
2024-05-21 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 2.13.4 to 3.25.6 (flutter/engine#52949)
2024-05-21 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 4.1.5 to 4.1.6 (flutter/engine#52948)
2024-05-21 skia-flutter-autoroll@skia.org Roll Skia from 62f369c75994 to 97d3b45d6b00 (1 revision) (flutter/engine#52946)
2024-05-21 skia-flutter-autoroll@skia.org Roll Dart SDK from 01a77883e9e9 to d1a786ef6888 (1 revision) (flutter/engine#52945)
2024-05-21 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from jXE7fqJI6VWFMaIdV... to HHwlAJN5imwf3yX4i... (flutter/engine#52944)
2024-05-21 bdero@google.com [Impeller] Reland: Remove Entity capture/AiksInspector. (flutter/engine#52932)
2024-05-20 1961493+harryterkelsen@users.noreply.github.com [canvaskit] Refactor HtmlImageCodec to generalize to different renderers (flutter/engine#52905)
2024-05-20 skia-flutter-autoroll@skia.org Roll Skia from 977a43773f7c to 62f369c75994 (1 revision) (flutter/engine#52941)
2024-05-20 skia-flutter-autoroll@skia.org Roll Skia from 0b8d8ce44d1f to 977a43773f7c (1 revision) (flutter/engine#52938)
2024-05-20 jonahwilliams@google.com [Impeller] write glyphs to malloc buffer. (flutter/engine#52937)
2024-05-20 skia-flutter-autoroll@skia.org Roll Dart SDK from 08f4324c988b to 01a77883e9e9 (1 revision) (flutter/engine#52936)
2024-05-20 bdero@google.com [Impeller] Fix use-after-move in SwapchainVK. (flutter/engine#52933)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from jXE7fqJI6VWF to HHwlAJN5imwf

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC jonahwilliams@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform-web Code specifically for the web engine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants