This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
[web:multiview] Make CanvasKitRenderer listen for view creation/disposal events #48812
Merged
harryterkelsen
merged 4 commits into
flutter:main
from
harryterkelsen:canvaskit-renderer-listen-for-view-events
Dec 13, 2023
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a26ceed
Make CanvasKitRenderer listen for view creation/disposal events
harryterkelsen 563f3ce
Remove unnecessary clear (the map should already be cleared)
harryterkelsen a2c7739
Unskip safari tests
harryterkelsen 8cddf17
Merge branch 'main' into canvaskit-renderer-listen-for-view-events
ditman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,8 @@ void testMain() { | |
reason: 'The slot reenables pointer events.'); | ||
expect(contentsHost.getAttribute('slot'), slot.getAttribute('name'), | ||
reason: 'The contents and slot are correctly related.'); | ||
|
||
await disposePlatformView(0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess it makes more sense to have this here, since creating and adding of platformView 0 happened in the test body too! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change was required since I no longer dispose of the Renderer between each test |
||
}); | ||
|
||
test('clips platform views with RRects', () async { | ||
|
@@ -101,6 +103,8 @@ void testMain() { | |
sceneHost.querySelectorAll('flt-clip').single.style.height, | ||
'100%', | ||
); | ||
|
||
await disposePlatformView(0); | ||
}); | ||
|
||
test('correctly transforms platform views', () async { | ||
|
@@ -131,6 +135,8 @@ void testMain() { | |
// 503 (5 * 100 + 3). | ||
'matrix3d(5, 0, 0, 0, 0, 5, 0, 0, 0, 0, 5, 0, 515, 515, 0, 1)', | ||
); | ||
|
||
await disposePlatformView(0); | ||
}); | ||
|
||
test('correctly offsets platform views', () async { | ||
|
@@ -157,6 +163,8 @@ void testMain() { | |
expect(slotRect.top, 4); | ||
expect(slotRect.right, 8); | ||
expect(slotRect.bottom, 10); | ||
|
||
await disposePlatformView(0); | ||
}); | ||
|
||
// Returns the list of CSS transforms applied to the ancestor chain of | ||
|
@@ -189,8 +197,7 @@ void testMain() { | |
CanvasKitRenderer.instance.renderScene(sb.build(), implicitView); | ||
|
||
// Transformations happen on the slot element. | ||
DomElement slotHost = | ||
sceneHost.querySelector('flt-platform-view-slot')!; | ||
DomElement slotHost = sceneHost.querySelector('flt-platform-view-slot')!; | ||
|
||
expect( | ||
getTransformChain(slotHost), | ||
|
@@ -220,6 +227,8 @@ void testMain() { | |
'matrix(1, 0, 0, 1, 3, 3)', | ||
], | ||
); | ||
|
||
await disposePlatformView(0); | ||
}); | ||
|
||
test('converts device pixels to logical pixels (no clips)', () async { | ||
|
@@ -245,6 +254,8 @@ void testMain() { | |
getTransformChain(slotHost), | ||
<String>['matrix(0.25, 0, 0, 0.25, 1.5, 1.5)'], | ||
); | ||
|
||
await disposePlatformView(0); | ||
}); | ||
|
||
test('converts device pixels to logical pixels (with clips)', () async { | ||
|
@@ -276,6 +287,8 @@ void testMain() { | |
'matrix(0.25, 0, 0, 0.25, 0.75, 0.75)', | ||
], | ||
); | ||
|
||
await disposePlatformView(0); | ||
}); | ||
|
||
test('renders overlays on top of platform views', () async { | ||
|
@@ -428,8 +441,11 @@ void testMain() { | |
await createPlatformView(0, 'test-platform-view'); | ||
renderTestScene(viewCount: 0); | ||
_expectSceneMatches(<_EmbeddedViewMarker>[_overlay]); | ||
// TODO(yjbanov): skipped due to https://github.com/flutter/flutter/issues/73867 | ||
}, skip: isSafari); | ||
|
||
for (int i = 0; i < 16; i++) { | ||
await disposePlatformView(i); | ||
} | ||
}); | ||
|
||
test('correctly reuses overlays', () async { | ||
final CkPicture testPicture = | ||
|
@@ -561,8 +577,11 @@ void testMain() { | |
_overlay, | ||
]); | ||
|
||
// TODO(yjbanov): skipped due to https://github.com/flutter/flutter/issues/73867 | ||
}, skip: isSafari); | ||
for (int i = 0; i < 20; i++) { | ||
await disposePlatformView(i); | ||
} | ||
|
||
}); | ||
|
||
test('embeds and disposes of a platform view', () async { | ||
ui_web.platformViewRegistry.registerViewFactory( | ||
|
@@ -641,6 +660,8 @@ void testMain() { | |
|
||
implicitView.debugPhysicalSizeOverride = null; | ||
implicitView.debugForceResize(); | ||
|
||
await disposePlatformView(0); | ||
// ImageDecoder is not supported in Safari or Firefox. | ||
}, skip: isSafari || isFirefox); | ||
|
||
|
@@ -695,6 +716,9 @@ void testMain() { | |
platformViewsHost.querySelectorAll('flt-platform-view'), | ||
hasLength(2), | ||
); | ||
|
||
await disposePlatformView(0); | ||
await disposePlatformView(1); | ||
}); | ||
|
||
test( | ||
|
@@ -729,6 +753,8 @@ void testMain() { | |
await Future<void>.delayed(Duration.zero); | ||
renderTestScene(); | ||
expect(skPathDefs.childNodes, hasLength(1)); | ||
|
||
await disposePlatformView(0); | ||
}); | ||
|
||
test('does not crash when a prerolled platform view is not composited', | ||
|
@@ -749,6 +775,8 @@ void testMain() { | |
_expectSceneMatches(<_EmbeddedViewMarker>[ | ||
_overlay, | ||
]); | ||
|
||
await disposePlatformView(0); | ||
}); | ||
|
||
test('does not create overlays for invisible platform views', () async { | ||
|
@@ -951,6 +979,9 @@ void testMain() { | |
_platformView, | ||
_overlay, | ||
]); | ||
for (int i = 0; i < 7; i++) { | ||
await disposePlatformView(i); | ||
} | ||
}); | ||
}); | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.