22// Use of this source code is governed by a BSD-style license that can be
33// found in the LICENSE file.
44
5- import 'dart:html' as html;
6-
75import 'package:meta/meta.dart' ;
86
7+ import 'dom.dart' ;
8+
99// iOS 15 launched WebGL 2.0, but there's something broken about it, which
1010// leads to apps failing to load. For now, we're forcing WebGL 1 on iOS.
1111//
@@ -65,8 +65,8 @@ BrowserEngine get browserEngine {
6565}
6666
6767BrowserEngine _detectBrowserEngine () {
68- final String vendor = html.window .navigator.vendor;
69- final String agent = html.window .navigator.userAgent.toLowerCase ();
68+ final String vendor = domWindow .navigator.vendor;
69+ final String agent = domWindow .navigator.userAgent.toLowerCase ();
7070 return detectBrowserEngineByVendorAgent (vendor, agent);
7171}
7272
@@ -167,14 +167,14 @@ OperatingSystem detectOperatingSystem({
167167 String ? overrideUserAgent,
168168 int ? overrideMaxTouchPoints,
169169}) {
170- final String platform = overridePlatform ?? html.window .navigator.platform! ;
171- final String userAgent = overrideUserAgent ?? html.window .navigator.userAgent;
170+ final String platform = overridePlatform ?? domWindow .navigator.platform! ;
171+ final String userAgent = overrideUserAgent ?? domWindow .navigator.userAgent;
172172
173173 if (platform.startsWith ('Mac' )) {
174174 // iDevices requesting a "desktop site" spoof their UA so it looks like a Mac.
175175 // This checks if we're in a touch device, or on a real mac.
176176 final int maxTouchPoints =
177- overrideMaxTouchPoints ?? html.window .navigator.maxTouchPoints ?? 0 ;
177+ overrideMaxTouchPoints ?? domWindow .navigator.maxTouchPoints ?? 0 ;
178178 if (maxTouchPoints > 2 ) {
179179 return OperatingSystem .iOs;
180180 }
@@ -233,7 +233,7 @@ bool get isIOS15 {
233233 return debugIsIOS15! ;
234234 }
235235 return operatingSystem == OperatingSystem .iOs &&
236- html.window .navigator.userAgent.contains ('OS 15_' );
236+ domWindow .navigator.userAgent.contains ('OS 15_' );
237237}
238238
239239/// Use in tests to simulate the detection of iOS 15.
@@ -256,7 +256,7 @@ int get webGLVersion =>
256256///
257257/// Our CanvasKit backend is affected due to: https://github.com/emscripten-core/emscripten/issues/11819
258258int _detectWebGLVersion () {
259- final html. CanvasElement canvas = html. CanvasElement (
259+ final DomCanvasElement canvas = DomCanvasElement (
260260 width: 1 ,
261261 height: 1 ,
262262 );
0 commit comments