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

Change cloneImageElement() to return clone every time #37811

Merged
merged 3 commits into from
Nov 22, 2022

Conversation

alanwutang11
Copy link
Contributor

@alanwutang11 alanwutang11 commented Nov 21, 2022

Previously, cloneImageElement() in HtmlImage would return the original DomHTMLImageElement on first call, then clone on subsequent calls. However, when a style is applied to the original DomHTMLImageElement on first call, those subsequent calls clone the DomHTMLImageElement with those styles applied. This happens when we have multiple widgets using an image with the same src.

Changed such that DomHTMLImageElement is always cloned, so that we only apply styles to the clone.

fixes: flutter/flutter#115405

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 Hixie said 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.

@flutter-dashboard flutter-dashboard bot added the platform-web Code specifically for the web engine label Nov 21, 2022
@skia-gold
Copy link

Gold has detected about 1 new digest(s) on patchset 1.
View them at https://flutter-engine-gold.skia.org/cl/github/37811

@skia-gold
Copy link

Gold has detected about 1 new digest(s) on patchset 2.
View them at https://flutter-engine-gold.skia.org/cl/github/37811

Copy link
Contributor

@harryterkelsen harryterkelsen left a comment

Choose a reason for hiding this comment

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

LGTM

@skia-gold
Copy link

Gold has detected about 1 new digest(s) on patchset 3.
View them at https://flutter-engine-gold.skia.org/cl/github/37811

@alanwutang11 alanwutang11 merged commit 2d8e539 into flutter:main Nov 22, 2022
@alanwutang11 alanwutang11 deleted the fix-image-cache-same-url branch November 22, 2022 21:13
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 22, 2022
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Nov 23, 2022
…115881)

* c05e7ff9b [Impeller] opt float/sampler into relaxed precision for gles (flutter/engine#37828)

* 256dc78f6 Reland "[web] Avoid returning int from js interop classes." (flutter/engine#37627)

* 5ab29c95a [web] Move unicode properties to third_party (flutter/engine#37440)

* 10da1a1f0 Remove setSampler from FragmentShader (flutter/engine#37839)

* a800e7650 [Impeller] make VerticesGeometry delegate to the DL class (flutter/engine#37835)

* 1067cd2b7 Roll Skia from 3b2d9e4bf668 to 3bd2fe46f6d2 (2 revisions) (flutter/engine#37848)

* 2d8e53925 change cloneImageElement() to return clone every time (flutter/engine#37811)

* cefb954e0 fix pixel ratio (flutter/engine#37268)

* c6b2ced1e Set nested clip nodes (flutter/engine#37850)

* c7ecca866 Roll Skia from 3bd2fe46f6d2 to c098e3c5d932 (2 revisions) (flutter/engine#37851)

* afac22d6c Made platform message responses threadsafe for macos. (flutter/engine#37607)

* a805efffb fix docs analysis error on setImageSampler (flutter/engine#37852)
shogohida pushed a commit to shogohida/flutter that referenced this pull request Dec 7, 2022
…lutter#115881)

* c05e7ff9b [Impeller] opt float/sampler into relaxed precision for gles (flutter/engine#37828)

* 256dc78f6 Reland "[web] Avoid returning int from js interop classes." (flutter/engine#37627)

* 5ab29c95a [web] Move unicode properties to third_party (flutter/engine#37440)

* 10da1a1f0 Remove setSampler from FragmentShader (flutter/engine#37839)

* a800e7650 [Impeller] make VerticesGeometry delegate to the DL class (flutter/engine#37835)

* 1067cd2b7 Roll Skia from 3b2d9e4bf668 to 3bd2fe46f6d2 (2 revisions) (flutter/engine#37848)

* 2d8e53925 change cloneImageElement() to return clone every time (flutter/engine#37811)

* cefb954e0 fix pixel ratio (flutter/engine#37268)

* c6b2ced1e Set nested clip nodes (flutter/engine#37850)

* c7ecca866 Roll Skia from 3bd2fe46f6d2 to c098e3c5d932 (2 revisions) (flutter/engine#37851)

* afac22d6c Made platform message responses threadsafe for macos. (flutter/engine#37607)

* a805efffb fix docs analysis error on setImageSampler (flutter/engine#37852)
gspencergoog pushed a commit to gspencergoog/flutter that referenced this pull request Jan 19, 2023
…lutter#115881)

* c05e7ff9b [Impeller] opt float/sampler into relaxed precision for gles (flutter/engine#37828)

* 256dc78f6 Reland "[web] Avoid returning int from js interop classes." (flutter/engine#37627)

* 5ab29c95a [web] Move unicode properties to third_party (flutter/engine#37440)

* 10da1a1f0 Remove setSampler from FragmentShader (flutter/engine#37839)

* a800e7650 [Impeller] make VerticesGeometry delegate to the DL class (flutter/engine#37835)

* 1067cd2b7 Roll Skia from 3b2d9e4bf668 to 3bd2fe46f6d2 (2 revisions) (flutter/engine#37848)

* 2d8e53925 change cloneImageElement() to return clone every time (flutter/engine#37811)

* cefb954e0 fix pixel ratio (flutter/engine#37268)

* c6b2ced1e Set nested clip nodes (flutter/engine#37850)

* c7ecca866 Roll Skia from 3bd2fe46f6d2 to c098e3c5d932 (2 revisions) (flutter/engine#37851)

* afac22d6c Made platform message responses threadsafe for macos. (flutter/engine#37607)

* a805efffb fix docs analysis error on setImageSampler (flutter/engine#37852)
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.

[Web] [HTML] Styles applied to an img tag url are incorrectly applied to other img tags with the same url
3 participants