refactor tab bar behaviour; respect scroll preferences of websites;

This commit is contained in:
Fabian Freund
2026-02-19 06:20:08 +01:00
parent 4d7c185460
commit 3025d6e42d
21 changed files with 602 additions and 195 deletions
@@ -30,6 +30,7 @@ class GeckoViewportService extends GeckoViewportEvents {
isVisible: false,
isAnimating: false,
));
final _browserHandlingScrollSubject = BehaviorSubject<bool>.seeded(false);
/// Stream of keyboard visibility changes.
///
@@ -46,6 +47,17 @@ class GeckoViewportService extends GeckoViewportEvents {
/// Whether the keyboard is currently visible.
bool get isKeyboardVisible => _keyboardSubject.value.isVisible;
/// Stream of browser scroll-handling eligibility.
///
/// Emits true when GeckoView reports that browser content can handle
/// scrolling for dynamic toolbar behavior.
ValueStream<bool> get browserHandlingScrollEvents =>
_browserHandlingScrollSubject.stream;
/// Current browser scroll-handling eligibility.
bool get isBrowserHandlingScrollEnabled =>
_browserHandlingScrollSubject.value;
/// Creates a new viewport service.
///
/// Call [setUp] to register the event handlers after construction.
@@ -113,8 +125,14 @@ class GeckoViewportService extends GeckoViewportEvents {
));
}
@override
void onBrowserHandlingScrollChanged(int sequence, bool isHandling) {
_browserHandlingScrollSubject.addWhenMoreRecent(sequence, null, isHandling);
}
/// Disposes the service and closes all streams.
Future<void> dispose() async {
await _keyboardSubject.close();
await _browserHandlingScrollSubject.close();
}
}