Skip to content

Commit

Permalink
[web] Do not reset 'cursor' in PersistedPlatformView. (flutter#22977)
Browse files Browse the repository at this point in the history
  • Loading branch information
ditman committed Dec 11, 2020
1 parent 1646966 commit 50d830a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/web_ui/dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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*`**
1 change: 1 addition & 0 deletions lib/web_ui/lib/src/engine/html/platform_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class PersistedPlatformView extends PersistedLeafSurface {
_styleReset.innerHtml = '''
:host {
all: initial;
cursor: inherit;
}''';
_shadowRoot.append(_styleReset);
final html.Element? platformView =
Expand Down
23 changes: 23 additions & 0 deletions lib/web_ui/test/engine/surface/platform_view_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;');
});
});
});
}

Expand All @@ -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));
}

0 comments on commit 50d830a

Please sign in to comment.