Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/support window pageoffset #428

Merged
merged 3 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions bridge/core/binding_call_methods.json5
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,7 @@
"closest",
"elementFromPoint",
"dir",
"pageXOffset",
"pageYOffset"
]
}
2 changes: 2 additions & 0 deletions bridge/core/frame/window.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ interface Window extends EventTarget, WindowEventHandlers, GlobalEventHandlers {

readonly scrollX: DartImpl<double>;
readonly scrollY: DartImpl<double>;
readonly pageXOffset: DartImpl<double>;
readonly pageYOffset: DartImpl<double>;
readonly devicePixelRatio: DartImpl<double>;
readonly colorScheme: DartImpl<string>;
readonly innerWidth: DartImpl<double>;
Expand Down
2 changes: 1 addition & 1 deletion webf/lib/src/dom/document.dart
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class Document extends ContainerNode {
}

get hidden {
return _visibilityState == VisibilityState.visible;
return _visibilityState == VisibilityState.hidden;
}

void visibilityChange(VisibilityState state) {
Expand Down
2 changes: 2 additions & 0 deletions webf/lib/src/dom/window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class Window extends EventTarget {
properties['innerHeight'] = BindingObjectProperty(getter: () => innerHeight);
properties['scrollX'] = BindingObjectProperty(getter: () => scrollX);
properties['scrollY'] = BindingObjectProperty(getter: () => scrollY);
properties['pageXOffset'] = BindingObjectProperty(getter: () => scrollX);
properties['pageYOffset'] = BindingObjectProperty(getter: () => scrollY);
properties['screen'] = BindingObjectProperty(getter: () => screen);
properties['colorScheme'] = BindingObjectProperty(getter: () => colorScheme);
properties['devicePixelRatio'] = BindingObjectProperty(getter: () => devicePixelRatio);
Expand Down
2 changes: 1 addition & 1 deletion webf/lib/src/launcher/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1133,8 +1133,8 @@ class WebFController {
// Are all script element complete?
if (_view.document.isDelayingDOMContentLoadedEvent) return;

_dispatchDOMContentLoadedEvent();
_view.document.readyState = DocumentReadyState.interactive;
_dispatchDOMContentLoadedEvent();

// Still waiting for images/scripts?
if (_view.document.hasPendingRequest) return;
Expand Down