Skip to content

Commit 50d830a

Browse files
authored
[web] Do not reset 'cursor' in PersistedPlatformView. (flutter#22977)
1 parent 1646966 commit 50d830a

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

lib/web_ui/dev/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,17 @@ Some useful links:
165165
2. Browser and driver CIPD [packages](https://chrome-infra-packages.appspot.com/p/flutter_internal) (Note: Access rights are restricted for these packages.)
166166
3. LUCI web [recipe](https://flutter.googlesource.com/recipes/+/refs/heads/master/recipes/web_engine.py)
167167
4. More general reading on CIPD packages [link](https://chromium.googlesource.com/chromium/src.git/+/master/docs/cipd.md#What-is-CIPD)
168+
169+
## Troubleshooting
170+
171+
### Can't load Kernel binary: Invalid kernel binary format version.
172+
173+
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.
174+
175+
In that case, any invocation to `felt` will fail with:
176+
177+
`Can't load Kernel binary: Invalid kernel binary format version.`
178+
179+
The solution is to delete the cached `felt.snapshot` files within `engine/src/flutter/lib/web_ui`:
180+
181+
**`rm .dart_tool/felt.snapshot*`**

lib/web_ui/lib/src/engine/html/platform_view.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class PersistedPlatformView extends PersistedLeafSurface {
4444
_styleReset.innerHtml = '''
4545
:host {
4646
all: initial;
47+
cursor: inherit;
4748
}''';
4849
_shadowRoot.append(_styleReset);
4950
final html.Element? platformView =

lib/web_ui/test/engine/surface/platform_view_test.dart

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,18 @@ void testMain() {
6767
expect(view.canUpdateAsMatch(anyView), isFalse);
6868
});
6969
});
70+
71+
group('createElement', () {
72+
test('adds reset to stylesheet', () {
73+
final element = view.createElement();
74+
_assertShadowRootStylesheetContains(element, 'all: initial;');
75+
});
76+
77+
test('creates element transparent to "cursor" property', () {
78+
final element = view.createElement();
79+
_assertShadowRootStylesheetContains(element, 'cursor: inherit;');
80+
});
81+
});
7082
});
7183
}
7284

@@ -86,3 +98,14 @@ Future<void> _createPlatformView(int id, String viewType) {
8698
);
8799
return completer.future;
88100
}
101+
102+
void _assertShadowRootStylesheetContains(html.Element element, String rule) {
103+
final shadow = element.shadowRoot;
104+
105+
expect(shadow, isNotNull);
106+
107+
final html.StyleElement style = shadow.children.first;
108+
109+
expect(style, isNotNull);
110+
expect(style.innerHtml, contains(rule));
111+
}

0 commit comments

Comments
 (0)