-
Notifications
You must be signed in to change notification settings - Fork 6k
Move pictures from deleted canvases to second-to-last canvas instead of last. #51397
Move pictures from deleted canvases to second-to-last canvas instead of last. #51397
Conversation
|
@harryterkelsen can this result in the opposite effect where too much is put on top of the platform view? and won't it make the platform view no longer able to receive events? A while back I experimented with a PR that cut holes out of the canvas with a clear operation when their layer was rendered instead of paint operations and then placed the views behind the canvas. Maybe that could be a useful strategy here so that whatever is on top of that last one that should be behind gets erased and you don't get reverse artifacts. On that subject,If now it is going to be possible to end up with views below the canvas (which I always thought was probably the better default as it has zero problems with overlay groups at the cost of disabling a few things that aren't usually used with overlay groups), it could maybe be useful to support that general concept for HtmlElementView to support this to allow users to control what happens with the platform views. Right now isVisible is a little confusing and misleading because it doesn't actually make anything invisible, it just puts it always on top of the canvas. It would probably make more sense to have: enum HtmlElementViewPosition {
above,
below,
alwaysOnTop /// replacement for isVisible, which is a lie
}
HtmlElementView.fromTagName(String tagName, position = HtmlElementViewPosition.below);And then you wouldn't burn platform layers by default, and you could use one of the other options when you need the element to be clickable |
|
@jezell |
|
@harryterkelsen I get what it's supposed to be, I also get what it actually is :). While it may supposed to be something you use when stuff is invisible, it doesn't make anything invisible, so it's confusing. If it was alwaysOnTop, it would say exactly what it actually does and would also be more clear that you can use this to avoid creating platform layers. This came up for us recently using the HtmlElementView to embed iframes that we want invisible because they are only used for cross domain communication. Because it says isVisible, everyone expected the iframes wouldn't be displayed, but of course that's not what it does, it just renders them on top. When this change gets merged, the engine will have three places it can put a view relative to the other canvases: on top While all three are valid places you might want to put them, one of them is misnamed as isInvisible, and one of them randomly happens only if you run out of platform views because the engine is trying to be smart and introduces undesirable side effects when it happens, so it's not clear it totally solves the problem. I think it would probably be better if all of these options were surfaced directly by the HtmlElementView. If beneath was the default, it has less side effects than other two options (if only a couple of lines of code are added for the clear op during the rendering). Then, if you manually opted into between and ran out of layers it could work more like the overflow indicators, where instead of rendering the platform view at all, it renders a shape with an error indicating that you've run out of platform layers. The problem right now is that this continual desire to insert the views between everything as the default keeps causing unpredictable behavior because it's a fundamentally problematic default. There is no real perfect solution to the problem, but the least problematic default would be something other than putting them between. None of these overlay group issues would be a big deal if they were something you opted into instead of being forced upon you by a problematic default. |
|
@jezell I tried to capture your feature request (and we've been thinking about similar ideas that are documented in the issue too) here: flutter/flutter#145360 |
|
I think this change should still go in. We're essentially choosing the least bad option for the case where we already know that we ran out of overlays and will render incorrectly. We're trying to minimize the damage. Seems like the strategy @harryterkelsen picked would be best for the common case, no? |
|
@yjbanov I agree it's better than the current behavior until flutter/flutter#145360 lands |
yjbanov
left a comment
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.
…148993) flutter/engine@2a48302...ad12c5d 2024-05-23 [email protected] Move pictures from deleted canvases to second-to-last canvas instead of last. (flutter/engine#51397) 2024-05-23 [email protected] Roll Skia from 8af1d36fbccb to 60ed6f47af08 (2 revisions) (flutter/engine#52999) 2024-05-23 [email protected] Roll Skia from 7fcb4edbd9b7 to 8af1d36fbccb (1 revision) (flutter/engine#52998) 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 [email protected],[email protected],[email protected] 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
…lay (#53006) When there is only 1 overlay, move pictures in the reduced rendering to the last canvas instead of the second-to-last. Fixes a bug in #51397 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
…lutter#148993) flutter/engine@2a48302...ad12c5d 2024-05-23 [email protected] Move pictures from deleted canvases to second-to-last canvas instead of last. (flutter/engine#51397) 2024-05-23 [email protected] Roll Skia from 8af1d36fbccb to 60ed6f47af08 (2 revisions) (flutter/engine#52999) 2024-05-23 [email protected] Roll Skia from 7fcb4edbd9b7 to 8af1d36fbccb (1 revision) (flutter/engine#52998) 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 [email protected],[email protected],[email protected] 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

Previously, when the number of display canvases exceeded the maximum amount, we would augment the rendering to reduce the number of canvases to the maximum amount, and move the pictures from the deleted canvases to the last canvas. However, this would cause ugly rendering in cases where pictures would render on top of the platform views they were supposed to be underneath.
This is especially noticeable when reproducing this bug: flutter/flutter#144854
This changes things slightly so that the pictures are moved to the second-to-last remaining canvas, so that platform views always render over the pictures they are supposed to.
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.