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

[web] Fix compositing order when adding paragraph tags #17645

Merged
merged 6 commits into from
Apr 13, 2020

Conversation

ferhatb
Copy link
Contributor

@ferhatb ferhatb commented Apr 10, 2020

@ferhatb ferhatb requested a review from yjbanov April 10, 2020 21:43
@@ -524,6 +537,7 @@ class BitmapCanvas extends EngineCanvas {
rootElement.append(paragraphElement);
}
_children.add(paragraphElement);
_allocateNewCanvas();
Copy link
Contributor

Choose a reason for hiding this comment

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

We used to do this before, but then discovered that this killed performance on some of the early demos, such as the weather app demo, so we changed it to always put text on top. Can you please add a benchmark prior to submitting this PR that interleaves text with drawing commands so we understand the performance hit of this change? I imagine once @mdebbar's text on canvas work is done we'll be able to use fillText for all text.

Copy link
Contributor Author

@ferhatb ferhatb Apr 13, 2020

Choose a reason for hiding this comment

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

A while ago introduced childOverDraw which makes sure that once we switch to using <p> tags we don't go back requesting extra canvas(s) to draw text. The weather app had drawImage+drawText pattern which is already handled since images are drawn using <img> tags all the time now. The only benchmark we could artificially create that would show regression would be of the pattern drawText, drawComplexPath, drawText that i have not seen in apps yet. One option : A list of material cards that have draw path + images + text is a more realistic benchmark but would not be effected by this change.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, right, we're creating them lazily. Ok, I guess it's not critical then, just nice-to-have.

// Any drawing operations after these tags should allocate a new canvas,
// instead of drawing into earlier canvas.
void _allocateNewCanvas() {
_canvasPool.allocateExtraCanvas();
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's rename _allocateNewCanvas and allocateExtraCanvas to something like "closeCurrentCanvas", since they do not allocate a new canvas. Otherwise it can be confusing when looking at the profiles that allocateExtraCanvas takes 1 nanosecond, but drawCircle takes 10 milliseconds.

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. Thanks for suggestion.

@ferhatb
Copy link
Contributor Author

ferhatb commented Apr 13, 2020

Merging on infra failure.

@ferhatb ferhatb merged commit 4a1085a into flutter:master Apr 13, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 14, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 14, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 14, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 14, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 14, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 14, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 14, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 14, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 14, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 14, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 14, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 14, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 15, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 15, 2020
goderbauer pushed a commit to goderbauer/engine that referenced this pull request Apr 16, 2020
* Add test and dartfmt
* Update golden locks
* Addressed review comments
* Fix lint error (unused widthConstraint)
* Add maxDiffRatePercent for text diff on mac/linux
@ferhatb ferhatb deleted the stacking_order branch August 10, 2020 20:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants