-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[web] Fix HtmlImage state pollution due to image.clone optimization #17370
Conversation
builder2.pushClipRect( | ||
const Rect.fromLTRB(0, 0, 100, 100), | ||
); | ||
_drawTestPicture(builder2, 20, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This passes a smaller targetSize
while claiming that the picture will be growing. Am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comment. Drawing the picture at actual size triggers new code path that reproduces the bug.
builder2.pop(); | ||
|
||
elm1.remove(); | ||
html.document.body.append(builder2.build().webOnlyRootElement); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test should also verify that the element was reused. Otherwise, if the canvas does not reuse the image element it will "fix the bug" by virtue of creating a new element instead of reusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are reusing the ImageElement, not the canvas. I noticed we don't have such a test for canvas reuse, added one as part of #17378.
builder2.pop(); | ||
|
||
elm1.remove(); | ||
html.document.body.append(builder2.build().webOnlyRootElement); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above.
…lutter#17370) * fix drawImage style when destination width==source * Add regression test * dartfmt * update golden lock * Addressed review comment * remove transform reset since _drawImage is called
Related to issue flutter/flutter#52490. That issue, second sample reproduces this bug.
Golden test added to reproduce painting with same instance using dst < src rect and then dst = src rect.
Screenshot after fix:
![Screen Shot 2020-03-26 at 2 19 25 PM](https://user-images.githubusercontent.com/5061034/77774734-c677a300-7008-11ea-9170-ff6e4b812899.png)