[web] Do not reset 'cursor' in PersistedPlatformView. (flutter/engine#22977)

This commit is contained in:
David Iglesias 2020-12-10 16:03:02 -08:00 committed by GitHub
parent e9e4a3d079
commit 289570c8d8
3 changed files with 38 additions and 0 deletions

View File

@ -165,3 +165,17 @@ Some useful links:
2. Browser and driver CIPD [packages](https://chrome-infra-packages.appspot.com/p/flutter_internal) (Note: Access rights are restricted for these packages.)
3. LUCI web [recipe](https://flutter.googlesource.com/recipes/+/refs/heads/master/recipes/web_engine.py)
4. More general reading on CIPD packages [link](https://chromium.googlesource.com/chromium/src.git/+/master/docs/cipd.md#What-is-CIPD)
## Troubleshooting
### Can't load Kernel binary: Invalid kernel binary format version.
Some times `.dart_tool` cache invalidation fails, and you'll end up with a cached version of `felt` that is not compatible with the Dart SDK that you're using.
In that case, any invocation to `felt` will fail with:
`Can't load Kernel binary: Invalid kernel binary format version.`
The solution is to delete the cached `felt.snapshot` files within `engine/src/flutter/lib/web_ui`:
**`rm .dart_tool/felt.snapshot*`**

View File

@ -44,6 +44,7 @@ class PersistedPlatformView extends PersistedLeafSurface {
_styleReset.innerHtml = '''
:host {
all: initial;
cursor: inherit;
}''';
_shadowRoot.append(_styleReset);
final html.Element? platformView =

View File

@ -67,6 +67,18 @@ void testMain() {
expect(view.canUpdateAsMatch(anyView), isFalse);
});
});
group('createElement', () {
test('adds reset to stylesheet', () {
final element = view.createElement();
_assertShadowRootStylesheetContains(element, 'all: initial;');
});
test('creates element transparent to "cursor" property', () {
final element = view.createElement();
_assertShadowRootStylesheetContains(element, 'cursor: inherit;');
});
});
});
}
@ -86,3 +98,14 @@ Future<void> _createPlatformView(int id, String viewType) {
);
return completer.future;
}
void _assertShadowRootStylesheetContains(html.Element element, String rule) {
final shadow = element.shadowRoot;
expect(shadow, isNotNull);
final html.StyleElement style = shadow.children.first;
expect(style, isNotNull);
expect(style.innerHtml, contains(rule));
}