-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] Workaround for compositing bug in chrome/webkit #18128
Conversation
| final int poolLength = _pool.length; | ||
| canvasCount += poolLength; | ||
| for (int i = 0; i < poolLength; i++) { | ||
| _pool[i].style.zIndex = (-canvasCount + i).toString(); |
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.
Unrelated to this change, but the fact that I can never remember what _pool and _reusabltPool contains probably means we could use better names for these variables 😃
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.
Done.
| // Possible Blink bugs that are causing this: | ||
| // * https://bugs.chromium.org/p/chromium/issues/detail?id=370604 | ||
| // * https://bugs.chromium.org/p/chromium/issues/detail?id=586601 | ||
| int canvasCount = _canvas == null ? 0 : 1; |
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.
Why is canvasCount not straight _pool.length?
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.
reverted
| element.style.overflow = 'hidden'; | ||
| element.style | ||
| ..overflow = 'hidden' | ||
| ..zIndex = '0'; |
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.
Don't know if it matters, but z-index: 0 is not the same as default z-index: https://www.w3.org/TR/CSS21/zindex.html
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.
Yes, spec says it will be treated atomically which seems to help with failure rather than tree order. Since it has single child should not matter.
| List<html.CanvasElement> list = | ||
| contentAfterReuse.querySelectorAll('canvas'); | ||
| expect(list[0].style.zIndex, '-2'); | ||
| expect(list[1].style.zIndex, '-1'); |
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.
If you have two canvases, with z-index -2 and -1, that means that there's an image or text that's between them. Shouldn't the image/text have a z-index that's between the two canvas' z-indexes? The other issue is that if both a canvas and text have negative z-index, then the canvas will appear on top of text due to the Chrome/Safari bug.
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.
reverted per offline discussion.
| int _saveContextCount = 0; | ||
| int _activeCanvasCount = 0; | ||
| // Number of elements that have been added to flt-canvas. | ||
| int _activeElementCount = 0; |
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.
Why not always have a non-null non-empty _pool? Then _canvas becomes _pool.last, and _activeElementCount becomes _pool.length, and we can remove all the null checks.
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.
pool only tracks canvas(s) if you have more than 1 canvas. activeElementCount tracks both canvas, p and img tags. So if you draw image and then canvas, activeElementCount is 2 at the end.
|
Mac Web Engine retry passed in https://ci.chromium.org/p/flutter/builders/try/Mac%20Web%20Engine/3028 |
Related issues: flutter/gallery#143