mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[web] Librarify all remaining files (flutter/engine#27296)
This commit is contained in:
parent
12750e2e95
commit
9602957de7
@ -19,16 +19,20 @@ import 'dart:async';
|
||||
// ignore: unused_import
|
||||
import 'dart:collection'
|
||||
show ListBase, IterableBase, DoubleLinkedQueue, DoubleLinkedQueueEntry;
|
||||
// ignore: unused_import
|
||||
import 'dart:convert' hide Codec;
|
||||
import 'dart:developer' as developer;
|
||||
import 'dart:html' as html;
|
||||
// ignore: unused_import
|
||||
import 'dart:js' as js;
|
||||
// ignore: unused_import
|
||||
import 'dart:js_util' as js_util;
|
||||
// ignore: unused_import
|
||||
import 'dart:math' as math;
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:js/js.dart';
|
||||
// ignore: unused_import
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
import '../ui.dart' as ui;
|
||||
@ -37,16 +41,23 @@ export 'engine/alarm_clock.dart';
|
||||
|
||||
export 'engine/assets.dart';
|
||||
|
||||
import 'engine/browser_detection.dart';
|
||||
export 'engine/browser_detection.dart';
|
||||
|
||||
export 'engine/canvas_pool.dart';
|
||||
|
||||
export 'engine/clipboard.dart';
|
||||
|
||||
export 'engine/color_filter.dart';
|
||||
|
||||
import 'engine/dom_renderer.dart';
|
||||
export 'engine/dom_renderer.dart';
|
||||
|
||||
export 'engine/engine_canvas.dart';
|
||||
|
||||
export 'engine/font_change_util.dart';
|
||||
|
||||
export 'engine/frame_reference.dart';
|
||||
|
||||
import 'engine/host_node.dart';
|
||||
export 'engine/host_node.dart';
|
||||
|
||||
export 'engine/html_image_codec.dart';
|
||||
@ -105,7 +116,6 @@ export 'engine/html/recording_canvas.dart';
|
||||
|
||||
export 'engine/html/render_vertices.dart';
|
||||
|
||||
import 'engine/html/scene.dart';
|
||||
export 'engine/html/scene.dart';
|
||||
|
||||
export 'engine/html/scene_builder.dart';
|
||||
@ -130,7 +140,6 @@ export 'engine/html/surface_stats.dart';
|
||||
|
||||
export 'engine/html/transform.dart';
|
||||
|
||||
import 'engine/keyboard_binding.dart';
|
||||
export 'engine/keyboard_binding.dart';
|
||||
|
||||
import 'engine/keyboard.dart';
|
||||
@ -141,7 +150,6 @@ export 'engine/key_map.dart';
|
||||
import 'engine/mouse_cursor.dart';
|
||||
export 'engine/mouse_cursor.dart';
|
||||
|
||||
import 'engine/navigation/history.dart';
|
||||
export 'engine/navigation/history.dart';
|
||||
|
||||
import 'engine/navigation/js_url_strategy.dart';
|
||||
@ -154,10 +162,20 @@ export 'engine/onscreen_logging.dart';
|
||||
|
||||
export 'engine/picture.dart';
|
||||
|
||||
import 'engine/plugins.dart';
|
||||
import 'engine/platform_dispatcher.dart';
|
||||
export 'engine/platform_dispatcher.dart';
|
||||
|
||||
export 'engine/platform_views.dart';
|
||||
|
||||
import 'engine/platform_views/content_manager.dart';
|
||||
export 'engine/platform_views/content_manager.dart';
|
||||
|
||||
export 'engine/platform_views/message_handler.dart';
|
||||
|
||||
export 'engine/platform_views/slots.dart';
|
||||
|
||||
export 'engine/plugins.dart';
|
||||
|
||||
import 'engine/pointer_binding.dart';
|
||||
export 'engine/pointer_binding.dart';
|
||||
|
||||
export 'engine/pointer_converter.dart';
|
||||
@ -167,7 +185,6 @@ export 'engine/profiler.dart';
|
||||
|
||||
export 'engine/rrect_renderer.dart';
|
||||
|
||||
import 'engine/semantics/accessibility.dart';
|
||||
export 'engine/semantics/accessibility.dart';
|
||||
|
||||
export 'engine/semantics/checkable.dart';
|
||||
@ -182,7 +199,6 @@ export 'engine/semantics/live_region.dart';
|
||||
|
||||
export 'engine/semantics/scrollable.dart';
|
||||
|
||||
import 'engine/semantics/semantics.dart';
|
||||
export 'engine/semantics/semantics.dart';
|
||||
|
||||
export 'engine/semantics/semantics_helper.dart';
|
||||
@ -193,17 +209,14 @@ export 'engine/semantics/text_field.dart';
|
||||
|
||||
export 'engine/services/buffers.dart';
|
||||
|
||||
import 'engine/services/message_codec.dart';
|
||||
export 'engine/services/message_codec.dart';
|
||||
|
||||
import 'engine/services/message_codecs.dart';
|
||||
export 'engine/services/message_codecs.dart';
|
||||
|
||||
export 'engine/services/serialization.dart';
|
||||
|
||||
export 'engine/shadow.dart';
|
||||
|
||||
import 'engine/test_embedding.dart';
|
||||
export 'engine/test_embedding.dart';
|
||||
|
||||
export 'engine/text/font_collection.dart';
|
||||
@ -214,7 +227,6 @@ export 'engine/text/line_break_properties.dart';
|
||||
|
||||
export 'engine/text/line_breaker.dart';
|
||||
|
||||
import 'engine/text/measurement.dart';
|
||||
export 'engine/text/measurement.dart';
|
||||
|
||||
export 'engine/text/paint_service.dart';
|
||||
@ -239,10 +251,8 @@ export 'engine/text_editing/input_type.dart';
|
||||
|
||||
export 'engine/text_editing/text_capitalization.dart';
|
||||
|
||||
import 'engine/text_editing/text_editing.dart';
|
||||
export 'engine/text_editing/text_editing.dart';
|
||||
|
||||
import 'engine/util.dart';
|
||||
export 'engine/util.dart';
|
||||
|
||||
export 'engine/validators.dart';
|
||||
@ -252,17 +262,17 @@ export 'engine/vector_math.dart';
|
||||
import 'engine/web_experiments.dart';
|
||||
export 'engine/web_experiments.dart';
|
||||
|
||||
import 'engine/window.dart';
|
||||
export 'engine/window.dart';
|
||||
|
||||
export 'engine/canvaskit/canvas.dart';
|
||||
|
||||
import 'engine/canvaskit/canvaskit_api.dart';
|
||||
export 'engine/canvaskit/canvaskit_api.dart';
|
||||
|
||||
export 'engine/canvaskit/canvaskit_canvas.dart';
|
||||
|
||||
import 'engine/canvaskit/color_filter.dart';
|
||||
export 'engine/canvaskit/color_filter.dart';
|
||||
|
||||
import 'engine/canvaskit/embedded_views.dart';
|
||||
export 'engine/canvaskit/embedded_views.dart';
|
||||
|
||||
export 'engine/canvaskit/fonts.dart';
|
||||
@ -273,14 +283,12 @@ export 'engine/canvaskit/image.dart';
|
||||
|
||||
export 'engine/canvaskit/image_filter.dart';
|
||||
|
||||
import 'engine/canvaskit/initialization.dart';
|
||||
export 'engine/canvaskit/initialization.dart';
|
||||
|
||||
export 'engine/canvaskit/interval_tree.dart';
|
||||
|
||||
export 'engine/canvaskit/layer.dart';
|
||||
|
||||
import 'engine/canvaskit/layer_scene_builder.dart';
|
||||
export 'engine/canvaskit/layer_scene_builder.dart';
|
||||
|
||||
export 'engine/canvaskit/layer_tree.dart';
|
||||
@ -299,7 +307,6 @@ export 'engine/canvaskit/picture.dart';
|
||||
|
||||
export 'engine/canvaskit/picture_recorder.dart';
|
||||
|
||||
import 'engine/canvaskit/rasterizer.dart';
|
||||
export 'engine/canvaskit/rasterizer.dart';
|
||||
|
||||
export 'engine/canvaskit/raster_cache.dart';
|
||||
@ -318,16 +325,6 @@ export 'engine/canvaskit/util.dart';
|
||||
|
||||
export 'engine/canvaskit/vertices.dart';
|
||||
|
||||
part 'engine/clipboard.dart';
|
||||
part 'engine/color_filter.dart';
|
||||
part 'engine/dom_renderer.dart';
|
||||
part 'engine/font_change_util.dart';
|
||||
part 'engine/platform_dispatcher.dart';
|
||||
part 'engine/platform_views.dart';
|
||||
part 'engine/platform_views/content_manager.dart';
|
||||
part 'engine/platform_views/message_handler.dart';
|
||||
part 'engine/platform_views/slots.dart';
|
||||
part 'engine/window.dart';
|
||||
|
||||
// The mode the app is running in.
|
||||
// Keep these in sync with the same constants on the framework-side under foundation/constants.dart.
|
||||
@ -428,12 +425,12 @@ void initializeEngine() {
|
||||
// part of the rasterization process, particularly in the HTML
|
||||
// renderer, takes place in the `SceneBuilder.build()`.
|
||||
frameTimingsOnBuildStart();
|
||||
if (EnginePlatformDispatcher.instance._onBeginFrame != null) {
|
||||
if (EnginePlatformDispatcher.instance.onBeginFrame != null) {
|
||||
EnginePlatformDispatcher.instance.invokeOnBeginFrame(
|
||||
Duration(microseconds: highResTimeMicroseconds));
|
||||
}
|
||||
|
||||
if (EnginePlatformDispatcher.instance._onDrawFrame != null) {
|
||||
if (EnginePlatformDispatcher.instance.onDrawFrame != null) {
|
||||
// TODO(yjbanov): technically Flutter flushes microtasks between
|
||||
// onBeginFrame and onDrawFrame. We don't, which hasn't
|
||||
// been an issue yet, but eventually we'll have to
|
||||
@ -449,12 +446,12 @@ void initializeEngine() {
|
||||
}
|
||||
|
||||
void _addUrlStrategyListener() {
|
||||
_jsSetUrlStrategy = allowInterop((JsUrlStrategy? jsStrategy) {
|
||||
jsSetUrlStrategy = allowInterop((JsUrlStrategy? jsStrategy) {
|
||||
customUrlStrategy =
|
||||
jsStrategy == null ? null : CustomUrlStrategy.fromJs(jsStrategy);
|
||||
});
|
||||
registerHotRestartListener(() {
|
||||
_jsSetUrlStrategy = null;
|
||||
jsSetUrlStrategy = null;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,13 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
part of engine;
|
||||
import 'dart:html' as html;
|
||||
|
||||
import 'package:ui/ui.dart' as ui;
|
||||
|
||||
import 'browser_detection.dart';
|
||||
import 'services.dart';
|
||||
import 'util.dart';
|
||||
|
||||
/// Handles clipboard related platform messages.
|
||||
class ClipboardMessageHandler {
|
||||
@ -78,17 +84,13 @@ class ClipboardMessageHandler {
|
||||
}
|
||||
}
|
||||
|
||||
bool _unsafeIsNull(dynamic object) {
|
||||
return object == null;
|
||||
}
|
||||
|
||||
/// Provides functionality for writing text to clipboard.
|
||||
///
|
||||
/// A concrete implementation is picked at runtime based on the available
|
||||
/// APIs and the browser.
|
||||
abstract class CopyToClipboardStrategy {
|
||||
factory CopyToClipboardStrategy() {
|
||||
return !_unsafeIsNull(html.window.navigator.clipboard)
|
||||
return !unsafeIsNull(html.window.navigator.clipboard)
|
||||
? ClipboardAPICopyStrategy()
|
||||
: ExecCommandCopyStrategy();
|
||||
}
|
||||
@ -108,7 +110,7 @@ abstract class CopyToClipboardStrategy {
|
||||
abstract class PasteFromClipboardStrategy {
|
||||
factory PasteFromClipboardStrategy() {
|
||||
return (browserEngine == BrowserEngine.firefox ||
|
||||
_unsafeIsNull(html.window.navigator.clipboard))
|
||||
unsafeIsNull(html.window.navigator.clipboard))
|
||||
? ExecCommandPasteStrategy()
|
||||
: ClipboardAPIPasteStrategy();
|
||||
}
|
||||
|
||||
@ -2,7 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
part of engine;
|
||||
import 'package:ui/ui.dart' as ui;
|
||||
|
||||
import 'canvaskit/color_filter.dart';
|
||||
|
||||
/// A description of a color filter to apply when drawing a shape or compositing
|
||||
/// a layer with a particular [Paint]. A color filter is a function that takes
|
||||
|
||||
@ -2,7 +2,26 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
part of engine;
|
||||
import 'dart:async';
|
||||
import 'dart:html' as html;
|
||||
import 'dart:js' as js;
|
||||
import 'dart:js_util' as js_util;
|
||||
|
||||
import 'package:ui/src/engine.dart' show buildMode, registerHotRestartListener;
|
||||
import 'package:ui/ui.dart' as ui;
|
||||
|
||||
import 'browser_detection.dart';
|
||||
import 'canvaskit/initialization.dart';
|
||||
import 'canvaskit/canvaskit_api.dart';
|
||||
import 'host_node.dart';
|
||||
import 'keyboard_binding.dart';
|
||||
import 'platform_dispatcher.dart';
|
||||
import 'pointer_binding.dart';
|
||||
import 'semantics.dart';
|
||||
import 'text/measurement.dart';
|
||||
import 'text_editing/text_editing.dart';
|
||||
import 'util.dart';
|
||||
import 'window.dart';
|
||||
|
||||
class DomRenderer {
|
||||
DomRenderer() {
|
||||
@ -514,7 +533,7 @@ class DomRenderer {
|
||||
}
|
||||
_localeSubscription =
|
||||
languageChangeEvent.forTarget(html.window).listen(_languageDidChange);
|
||||
EnginePlatformDispatcher.instance._updateLocales();
|
||||
EnginePlatformDispatcher.instance.updateLocales();
|
||||
}
|
||||
|
||||
// Creates a [HostNode] into a `root` [html.Element].
|
||||
@ -550,7 +569,7 @@ class DomRenderer {
|
||||
window.computeOnScreenKeyboardInsets(true);
|
||||
EnginePlatformDispatcher.instance.invokeOnMetricsChanged();
|
||||
} else {
|
||||
window._computePhysicalSize();
|
||||
window.computePhysicalSize();
|
||||
// When physical size changes this value has to be recalculated.
|
||||
window.computeOnScreenKeyboardInsets(false);
|
||||
EnginePlatformDispatcher.instance.invokeOnMetricsChanged();
|
||||
@ -559,7 +578,7 @@ class DomRenderer {
|
||||
|
||||
/// Called immediately after browser window language change.
|
||||
void _languageDidChange(html.Event event) {
|
||||
EnginePlatformDispatcher.instance._updateLocales();
|
||||
EnginePlatformDispatcher.instance.updateLocales();
|
||||
if (ui.window.onLocaleChanged != null) {
|
||||
ui.window.onLocaleChanged!();
|
||||
}
|
||||
@ -626,9 +645,9 @@ class DomRenderer {
|
||||
/// See w3c screen api: https://www.w3.org/TR/screen-orientation/
|
||||
Future<bool> setPreferredOrientation(List<dynamic> orientations) {
|
||||
final html.Screen screen = html.window.screen!;
|
||||
if (!_unsafeIsNull(screen)) {
|
||||
if (!unsafeIsNull(screen)) {
|
||||
final html.ScreenOrientation? screenOrientation = screen.orientation;
|
||||
if (!_unsafeIsNull(screenOrientation)) {
|
||||
if (!unsafeIsNull(screenOrientation)) {
|
||||
if (orientations.isEmpty) {
|
||||
screenOrientation!.unlock();
|
||||
return Future.value(true);
|
||||
|
||||
@ -2,7 +2,12 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
part of engine;
|
||||
import 'dart:async';
|
||||
import 'dart:html' as html;
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'platform_dispatcher.dart';
|
||||
import 'services.dart';
|
||||
|
||||
final ByteData? _fontChangeMessage =
|
||||
JSONMessageCodec().encodeMessage(<String, dynamic>{'type': 'fontsChange'});
|
||||
|
||||
@ -2,7 +2,30 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
part of engine;
|
||||
import 'dart:async';
|
||||
import 'dart:html' as html;
|
||||
import 'dart:typed_data';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:ui/src/engine.dart' show platformViewManager, registerHotRestartListener;
|
||||
import 'package:ui/ui.dart' as ui;
|
||||
|
||||
import 'canvaskit/initialization.dart';
|
||||
import 'canvaskit/layer_scene_builder.dart';
|
||||
import 'canvaskit/rasterizer.dart';
|
||||
import 'clipboard.dart';
|
||||
import 'dom_renderer.dart';
|
||||
import 'html/scene.dart';
|
||||
import 'profiler.dart';
|
||||
import 'mouse_cursor.dart';
|
||||
import 'platform_views/message_handler.dart';
|
||||
import 'plugins.dart';
|
||||
import 'semantics.dart';
|
||||
import 'services.dart';
|
||||
import 'text_editing/text_editing.dart';
|
||||
import 'util.dart';
|
||||
import 'window.dart';
|
||||
|
||||
/// Requests that the browser schedule a frame.
|
||||
///
|
||||
@ -54,12 +77,14 @@ class EnginePlatformDispatcher extends ui.PlatformDispatcher {
|
||||
|
||||
/// The current list of windows,
|
||||
Iterable<ui.FlutterView> get views => _windows.values;
|
||||
Map<Object, ui.FlutterWindow> get windows => _windows;
|
||||
Map<Object, ui.FlutterWindow> _windows = <Object, ui.FlutterWindow>{};
|
||||
|
||||
/// A map of opaque platform window identifiers to window configurations.
|
||||
///
|
||||
/// This should be considered a protected member, only to be used by
|
||||
/// [PlatformDispatcher] subclasses.
|
||||
Map<Object, ui.ViewConfiguration> get windowConfigurations => _windowConfigurations;
|
||||
Map<Object, ui.ViewConfiguration> _windowConfigurations =
|
||||
<Object, ui.ViewConfiguration>{};
|
||||
|
||||
@ -326,7 +351,7 @@ class EnginePlatformDispatcher extends ui.PlatformDispatcher {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_debugPrintPlatformMessages) {
|
||||
if (debugPrintPlatformMessages) {
|
||||
print('Sent platform message on channel: "$name"');
|
||||
}
|
||||
|
||||
@ -684,7 +709,7 @@ class EnginePlatformDispatcher extends ui.PlatformDispatcher {
|
||||
}
|
||||
|
||||
// Called by DomRenderer when browser languages change.
|
||||
void _updateLocales() {
|
||||
void updateLocales() {
|
||||
_configuration = _configuration.copyWith(locales: parseBrowserLanguages());
|
||||
}
|
||||
|
||||
|
||||
@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
part of engine;
|
||||
|
||||
// TODO(yjbanov): The code in this file was temporarily moved to lib/web_ui/lib/ui.dart
|
||||
// during the NNBD migration so that `dart:ui` does not have to export
|
||||
// `dart:_engine`. NNBD does not allow exported non-migrated libraries
|
||||
|
||||
@ -2,7 +2,12 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
part of engine;
|
||||
import 'dart:html' as html;
|
||||
|
||||
import '../browser_detection.dart';
|
||||
import '../dom_renderer.dart';
|
||||
import '../util.dart';
|
||||
import 'slots.dart';
|
||||
|
||||
/// A function which takes a unique `id` and some `params` and creates an HTML element.
|
||||
///
|
||||
@ -149,7 +154,7 @@ class PlatformViewManager {
|
||||
final html.Element slot = html.document.createElement('slot')
|
||||
..style.display = 'none'
|
||||
..setAttribute('name', tombstoneName);
|
||||
domRenderer._glassPaneShadow!.append(slot);
|
||||
domRenderer.glassPaneShadow!.append(slot);
|
||||
// Link the element to the new slot
|
||||
element.setAttribute('slot', tombstoneName);
|
||||
// Delete both the element, and the new slot
|
||||
|
||||
@ -2,7 +2,11 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
part of engine;
|
||||
import 'dart:html' as html;
|
||||
import 'dart:typed_data';
|
||||
|
||||
import '../services.dart';
|
||||
import 'content_manager.dart';
|
||||
|
||||
/// The signature for a callback for a Platform Message. From the `ui` package.
|
||||
/// Copied here so there's no circular dependencies.
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
part of engine;
|
||||
import 'dart:html' as html;
|
||||
|
||||
/// Returns the name of a slot from its `viewId`.
|
||||
///
|
||||
|
||||
@ -555,3 +555,8 @@ bool listEquals<T>(List<T>? a, List<T>? b) {
|
||||
String blurSigmasToCssString(double sigmaX, double sigmaY) {
|
||||
return 'blur(${(sigmaX + sigmaY) * 0.5}px)';
|
||||
}
|
||||
|
||||
/// Checks if the dynamic [object] is equal to null.
|
||||
bool unsafeIsNull(dynamic object) {
|
||||
return object == null;
|
||||
}
|
||||
|
||||
@ -2,12 +2,30 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
part of engine;
|
||||
@JS()
|
||||
library window;
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:html' as html;
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:js/js.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:ui/src/engine.dart' show registerHotRestartListener;
|
||||
import 'package:ui/ui.dart' as ui;
|
||||
|
||||
import 'browser_detection.dart';
|
||||
import 'navigation/history.dart';
|
||||
import 'navigation/js_url_strategy.dart';
|
||||
import 'navigation/url_strategy.dart';
|
||||
import 'platform_dispatcher.dart';
|
||||
import 'services.dart';
|
||||
import 'test_embedding.dart';
|
||||
|
||||
typedef _HandleMessageCallBack = Future<bool> Function();
|
||||
|
||||
/// When set to true, all platform messages will be printed to the console.
|
||||
const bool /*!*/ _debugPrintPlatformMessages = false;
|
||||
const bool debugPrintPlatformMessages = false;
|
||||
|
||||
/// Whether [_customUrlStrategy] has been set or not.
|
||||
///
|
||||
@ -28,8 +46,8 @@ class EngineFlutterWindow extends ui.SingletonFlutterWindow {
|
||||
EngineFlutterWindow(this._windowId, this.platformDispatcher) {
|
||||
final EnginePlatformDispatcher engineDispatcher =
|
||||
platformDispatcher as EnginePlatformDispatcher;
|
||||
engineDispatcher._windows[_windowId] = this;
|
||||
engineDispatcher._windowConfigurations[_windowId] = ui.ViewConfiguration();
|
||||
engineDispatcher.windows[_windowId] = this;
|
||||
engineDispatcher.windowConfigurations[_windowId] = ui.ViewConfiguration();
|
||||
if (_isUrlStrategySet) {
|
||||
_browserHistory =
|
||||
MultiEntriesBrowserHistory(urlStrategy: _customUrlStrategy);
|
||||
@ -44,7 +62,6 @@ class EngineFlutterWindow extends ui.SingletonFlutterWindow {
|
||||
|
||||
/// Handles the browser history integration to allow users to use the back
|
||||
/// button, etc.
|
||||
@visibleForTesting
|
||||
BrowserHistory get browserHistory {
|
||||
return _browserHistory ??=
|
||||
MultiEntriesBrowserHistory(urlStrategy: _urlStrategyForInitialization);
|
||||
@ -164,15 +181,15 @@ class EngineFlutterWindow extends ui.SingletonFlutterWindow {
|
||||
ui.ViewConfiguration get viewConfiguration {
|
||||
final EnginePlatformDispatcher engineDispatcher =
|
||||
platformDispatcher as EnginePlatformDispatcher;
|
||||
assert(engineDispatcher._windowConfigurations.containsKey(_windowId));
|
||||
return engineDispatcher._windowConfigurations[_windowId] ??
|
||||
assert(engineDispatcher.windowConfigurations.containsKey(_windowId));
|
||||
return engineDispatcher.windowConfigurations[_windowId] ??
|
||||
ui.ViewConfiguration();
|
||||
}
|
||||
|
||||
@override
|
||||
ui.Size get physicalSize {
|
||||
if (_physicalSize == null) {
|
||||
_computePhysicalSize();
|
||||
computePhysicalSize();
|
||||
}
|
||||
assert(_physicalSize != null);
|
||||
return _physicalSize!;
|
||||
@ -182,7 +199,7 @@ class EngineFlutterWindow extends ui.SingletonFlutterWindow {
|
||||
///
|
||||
/// This function is expensive. It triggers browser layout if there are
|
||||
/// pending DOM writes.
|
||||
void _computePhysicalSize() {
|
||||
void computePhysicalSize() {
|
||||
bool override = false;
|
||||
|
||||
assert(() {
|
||||
@ -231,7 +248,7 @@ class EngineFlutterWindow extends ui.SingletonFlutterWindow {
|
||||
|
||||
/// Forces the window to recompute its physical size. Useful for tests.
|
||||
void debugForceResize() {
|
||||
_computePhysicalSize();
|
||||
computePhysicalSize();
|
||||
}
|
||||
|
||||
void computeOnScreenKeyboardInsets(bool isEditingOnMobile) {
|
||||
@ -315,7 +332,7 @@ typedef _JsSetUrlStrategy = void Function(JsUrlStrategy?);
|
||||
//
|
||||
// TODO: Add integration test https://github.com/flutter/flutter/issues/66852
|
||||
@JS('_flutter_web_set_location_strategy')
|
||||
external set _jsSetUrlStrategy(_JsSetUrlStrategy? newJsSetUrlStrategy);
|
||||
external set jsSetUrlStrategy(_JsSetUrlStrategy? newJsSetUrlStrategy);
|
||||
|
||||
UrlStrategy? _createDefaultUrlStrategy() {
|
||||
return ui.debugEmulateFlutterTesterEnvironment
|
||||
@ -356,8 +373,8 @@ class EngineFlutterWindowView extends ui.FlutterWindow {
|
||||
ui.ViewConfiguration get viewConfiguration {
|
||||
final EnginePlatformDispatcher engineDispatcher =
|
||||
platformDispatcher as EnginePlatformDispatcher;
|
||||
assert(engineDispatcher._windowConfigurations.containsKey(_viewId));
|
||||
return engineDispatcher._windowConfigurations[_viewId] ??
|
||||
assert(engineDispatcher.windowConfigurations.containsKey(_viewId));
|
||||
return engineDispatcher.windowConfigurations[_viewId] ??
|
||||
ui.ViewConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user