From b84f50bfdc2a68ee0b2e9e7a16dd8f23ef92437d Mon Sep 17 00:00:00 2001 From: ferhatb Date: Thu, 29 Jul 2021 12:43:35 -0700 Subject: [PATCH 1/5] update TODO format to match flutter repo --- lib/web_ui/analysis_options.yaml | 12 +---- lib/web_ui/dev/chrome.dart | 2 +- lib/web_ui/dev/common.dart | 4 +- lib/web_ui/dev/edge.dart | 2 +- lib/web_ui/dev/edge_installation.dart | 2 +- lib/web_ui/dev/felt_windows.bat | 2 +- lib/web_ui/dev/firefox_installer.dart | 4 +- lib/web_ui/dev/safari_installation.dart | 2 +- lib/web_ui/dev/test_runner.dart | 6 +-- lib/web_ui/lib/src/engine.dart | 6 +-- .../lib/src/engine/browser_detection.dart | 2 +- .../lib/src/engine/canvaskit/canvas.dart | 1 + .../src/engine/canvaskit/canvaskit_api.dart | 2 + .../src/engine/canvaskit/font_fallbacks.dart | 7 ++- .../lib/src/engine/canvaskit/image.dart | 1 + .../engine/canvaskit/layer_scene_builder.dart | 8 +-- .../lib/src/engine/canvaskit/surface.dart | 1 + lib/web_ui/lib/src/engine/canvaskit/text.dart | 2 +- lib/web_ui/lib/src/engine/clipboard.dart | 2 +- lib/web_ui/lib/src/engine/dom_renderer.dart | 2 +- lib/web_ui/lib/src/engine/engine_canvas.dart | 3 ++ lib/web_ui/lib/src/engine/host_node.dart | 2 +- .../lib/src/engine/html/backdrop_filter.dart | 2 +- .../lib/src/engine/html/bitmap_canvas.dart | 19 +++---- .../lib/src/engine/html/color_filter.dart | 1 + .../lib/src/engine/html/dom_canvas.dart | 2 +- lib/web_ui/lib/src/engine/html/painting.dart | 6 +-- lib/web_ui/lib/src/engine/html/path/path.dart | 6 +-- .../src/engine/html/path/path_metrics.dart | 6 +-- .../lib/src/engine/html/path/path_ref.dart | 8 +-- .../lib/src/engine/html/recording_canvas.dart | 3 +- .../lib/src/engine/html/shader_mask.dart | 2 +- .../lib/src/engine/html/shaders/shader.dart | 6 +-- .../engine/html/shaders/shader_builder.dart | 4 +- .../lib/src/engine/keyboard_binding.dart | 5 +- .../lib/src/engine/platform_dispatcher.dart | 2 +- .../platform_views/content_manager.dart | 4 +- .../platform_views/message_handler.dart | 2 +- .../lib/src/engine/pointer_binding.dart | 6 +-- .../lib/src/engine/semantics/semantics.dart | 1 + .../src/engine/services/message_codecs.dart | 2 +- .../lib/src/engine/text/font_collection.dart | 4 +- .../lib/src/engine/text/layout_service.dart | 5 +- .../lib/src/engine/text/measurement.dart | 6 +-- lib/web_ui/lib/src/engine/text/paragraph.dart | 11 ++-- .../lib/src/engine/text/word_breaker.dart | 2 +- .../src/engine/text_editing/input_type.dart | 2 +- .../text_editing/text_capitalization.dart | 2 +- .../src/engine/text_editing/text_editing.dart | 4 +- lib/web_ui/lib/src/engine/window.dart | 2 +- lib/web_ui/lib/src/ui/geometry.dart | 3 ++ lib/web_ui/lib/src/ui/painting.dart | 17 +++--- lib/web_ui/lib/src/ui/path.dart | 3 ++ lib/web_ui/lib/src/ui/test_embedding.dart | 2 +- lib/web_ui/lib/src/ui/window.dart | 4 +- .../backdrop_filter_golden_test.dart | 4 +- .../test/canvaskit/canvas_golden_test.dart | 4 +- .../test/canvaskit/canvaskit_api_test.dart | 2 +- .../canvaskit/color_filter_golden_test.dart | 4 +- lib/web_ui/test/canvaskit/common.dart | 2 +- .../test/canvaskit/embedded_views_test.dart | 2 +- .../canvaskit/fallback_fonts_golden_test.dart | 10 ++-- lib/web_ui/test/canvaskit/filter_test.dart | 4 +- .../test/canvaskit/frame_timings_test.dart | 2 +- .../test/canvaskit/hot_restart_test.dart | 2 +- lib/web_ui/test/canvaskit/image_test.dart | 2 +- .../test/canvaskit/initialization_test.dart | 2 +- lib/web_ui/test/canvaskit/layer_test.dart | 2 +- .../linear_gradient_golden_test.dart | 4 +- lib/web_ui/test/canvaskit/path_test.dart | 2 +- lib/web_ui/test/canvaskit/picture_test.dart | 2 +- .../canvaskit/platform_dispatcher_test.dart | 2 +- lib/web_ui/test/canvaskit/scene_test.dart | 2 +- .../canvaskit/shader_mask_golden_test.dart | 4 +- lib/web_ui/test/canvaskit/shader_test.dart | 2 +- .../canvaskit/skia_font_collection_test.dart | 2 +- .../canvaskit/skia_objects_cache_test.dart | 2 +- .../test/canvaskit/surface_factory_test.dart | 2 +- .../canvaskit/sweep_gradient_golden_test.dart | 4 +- lib/web_ui/test/canvaskit/text_test.dart | 2 +- lib/web_ui/test/canvaskit/vertices_test.dart | 2 +- lib/web_ui/test/channel_buffers_test.dart | 28 +++++----- lib/web_ui/test/clipboard_test.dart | 12 ++--- lib/web_ui/test/dom_renderer_test.dart | 4 +- lib/web_ui/test/engine/history_test.dart | 22 ++++---- .../test/engine/pointer_binding_test.dart | 2 +- .../test/engine/semantics/semantics_test.dart | 44 ++++++++-------- .../engine/semantics/text_field_test.dart | 8 +-- .../engine/surface/scene_builder_test.dart | 2 +- .../test/engine/surface/surface_test.dart | 2 +- lib/web_ui/test/engine/window_test.dart | 52 +++++++++---------- .../golden_success_smoke_test.dart | 2 +- .../compositing/color_filter_golden_test.dart | 2 +- .../compositing/compositing_golden_test.dart | 2 +- .../canvas_draw_color_golden_test.dart | 4 +- .../text_multiline_clipping_golden_test.dart | 2 +- .../text_placeholders_golden_test.dart | 2 +- .../html/recording_canvas_golden_test.dart | 4 +- .../html/shaders/shader_mask_golden_test.dart | 2 +- lib/web_ui/test/keyboard_converter_test.dart | 10 ++-- lib/web_ui/test/keyboard_test.dart | 8 +-- lib/web_ui/test/paragraph_test.dart | 12 ++--- lib/web_ui/test/path_test.dart | 2 +- .../test/text/font_collection_test.dart | 30 +++++------ lib/web_ui/test/text/font_loading_test.dart | 16 +++--- .../test/text/layout_service_plain_test.dart | 2 +- lib/web_ui/test/text/measurement_test.dart | 2 +- lib/web_ui/test/text_editing_test.dart | 20 +++---- lib/web_ui/test/text_test.dart | 10 ++-- 109 files changed, 307 insertions(+), 304 deletions(-) diff --git a/lib/web_ui/analysis_options.yaml b/lib/web_ui/analysis_options.yaml index f4b1f253b4b0c..9e6bab0f4acb4 100644 --- a/lib/web_ui/analysis_options.yaml +++ b/lib/web_ui/analysis_options.yaml @@ -13,14 +13,4 @@ analyzer: linter: rules: - package_api_docs: false - prefer_foreach: false - prefer_generic_function_type_aliases: false - prefer_initializing_formals: false - prefer_single_quotes: false - prefer_typing_uninitialized_variables: false - public_member_api_docs: false - flutter_style_todos: false - - # We have some legitimate use-cases for this (preserve tear-off identity) - prefer_function_declarations_over_variables: false \ No newline at end of file + public_member_api_docs: false \ No newline at end of file diff --git a/lib/web_ui/dev/chrome.dart b/lib/web_ui/dev/chrome.dart index 98b93f5a028df..5daf0a92b0eeb 100644 --- a/lib/web_ui/dev/chrome.dart +++ b/lib/web_ui/dev/chrome.dart @@ -208,7 +208,7 @@ Future getRemoteDebuggerUrl(Uri base) async { /// [ScreenshotManager] implementation for Chrome. /// /// This manager can be used for both macOS and Linux. -// TODO: https://github.com/flutter/flutter/issues/65673 +// TODO(yjbanov): extends tests to Window, https://github.com/flutter/flutter/issues/65673 class ChromeScreenshotManager extends ScreenshotManager { @override String get filenameSuffix => ''; diff --git a/lib/web_ui/dev/common.dart b/lib/web_ui/dev/common.dart index 4149785da5982..7af7a0559a8a1 100644 --- a/lib/web_ui/dev/common.dart +++ b/lib/web_ui/dev/common.dart @@ -222,13 +222,13 @@ class DevNull implements StringSink { void write(Object? obj) {} @override - void writeAll(Iterable objects, [String separator = ""]) {} + void writeAll(Iterable objects, [String separator = '']) {} @override void writeCharCode(int charCode) {} @override - void writeln([Object? obj = ""]) {} + void writeln([Object? obj = '']) {} } /// Whether the felt command is running on Cirrus CI. diff --git a/lib/web_ui/dev/edge.dart b/lib/web_ui/dev/edge.dart index 2006a75a6a414..843d68880ed18 100644 --- a/lib/web_ui/dev/edge.dart +++ b/lib/web_ui/dev/edge.dart @@ -50,7 +50,7 @@ class Edge extends Browser { final String version = EdgeArgParser.instance.version; return Edge._(() async { - // TODO(nurhan): Configure info log for LUCI. + // TODO(yjbanov): Configure info log for LUCI. final BrowserInstallation installation = await getEdgeInstallation( version, infoLog: DevNull(), diff --git a/lib/web_ui/dev/edge_installation.dart b/lib/web_ui/dev/edge_installation.dart index c38d1206b5045..e44318b9db9b7 100644 --- a/lib/web_ui/dev/edge_installation.dart +++ b/lib/web_ui/dev/edge_installation.dart @@ -50,7 +50,7 @@ class EdgeArgParser extends BrowserArgParser { /// exclusively with Windows 10 and cannot be downloaded or installed separately.` /// See: https://support.microsoft.com/en-us/help/17171/microsoft-edge-get-to-know /// -// TODO(nurhan): Investigate running tests for the tech preview downloads +// TODO(yjbanov): Investigate running tests for the tech preview downloads // from the beta channel. Future getEdgeInstallation( String requestedVersion, { diff --git a/lib/web_ui/dev/felt_windows.bat b/lib/web_ui/dev/felt_windows.bat index 1b999e993d02d..f79bd49e0c52d 100644 --- a/lib/web_ui/dev/felt_windows.bat +++ b/lib/web_ui/dev/felt_windows.bat @@ -48,7 +48,7 @@ IF %orTempValue%==0 ( CALL python %GN% --unoptimized --full-dart-sdk CALL ninja -C %HOST_DEBUG_UNOPT_DIR%) -:: TODO(nurhan): The batch script does not support snanphot option. +:: TODO(yjbanov): The batch script does not support snanphot option. :: Support snapshot option. CALL :installdeps IF %1==test (%DART_SDK_DIR%\bin\dart "%DEV_DIR%\felt.dart" %* --browser=chrome) ELSE ( %DART_SDK_DIR%\bin\dart "%DEV_DIR%\felt.dart" %* ) diff --git a/lib/web_ui/dev/firefox_installer.dart b/lib/web_ui/dev/firefox_installer.dart index 3f44596313e1b..aa887c2de57c4 100644 --- a/lib/web_ui/dev/firefox_installer.dart +++ b/lib/web_ui/dev/firefox_installer.dart @@ -317,7 +317,7 @@ Future _findSystemFirefoxExecutable() async { /// Fetches the latest available Firefox build version on Linux. Future fetchLatestFirefoxVersionLinux() async { - final RegExp forFirefoxVersion = RegExp("firefox-[0-9.]+[0-9]"); + final RegExp forFirefoxVersion = RegExp('firefox-[0-9.]+[0-9]'); final io.HttpClientRequest request = await io.HttpClient() .getUrl(Uri.parse(PlatformBinding.instance.getFirefoxLatestVersionUrl())); request.followRedirects = false; @@ -332,7 +332,7 @@ Future fetchLatestFirefoxVersionLinux() async { /// Fetches the latest available Firefox build version on Mac OS. Future fetchLatestFirefoxVersionMacOS() async { - final RegExp forFirefoxVersion = RegExp("firefox/releases/[0-9.]+[0-9]"); + final RegExp forFirefoxVersion = RegExp('firefox/releases/[0-9.]+[0-9]'); final io.HttpClientRequest request = await io.HttpClient() .getUrl(Uri.parse(PlatformBinding.instance.getFirefoxLatestVersionUrl())); request.followRedirects = false; diff --git a/lib/web_ui/dev/safari_installation.dart b/lib/web_ui/dev/safari_installation.dart index d8a3dc13a0973..47e96ca6a5e8d 100644 --- a/lib/web_ui/dev/safari_installation.dart +++ b/lib/web_ui/dev/safari_installation.dart @@ -181,7 +181,7 @@ class IosSafariArgParser extends BrowserArgParser { /// Latest Safari version for Catalina, Mojave, High Siera is 13. /// /// Latest Safari version for Sierra is 12. -// TODO(nurhan): user latest version to download and install the latest +// TODO(yjbanov): user latest version to download and install the latest // technology preview. Future getOrInstallSafari( String requestedVersion, { diff --git a/lib/web_ui/dev/test_runner.dart b/lib/web_ui/dev/test_runner.dart index ef333edb757b6..2046a39a6d966 100644 --- a/lib/web_ui/dev/test_runner.dart +++ b/lib/web_ui/dev/test_runner.dart @@ -361,7 +361,7 @@ class TestCommand extends Command with ArgUtils { /// /// For now Firefox integration tests only run on Linux and Mac on local. /// - // TODO: https://github.com/flutter/flutter/issues/63832 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/63832 bool get isFirefoxIntegrationTestAvailable => (isFirefox && isLuci && io.Platform.isLinux) || (isFirefox && !isLuci && !io.Platform.isWindows); @@ -369,7 +369,7 @@ class TestCommand extends Command with ArgUtils { /// Latest versions of Safari Desktop are only available on macOS. /// /// Integration testing on LUCI is not supported at the moment. - // TODO: https://github.com/flutter/flutter/issues/63710 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/63710 bool get isSafariIntegrationTestAvailable => isSafariOnMacOS && !isLuci; /// Due to various factors integration tests might be missing on a given @@ -776,7 +776,7 @@ class ClearTerminalScreenStep implements PipelineStep { Future run() async { if (!io.Platform.isWindows) { // See: https://en.wikipedia.org/wiki/ANSI_escape_code#CSI_sequences - print("\x1B[2J\x1B[1;2H"); + print('\x1B[2J\x1B[1;2H'); } } } diff --git a/lib/web_ui/lib/src/engine.dart b/lib/web_ui/lib/src/engine.dart index 566e39329fd7f..8b246c159f3b2 100644 --- a/lib/web_ui/lib/src/engine.dart +++ b/lib/web_ui/lib/src/engine.dart @@ -326,8 +326,8 @@ export 'engine/web_experiments.dart'; export '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. +/// The mode the app is running in. +/// Keep these in sync with the same constants on the framework-side under foundation/constants.dart. const bool kReleaseMode = bool.fromEnvironment('dart.vm.product', defaultValue: false); const bool kProfileMode = @@ -461,7 +461,7 @@ class NullTreeSanitizer implements html.NodeTreeSanitizer { /// The shared instance of PlatformViewManager shared across the engine to handle /// rendering of PlatformViews into the web app. -/// TODO(dit): How to make this overridable from tests? +// TODO(dit): How to make this overridable from tests? final PlatformViewManager platformViewManager = PlatformViewManager(); /// Converts a matrix represented using [Float64List] to one represented using diff --git a/lib/web_ui/lib/src/engine/browser_detection.dart b/lib/web_ui/lib/src/engine/browser_detection.dart index f7116eb2dda38..3b3fc279bc576 100644 --- a/lib/web_ui/lib/src/engine/browser_detection.dart +++ b/lib/web_ui/lib/src/engine/browser_detection.dart @@ -74,7 +74,7 @@ BrowserEngine _detectBrowserEngine() { /// Note: SAMSUNG-SGH-I717 /// SPH/SCH are very old Palm models. bool _isSamsungBrowser(String agent) { - final RegExp exp = RegExp(r"SAMSUNG|SGH-[I|N|T]|GT-[I|N]|SM-[A|N|P|T|Z]|SHV-E|SCH-[I|J|R|S]|SPH-L"); + final RegExp exp = RegExp(r'SAMSUNG|SGH-[I|N|T]|GT-[I|N]|SM-[A|N|P|T|Z]|SHV-E|SCH-[I|J|R|S]|SPH-L'); return exp.hasMatch(agent.toUpperCase()); } diff --git a/lib/web_ui/lib/src/engine/canvaskit/canvas.dart b/lib/web_ui/lib/src/engine/canvaskit/canvas.dart index a2d38a3656103..f5c94879121d6 100644 --- a/lib/web_ui/lib/src/engine/canvaskit/canvas.dart +++ b/lib/web_ui/lib/src/engine/canvaskit/canvas.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// ignore_for_file: public_member_api_docs import 'dart:math' as math; import 'dart:typed_data'; diff --git a/lib/web_ui/lib/src/engine/canvaskit/canvaskit_api.dart b/lib/web_ui/lib/src/engine/canvaskit/canvaskit_api.dart index d4c8a53bb2119..61c391daeb924 100644 --- a/lib/web_ui/lib/src/engine/canvaskit/canvaskit_api.dart +++ b/lib/web_ui/lib/src/engine/canvaskit/canvaskit_api.dart @@ -7,6 +7,8 @@ /// Prefer keeping the original CanvasKit names so it is easier to locate /// the API behind these bindings in the Skia source code. // ignore_for_file: non_constant_identifier_names + +// ignore_for_file: public_member_api_docs @JS() library canvaskit_api; diff --git a/lib/web_ui/lib/src/engine/canvaskit/font_fallbacks.dart b/lib/web_ui/lib/src/engine/canvaskit/font_fallbacks.dart index 7df7c796f7405..23e1110454676 100644 --- a/lib/web_ui/lib/src/engine/canvaskit/font_fallbacks.dart +++ b/lib/web_ui/lib/src/engine/canvaskit/font_fallbacks.dart @@ -56,6 +56,7 @@ class FontFallbackData { // resetting the tree would be a matter of reconstructing // the new resolved tree. font.reset(); + //ignore: prefer_foreach for (final CodeunitRange range in font.approximateUnicodeRanges) { ranges.putIfAbsent(font, () => []).add(range); } @@ -282,10 +283,7 @@ Future findFontsForMissingCodeunits(List codeUnits) async { resolvedFonts.addAll(font.resolvedFont!.tree.intersections(codeUnit)); } } - - for (final _ResolvedNotoSubset resolvedFont in resolvedFonts) { - notoDownloadQueue.add(resolvedFont); - } + resolvedFonts.forEach(notoDownloadQueue.add); // We looked through the Noto font tree and didn't find any font families // covering some code units, or we did find a font family, but when we @@ -402,6 +400,7 @@ _ResolvedNotoFont? _makeResolvedNotoFontFromCss(String css, String name) { final Map<_ResolvedNotoSubset, List> rangesMap = <_ResolvedNotoSubset, List>{}; for (final _ResolvedNotoSubset subset in subsets) { + // ignore: prefer_foreach for (final CodeunitRange range in subset.ranges) { rangesMap.putIfAbsent(subset, () => []).add(range); } diff --git a/lib/web_ui/lib/src/engine/canvaskit/image.dart b/lib/web_ui/lib/src/engine/canvaskit/image.dart index 295d5749c5dc4..f4731330f4740 100644 --- a/lib/web_ui/lib/src/engine/canvaskit/image.dart +++ b/lib/web_ui/lib/src/engine/canvaskit/image.dart @@ -33,6 +33,7 @@ class ImageCodecException implements Exception { const String _kNetworkImageMessage = 'Failed to load network image.'; typedef HttpRequestFactory = html.HttpRequest Function(); +// ignore: prefer_function_declarations_over_variables HttpRequestFactory httpRequestFactory = () => html.HttpRequest(); void debugRestoreHttpRequestFactory() { httpRequestFactory = () => html.HttpRequest(); diff --git a/lib/web_ui/lib/src/engine/canvaskit/layer_scene_builder.dart b/lib/web_ui/lib/src/engine/canvaskit/layer_scene_builder.dart index f05bd910bdbdd..0835c8bf91431 100644 --- a/lib/web_ui/lib/src/engine/canvaskit/layer_scene_builder.dart +++ b/lib/web_ui/lib/src/engine/canvaskit/layer_scene_builder.dart @@ -67,7 +67,7 @@ class LayerSceneBuilder implements ui.SceneBuilder { bool freeze = false, ui.FilterQuality filterQuality = ui.FilterQuality.low, }) { - // TODO(b/128315641): implement addTexture. + // TODO(hterkelsen): implement addTexture, b/128315641 } @override @@ -214,17 +214,17 @@ class LayerSceneBuilder implements ui.SceneBuilder { @override void setCheckerboardOffscreenLayers(bool checkerboard) { - // TODO: implement setCheckerboardOffscreenLayers + // TODO(hterkelsen): implement setCheckerboardOffscreenLayers } @override void setCheckerboardRasterCacheImages(bool checkerboard) { - // TODO: implement setCheckerboardRasterCacheImages + // TODO(hterkelsen): implement setCheckerboardRasterCacheImages } @override void setRasterizerTracingThreshold(int frameInterval) { - // TODO: implement setRasterizerTracingThreshold + // TODO(hterkelsen): implement setRasterizerTracingThreshold } T pushLayer(T layer) { diff --git a/lib/web_ui/lib/src/engine/canvaskit/surface.dart b/lib/web_ui/lib/src/engine/canvaskit/surface.dart index c77173c594553..4713bdfaad7a5 100644 --- a/lib/web_ui/lib/src/engine/canvaskit/surface.dart +++ b/lib/web_ui/lib/src/engine/canvaskit/surface.dart @@ -117,6 +117,7 @@ class Surface { if (surface.context != null) { canvasKit.setCurrentContext(surface.context!); } + // ignore: prefer_function_declarations_over_variables final SubmitCallback submitCallback = (SurfaceFrame surfaceFrame, CkCanvas canvas) { return _presentSurface(); diff --git a/lib/web_ui/lib/src/engine/canvaskit/text.dart b/lib/web_ui/lib/src/engine/canvaskit/text.dart index 5fefea4b43cba..97453df8801aa 100644 --- a/lib/web_ui/lib/src/engine/canvaskit/text.dart +++ b/lib/web_ui/lib/src/engine/canvaskit/text.dart @@ -458,7 +458,7 @@ class CkStrutStyle implements ui.StrutStyle { List? fontFamilyFallback, double? fontSize, double? height, - //TODO(LongCatIsLooong): implement leadingDistribution. + // TODO(mdebbar): implement leadingDistribution. ui.TextLeadingDistribution? leadingDistribution, double? leading, ui.FontWeight? fontWeight, diff --git a/lib/web_ui/lib/src/engine/clipboard.dart b/lib/web_ui/lib/src/engine/clipboard.dart index fb49e5315c98e..3cd1d4ef33bc0 100644 --- a/lib/web_ui/lib/src/engine/clipboard.dart +++ b/lib/web_ui/lib/src/engine/clipboard.dart @@ -203,7 +203,7 @@ class ExecCommandCopyStrategy implements CopyToClipboardStrategy { class ExecCommandPasteStrategy implements PasteFromClipboardStrategy { @override Future getData() { - // TODO(nurhan): https://github.com/flutter/flutter/issues/48581 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/48581 return Future.error( UnimplementedError('Paste is not implemented for this browser.')); } diff --git a/lib/web_ui/lib/src/engine/dom_renderer.dart b/lib/web_ui/lib/src/engine/dom_renderer.dart index fb830e45932ba..d584e12316a19 100644 --- a/lib/web_ui/lib/src/engine/dom_renderer.dart +++ b/lib/web_ui/lib/src/engine/dom_renderer.dart @@ -324,7 +324,7 @@ class DomRenderer { setElementStyle(bodyElement, 'font', defaultCssFont); setElementStyle(bodyElement, 'color', 'red'); - // TODO(flutter_web): Disable spellcheck until changes in the framework and + // TODO(mdebbar): Disable spellcheck until changes in the framework and // engine are complete. bodyElement.spellcheck = false; diff --git a/lib/web_ui/lib/src/engine/engine_canvas.dart b/lib/web_ui/lib/src/engine/engine_canvas.dart index 61ba020663a4f..258ced6479440 100644 --- a/lib/web_ui/lib/src/engine/engine_canvas.dart +++ b/lib/web_ui/lib/src/engine/engine_canvas.dart @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// For member documentation see https://api.flutter.dev/flutter/dart-ui/Canvas-class.html +// ignore_for_file: public_member_api_docs + import 'dart:html' as html; import 'dart:typed_data'; diff --git a/lib/web_ui/lib/src/engine/host_node.dart b/lib/web_ui/lib/src/engine/host_node.dart index 4e805a75d978c..f8f41c2b3cd9f 100644 --- a/lib/web_ui/lib/src/engine/host_node.dart +++ b/lib/web_ui/lib/src/engine/host_node.dart @@ -106,7 +106,7 @@ class ShadowDomHostNode implements HostNode { // The shadowRootStyleElement must be appended to the DOM, or its `sheet` will be null later. _shadow.append(shadowRootStyleElement); - // TODO: Apply only rules for the shadow root + // TODO(dit): Apply only rules for the shadow root applyGlobalCssRulesToSheet( shadowRootStyleElement.sheet! as html.CssStyleSheet, browserEngine: browserEngine, diff --git a/lib/web_ui/lib/src/engine/html/backdrop_filter.dart b/lib/web_ui/lib/src/engine/html/backdrop_filter.dart index b93e5eaddbde6..4758ad33e2d5b 100644 --- a/lib/web_ui/lib/src/engine/html/backdrop_filter.dart +++ b/lib/web_ui/lib/src/engine/html/backdrop_filter.dart @@ -112,7 +112,7 @@ class PersistedBackdropFilter extends PersistedContainerSurface ..height = '${height}px'; if (browserEngine == BrowserEngine.firefox) { // For FireFox for now render transparent black background. - // TODO(flutter_web): Switch code to use filter when + // TODO(ferhat): Switch code to use filter when // See https://caniuse.com/#feat=css-backdrop-filter. filterElementStyle ..backgroundColor = '#000' diff --git a/lib/web_ui/lib/src/engine/html/bitmap_canvas.dart b/lib/web_ui/lib/src/engine/html/bitmap_canvas.dart index f1731cb4940c2..a1e281957ac42 100644 --- a/lib/web_ui/lib/src/engine/html/bitmap_canvas.dart +++ b/lib/web_ui/lib/src/engine/html/bitmap_canvas.dart @@ -105,7 +105,7 @@ class BitmapCanvas extends EngineCanvas { // Indicates the instructions following drawImage or drawParagraph that // a child element was created to paint. - // TODO(flutter_web): When childElements are created by + // TODO(yjbanov): When childElements are created by // drawImage/drawParagraph commands, compositing order is not correctly // handled when we interleave these with other paint commands. // To solve this, recording canvas will have to check the paint queue @@ -183,7 +183,8 @@ class BitmapCanvas extends EngineCanvas { // initial translation so the paint operations are positioned as expected. // // The flooring of the value is to ensure that canvas' top-left corner - // lands on the physical pixel. TODO: !This is not accurate if there are + // lands on the physical pixel. + // TODO(yjbanov): !This is not accurate if there are // transforms higher up in the stack. rootElement.style.transform = 'translate(${_canvasPositionX}px, ${_canvasPositionY}px)'; @@ -783,8 +784,8 @@ class BitmapCanvas extends EngineCanvas { // left,top are set to 0 (although position is absolute) because // Chrome will glitch if you leave them out, reproducible with // canvas_image_blend_test on row 6, MacOS / Chrome 81.04. - ..left = "0px" - ..top = "0px" + ..left = '0px' + ..top = '0px' ..width = widthPx ..height = heightPx; if (imageElement is! html.ImageElement) { @@ -972,8 +973,8 @@ class BitmapCanvas extends EngineCanvas { _children.add(paragraphElement); // If there is a prior sibling such as img prevent left/top shift. paragraphElement.style - ..left = "0px" - ..top = "0px"; + ..left = '0px' + ..top = '0px'; _closeCurrentCanvas(); } @@ -992,7 +993,7 @@ class BitmapCanvas extends EngineCanvas { @override void drawVertices(SurfaceVertices vertices, ui.BlendMode blendMode, SurfacePaintData paint) { - // TODO(flutter_web): Implement shaders for [Paint.shader] and + // TODO(ferhat): Implement shaders for [Paint.shader] and // blendMode. https://github.com/flutter/flutter/issues/40096 // Move rendering to OffscreenCanvas so that transform is preserved // as well. @@ -1132,7 +1133,7 @@ String? stringForBlendMode(ui.BlendMode? blendMode) { return 'xor'; case ui.BlendMode.multiply: // Falling back to multiply, ignoring alpha channel. - // TODO(flutter_web): only used for debug, find better fallback for web. + // TODO(ferhat): only used for debug, find better fallback for web. case ui.BlendMode.modulate: return 'multiply'; case ui.BlendMode.screen: @@ -1281,7 +1282,7 @@ List _clipContent(List clipStack, } // Reverse the transform of the clipping element so children can use // effective transform to render. - // TODO(flutter_web): When we have more than a single clip element, + // TODO(ferhat): When we have more than a single clip element, // reduce number of div nodes by merging (multiplying transforms). final html.Element reverseTransformDiv = html.DivElement(); reverseTransformDiv.style.position = 'absolute'; diff --git a/lib/web_ui/lib/src/engine/html/color_filter.dart b/lib/web_ui/lib/src/engine/html/color_filter.dart index 1b61063aaae9f..feb1df8ef2f46 100644 --- a/lib/web_ui/lib/src/engine/html/color_filter.dart +++ b/lib/web_ui/lib/src/engine/html/color_filter.dart @@ -29,6 +29,7 @@ class PersistedColorFilter extends PersistedContainerSurface /// introduced by the [rootElement] translation. html.Element? _childContainer; + /// Color filter to apply to this surface. final ui.ColorFilter filter; html.Element? _filterElement; bool containerVisible = true; diff --git a/lib/web_ui/lib/src/engine/html/dom_canvas.dart b/lib/web_ui/lib/src/engine/html/dom_canvas.dart index f3ce75d8dc718..4156df30bf89a 100644 --- a/lib/web_ui/lib/src/engine/html/dom_canvas.dart +++ b/lib/web_ui/lib/src/engine/html/dom_canvas.dart @@ -267,7 +267,7 @@ void applyRRectBorderRadius(html.CssStyleDeclaration style, ui.RRect rrect) { String _borderStrokeToCssUnit(double value) { if (value == 0) { - // TODO: hairline nees to take into account both dpi and density. + // TODO(ferhat): hairline nees to take into account both dpi and density. value = 1.0; } return '${value.toStringAsFixed(3)}px'; diff --git a/lib/web_ui/lib/src/engine/html/painting.dart b/lib/web_ui/lib/src/engine/html/painting.dart index 09acfbe0c9713..f3a70396ce604 100644 --- a/lib/web_ui/lib/src/engine/html/painting.dart +++ b/lib/web_ui/lib/src/engine/html/painting.dart @@ -153,7 +153,7 @@ class SurfacePaint implements ui.Paint { _paintData.colorFilter = value; } - // TODO(flutter_web): see https://github.com/flutter/flutter/issues/33605 + // TODO(ferhat): see https://github.com/flutter/flutter/issues/33605 @override double get strokeMiterLimit { throw UnsupportedError('SurfacePaint.strokeMiterLimit'); @@ -166,13 +166,13 @@ class SurfacePaint implements ui.Paint { @override ui.ImageFilter? get imageFilter { - // TODO(flutter/flutter#35156): Implement ImageFilter. + // TODO(ferhat): Implement ImageFilter, flutter/flutter#35156. return null; } @override set imageFilter(ui.ImageFilter? value) { - // TODO(flutter/flutter#35156): Implement ImageFilter. + // TODO(ferhat): Implement ImageFilter, flutter/flutter#35156 } // True if Paint instance has used in RecordingCanvas. diff --git a/lib/web_ui/lib/src/engine/html/path/path.dart b/lib/web_ui/lib/src/engine/html/path/path.dart index 17fa23c4f7d18..c0b8a56f64a1a 100644 --- a/lib/web_ui/lib/src/engine/html/path/path.dart +++ b/lib/web_ui/lib/src/engine/html/path/path.dart @@ -162,7 +162,7 @@ class SurfacePath implements ui.Path { } void _debugValidate() { - // TODO. + assert(pathRef.isValid); } /// Return true if path is a single line and returns points in out. @@ -413,7 +413,7 @@ class SurfacePath implements ui.Path { _resetAfterEdit(); // SkAutoDisableDirectionCheck. _firstDirection = finalDirection; - // TODO: optimize by setting pathRef bounds if bounds are already computed. + // TODO(ferhat): optimize by setting pathRef bounds if bounds are already computed. } /// If the `forceMoveTo` argument is false, adds a straight line @@ -1320,7 +1320,7 @@ class SurfacePath implements ui.Path { points[i] = transformedX; points[i + 1] = transformedY; } - // TODO: optimize for axis aligned or scale/translate type transforms. + // TODO(ferhat): optimize for axis aligned or scale/translate type transforms. _convexityType = SPathConvexityType.kUnknown; } diff --git a/lib/web_ui/lib/src/engine/html/path/path_metrics.dart b/lib/web_ui/lib/src/engine/html/path/path_metrics.dart index beb67f2803dec..7109391c98447 100644 --- a/lib/web_ui/lib/src/engine/html/path/path_metrics.dart +++ b/lib/web_ui/lib/src/engine/html/path/path_metrics.dart @@ -287,8 +287,7 @@ class _PathContourMeasure { double distance = 0.0; bool haveSeenMoveTo = false; - final Function lineToHandler = - (double fromX, double fromY, double x, double y) { + void lineToHandler(double fromX, double fromY, double x, double y) { final double dx = fromX - x; final double dy = fromY - y; final double prevDistance = distance; @@ -301,7 +300,8 @@ class _PathContourMeasure { _PathSegment(SPath.kLineVerb, distance, [fromX, fromY, x, y]), ); } - }; + } + int verb = 0; final Float32List points = Float32List(PathRefIterator.kMaxBufferSize); do { diff --git a/lib/web_ui/lib/src/engine/html/path/path_ref.dart b/lib/web_ui/lib/src/engine/html/path/path_ref.dart index e1f92415d14f3..14f14a3756a72 100644 --- a/lib/web_ui/lib/src/engine/html/path/path_ref.dart +++ b/lib/web_ui/lib/src/engine/html/path/path_ref.dart @@ -655,13 +655,13 @@ class PathRef { break; case SPath.kDoneVerb: if (assertionsEnabled) { - throw Exception("growForVerb called for kDone"); + throw Exception('growForVerb called for kDone'); } pCnt = 0; break; default: if (assertionsEnabled) { - throw Exception("default is not reached"); + throw Exception('default is not reached'); } pCnt = 0; break; @@ -722,13 +722,13 @@ class PathRef { break; case SPath.kDoneVerb: if (assertionsEnabled) { - throw Exception("growForVerb called for kDone"); + throw Exception('growForVerb called for kDone'); } pCnt = 0; break; default: if (assertionsEnabled) { - throw Exception("default is not reached"); + throw Exception('default is not reached'); } pCnt = 0; break; diff --git a/lib/web_ui/lib/src/engine/html/recording_canvas.dart b/lib/web_ui/lib/src/engine/html/recording_canvas.dart index 44177234bbf98..f0c731305d41c 100644 --- a/lib/web_ui/lib/src/engine/html/recording_canvas.dart +++ b/lib/web_ui/lib/src/engine/html/recording_canvas.dart @@ -549,7 +549,6 @@ class RecordingCanvas { void drawPicture(ui.Picture picture) { assert(!_recordingEnded); final EnginePicture enginePicture = picture as EnginePicture; - // TODO apply renderStrategy of picture recording to this recording. if (enginePicture.recordingCanvas == null) { // No contents / nothing to draw. return; @@ -1705,7 +1704,7 @@ class _PaintBounds { _currentClipRight = 0.0, _currentClipBottom = 0.0; - _PaintBounds(ui.Rect maxPaintBounds) : maxPaintBounds = maxPaintBounds; + _PaintBounds(this.maxPaintBounds); void translate(double dx, double dy) { if (dx != 0.0 || dy != 0.0) { diff --git a/lib/web_ui/lib/src/engine/html/shader_mask.dart b/lib/web_ui/lib/src/engine/html/shader_mask.dart index 29d00dc14d078..515bbdbe6a24b 100644 --- a/lib/web_ui/lib/src/engine/html/shader_mask.dart +++ b/lib/web_ui/lib/src/engine/html/shader_mask.dart @@ -102,7 +102,7 @@ class PersistedShaderMask extends PersistedContainerSurface } return; } - // TODO: Implement _applyImageShader(); + // TODO(ferhat): Implement _applyImageShader(); throw Exception('Shader type not supported for ShaderMask'); } diff --git a/lib/web_ui/lib/src/engine/html/shaders/shader.dart b/lib/web_ui/lib/src/engine/html/shaders/shader.dart index 22c20b823afa1..a8d0948641818 100644 --- a/lib/web_ui/lib/src/engine/html/shaders/shader.dart +++ b/lib/web_ui/lib/src/engine/html/shaders/shader.dart @@ -584,7 +584,7 @@ class GradientRadial extends EngineGradient { } } -/// TODO: Implement focal https://github.com/flutter/flutter/issues/76643. +// TODO(ferhat): Implement focal https://github.com/flutter/flutter/issues/76643. class GradientConical extends GradientRadial { GradientConical( this.focal, @@ -697,7 +697,7 @@ class _BlurEngineImageFilter extends EngineImageFilter { final double sigmaY; final ui.TileMode tileMode; - // TODO(flutter_web): implement TileMode. + // TODO(ferhat): implement TileMode. @override String get filterAttribute => blurSigmasToCssString(sigmaX, sigmaY); @@ -728,7 +728,7 @@ class _MatrixEngineImageFilter extends EngineImageFilter { final Float64List webMatrix; final ui.FilterQuality filterQuality; - // TODO(flutter_web): implement FilterQuality. + // TODO(yjbanov): implement FilterQuality. @override String get transformAttribute => float64ListToCssTransform(webMatrix); diff --git a/lib/web_ui/lib/src/engine/html/shaders/shader_builder.dart b/lib/web_ui/lib/src/engine/html/shaders/shader_builder.dart index b5c87dd348071..aa34f0191c341 100644 --- a/lib/web_ui/lib/src/engine/html/shaders/shader_builder.dart +++ b/lib/web_ui/lib/src/engine/html/shaders/shader_builder.dart @@ -293,9 +293,7 @@ class ShaderMethod { void write(StringBuffer buffer) { buffer.writeln('$returnType $name() {'); - for (final String statement in _statements) { - buffer.writeln(statement); - } + _statements.forEach(buffer.writeln); buffer.writeln('}'); } } diff --git a/lib/web_ui/lib/src/engine/keyboard_binding.dart b/lib/web_ui/lib/src/engine/keyboard_binding.dart index 8b74094900b80..c99094e3b42a0 100644 --- a/lib/web_ui/lib/src/engine/keyboard_binding.dart +++ b/lib/web_ui/lib/src/engine/keyboard_binding.dart @@ -110,14 +110,15 @@ class KeyboardBinding { final Map _listeners = {}; void _addEventListener(String eventName, html.EventListener handler) { - final html.EventListener loggedHandler = (html.Event event) { + html.EventListener? loggedHandler(html.Event event) { if (_debugLogKeyEvents) { print(event.type); } if (EngineSemanticsOwner.instance.receiveGlobalEvent(event)) { return handler(event); } - }; + } + assert(!_listeners.containsKey(eventName)); _listeners[eventName] = loggedHandler; html.window.addEventListener(eventName, loggedHandler, true); diff --git a/lib/web_ui/lib/src/engine/platform_dispatcher.dart b/lib/web_ui/lib/src/engine/platform_dispatcher.dart index e2c921a9c2580..1b7ae1537c4ff 100644 --- a/lib/web_ui/lib/src/engine/platform_dispatcher.dart +++ b/lib/web_ui/lib/src/engine/platform_dispatcher.dart @@ -422,7 +422,7 @@ class EnginePlatformDispatcher extends ui.PlatformDispatcher { return; case 'SystemChrome.setApplicationSwitcherDescription': final Map arguments = decoded.arguments; - // TODO: Find more appropriate defaults? Or noop when values are null? + // TODO(ferhat): Find more appropriate defaults? Or noop when values are null? final String label = arguments['label'] as String? ?? ''; final int primaryColor = arguments['primaryColor'] as int? ?? 0xFF000000; domRenderer.setTitle(label); diff --git a/lib/web_ui/lib/src/engine/platform_views/content_manager.dart b/lib/web_ui/lib/src/engine/platform_views/content_manager.dart index cc484a21f5db5..38c52ebdd8aa9 100644 --- a/lib/web_ui/lib/src/engine/platform_views/content_manager.dart +++ b/lib/web_ui/lib/src/engine/platform_views/content_manager.dart @@ -191,9 +191,7 @@ class PlatformViewManager { /// Returns the set of know view ids, so they can be cleaned up. Set debugClear() { final Set result = _contents.keys.toSet(); - for (final int viewId in result) { - clearPlatformView(viewId); - } + result.forEach(clearPlatformView); _factories.clear(); _contents.clear(); return result; diff --git a/lib/web_ui/lib/src/engine/platform_views/message_handler.dart b/lib/web_ui/lib/src/engine/platform_views/message_handler.dart index 94ef036249c4c..d823e58302dec 100644 --- a/lib/web_ui/lib/src/engine/platform_views/message_handler.dart +++ b/lib/web_ui/lib/src/engine/platform_views/message_handler.dart @@ -87,7 +87,7 @@ class PlatformViewMessageHandler { return; } - // TODO: How can users add extra `args` from the HtmlElementView widget? + // TODO(hterkelsen): How can users add extra `args` from the HtmlElementView widget? final html.Element content = _contentManager.renderContent( viewType, viewId, diff --git a/lib/web_ui/lib/src/engine/pointer_binding.dart b/lib/web_ui/lib/src/engine/pointer_binding.dart index 103e8f15aee4b..9f1d57694d9c6 100644 --- a/lib/web_ui/lib/src/engine/pointer_binding.dart +++ b/lib/web_ui/lib/src/engine/pointer_binding.dart @@ -204,9 +204,9 @@ abstract class _BaseAdapter { html.EventListener handler, { bool acceptOutsideGlasspane = false, }) { - final html.EventListener loggedHandler = (html.Event event) { + html.EventListener? loggedHandler(html.Event event) { if (!acceptOutsideGlasspane && !glassPaneElement.contains(event.target as html.Node?)) { - return; + return null; } if (_debugLogPointerEvents) { @@ -224,7 +224,7 @@ abstract class _BaseAdapter { if (EngineSemanticsOwner.instance.receiveGlobalEvent(event)) { handler(event); } - }; + } _listeners[eventName] = loggedHandler; // We have to attach the event listener on the window instead of the // glasspane element. That's because "up" events that occur outside the diff --git a/lib/web_ui/lib/src/engine/semantics/semantics.dart b/lib/web_ui/lib/src/engine/semantics/semantics.dart index 26d794b4df916..4e544c5fe1219 100644 --- a/lib/web_ui/lib/src/engine/semantics/semantics.dart +++ b/lib/web_ui/lib/src/engine/semantics/semantics.dart @@ -1328,6 +1328,7 @@ class EngineSemanticsOwner { /// The top-level DOM element of the semantics DOM element tree. html.Element? _rootSemanticsElement; + // ignore: prefer_function_declarations_over_variables TimestampFunction _now = () => DateTime.now(); void debugOverrideTimestampFunction(TimestampFunction value) { diff --git a/lib/web_ui/lib/src/engine/services/message_codecs.dart b/lib/web_ui/lib/src/engine/services/message_codecs.dart index 7a4b728065b0b..777386978c5ef 100644 --- a/lib/web_ui/lib/src/engine/services/message_codecs.dart +++ b/lib/web_ui/lib/src/engine/services/message_codecs.dart @@ -307,7 +307,7 @@ class StandardMessageCodec implements MessageCodec { buffer.putUint8(_valueNull); } else if (value is bool) { buffer.putUint8(value ? _valueTrue : _valueFalse); - // TODO(flutter_web): upstream double/int if/else swap. + // TODO(hterkelsen): upstream double/int if/else swap. } else if (value is double) { buffer.putUint8(_valueFloat64); buffer.putFloat64(value); diff --git a/lib/web_ui/lib/src/engine/text/font_collection.dart b/lib/web_ui/lib/src/engine/text/font_collection.dart index 8c26cfb9ed0e4..8a93fd1824044 100644 --- a/lib/web_ui/lib/src/engine/text/font_collection.dart +++ b/lib/web_ui/lib/src/engine/text/font_collection.dart @@ -116,11 +116,11 @@ class FontManager { // For example font family 'Ahem!' does not fall into this category // so the family name will be wrapped in quotes. static final RegExp notPunctuation = - RegExp(r"[a-z0-9\s]+", caseSensitive: false); + RegExp(r'[a-z0-9\s]+', caseSensitive: false); // Regular expression to detect tokens starting with a digit. // For example font family 'Goudy Bookletter 1911' falls into this // category. - static final RegExp startWithDigit = RegExp(r"\b\d"); + static final RegExp startWithDigit = RegExp(r'\b\d'); factory FontManager() { if (supportsFontLoadingApi) { diff --git a/lib/web_ui/lib/src/engine/text/layout_service.dart b/lib/web_ui/lib/src/engine/text/layout_service.dart index 57d39440e7dc5..6d3c374523d05 100644 --- a/lib/web_ui/lib/src/engine/text/layout_service.dart +++ b/lib/web_ui/lib/src/engine/text/layout_service.dart @@ -518,7 +518,7 @@ class PlaceholderBox extends RangeBox { /// Represents a box in a [FlatTextSpan]. class SpanBox extends RangeBox { SpanBox( - Spanometer spanometer, { + this.spanometer, { required LineBreakResult start, required LineBreakResult end, required double width, @@ -526,8 +526,7 @@ class SpanBox extends RangeBox { required ui.TextDirection boxDirection, required this.contentDirection, required this.isSpaceOnly, - }) : this.spanometer = spanometer, // ignore: unnecessary_this - span = spanometer.currentSpan, + }) : span = spanometer.currentSpan, height = spanometer.height, baseline = spanometer.ascent, super(start, end, width, paragraphDirection, boxDirection); diff --git a/lib/web_ui/lib/src/engine/text/measurement.dart b/lib/web_ui/lib/src/engine/text/measurement.dart index d6221d907e154..4ba8203592680 100644 --- a/lib/web_ui/lib/src/engine/text/measurement.dart +++ b/lib/web_ui/lib/src/engine/text/measurement.dart @@ -226,7 +226,7 @@ abstract class TextMeasurementService { /// Gets the appropriate [TextMeasurementService] instance for the given /// [paragraph]. static TextMeasurementService forParagraph(ui.Paragraph paragraph) { - // TODO(flutter_web): https://github.com/flutter/flutter/issues/33523 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/33523 // When the canvas-based implementation is complete and passes all the // tests, get rid of [_experimentalEnableCanvasImplementation]. // We need to check [window.physicalSize.isEmpty] because some canvas @@ -606,7 +606,7 @@ class CanvasTextMeasurementService extends TextMeasurementService { // string and that would mess things up. bool reachedEndOfText = false; - // TODO(flutter_web): Chrome & Safari return more info from [canvasContext.measureText]. + // TODO(mdebbar): Chrome & Safari return more info from [canvasContext.measureText]. int i = 0; while (!reachedEndOfText) { final LineBreakResult brk = nextLineBreak(text, i); @@ -671,7 +671,7 @@ class CanvasTextMeasurementService extends TextMeasurementService { @override ui.TextPosition getTextPositionForOffset(EngineParagraph paragraph, ui.ParagraphConstraints? constraints, ui.Offset offset) { - // TODO(flutter_web): implement. + // TODO(mdebbar): implement. return const ui.TextPosition(offset: 0); } } diff --git a/lib/web_ui/lib/src/engine/text/paragraph.dart b/lib/web_ui/lib/src/engine/text/paragraph.dart index 8f1f509130f44..edc02f009ecea 100644 --- a/lib/web_ui/lib/src/engine/text/paragraph.dart +++ b/lib/web_ui/lib/src/engine/text/paragraph.dart @@ -85,10 +85,9 @@ class EngineLineMetrics implements ui.LineMetrics { required this.descent, // Didn't use `this.boxes` because we want it to be non-null in this // constructor. - required List boxes, + required this.boxes, }) : displayText = null, - unscaledAscent = double.infinity, - this.boxes = boxes; // ignore: unnecessary_this + unscaledAscent = double.infinity; /// The text to be rendered on the screen representing this line. final String? displayText; @@ -508,7 +507,7 @@ class DomParagraph implements EngineParagraph { final ParagraphGeometricStyle style = _geometricStyle; - // TODO(flutter_web): https://github.com/flutter/flutter/issues/33223 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/33223 if (style.ellipsis != null && (style.maxLines == null || style.maxLines == 1)) { paragraphStyle @@ -831,7 +830,7 @@ class EngineParagraphStyle implements ui.ParagraphStyle { this.ellipsis, this.locale, }) : _textHeightBehavior = textHeightBehavior, - // TODO(b/128317744): add support for strut style. + // TODO(mdebbar): add support for strut style., b/128317744 _strutStyle = strutStyle as EngineStrutStyle?; final ui.TextAlign? textAlign; @@ -1240,7 +1239,7 @@ class DomParagraphBuilder implements ui.ParagraphBuilder { /// Creates a [DomParagraphBuilder] object, which is used to create a /// [DomParagraph]. DomParagraphBuilder(EngineParagraphStyle style) : _paragraphStyle = style { - // TODO(b/128317744): Implement support for strut font families. + // TODO(mdebbar): Implement support for strut font families, b/128317744 List strutFontFamilies; if (style._strutStyle != null) { strutFontFamilies = []; diff --git a/lib/web_ui/lib/src/engine/text/word_breaker.dart b/lib/web_ui/lib/src/engine/text/word_breaker.dart index d4610eb1e2199..603ff428a5999 100644 --- a/lib/web_ui/lib/src/engine/text/word_breaker.dart +++ b/lib/web_ui/lib/src/engine/text/word_breaker.dart @@ -89,7 +89,7 @@ abstract class WordBreaker { } // WB3c: ZWJ × \p{Extended_Pictographic} - // TODO(flutter_web): What's the right way to implement this? + // TODO(mdebbar): What's the right way to implement this? // Keep horizontal whitespace together. // WB3d: WSegSpace × WSegSpace diff --git a/lib/web_ui/lib/src/engine/text_editing/input_type.dart b/lib/web_ui/lib/src/engine/text_editing/input_type.dart index dd2dcb784edc6..23fb82d16f8ff 100644 --- a/lib/web_ui/lib/src/engine/text_editing/input_type.dart +++ b/lib/web_ui/lib/src/engine/text_editing/input_type.dart @@ -11,7 +11,7 @@ import '../browser_detection.dart'; /// These types are coming from Flutter's [TextInputType]. Currently, we don't /// support all the types. We fallback to [EngineInputType.text] when Flutter /// sends a type that isn't supported. -// TODO(flutter_web): Support more types. +// TODO(mdebbar): Support more types. abstract class EngineInputType { const EngineInputType(); diff --git a/lib/web_ui/lib/src/engine/text_editing/text_capitalization.dart b/lib/web_ui/lib/src/engine/text_editing/text_capitalization.dart index dd89eccb850d6..12d854ab80b2a 100644 --- a/lib/web_ui/lib/src/engine/text_editing/text_capitalization.dart +++ b/lib/web_ui/lib/src/engine/text_editing/text_capitalization.dart @@ -62,7 +62,7 @@ class TextCapitalizationConfig { String autocapitalize = ''; switch (textCapitalization) { case TextCapitalization.words: - // TODO: There is a bug for `words` level capitalization in IOS now. + // TODO(mdebbar): There is a bug for `words` level capitalization in IOS now. // For now go back to default. Remove the check after bug is resolved. // https://bugs.webkit.org/show_bug.cgi?id=148504 if (browserEngine == BrowserEngine.webkit) { diff --git a/lib/web_ui/lib/src/engine/text_editing/text_editing.dart b/lib/web_ui/lib/src/engine/text_editing/text_editing.dart index a5cb3e475ecbd..ae5971218c6bb 100644 --- a/lib/web_ui/lib/src/engine/text_editing/text_editing.dart +++ b/lib/web_ui/lib/src/engine/text_editing/text_editing.dart @@ -278,7 +278,7 @@ class EngineAutofillForm { final List> subscriptions = >[]; - final void Function(String key) addSubscriptionForKey = (String key) { + void addSubscriptionForKey(String key) { final html.Element element = elements![key]!; subscriptions.add( element.onInput.listen((html.Event e) { @@ -291,7 +291,7 @@ class EngineAutofillForm { } }) ); - }; + } keys.forEach(addSubscriptionForKey); return subscriptions; diff --git a/lib/web_ui/lib/src/engine/window.dart b/lib/web_ui/lib/src/engine/window.dart index 540ed1bc10943..0e5d6f9aa207a 100644 --- a/lib/web_ui/lib/src/engine/window.dart +++ b/lib/web_ui/lib/src/engine/window.dart @@ -332,7 +332,7 @@ typedef _JsSetUrlStrategy = void Function(JsUrlStrategy?); // Keep this js name in sync with flutter_web_plugins. Find it at: // https://github.com/flutter/flutter/blob/custom_location_strategy/packages/flutter_web_plugins/lib/src/navigation/js_url_strategy.dart // -// TODO: Add integration test https://github.com/flutter/flutter/issues/66852 +// TODO(mdebbar): Add integration test https://github.com/flutter/flutter/issues/66852 @JS('_flutter_web_set_location_strategy') external set jsSetUrlStrategy(_JsSetUrlStrategy? newJsSetUrlStrategy); diff --git a/lib/web_ui/lib/src/ui/geometry.dart b/lib/web_ui/lib/src/ui/geometry.dart index 4cd8e412c276d..06e4655b339a3 100644 --- a/lib/web_ui/lib/src/ui/geometry.dart +++ b/lib/web_ui/lib/src/ui/geometry.dart @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// See https://github.com/flutter/engine/blob/master/lib/ui/geometry.dart for +// documentation of APIs. +// ignore_for_file: public_member_api_docs part of ui; abstract class OffsetBase { diff --git a/lib/web_ui/lib/src/ui/painting.dart b/lib/web_ui/lib/src/ui/painting.dart index b1dce2e65e2cd..cf6c5928b97ad 100644 --- a/lib/web_ui/lib/src/ui/painting.dart +++ b/lib/web_ui/lib/src/ui/painting.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// For documentation see https://github.com/flutter/engine/blob/master/lib/ui/painting.dart +// ignore_for_file: public_member_api_docs part of ui; // ignore: unused_element, Used in Shader assert. @@ -399,7 +401,7 @@ class ImageFilter { if (engine.useCanvasKit) { return engine.CkImageFilter.blur(sigmaX: sigmaX, sigmaY: sigmaY, tileMode: tileMode); } - // TODO(flutter_web): implement TileMode. + // TODO(ferhat): implement TileMode. return engine.EngineImageFilter.blur(sigmaX: sigmaX, sigmaY: sigmaY, tileMode: tileMode); } @@ -409,11 +411,11 @@ class ImageFilter { if (engine.useCanvasKit) { return engine.CkImageFilter.matrix(matrix: matrix4, filterQuality: filterQuality); } - // TODO(flutter_web): implement FilterQuality. + // TODO(yjbanov): implement FilterQuality. return engine.EngineImageFilter.matrix(matrix: matrix4, filterQuality: filterQuality); } - // TODO(flutter_web): add implementation and remove the "ignore". + // TODO(ferhat): add implementation and remove the "ignore". // ignore: avoid_unused_constructor_parameters ImageFilter.compose({required ImageFilter outer, required ImageFilter inner}) { throw UnimplementedError( @@ -460,7 +462,7 @@ Future instantiateImageCodec( bool allowUpscaling = true, }) async { if (engine.useCanvasKit) { - // TODO: Implement targetWidth and targetHeight support. + // TODO(hterkelsen): Implement targetWidth and targetHeight support. return engine.skiaInstantiateImageCodec(list); } else { final html.Blob blob = html.Blob([list.buffer]); @@ -594,12 +596,13 @@ void decodeImageFromPixels( return; } - final void Function(Codec) callbacker = (Codec codec) { + void executeCallback(Codec codec) { codec.getNextFrame().then((FrameInfo frameInfo) { callback(frameInfo.image); }); - }; - _createBmp(pixels, width, height, rowBytes ?? width, format).then(callbacker); + } + _createBmp(pixels, width, height, rowBytes ?? width, format).then( + executeCallback); } diff --git a/lib/web_ui/lib/src/ui/path.dart b/lib/web_ui/lib/src/ui/path.dart index 4a358af62b341..0d9b7cc6a9fb9 100644 --- a/lib/web_ui/lib/src/ui/path.dart +++ b/lib/web_ui/lib/src/ui/path.dart @@ -4,6 +4,9 @@ part of ui; +// For documentation see https://github.com/flutter/engine/blob/master/lib/ui/painting.dart +// ignore_for_file: public_member_api_docs + abstract class Path { factory Path() { if (engine.useCanvasKit) { diff --git a/lib/web_ui/lib/src/ui/test_embedding.dart b/lib/web_ui/lib/src/ui/test_embedding.dart index 72ec5c7f44188..d8a6c2f8cf2b3 100644 --- a/lib/web_ui/lib/src/ui/test_embedding.dart +++ b/lib/web_ui/lib/src/ui/test_embedding.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// TODO(flutter_web): the Web-only API below need to be cleaned up. +// TODO(yjbanov): the Web-only API below need to be cleaned up. part of ui; diff --git a/lib/web_ui/lib/src/ui/window.dart b/lib/web_ui/lib/src/ui/window.dart index c5442f8a7182f..d875d50ff5dea 100644 --- a/lib/web_ui/lib/src/ui/window.dart +++ b/lib/web_ui/lib/src/ui/window.dart @@ -198,7 +198,7 @@ enum Brightness { } // Unimplemented classes. -// TODO(flutter_web): see https://github.com/flutter/flutter/issues/33614. +// TODO(dit): see https://github.com/flutter/flutter/issues/33614. class CallbackHandle { CallbackHandle.fromRawHandle(this._handle) : assert(_handle != null, "'_handle' must not be null."); // ignore: unnecessary_null_comparison @@ -215,7 +215,7 @@ class CallbackHandle { int get hashCode => super.hashCode; } -// TODO(flutter_web): see https://github.com/flutter/flutter/issues/33615. +// TODO(dit): see https://github.com/flutter/flutter/issues/33615. class PluginUtilities { // This class is only a namespace, and should not be instantiated or // extended directly. diff --git a/lib/web_ui/test/canvaskit/backdrop_filter_golden_test.dart b/lib/web_ui/test/canvaskit/backdrop_filter_golden_test.dart index 08dc4929be4a4..54acaa9c759bf 100644 --- a/lib/web_ui/test/canvaskit/backdrop_filter_golden_test.dart +++ b/lib/web_ui/test/canvaskit/backdrop_filter_golden_test.dart @@ -54,7 +54,7 @@ void testMain() { await matchGoldenFile('canvaskit_backdropfilter_blur_edges.png', region: region); }); - // TODO: https://github.com/flutter/flutter/issues/60040 - // TODO: https://github.com/flutter/flutter/issues/71520 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/71520 }, skip: isIosSafari || isFirefox); } diff --git a/lib/web_ui/test/canvaskit/canvas_golden_test.dart b/lib/web_ui/test/canvaskit/canvas_golden_test.dart index d4109c7c58e08..f61943f4d7f53 100644 --- a/lib/web_ui/test/canvaskit/canvas_golden_test.dart +++ b/lib/web_ui/test/canvaskit/canvas_golden_test.dart @@ -825,8 +825,8 @@ void testMain() { await matchGoldenFile('canvaskit_empty_scene.png', region: const ui.Rect.fromLTRB(0, 0, 100, 100)); }); - // TODO: https://github.com/flutter/flutter/issues/60040 - // TODO: https://github.com/flutter/flutter/issues/71520 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/71520 }, skip: isIosSafari || isFirefox); } diff --git a/lib/web_ui/test/canvaskit/canvaskit_api_test.dart b/lib/web_ui/test/canvaskit/canvaskit_api_test.dart index 826f5f5278519..55cda12acdf92 100644 --- a/lib/web_ui/test/canvaskit/canvaskit_api_test.dart +++ b/lib/web_ui/test/canvaskit/canvaskit_api_test.dart @@ -57,7 +57,7 @@ void testMain() { group('SkParagraph', () { _textStyleTests(); }); - // TODO: https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 }, skip: isIosSafari); } diff --git a/lib/web_ui/test/canvaskit/color_filter_golden_test.dart b/lib/web_ui/test/canvaskit/color_filter_golden_test.dart index 31bda23eda201..b52b1e660497f 100644 --- a/lib/web_ui/test/canvaskit/color_filter_golden_test.dart +++ b/lib/web_ui/test/canvaskit/color_filter_golden_test.dart @@ -71,7 +71,7 @@ void testMain() { await matchSceneGolden('canvaskit_colorfilter.png', builder.build()); }); - // TODO: https://github.com/flutter/flutter/issues/60040 - // TODO: https://github.com/flutter/flutter/issues/71520 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/71520 }, skip: isIosSafari || isFirefox); } diff --git a/lib/web_ui/test/canvaskit/common.dart b/lib/web_ui/test/canvaskit/common.dart index 2c7011f70bd61..7344557738483 100644 --- a/lib/web_ui/test/canvaskit/common.dart +++ b/lib/web_ui/test/canvaskit/common.dart @@ -11,7 +11,7 @@ import 'package:ui/ui.dart' as ui; bool get isSafari => browserEngine == BrowserEngine.webkit; /// Whether the current browser is Safari on iOS. -// TODO: https://github.com/flutter/flutter/issues/60040 +// TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 bool get isIosSafari => isSafari && operatingSystem == OperatingSystem.iOs; /// Whether the current browser is Firefox. diff --git a/lib/web_ui/test/canvaskit/embedded_views_test.dart b/lib/web_ui/test/canvaskit/embedded_views_test.dart index 025bc3c4693e5..a94bd8f31b458 100644 --- a/lib/web_ui/test/canvaskit/embedded_views_test.dart +++ b/lib/web_ui/test/canvaskit/embedded_views_test.dart @@ -448,7 +448,7 @@ void testMain() { renderTestScene(); expect(skPathDefs.childNodes, hasLength(1)); }); - // TODO: https://github.com/flutter/flutter/issues/60040 + // TODO(dit): https://github.com/flutter/flutter/issues/60040 }, skip: isIosSafari); } diff --git a/lib/web_ui/test/canvaskit/fallback_fonts_golden_test.dart b/lib/web_ui/test/canvaskit/fallback_fonts_golden_test.dart index 120eb00fe1f80..7cc2c57aa4fe2 100644 --- a/lib/web_ui/test/canvaskit/fallback_fonts_golden_test.dart +++ b/lib/web_ui/test/canvaskit/fallback_fonts_golden_test.dart @@ -102,8 +102,8 @@ void testMain() { await matchPictureGolden( 'canvaskit_font_fallback_arabic.png', recorder.endRecording()); - // TODO: https://github.com/flutter/flutter/issues/60040 - // TODO: https://github.com/flutter/flutter/issues/71520 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/71520 }, skip: isIosSafari || isFirefox); test('will put the Noto Emoji font before other fallback fonts in the list', @@ -209,8 +209,8 @@ void testMain() { await matchPictureGolden( 'canvaskit_font_fallback_emoji.png', recorder.endRecording()); - // TODO: https://github.com/flutter/flutter/issues/60040 - // TODO: https://github.com/flutter/flutter/issues/71520 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/71520 }, skip: isIosSafari || isFirefox); test('will gracefully fail if we cannot parse the Google Fonts CSS', @@ -364,7 +364,7 @@ void testMain() { } } }); - // TODO: https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 }, skip: isIosSafari); } diff --git a/lib/web_ui/test/canvaskit/filter_test.dart b/lib/web_ui/test/canvaskit/filter_test.dart index ad2634b66bc99..45c8866348e50 100644 --- a/lib/web_ui/test/canvaskit/filter_test.dart +++ b/lib/web_ui/test/canvaskit/filter_test.dart @@ -89,7 +89,7 @@ void testMain() { expect((paint.imageFilter! as ManagedSkiaObject).skiaObject, same(skiaFilter)); }); - // TODO: https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 }, skip: isIosSafari); group('MaskFilter', () { @@ -102,6 +102,6 @@ void testMain() { expect(() => paint.maskFilter = filter, isNot(throwsException)); }); - // TODO: https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 }, skip: isIosSafari); } diff --git a/lib/web_ui/test/canvaskit/frame_timings_test.dart b/lib/web_ui/test/canvaskit/frame_timings_test.dart index 83de99d0d2e84..f6910f4c74dd9 100644 --- a/lib/web_ui/test/canvaskit/frame_timings_test.dart +++ b/lib/web_ui/test/canvaskit/frame_timings_test.dart @@ -19,5 +19,5 @@ void testMain() { test('collects frame timings', () async { await runFrameTimingsTest(); }); - }, skip: isIosSafari); // TODO: https://github.com/flutter/flutter/issues/60040 + }, skip: isIosSafari); // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 } diff --git a/lib/web_ui/test/canvaskit/hot_restart_test.dart b/lib/web_ui/test/canvaskit/hot_restart_test.dart index e98a974f75b2b..d187fbb7a8284 100644 --- a/lib/web_ui/test/canvaskit/hot_restart_test.dart +++ b/lib/web_ui/test/canvaskit/hot_restart_test.dart @@ -35,6 +35,6 @@ void testMain() { // The instance is the same. expect(firstCanvasKitInstance, windowFlutterCanvasKit); }); - // TODO: https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 }, skip: isIosSafari); } diff --git a/lib/web_ui/test/canvaskit/image_test.dart b/lib/web_ui/test/canvaskit/image_test.dart index 8de15f2a20fc0..8d17b02e69bf3 100644 --- a/lib/web_ui/test/canvaskit/image_test.dart +++ b/lib/web_ui/test/canvaskit/image_test.dart @@ -252,7 +252,7 @@ void testMain() { ); } }); - // TODO: https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 }, skip: isIosSafari); } diff --git a/lib/web_ui/test/canvaskit/initialization_test.dart b/lib/web_ui/test/canvaskit/initialization_test.dart index 50792f1ae6610..49c614b07537f 100644 --- a/lib/web_ui/test/canvaskit/initialization_test.dart +++ b/lib/web_ui/test/canvaskit/initialization_test.dart @@ -24,6 +24,6 @@ void testMain() { 'canvaskit (requested explicitly)'); expect(html.document.body!.attributes['flt-build-mode'], 'debug'); }); - // TODO: https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 }, skip: isIosSafari); } diff --git a/lib/web_ui/test/canvaskit/layer_test.dart b/lib/web_ui/test/canvaskit/layer_test.dart index 245e098411cc9..dfc4f7ea73349 100644 --- a/lib/web_ui/test/canvaskit/layer_test.dart +++ b/lib/web_ui/test/canvaskit/layer_test.dart @@ -56,6 +56,6 @@ void testMain() { LayerSceneBuilder().addPicture(ui.Offset.zero, recorder.endRecording()); }); - // TODO: https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 }, skip: isIosSafari); } diff --git a/lib/web_ui/test/canvaskit/linear_gradient_golden_test.dart b/lib/web_ui/test/canvaskit/linear_gradient_golden_test.dart index 1551438d41fd4..352f8de8ffb7b 100644 --- a/lib/web_ui/test/canvaskit/linear_gradient_golden_test.dart +++ b/lib/web_ui/test/canvaskit/linear_gradient_golden_test.dart @@ -101,7 +101,7 @@ void testMain() { recorder.endRecording(), ); }); - // TODO: https://github.com/flutter/flutter/issues/60040 - // TODO: https://github.com/flutter/flutter/issues/71520 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/71520 }, skip: isIosSafari || isFirefox); } diff --git a/lib/web_ui/test/canvaskit/path_test.dart b/lib/web_ui/test/canvaskit/path_test.dart index d89bc6895c7aa..40f93595678ab 100644 --- a/lib/web_ui/test/canvaskit/path_test.dart +++ b/lib/web_ui/test/canvaskit/path_test.dart @@ -177,5 +177,5 @@ void testMain() { }); }, skip: - isIosSafari); // TODO: https://github.com/flutter/flutter/issues/60040 + isIosSafari); // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 } diff --git a/lib/web_ui/test/canvaskit/picture_test.dart b/lib/web_ui/test/canvaskit/picture_test.dart index 6db6f66c36da6..250618a79605b 100644 --- a/lib/web_ui/test/canvaskit/picture_test.dart +++ b/lib/web_ui/test/canvaskit/picture_test.dart @@ -64,6 +64,6 @@ void testMain() { expect(picture.resurrect(), isNotNull); }); }); - // TODO: https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 }, skip: isIosSafari); } diff --git a/lib/web_ui/test/canvaskit/platform_dispatcher_test.dart b/lib/web_ui/test/canvaskit/platform_dispatcher_test.dart index 3a6619a6b6e3d..e13eff9584f92 100644 --- a/lib/web_ui/test/canvaskit/platform_dispatcher_test.dart +++ b/lib/web_ui/test/canvaskit/platform_dispatcher_test.dart @@ -40,6 +40,6 @@ void testMain() { [true], ); }); - // TODO: https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 }, skip: isIosSafari); } diff --git a/lib/web_ui/test/canvaskit/scene_test.dart b/lib/web_ui/test/canvaskit/scene_test.dart index 1fe148cb997bf..70af8e7f74e0d 100644 --- a/lib/web_ui/test/canvaskit/scene_test.dart +++ b/lib/web_ui/test/canvaskit/scene_test.dart @@ -59,6 +59,6 @@ void testMain() { final ui.Scene scene = builder.build(); expect(scene, isNotNull); }); - // TODO: https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 }, skip: isIosSafari); } diff --git a/lib/web_ui/test/canvaskit/shader_mask_golden_test.dart b/lib/web_ui/test/canvaskit/shader_mask_golden_test.dart index 001e13630dafb..9d282ab1316a4 100644 --- a/lib/web_ui/test/canvaskit/shader_mask_golden_test.dart +++ b/lib/web_ui/test/canvaskit/shader_mask_golden_test.dart @@ -158,7 +158,7 @@ void testMain() { await matchSceneGolden('canvaskit_shadermask_linear_translated.png', builder.build()); }); - // TODO: https://github.com/flutter/flutter/issues/60040 - // TODO: https://github.com/flutter/flutter/issues/71520 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/71520 }, skip: isIosSafari || isFirefox); } diff --git a/lib/web_ui/test/canvaskit/shader_test.dart b/lib/web_ui/test/canvaskit/shader_test.dart index ebd9e8e68663d..2f44ed7e7a837 100644 --- a/lib/web_ui/test/canvaskit/shader_test.dart +++ b/lib/web_ui/test/canvaskit/shader_test.dart @@ -71,7 +71,7 @@ void testMain() { ) as CkImageShader; expect(imageShader, isA()); }); - // TODO: https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 }, skip: isIosSafari); } diff --git a/lib/web_ui/test/canvaskit/skia_font_collection_test.dart b/lib/web_ui/test/canvaskit/skia_font_collection_test.dart index 4523fe55ddd39..b69a778d1ebb7 100644 --- a/lib/web_ui/test/canvaskit/skia_font_collection_test.dart +++ b/lib/web_ui/test/canvaskit/skia_font_collection_test.dart @@ -72,6 +72,6 @@ void testMain() { ), ); }); - // TODO: https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 }, skip: isIosSafari); } diff --git a/lib/web_ui/test/canvaskit/skia_objects_cache_test.dart b/lib/web_ui/test/canvaskit/skia_objects_cache_test.dart index 47ed663792038..f1c092e5d55ee 100644 --- a/lib/web_ui/test/canvaskit/skia_objects_cache_test.dart +++ b/lib/web_ui/test/canvaskit/skia_objects_cache_test.dart @@ -19,7 +19,7 @@ void main() { void testMain() { group('skia_objects_cache', () { _tests(); - // TODO: https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 }, skip: isIosSafari); } diff --git a/lib/web_ui/test/canvaskit/surface_factory_test.dart b/lib/web_ui/test/canvaskit/surface_factory_test.dart index a25428f949d91..77b03269ad03e 100644 --- a/lib/web_ui/test/canvaskit/surface_factory_test.dart +++ b/lib/web_ui/test/canvaskit/surface_factory_test.dart @@ -76,6 +76,6 @@ void testMain() { expect(factory.isLive(surface), isFalse); }); - // TODO: https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 }, skip: isIosSafari); } diff --git a/lib/web_ui/test/canvaskit/sweep_gradient_golden_test.dart b/lib/web_ui/test/canvaskit/sweep_gradient_golden_test.dart index 210018016a07c..78e667dcfba96 100644 --- a/lib/web_ui/test/canvaskit/sweep_gradient_golden_test.dart +++ b/lib/web_ui/test/canvaskit/sweep_gradient_golden_test.dart @@ -68,7 +68,7 @@ void testMain() { recorder.endRecording(), ); }); - // TODO: https://github.com/flutter/flutter/issues/60040 - // TODO: https://github.com/flutter/flutter/issues/71520 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/71520 }, skip: isIosSafari || isFirefox); } diff --git a/lib/web_ui/test/canvaskit/text_test.dart b/lib/web_ui/test/canvaskit/text_test.dart index 11b6b4cb1d9e2..fabf17ed222b2 100644 --- a/lib/web_ui/test/canvaskit/text_test.dart +++ b/lib/web_ui/test/canvaskit/text_test.dart @@ -53,6 +53,6 @@ void testMain() { expect(paragraph, isNotNull); } }); - // TODO: https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 }, skip: isIosSafari); } diff --git a/lib/web_ui/test/canvaskit/vertices_test.dart b/lib/web_ui/test/canvaskit/vertices_test.dart index 6182dffff809a..89f1d387e4e51 100644 --- a/lib/web_ui/test/canvaskit/vertices_test.dart +++ b/lib/web_ui/test/canvaskit/vertices_test.dart @@ -32,7 +32,7 @@ void testMain() { ); vertices.delete(); }); - // TODO: https://github.com/flutter/flutter/issues/60040 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040 }, skip: isIosSafari); } diff --git a/lib/web_ui/test/channel_buffers_test.dart b/lib/web_ui/test/channel_buffers_test.dart index 2e04c1b3dae05..efede2f1f31ae 100644 --- a/lib/web_ui/test/channel_buffers_test.dart +++ b/lib/web_ui/test/channel_buffers_test.dart @@ -37,9 +37,9 @@ void testMain() { final ByteData data = _makeByteData('bar'); final ui.ChannelBuffers buffers = ui.ChannelBuffers(); bool called = false; - final ui.PlatformMessageResponseCallback callback = (ByteData? responseData) { + void callback(ByteData? responseData) { called = true; - }; + } buffers.push(channel, data, callback); await buffers.drain(channel, (ByteData? drainedData, ui.PlatformMessageResponseCallback drainedCallback) { expect(drainedData, equals(data)); @@ -54,7 +54,7 @@ void testMain() { const String channel = 'foo'; final ByteData data = _makeByteData('message'); final ui.ChannelBuffers buffers = ui.ChannelBuffers(); - final ui.PlatformMessageResponseCallback callback = (ByteData? responseData) {}; + void callback(ByteData? responseData) {} buffers.push(channel, data, callback); final List log = []; final Completer completer = Completer(); @@ -81,7 +81,7 @@ void testMain() { final ByteData data = _makeByteData('bar'); final ui.ChannelBuffers buffers = ui.ChannelBuffers(); - final ui.PlatformMessageResponseCallback callback = (ByteData? responseData) {}; + void callback(ByteData? responseData) {} _resize(buffers, channel, 0); buffers.push(channel, data, callback); bool didCall = false; @@ -110,7 +110,7 @@ void testMain() { final ByteData three = _makeByteData('three'); final ByteData four = _makeByteData('four'); final ui.ChannelBuffers buffers = ui.ChannelBuffers(); - final ui.PlatformMessageResponseCallback callback = (ByteData? responseData) {}; + void callback(ByteData? responseData) {} _resize(buffers, channel, 3); buffers.push(channel, one, callback); buffers.push(channel, two, callback); @@ -141,7 +141,7 @@ void testMain() { final ByteData two = _makeByteData('two'); final ui.ChannelBuffers buffers = ui.ChannelBuffers(); _resize(buffers, channel, 100); - final ui.PlatformMessageResponseCallback callback = (ByteData? responseData) {}; + void callback(ByteData? responseData) {} buffers.push(channel, one, callback); buffers.push(channel, two, callback); _resize(buffers, channel, 1); @@ -163,13 +163,13 @@ void testMain() { final ByteData two = _makeByteData('two'); final ui.ChannelBuffers buffers = ui.ChannelBuffers(); bool didCallCallback = false; - final ui.PlatformMessageResponseCallback oneCallback = (ByteData? responseData) { + void oneCallback(ByteData? responseData) { expect(responseData, isNull); didCallCallback = true; - }; - final ui.PlatformMessageResponseCallback twoCallback = (ByteData? responseData) { + } + void twoCallback(ByteData? responseData) { throw TestFailure('wrong callback called'); - }; + } _resize(buffers, channel, 100); buffers.push(channel, one, oneCallback); buffers.push(channel, two, twoCallback); @@ -184,13 +184,13 @@ void testMain() { final ByteData two = _makeByteData('two'); final ui.ChannelBuffers buffers = ui.ChannelBuffers(); bool didCallCallback = false; - final ui.PlatformMessageResponseCallback oneCallback = (ByteData? responseData) { + void oneCallback(ByteData? responseData) { expect(responseData, isNull); didCallCallback = true; - }; - final ui.PlatformMessageResponseCallback twoCallback = (ByteData? responseData) { + } + void twoCallback(ByteData? responseData) { throw TestFailure('wrong callback called'); - }; + } _resize(buffers, channel, 1); buffers.push(channel, one, oneCallback); buffers.push(channel, two, twoCallback); diff --git a/lib/web_ui/test/clipboard_test.dart b/lib/web_ui/test/clipboard_test.dart index 2dcd505742004..9746400b60186 100644 --- a/lib/web_ui/test/clipboard_test.dart +++ b/lib/web_ui/test/clipboard_test.dart @@ -39,9 +39,9 @@ Future testMain() async { clipboardAPICopyStrategy.testResult = true; const MethodCodec codec = JSONMethodCodec(); final Completer completer = Completer(); - final ui.PlatformMessageResponseCallback callback = (ByteData? data) { + void callback(ByteData? data) { completer.complete(codec.decodeEnvelope(data!)); - }; + } clipboardMessageHandler.setDataMethodCall( const MethodCall('Clipboard.setData', { @@ -56,9 +56,9 @@ Future testMain() async { clipboardAPICopyStrategy.testResult = false; const MethodCodec codec = JSONMethodCodec(); final Completer completer = Completer(); - final ui.PlatformMessageResponseCallback callback = (ByteData? data) { + void callback(ByteData? data) { completer.complete(data!); - }; + } clipboardMessageHandler.setDataMethodCall( const MethodCall('Clipboard.setData', { @@ -77,9 +77,9 @@ Future testMain() async { clipboardAPIPasteStrategy.testResult = testText; const MethodCodec codec = JSONMethodCodec(); final Completer> completer = Completer>(); - final ui.PlatformMessageResponseCallback callback = (ByteData? data) { + void callback(ByteData? data) { completer.complete(codec.decodeEnvelope(data!)); - }; + } clipboardMessageHandler.getDataMethodCall(callback); diff --git a/lib/web_ui/test/dom_renderer_test.dart b/lib/web_ui/test/dom_renderer_test.dart index d278f282ad152..bc6fadb521501 100644 --- a/lib/web_ui/test/dom_renderer_test.dart +++ b/lib/web_ui/test/dom_renderer_test.dart @@ -118,8 +118,8 @@ void testMain() { final DomRenderer renderer = DomRenderer(); renderer.reset(); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/46638 - // TODO(nurhan): https://github.com/flutter/flutter/issues/50828 + // TODO(ferhat): https://github.com/flutter/flutter/issues/46638 + // TODO(ferhat): https://github.com/flutter/flutter/issues/50828 skip: browserEngine == BrowserEngine.firefox || browserEngine == BrowserEngine.edge); diff --git a/lib/web_ui/test/engine/history_test.dart b/lib/web_ui/test/engine/history_test.dart index 531e8bd19c803..08b2aed6ad856 100644 --- a/lib/web_ui/test/engine/history_test.dart +++ b/lib/web_ui/test/engine/history_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. @TestOn('!safari') -// TODO(nurhan): https://github.com/flutter/flutter/issues/51169 +// TODO(mdebbar): https://github.com/flutter/flutter/issues/51169 import 'dart:async'; import 'dart:html' as html; @@ -74,7 +74,7 @@ void testMain() { // The flutter entry is the current entry. expect(strategy.currentEntry, flutterEntry); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50836 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50836 skip: browserEngine == BrowserEngine.edge); test('browser back button pops routes correctly', () async { @@ -111,7 +111,7 @@ void testMain() { expect(strategy.currentEntry.state, flutterState); expect(strategy.currentEntry.url, '/home'); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50836 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50836 skip: browserEngine == BrowserEngine.edge); test('multiple browser back clicks', () async { @@ -179,7 +179,7 @@ void testMain() { // navigated past it. expect(originalStrategy.currentEntryIndex, -1); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50836 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50836 skip: browserEngine == BrowserEngine.edge || browserEngine == BrowserEngine.webkit); @@ -223,7 +223,7 @@ void testMain() { expect(strategy.currentEntry.state, flutterState); expect(strategy.currentEntry.url, '/home'); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50836 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50836 skip: browserEngine == BrowserEngine.edge); test('user types unknown url', () async { @@ -249,7 +249,7 @@ void testMain() { expect(strategy.currentEntry.state, flutterState); expect(strategy.currentEntry.url, '/home'); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50836 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50836 skip: browserEngine == BrowserEngine.edge); }); @@ -279,7 +279,7 @@ void testMain() { expect(taggedOriginEntry.state, _tagStateWithSerialCount('initial state', 0)); expect(taggedOriginEntry.url, '/initial'); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50836 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50836 skip: browserEngine == BrowserEngine.edge); test('browser back button push route information correctly', () async { @@ -320,7 +320,7 @@ void testMain() { expect(strategy.currentEntry.state, _tagStateWithSerialCount('initial state', 0)); expect(strategy.currentEntry.url, '/home'); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50836 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50836 skip: browserEngine == BrowserEngine.edge); test('multiple browser back clicks', () async { @@ -371,7 +371,7 @@ void testMain() { expect(strategy.currentEntry.state, _tagStateWithSerialCount('initial state', 0)); expect(strategy.currentEntry.url, '/home'); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50836 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50836 skip: browserEngine == BrowserEngine.edge || browserEngine == BrowserEngine.webkit); @@ -417,7 +417,7 @@ void testMain() { expect(strategy.currentEntry.state, _tagStateWithSerialCount('initial state', 0)); expect(strategy.currentEntry.url, '/home'); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50836 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50836 skip: browserEngine == BrowserEngine.edge); test('forward button works', () async { @@ -469,7 +469,7 @@ void testMain() { expect(strategy.currentEntry.state, _tagStateWithSerialCount('page2 state', 2)); expect(strategy.currentEntry.url, '/page2'); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50836 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50836 skip: browserEngine == BrowserEngine.edge); }); diff --git a/lib/web_ui/test/engine/pointer_binding_test.dart b/lib/web_ui/test/engine/pointer_binding_test.dart index a8e27fe9ec6de..31559b1c6f34e 100644 --- a/lib/web_ui/test/engine/pointer_binding_test.dart +++ b/lib/web_ui/test/engine/pointer_binding_test.dart @@ -37,7 +37,7 @@ void _testEach( } /// Some methods in this class are skipped for iOS-Safari. -/// TODO: https://github.com/flutter/flutter/issues/60033 +// TODO(mdebbar): https://github.com/flutter/flutter/issues/60033 bool get isIosSafari => browserEngine == BrowserEngine.webkit && operatingSystem == OperatingSystem.iOs; diff --git a/lib/web_ui/test/engine/semantics/semantics_test.dart b/lib/web_ui/test/engine/semantics/semantics_test.dart index dcea8ce9f467b..3af88c138d637 100644 --- a/lib/web_ui/test/engine/semantics/semantics_test.dart +++ b/lib/web_ui/test/engine/semantics/semantics_test.dart @@ -880,7 +880,7 @@ void _testIncrementables() { semantics().semanticsEnabled = false; }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50754 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50754 skip: browserEngine == BrowserEngine.edge); test('renders a node that can both increment and decrement', () async { @@ -911,7 +911,7 @@ void _testIncrementables() { semantics().semanticsEnabled = false; }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50754 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50754 skip: browserEngine == BrowserEngine.edge); } @@ -940,7 +940,7 @@ void _testTextField() { semantics().semanticsEnabled = false; }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50754 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50754 skip: browserEngine == BrowserEngine.edge); // TODO(yjbanov): this test will need to be adjusted for Safari when we add @@ -976,9 +976,9 @@ void _testTextField() { expect(await logger.actionLog.first, ui.SemanticsAction.tap); semantics().semanticsEnabled = false; - }, // TODO(nurhan): https://github.com/flutter/flutter/issues/46638 - // TODO(nurhan): https://github.com/flutter/flutter/issues/50590 - // TODO(nurhan): https://github.com/flutter/flutter/issues/50754 + }, // TODO(yjbanov): https://github.com/flutter/flutter/issues/46638 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50590 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50754 skip: browserEngine != BrowserEngine.blink); } @@ -1009,7 +1009,7 @@ void _testCheckables() { semantics().semanticsEnabled = false; }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50754 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50754 skip: browserEngine == BrowserEngine.edge); test('renders a switched on disabled switch element', () async { @@ -1037,7 +1037,7 @@ void _testCheckables() { semantics().semanticsEnabled = false; }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50754 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50754 skip: browserEngine == BrowserEngine.edge); test('renders a switched off switch element', () async { @@ -1065,7 +1065,7 @@ void _testCheckables() { semantics().semanticsEnabled = false; }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50754 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50754 skip: browserEngine == BrowserEngine.edge); test('renders a checked checkbox', () async { @@ -1094,7 +1094,7 @@ void _testCheckables() { semantics().semanticsEnabled = false; }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50754 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50754 skip: browserEngine == BrowserEngine.edge); test('renders a checked disabled checkbox', () async { @@ -1122,7 +1122,7 @@ void _testCheckables() { semantics().semanticsEnabled = false; }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50754 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50754 skip: browserEngine == BrowserEngine.edge); test('renders an unchecked checkbox', () async { @@ -1150,7 +1150,7 @@ void _testCheckables() { semantics().semanticsEnabled = false; }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50754 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50754 skip: browserEngine == BrowserEngine.edge); test('renders a checked radio button', () async { @@ -1180,7 +1180,7 @@ void _testCheckables() { semantics().semanticsEnabled = false; }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50754 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50754 skip: browserEngine == BrowserEngine.edge); test('renders a checked disabled radio button', () async { @@ -1209,7 +1209,7 @@ void _testCheckables() { semantics().semanticsEnabled = false; }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50754 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50754 skip: browserEngine == BrowserEngine.edge); test('renders an unchecked checkbox', () async { @@ -1238,7 +1238,7 @@ void _testCheckables() { semantics().semanticsEnabled = false; }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50754 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50754 skip: browserEngine == BrowserEngine.edge); } @@ -1267,7 +1267,7 @@ void _testTappable() { semantics().semanticsEnabled = false; }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50754 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50754 skip: browserEngine == BrowserEngine.edge); test('renders a disabled tappable widget', () async { @@ -1294,7 +1294,7 @@ void _testTappable() { semantics().semanticsEnabled = false; }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50754 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50754 skip: browserEngine == BrowserEngine.edge); } @@ -1322,7 +1322,7 @@ void _testImage() { semantics().semanticsEnabled = false; }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50754 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50754 skip: browserEngine == BrowserEngine.edge); test('renders an image with a child node and with a label', () async { @@ -1355,7 +1355,7 @@ void _testImage() { semantics().semanticsEnabled = false; }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50754 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50754 skip: browserEngine == BrowserEngine.edge); test('renders an image with no child nodes without a label', () async { @@ -1379,7 +1379,7 @@ void _testImage() { semantics().semanticsEnabled = false; }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50754 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50754 skip: browserEngine == BrowserEngine.edge); test('renders an image with a child node and without a label', () async { @@ -1411,7 +1411,7 @@ void _testImage() { semantics().semanticsEnabled = false; }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50754 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50754 skip: browserEngine == BrowserEngine.edge); } @@ -1439,7 +1439,7 @@ void _testLiveRegion() { semantics().semanticsEnabled = false; }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50754 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50754 skip: browserEngine == BrowserEngine.edge); test('does not render a live region if there is no label', () async { diff --git a/lib/web_ui/test/engine/semantics/text_field_test.dart b/lib/web_ui/test/engine/semantics/text_field_test.dart index 3b2366c6b2063..018969d7864a1 100644 --- a/lib/web_ui/test/engine/semantics/text_field_test.dart +++ b/lib/web_ui/test/engine/semantics/text_field_test.dart @@ -87,9 +87,9 @@ void testMain() { expect(await logger.actionLog.first, ui.SemanticsAction.tap); semantics().semanticsEnabled = false; - }, // TODO(nurhan): https://github.com/flutter/flutter/issues/46638 - // TODO(nurhan): https://github.com/flutter/flutter/issues/50590 - // TODO(nurhan): https://github.com/flutter/flutter/issues/50754 + }, // TODO(yjbanov): https://github.com/flutter/flutter/issues/46638 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50590 + // TODO(yjbanov): https://github.com/flutter/flutter/issues/50754 skip: browserEngine != BrowserEngine.blink); test('Syncs editing state from framework', () async { @@ -405,7 +405,7 @@ void testMain() { semantics().semanticsEnabled = false; }); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50769 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50769 skip: browserEngine == BrowserEngine.edge); } diff --git a/lib/web_ui/test/engine/surface/scene_builder_test.dart b/lib/web_ui/test/engine/surface/scene_builder_test.dart index 77c89f9df5e41..c1e512dbf5610 100644 --- a/lib/web_ui/test/engine/surface/scene_builder_test.dart +++ b/lib/web_ui/test/engine/surface/scene_builder_test.dart @@ -188,7 +188,7 @@ void testMain() { expect(picture.buildCount, 1); expect(picture.updateCount, 0); expect(picture.applyPaintCount, 2); - }, // TODO(nurhan): https://github.com/flutter/flutter/issues/46638 + }, // TODO(yjbanov): https://github.com/flutter/flutter/issues/46638 skip: browserEngine == BrowserEngine.firefox); }); diff --git a/lib/web_ui/test/engine/surface/surface_test.dart b/lib/web_ui/test/engine/surface/surface_test.dart index aab307ed5d259..90911fdb23109 100644 --- a/lib/web_ui/test/engine/surface/surface_test.dart +++ b/lib/web_ui/test/engine/surface/surface_test.dart @@ -202,7 +202,7 @@ void testMain() { expect(elementB.parent, null); }, // This method failed on iOS Safari. - // TODO: https://github.com/flutter/flutter/issues/60036 + // TODO(ferhat): https://github.com/flutter/flutter/issues/60036 skip: browserEngine == BrowserEngine.webkit && operatingSystem == OperatingSystem.iOs); diff --git a/lib/web_ui/test/engine/window_test.dart b/lib/web_ui/test/engine/window_test.dart index dc7358ca2076c..8fa9850d36aff 100644 --- a/lib/web_ui/test/engine/window_test.dart +++ b/lib/web_ui/test/engine/window_test.dart @@ -24,9 +24,9 @@ void testMain() { final Zone innerZone = Zone.current.fork(); innerZone.runGuarded(() { - final ui.VoidCallback callback = () { + void callback() { expect(Zone.current, innerZone); - }; + } window.onTextScaleFactorChanged = callback; // Test that the getter returns the exact same callback, e.g. it doesn't wrap it. @@ -40,9 +40,9 @@ void testMain() { final Zone innerZone = Zone.current.fork(); innerZone.runGuarded(() { - final ui.VoidCallback callback = () { + void callback() { expect(Zone.current, innerZone); - }; + } window.onPlatformBrightnessChanged = callback; // Test that the getter returns the exact same callback, e.g. it doesn't wrap it. @@ -56,9 +56,9 @@ void testMain() { final Zone innerZone = Zone.current.fork(); innerZone.runGuarded(() { - final ui.VoidCallback callback = () { + void callback() { expect(Zone.current, innerZone); - }; + } window.onMetricsChanged = callback; // Test that the getter returns the exact same callback, e.g. it doesn't wrap it. @@ -72,9 +72,9 @@ void testMain() { final Zone innerZone = Zone.current.fork(); innerZone.runGuarded(() { - final ui.VoidCallback callback = () { + void callback() { expect(Zone.current, innerZone); - }; + } window.onLocaleChanged = callback; // Test that the getter returns the exact same callback, e.g. it doesn't wrap it. @@ -88,9 +88,9 @@ void testMain() { final Zone innerZone = Zone.current.fork(); innerZone.runGuarded(() { - final ui.FrameCallback callback = (_) { + void callback(Duration _) { expect(Zone.current, innerZone); - }; + } window.onBeginFrame = callback; // Test that the getter returns the exact same callback, e.g. it doesn't wrap it. @@ -104,9 +104,9 @@ void testMain() { final Zone innerZone = Zone.current.fork(); innerZone.runGuarded(() { - final ui.TimingsCallback callback = (_) { + void callback(List _) { expect(Zone.current, innerZone); - }; + } window.onReportTimings = callback; // Test that the getter returns the exact same callback, e.g. it doesn't wrap it. @@ -120,9 +120,9 @@ void testMain() { final Zone innerZone = Zone.current.fork(); innerZone.runGuarded(() { - final ui.VoidCallback callback = () { + void callback() { expect(Zone.current, innerZone); - }; + } window.onDrawFrame = callback; // Test that the getter returns the exact same callback, e.g. it doesn't wrap it. @@ -136,9 +136,9 @@ void testMain() { final Zone innerZone = Zone.current.fork(); innerZone.runGuarded(() { - final ui.PointerDataPacketCallback callback = (_) { + void callback(ui.PointerDataPacket _) { expect(Zone.current, innerZone); - }; + } window.onPointerDataPacket = callback; // Test that the getter returns the exact same callback, e.g. it doesn't wrap it. @@ -168,10 +168,10 @@ void testMain() { final Zone innerZone = Zone.current.fork(); innerZone.runGuarded(() { - final ui.KeyDataCallback onKeyData = (_) { + bool onKeyData(ui.KeyData _) { expect(Zone.current, innerZone); return false; - }; + } window.onKeyData = onKeyData; // Test that the getter returns the exact same onKeyData, e.g. it doesn't @@ -198,9 +198,9 @@ void testMain() { final Zone innerZone = Zone.current.fork(); innerZone.runGuarded(() { - final ui.VoidCallback callback = () { + void callback() { expect(Zone.current, innerZone); - }; + } window.onSemanticsEnabledChanged = callback; // Test that the getter returns the exact same callback, e.g. it doesn't wrap it. @@ -214,9 +214,9 @@ void testMain() { final Zone innerZone = Zone.current.fork(); innerZone.runGuarded(() { - final ui.SemanticsActionCallback callback = (_, __, ___) { + void callback(int _, ui.SemanticsAction __, ByteData? ___) { expect(Zone.current, innerZone); - }; + } window.onSemanticsAction = callback; // Test that the getter returns the exact same callback, e.g. it doesn't wrap it. @@ -230,9 +230,9 @@ void testMain() { final Zone innerZone = Zone.current.fork(); innerZone.runGuarded(() { - final ui.VoidCallback callback = () { + void callback() { expect(Zone.current, innerZone); - }; + } window.onAccessibilityFeaturesChanged = callback; // Test that the getter returns the exact same callback, e.g. it doesn't wrap it. @@ -246,9 +246,9 @@ void testMain() { final Zone innerZone = Zone.current.fork(); innerZone.runGuarded(() { - final ui.PlatformMessageCallback callback = (_, __, ___) { + void callback(String _, ByteData? __, void Function(ByteData?)? ___) { expect(Zone.current, innerZone); - }; + } window.onPlatformMessage = callback; // Test that the getter returns the exact same callback, e.g. it doesn't wrap it. diff --git a/lib/web_ui/test/golden_tests/golden_success_smoke_test.dart b/lib/web_ui/test/golden_tests/golden_success_smoke_test.dart index 545aba32d96a3..b6ce8db86e82b 100644 --- a/lib/web_ui/test/golden_tests/golden_success_smoke_test.dart +++ b/lib/web_ui/test/golden_tests/golden_success_smoke_test.dart @@ -21,7 +21,7 @@ Future testMain() async { test('screenshot test reports success', () async { html.document.body!.style.fontFamily = 'Roboto'; html.document.body!.innerHtml = 'Hello world!'; - // TODO: https://github.com/flutter/flutter/issues/74702 , reduce webkit percentage. + // TODO(yjbanov): https://github.com/flutter/flutter/issues/74702 , reduce webkit percentage. await matchGoldenFile('__local__/smoke_test.png', region: const Rect.fromLTWH(0, 0, 320, 200), maxDiffRatePercent: browserEngine == BrowserEngine.webkit ? 3.0 : 0.28); }); diff --git a/lib/web_ui/test/html/compositing/color_filter_golden_test.dart b/lib/web_ui/test/html/compositing/color_filter_golden_test.dart index 4b7f3802f5c51..28dfd443bb5b6 100644 --- a/lib/web_ui/test/html/compositing/color_filter_golden_test.dart +++ b/lib/web_ui/test/html/compositing/color_filter_golden_test.dart @@ -42,7 +42,7 @@ Future testMain() async { builder.pop(); html.document.body!.append(builder.build().webOnlyRootElement!); - // TODO: update golden for this test after canvas sandwich detection is + // TODO(ferhat): update golden for this test after canvas sandwich detection is // added to RecordingCanvas. await matchGoldenFile('color_filter_blendMode_color.png', region: region, maxDiffRatePercent: 12.0); diff --git a/lib/web_ui/test/html/compositing/compositing_golden_test.dart b/lib/web_ui/test/html/compositing/compositing_golden_test.dart index 70939054c4400..4c2e11ec40cca 100644 --- a/lib/web_ui/test/html/compositing/compositing_golden_test.dart +++ b/lib/web_ui/test/html/compositing/compositing_golden_test.dart @@ -789,7 +789,7 @@ void _testCullRectComputation() { // ignore: unused_local_variable final PersistedPicture picture = enumeratePictures().single; - // TODO(https://github.com/flutter/flutter/issues/40395): + // TODO(yjbanov): https://github.com/flutter/flutter/issues/40395) // Needs ability to set iframe to 500,100 size. Current screen seems to be 500,500. // expect( // picture.optimalLocalCullRect, diff --git a/lib/web_ui/test/html/drawing/canvas_draw_color_golden_test.dart b/lib/web_ui/test/html/drawing/canvas_draw_color_golden_test.dart index e304a415950af..012930f118263 100644 --- a/lib/web_ui/test/html/drawing/canvas_draw_color_golden_test.dart +++ b/lib/web_ui/test/html/drawing/canvas_draw_color_golden_test.dart @@ -37,7 +37,7 @@ Future testMain() async { final Picture testPicture = _drawTestPicture(region, useColor: true); builder.addPicture(Offset.zero, testPicture); await sceneScreenshot(builder, 'canvas_draw_color', region: region); - }, skip: true); // TODO: matchGolden fails when a div covers viewport. + }, skip: true); // TODO(ferhat): matchGolden fails when a div covers viewport. test('drawPaint should cover entire viewport', () async { const Rect region = Rect.fromLTWH(0, 0, 400, 400); @@ -46,7 +46,7 @@ Future testMain() async { final Picture testPicture = _drawTestPicture(region, useColor: false); builder.addPicture(Offset.zero, testPicture); await sceneScreenshot(builder, 'canvas_draw_paint', region: region); - }, skip: true); // TODO: matchGolden fails when a div covers viewport.); + }, skip: true); // TODO(ferhat): matchGolden fails when a div covers viewport.); } Picture _drawTestPicture(Rect region, {bool useColor = false}) { diff --git a/lib/web_ui/test/html/paragraph/text_multiline_clipping_golden_test.dart b/lib/web_ui/test/html/paragraph/text_multiline_clipping_golden_test.dart index 2aa3bb6b332b6..d1f6fe26f0e22 100644 --- a/lib/web_ui/test/html/paragraph/text_multiline_clipping_golden_test.dart +++ b/lib/web_ui/test/html/paragraph/text_multiline_clipping_golden_test.dart @@ -89,7 +89,7 @@ Future testMain() async { (EngineCanvas canvas) { // [DomCanvas] doesn't support clip commands. if (canvas is! DomCanvas) { - // TODO(flutter_web): https://github.com/flutter/flutter/issues/35086 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/35086 // This produces the wrong result when using [BitmapCanvas] but without // the new experimental canvas mode. paintTest(canvas, paintTextWithClipStack); diff --git a/lib/web_ui/test/html/paragraph/text_placeholders_golden_test.dart b/lib/web_ui/test/html/paragraph/text_placeholders_golden_test.dart index 3ea6514c306cf..5ab09652e51ab 100644 --- a/lib/web_ui/test/html/paragraph/text_placeholders_golden_test.dart +++ b/lib/web_ui/test/html/paragraph/text_placeholders_golden_test.dart @@ -15,7 +15,7 @@ void main() { } /// Whether we are running on iOS Safari. -// TODO: https://github.com/flutter/flutter/issues/66656 +// TODO(mdebbar): https://github.com/flutter/flutter/issues/66656 bool get isIosSafari => browserEngine == BrowserEngine.webkit && operatingSystem == OperatingSystem.iOs; diff --git a/lib/web_ui/test/html/recording_canvas_golden_test.dart b/lib/web_ui/test/html/recording_canvas_golden_test.dart index 9e33a58eaf068..649c7cda70375 100644 --- a/lib/web_ui/test/html/recording_canvas_golden_test.dart +++ b/lib/web_ui/test/html/recording_canvas_golden_test.dart @@ -313,7 +313,7 @@ Future testMain() async { const Rect.fromLTRB(textLeft, textTop, textLeft + widthConstraint, 21.0), ); await _checkScreenshot(rc, 'draw_paragraph'); - }, // TODO: https://github.com/flutter/flutter/issues/65789 + }, // TODO(mdebbar): https://github.com/flutter/flutter/issues/65789 skip: browserEngine == BrowserEngine.webkit && operatingSystem == OperatingSystem.iOs); @@ -332,7 +332,7 @@ Future testMain() async { const Rect.fromLTRB(textLeft, textTop, textLeft + widthConstraint, 35.0), ); await _checkScreenshot(rc, 'draw_paragraph_multi_line'); - }, // TODO: https://github.com/flutter/flutter/issues/65789 + }, // TODO(mdebbar): https://github.com/flutter/flutter/issues/65789 skip: browserEngine == BrowserEngine.webkit && operatingSystem == OperatingSystem.iOs); diff --git a/lib/web_ui/test/html/shaders/shader_mask_golden_test.dart b/lib/web_ui/test/html/shaders/shader_mask_golden_test.dart index 84c1daf2e95ec..c00f6a505d953 100644 --- a/lib/web_ui/test/html/shaders/shader_mask_golden_test.dart +++ b/lib/web_ui/test/html/shaders/shader_mask_golden_test.dart @@ -25,7 +25,7 @@ Future main() async { } } -/// TODO: unskip webkit tests once flakiness is resolved. See +// TODO(ferhat): unskip webkit tests once flakiness is resolved. See /// https://github.com/flutter/flutter/issues/76713 bool get isWebkit => browserEngine == BrowserEngine.webkit; diff --git a/lib/web_ui/test/keyboard_converter_test.dart b/lib/web_ui/test/keyboard_converter_test.dart index abb8660e12d51..4ca7fec78c765 100644 --- a/lib/web_ui/test/keyboard_converter_test.dart +++ b/lib/web_ui/test/keyboard_converter_test.dart @@ -51,7 +51,7 @@ void testMain() { return key.type == ui.KeyEventType.down; }); bool preventedDefault = false; - final ui.VoidCallback onPreventDefault = () { preventedDefault = true; }; + void onPreventDefault() { preventedDefault = true; } converter.handleEvent(keyDownEvent('KeyA', 'a') ..timeStamp = 1 @@ -115,7 +115,7 @@ void testMain() { return key.type == ui.KeyEventType.down; }); bool preventedDefault = false; - final ui.VoidCallback onPreventDefault = () { preventedDefault = true; }; + void onPreventDefault() { preventedDefault = true; } converter.handleEvent(keyDownEvent('ShiftLeft', 'Shift', kShift, kLocationLeft) ..onPreventDefault = onPreventDefault @@ -356,7 +356,7 @@ void testMain() { return true; }); bool preventedDefault = false; - final ui.VoidCallback onPreventDefault = () { preventedDefault = true; }; + void onPreventDefault() { preventedDefault = true; } converter.handleEvent(keyDownEvent('ShiftLeft', 'Shift', kShift, kLocationLeft) ..onPreventDefault = onPreventDefault @@ -392,7 +392,7 @@ void testMain() { return true; }); bool preventedDefault = false; - final ui.VoidCallback onPreventDefault = () { preventedDefault = true; }; + void onPreventDefault() { preventedDefault = true; } // A KeyDown of ShiftRight is missed due to loss of focus. converter.handleEvent(keyUpEvent('ShiftRight', 'Shift', 0, kLocationRight) @@ -447,7 +447,7 @@ void testMain() { return true; }, onMacOs: true); bool preventedDefault = false; - final ui.VoidCallback onPreventDefault = () { preventedDefault = true; }; + void onPreventDefault() { preventedDefault = true; } // A KeyDown of ShiftRight is missed due to loss of focus. converter.handleEvent(keyDownEvent('CapsLock', 'CapsLock') diff --git a/lib/web_ui/test/keyboard_test.dart b/lib/web_ui/test/keyboard_test.dart index 23c8a1c33108b..e08ee22219954 100644 --- a/lib/web_ui/test/keyboard_test.dart +++ b/lib/web_ui/test/keyboard_test.dart @@ -67,7 +67,7 @@ void testMain() { Keyboard.instance!.dispose(); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50815 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50815 skip: browserEngine == BrowserEngine.edge); test('dispatches keydown to flutter/keyevent channel', () { @@ -98,7 +98,7 @@ void testMain() { Keyboard.instance!.dispose(); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50815 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50815 skip: browserEngine == BrowserEngine.edge); test('dispatches correct meta state', () { @@ -148,7 +148,7 @@ void testMain() { Keyboard.instance!.dispose(); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50815 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50815 skip: browserEngine == BrowserEngine.edge); test('dispatches repeat events', () { @@ -201,7 +201,7 @@ void testMain() { Keyboard.instance!.dispose(); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50815 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50815 skip: browserEngine == BrowserEngine.edge); test('stops dispatching events after dispose', () { diff --git a/lib/web_ui/test/paragraph_test.dart b/lib/web_ui/test/paragraph_test.dart index 681bb736c9d8d..a84a28357efeb 100644 --- a/lib/web_ui/test/paragraph_test.dart +++ b/lib/web_ui/test/paragraph_test.dart @@ -116,9 +116,9 @@ Future testMain() async { expect(paragraph.maxIntrinsicWidth, fontSize * 10.0); } }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50771 - // TODO(nurhan): https://github.com/flutter/flutter/issues/46638 - // TODO(nurhan): https://github.com/flutter/flutter/issues/50590 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50771 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/46638 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50590 skip: browserEngine != BrowserEngine.blink); testEachMeasurement('predictably lays out a multi-line rich paragraph', () { @@ -142,9 +142,9 @@ Future testMain() async { expect(paragraph.maxIntrinsicWidth, fontSize * 16.0); } }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/46638 - // TODO(nurhan): https://github.com/flutter/flutter/issues/50590 - // TODO(nurhan): https://github.com/flutter/flutter/issues/50771 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/46638 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50590 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50771 skip: browserEngine != BrowserEngine.blink); testEachMeasurement('getPositionForOffset single-line', () { diff --git a/lib/web_ui/test/path_test.dart b/lib/web_ui/test/path_test.dart index f35b87ae4da19..55f9496dd16ab 100644 --- a/lib/web_ui/test/path_test.dart +++ b/lib/web_ui/test/path_test.dart @@ -423,7 +423,7 @@ void testMain() { expect(path.contains(const Offset(50, 50)), isTrue); js_util.setProperty(html.window, 'devicePixelRatio', 1.0); window.debugOverrideDevicePixelRatio(1.0); - // TODO: Investigate failure on CI. Locally this passes. + // TODO(ferhat): Investigate failure on CI. Locally this passes. // [Exception... "Failure" nsresult: "0x80004005 (NS_ERROR_FAILURE)" }, skip: browserEngine == BrowserEngine.firefox); diff --git a/lib/web_ui/test/text/font_collection_test.dart b/lib/web_ui/test/text/font_collection_test.dart index 7de6eff71ecd8..c58e0add78d3f 100644 --- a/lib/web_ui/test/text/font_collection_test.dart +++ b/lib/web_ui/test/text/font_collection_test.dart @@ -28,7 +28,7 @@ void testMain() { group('regular special characters', () { test('Register Asset with no special characters', () async { - const String _testFontFamily = "Ahem"; + const String _testFontFamily = 'Ahem'; final List fontFamilyList = []; fontManager.registerAsset( @@ -42,11 +42,11 @@ void testMain() { expect(fontFamilyList.length, equals(1)); expect(fontFamilyList.first, 'Ahem'); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50770 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50770 skip: browserEngine == BrowserEngine.edge); test('Register Asset with white space in the family name', () async { - const String _testFontFamily = "Ahem ahem ahem"; + const String _testFontFamily = 'Ahem ahem ahem'; final List fontFamilyList = []; fontManager.registerAsset( @@ -60,13 +60,13 @@ void testMain() { expect(fontFamilyList.length, equals(1)); expect(fontFamilyList.first, 'Ahem ahem ahem'); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50770 - // TODO(nurhan): https://github.com/flutter/flutter/issues/51142 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50770 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/51142 skip: browserEngine == BrowserEngine.edge || browserEngine == BrowserEngine.webkit); test('Register Asset with capital case letters', () async { - const String _testFontFamily = "AhEm"; + const String _testFontFamily = 'AhEm'; final List fontFamilyList = []; fontManager.registerAsset( @@ -80,7 +80,7 @@ void testMain() { expect(fontFamilyList.length, equals(1)); expect(fontFamilyList.first, 'AhEm'); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50770 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50770 skip: browserEngine == BrowserEngine.edge); }); @@ -106,8 +106,8 @@ void testMain() { expect(fontFamilyList.first, '"/Ahem"'); } }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50770 - // TODO(nurhan): https://github.com/flutter/flutter/issues/51142 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50770 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/51142 skip: browserEngine == BrowserEngine.edge || browserEngine == BrowserEngine.webkit); @@ -132,8 +132,8 @@ void testMain() { expect(fontFamilyList.first, '"Ahem!!ahem"'); } }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50770 - // TODO(nurhan): https://github.com/flutter/flutter/issues/51142 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50770 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/51142 skip: browserEngine == BrowserEngine.edge || browserEngine == BrowserEngine.webkit); @@ -158,8 +158,8 @@ void testMain() { expect(fontFamilyList.first, '"Ahem ,ahem"'); } }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50770 - // TODO(nurhan): https://github.com/flutter/flutter/issues/51142 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50770 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/51142 skip: browserEngine == BrowserEngine.edge || browserEngine == BrowserEngine.webkit); @@ -185,8 +185,8 @@ void testMain() { expect(fontFamilyList.first, '"Ahem 1998"'); } }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50770 - // TODO(nurhan): https://github.com/flutter/flutter/issues/51142 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50770 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/51142 skip: browserEngine == BrowserEngine.edge || browserEngine == BrowserEngine.webkit); }); diff --git a/lib/web_ui/test/text/font_loading_test.dart b/lib/web_ui/test/text/font_loading_test.dart index 5b5791979305a..331e1a67b981e 100644 --- a/lib/web_ui/test/text/font_loading_test.dart +++ b/lib/web_ui/test/text/font_loading_test.dart @@ -30,8 +30,8 @@ Future testMain() async { ui.loadFontFromList(Uint8List(0), fontFamily: 'test-font'), throwsA(const TypeMatcher())); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/56702 - // TODO(nurhan): https://github.com/flutter/flutter/issues/50770 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/56702 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/50770 skip: browserEngine == BrowserEngine.edge || browserEngine == BrowserEngine.webkit); @@ -46,8 +46,8 @@ Future testMain() async { expect(_containsFontFamily('Blehm'), isTrue); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/56702 - // TODO(nurhan): https://github.com/flutter/flutter/issues/50770 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/56702 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/50770 skip: browserEngine == BrowserEngine.edge || browserEngine == BrowserEngine.webkit); @@ -81,8 +81,8 @@ Future testMain() async { expect(TextMeasurementService.rulerManager!.rulers.length, 0); expect(Spanometer.rulers.length, 0); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/56702 - // TODO(nurhan): https://github.com/flutter/flutter/issues/50770 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/56702 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/50770 skip: browserEngine == BrowserEngine.edge || browserEngine == BrowserEngine.webkit); @@ -110,8 +110,8 @@ Future testMain() async { expect(actualName, 'flutter/system'); expect(message, '{"type":"fontsChange"}'); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/56702 - // TODO(nurhan): https://github.com/flutter/flutter/issues/50770 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/56702 + // TODO(hterkelsen): https://github.com/flutter/flutter/issues/50770 skip: browserEngine == BrowserEngine.edge || browserEngine == BrowserEngine.webkit); }); diff --git a/lib/web_ui/test/text/layout_service_plain_test.dart b/lib/web_ui/test/text/layout_service_plain_test.dart index e9867b1e92c57..4e829eb16cb0d 100644 --- a/lib/web_ui/test/text/layout_service_plain_test.dart +++ b/lib/web_ui/test/text/layout_service_plain_test.dart @@ -467,7 +467,7 @@ Future testMain() async { expect(paragraph.maxIntrinsicWidth, 40); expect(paragraph.height, 10); - // TODO(flutter_web): https://github.com/flutter/flutter/issues/34346 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/34346 // expectLines(paragraph, [ // l('.', 0, 0, hardBreak: false, width: 10.0, left: 0.0), // ]); diff --git a/lib/web_ui/test/text/measurement_test.dart b/lib/web_ui/test/text/measurement_test.dart index 99c4639cff40e..18567ec87c848 100644 --- a/lib/web_ui/test/text/measurement_test.dart +++ b/lib/web_ui/test/text/measurement_test.dart @@ -810,7 +810,7 @@ Future testMain() async { expect(result.maxIntrinsicWidth, 40); expect(result.height, 10); if (instance.isCanvas) { - // TODO(flutter_web): https://github.com/flutter/flutter/issues/34346 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/34346 // expect(result.lines, [ // line('.', 0, 4, hardBreak: false, width: 10.0, lineNumber: 0, left: 0.0), // ]); diff --git a/lib/web_ui/test/text_editing_test.dart b/lib/web_ui/test/text_editing_test.dart index bba4de66df02c..e8f201ffa66e0 100644 --- a/lib/web_ui/test/text_editing_test.dart +++ b/lib/web_ui/test/text_editing_test.dart @@ -27,7 +27,7 @@ const int _kReturnKeyCode = 13; const MethodCodec codec = JSONMethodCodec(); /// Add unit tests for [FirefoxTextEditingStrategy]. -/// TODO(nurhan): https://github.com/flutter/flutter/issues/46891 +// TODO(mdebbar): https://github.com/flutter/flutter/issues/46891 DefaultTextEditingStrategy? editingStrategy; EditingState? lastEditingState; @@ -327,7 +327,7 @@ void testMain() { ); expect(lastInputAction, 'TextInputAction.done'); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50769 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50769 skip: browserEngine == BrowserEngine.edge); test('Does not trigger input action in multi-line mode', () { @@ -591,7 +591,7 @@ void testMain() { expect(defaultTextEditingRoot.activeElement, textEditing!.strategy.domElement); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50769 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50769 skip: browserEngine == BrowserEngine.edge); test('finishAutofillContext closes connection no autofill element', @@ -634,7 +634,7 @@ void testMain() { // Input element is removed from DOM. expect(defaultTextEditingRoot.querySelectorAll('input'), hasLength(0)); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50769 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50769 skip: browserEngine == BrowserEngine.edge); test('finishAutofillContext removes form from DOM', () async { @@ -745,7 +745,7 @@ void testMain() { // `submit` action is called on form. await expectLater(await submittedForm.future, isTrue); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50769 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50769 skip: browserEngine == BrowserEngine.edge); test('forms submits for focused input', () async { @@ -804,7 +804,7 @@ void testMain() { expect(defaultTextEditingRoot.querySelectorAll('form'), hasLength(0)); expect(formsOnTheDom, hasLength(0)); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50769 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50769 skip: browserEngine == BrowserEngine.edge); test('setClient, setEditingState, show, setClient', () { @@ -1153,7 +1153,7 @@ void testMain() { // Confirm that [HybridTextEditing] didn't send any messages. expect(spy.messages, isEmpty); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50590 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50590 skip: browserEngine == BrowserEngine.webkit); test( @@ -1224,7 +1224,7 @@ void testMain() { const MethodCall clearClient = MethodCall('TextInput.clearClient'); sendFrameworkMessage(codec.encodeMethodCall(clearClient)); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50590 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50590 skip: browserEngine == BrowserEngine.webkit); test('input font set successfully with null fontWeightIndex', () { @@ -1268,7 +1268,7 @@ void testMain() { hideKeyboard(); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50590 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50590 skip: browserEngine == BrowserEngine.webkit); test('Canonicalizes font family', () { @@ -1640,7 +1640,7 @@ void testMain() { [clientId, 'TextInputAction.next'], ); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50769 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50769 skip: browserEngine == BrowserEngine.edge); test('does not send input action in multi-line mode', () { diff --git a/lib/web_ui/test/text_test.dart b/lib/web_ui/test/text_test.dart index 68d339686ae6a..87acff462b013 100644 --- a/lib/web_ui/test/text_test.dart +++ b/lib/web_ui/test/text_test.dart @@ -379,8 +379,8 @@ Future testMain() async { // The nested span here should not set it's family to default sans-serif. expect(spans[1].style.fontFamily, 'Ahem, $fallback, sans-serif'); }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50771 - // TODO(nurhan): https://github.com/flutter/flutter/issues/46638 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50771 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/46638 skip: browserEngine == BrowserEngine.firefox || browserEngine == BrowserEngine.edge); @@ -401,8 +401,8 @@ Future testMain() async { debugEmulateFlutterTesterEnvironment = true; }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50771 - // TODO(nurhan): https://github.com/flutter/flutter/issues/46638 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50771 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/46638 skip: browserEngine == BrowserEngine.firefox || browserEngine == BrowserEngine.edge); @@ -440,7 +440,7 @@ Future testMain() async { debugEmulateFlutterTesterEnvironment = true; }, - // TODO(nurhan): https://github.com/flutter/flutter/issues/50771 + // TODO(mdebbar): https://github.com/flutter/flutter/issues/50771 skip: browserEngine == BrowserEngine.edge); group('TextRange', () { From 28b48fbcf4cb55f7a13b07a814bf2b74e7aa8fb7 Mon Sep 17 00:00:00 2001 From: ferhatb Date: Thu, 29 Jul 2021 14:04:28 -0700 Subject: [PATCH 2/5] address reviewer comments --- lib/web_ui/lib/src/engine/canvaskit/font_fallbacks.dart | 2 +- lib/web_ui/lib/src/engine/text/paragraph.dart | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/web_ui/lib/src/engine/canvaskit/font_fallbacks.dart b/lib/web_ui/lib/src/engine/canvaskit/font_fallbacks.dart index 23e1110454676..15db754fe52c8 100644 --- a/lib/web_ui/lib/src/engine/canvaskit/font_fallbacks.dart +++ b/lib/web_ui/lib/src/engine/canvaskit/font_fallbacks.dart @@ -56,7 +56,7 @@ class FontFallbackData { // resetting the tree would be a matter of reconstructing // the new resolved tree. font.reset(); - //ignore: prefer_foreach + // ignore: prefer_foreach for (final CodeunitRange range in font.approximateUnicodeRanges) { ranges.putIfAbsent(font, () => []).add(range); } diff --git a/lib/web_ui/lib/src/engine/text/paragraph.dart b/lib/web_ui/lib/src/engine/text/paragraph.dart index edc02f009ecea..fb1447bb0db6a 100644 --- a/lib/web_ui/lib/src/engine/text/paragraph.dart +++ b/lib/web_ui/lib/src/engine/text/paragraph.dart @@ -83,8 +83,6 @@ class EngineLineMetrics implements ui.LineMetrics { required this.baseline, required this.ascent, required this.descent, - // Didn't use `this.boxes` because we want it to be non-null in this - // constructor. required this.boxes, }) : displayText = null, unscaledAscent = double.infinity; From 034c867955566f5915d963f329c2078d9a0adfbc Mon Sep 17 00:00:00 2001 From: ferhatb Date: Fri, 30 Jul 2021 08:43:12 -0700 Subject: [PATCH 3/5] add documentation --- lib/web_ui/lib/src/engine.dart | 5 +++++ lib/web_ui/lib/src/engine/alarm_clock.dart | 2 ++ lib/web_ui/lib/src/engine/assets.dart | 21 +++++++++++++------ .../lib/src/engine/browser_detection.dart | 8 +++++-- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/lib/web_ui/lib/src/engine.dart b/lib/web_ui/lib/src/engine.dart index 8b246c159f3b2..50cc107c91e1a 100644 --- a/lib/web_ui/lib/src/engine.dart +++ b/lib/web_ui/lib/src/engine.dart @@ -330,9 +330,12 @@ export 'engine/window.dart'; /// Keep these in sync with the same constants on the framework-side under foundation/constants.dart. const bool kReleaseMode = bool.fromEnvironment('dart.vm.product', defaultValue: false); +/// A constant that is true if the application was compiled in profile mode. const bool kProfileMode = bool.fromEnvironment('dart.vm.profile', defaultValue: false); +/// A constant that is true if the application was compiled in debug mode. const bool kDebugMode = !kReleaseMode && !kProfileMode; +/// Returns mode of the app is running in as a string. String get buildMode => kReleaseMode ? 'release' : kProfileMode @@ -454,6 +457,8 @@ void _addUrlStrategyListener() { }); } +/// Sanitizer used to convert const svg filter and clippath snippets to +/// SvgElement without sanitization. class NullTreeSanitizer implements html.NodeTreeSanitizer { @override void sanitizeTree(html.Node node) {} diff --git a/lib/web_ui/lib/src/engine/alarm_clock.dart b/lib/web_ui/lib/src/engine/alarm_clock.dart index 265828c87d8e2..900286e77dcc7 100644 --- a/lib/web_ui/lib/src/engine/alarm_clock.dart +++ b/lib/web_ui/lib/src/engine/alarm_clock.dart @@ -18,6 +18,8 @@ typedef TimestampFunction = DateTime Function(); /// /// https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout#Notes class AlarmClock { + + /// Initializes Alarmclock with a closure that gets called with a timestamp. AlarmClock(TimestampFunction timestampFunction) : _timestampFunction = timestampFunction; diff --git a/lib/web_ui/lib/src/engine/assets.dart b/lib/web_ui/lib/src/engine/assets.dart index a11e8ac8c4e28..84ed57f4565e2 100644 --- a/lib/web_ui/lib/src/engine/assets.dart +++ b/lib/web_ui/lib/src/engine/assets.dart @@ -19,6 +19,7 @@ class AssetManager { /// The directory containing the assets. final String assetsDir; + /// Initializes [AssetManager] with path to assets relative to baseUrl. const AssetManager({this.assetsDir = _defaultAssetsDir}); String? get _baseUrl { @@ -53,6 +54,7 @@ class AssetManager { return Uri.encodeFull((_baseUrl ?? '') + '$assetsDir/$asset'); } + /// Loads an asset using an [html.HttpRequest] and returns data as [ByteData]. Future load(String asset) async { final String url = getAssetUrl(asset); try { @@ -77,10 +79,14 @@ class AssetManager { } } +/// Thrown to indicate http failure during asset loading. class AssetManagerException implements Exception { + /// Http request url for asset. final String url; + /// Http status of of response. final int httpStatus; + /// Initializes exception with request url and http status. AssetManagerException(this.url, this.httpStatus); @override @@ -89,9 +95,12 @@ class AssetManagerException implements Exception { /// An asset manager that gives fake empty responses for assets. class WebOnlyMockAssetManager implements AssetManager { - String defaultAssetsDir = ''; - String defaultAssetManifest = '{}'; - String defaultFontManifest = ''' + /// Mock asset directory relative to base url. + static const String kDefaultAssetsDir = ''; + /// Mock empty asset manifest. + static const String kdefaultAssetManifest = '{}'; + /// Mock default font manifest. + static const String kDefaultFontManifest = ''' [ { "family":"$robotoFontFamily", @@ -104,7 +113,7 @@ class WebOnlyMockAssetManager implements AssetManager { ]'''; @override - String get assetsDir => defaultAssetsDir; + String get assetsDir => kDefaultAssetsDir; @override String get _baseUrl => ''; @@ -116,11 +125,11 @@ class WebOnlyMockAssetManager implements AssetManager { Future load(String asset) { if (asset == getAssetUrl('AssetManifest.json')) { return Future.value( - _toByteData(utf8.encode(defaultAssetManifest))); + _toByteData(utf8.encode(kdefaultAssetManifest))); } if (asset == getAssetUrl('FontManifest.json')) { return Future.value( - _toByteData(utf8.encode(defaultFontManifest))); + _toByteData(utf8.encode(kdefaultAssetManifest))); } throw AssetManagerException(asset, 404); } diff --git a/lib/web_ui/lib/src/engine/browser_detection.dart b/lib/web_ui/lib/src/engine/browser_detection.dart index 3b3fc279bc576..f0cf2adfb28c4 100644 --- a/lib/web_ui/lib/src/engine/browser_detection.dart +++ b/lib/web_ui/lib/src/engine/browser_detection.dart @@ -33,9 +33,9 @@ enum BrowserEngine { /// html webgl version qualifier constants. abstract class WebGLVersion { - // WebGL 1.0 is based on OpenGL ES 2.0 / GLSL 1.00 + /// WebGL 1.0 is based on OpenGL ES 2.0 / GLSL 1.00 static const int webgl1 = 1; - // WebGL 2.0 is based on OpenGL ES 3.0 / GLSL 3.00 + /// WebGL 2.0 is based on OpenGL ES 3.0 / GLSL 3.00 static const int webgl2 = 2; } @@ -78,6 +78,9 @@ bool _isSamsungBrowser(String agent) { return exp.hasMatch(agent.toUpperCase()); } +/// Detects browser engine for a given vendor and agent string. +/// +/// Used for testing this library. @visibleForTesting BrowserEngine detectBrowserEngineByVendorAgent(String vendor, String agent) { if (vendor == 'Google Inc.') { @@ -149,6 +152,7 @@ OperatingSystem get operatingSystem { /// This is intended to be used for testing and debugging only. OperatingSystem? debugOperatingSystemOverride; +/// Detects operating system using platform and UA used for unit testing. @visibleForTesting OperatingSystem detectOperatingSystem({ String? overridePlatform, From 64eebb3eec7ff271f06d8502eb1da9700ea5707a Mon Sep 17 00:00:00 2001 From: ferhatb Date: Fri, 30 Jul 2021 08:46:16 -0700 Subject: [PATCH 4/5] fix MockAssetManager fields --- lib/web_ui/lib/src/engine/assets.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/web_ui/lib/src/engine/assets.dart b/lib/web_ui/lib/src/engine/assets.dart index 84ed57f4565e2..7709c56428dea 100644 --- a/lib/web_ui/lib/src/engine/assets.dart +++ b/lib/web_ui/lib/src/engine/assets.dart @@ -98,9 +98,9 @@ class WebOnlyMockAssetManager implements AssetManager { /// Mock asset directory relative to base url. static const String kDefaultAssetsDir = ''; /// Mock empty asset manifest. - static const String kdefaultAssetManifest = '{}'; - /// Mock default font manifest. - static const String kDefaultFontManifest = ''' + static const String kDefaultAssetManifest = '{}'; + /// Mock font manifest overridable for unit testing. + String defaultFontManifest = ''' [ { "family":"$robotoFontFamily", @@ -125,11 +125,11 @@ class WebOnlyMockAssetManager implements AssetManager { Future load(String asset) { if (asset == getAssetUrl('AssetManifest.json')) { return Future.value( - _toByteData(utf8.encode(kdefaultAssetManifest))); + _toByteData(utf8.encode(kDefaultAssetManifest))); } if (asset == getAssetUrl('FontManifest.json')) { return Future.value( - _toByteData(utf8.encode(kdefaultAssetManifest))); + _toByteData(utf8.encode(kDefaultAssetManifest))); } throw AssetManagerException(asset, 404); } From dbf78d88ae533a04b5557b7d154981eea0837707 Mon Sep 17 00:00:00 2001 From: ferhatb Date: Fri, 30 Jul 2021 10:11:21 -0700 Subject: [PATCH 5/5] Add documentation for CanvasPool --- lib/web_ui/lib/src/engine/canvas_pool.dart | 121 ++++++++++++------ .../lib/src/engine/html/bitmap_canvas.dart | 6 +- 2 files changed, 87 insertions(+), 40 deletions(-) diff --git a/lib/web_ui/lib/src/engine/canvas_pool.dart b/lib/web_ui/lib/src/engine/canvas_pool.dart index 91dd4177cbf76..be03c284e9bc2 100644 --- a/lib/web_ui/lib/src/engine/canvas_pool.dart +++ b/lib/web_ui/lib/src/engine/canvas_pool.dart @@ -54,16 +54,37 @@ class CanvasPool extends _SaveStackTracking { // List of canvases available to reuse from prior paint cycle. List? _reusablePool; // Current canvas element or null if marked for lazy allocation. - html.CanvasElement? get canvas => _canvas; html.CanvasElement? _canvas; html.HtmlElement? _rootElement; int _saveContextCount = 0; final double _density; + /// Initializes canvas pool for target size and dpi. CanvasPool(this._widthInBitmapPixels, this._heightInBitmapPixels, this._density); + /// Initializes canvas pool to be hosted on a surface. + void mount(html.HtmlElement rootElement) { + _rootElement = rootElement; + } + + /// Sets the translate transform to be applied to canvas to compensate for + /// pixel padding applied to hosting [BitmapCanvas]. + /// + /// Should be called during initialization after [CanvasPool] is mounted. + set initialTransform(ui.Offset transform) { + translate(transform.dx, transform.dy); + } + + /// Returns true if no canvas has been allocated yet. + bool get isEmpty => _canvas == null; + + /// Returns true if a canvas has been allocated for use. + bool get isNotEmpty => _canvas != null; + + + /// Returns [CanvasRenderingContext2D] api to draw into this canvas. html.CanvasRenderingContext2D get context { html.CanvasRenderingContext2D? ctx = _context; if (ctx == null) { @@ -75,6 +96,8 @@ class CanvasPool extends _SaveStackTracking { return ctx; } + /// Returns [ContextStateHandle] API to efficiently update state of + /// drawing context. ContextStateHandle get contextHandle { if (_canvas == null) { _createCanvas(); @@ -84,11 +107,11 @@ class CanvasPool extends _SaveStackTracking { return _contextHandle!; } - // Prevents active canvas to be used for rendering and prepares a new - // canvas allocation on next drawing request that will require one. - // - // Saves current canvas so we can dispose - // and replay the clip/transform stack on top of new canvas. + /// Prevents active canvas to be used for rendering and prepares a new + /// canvas allocation on next drawing request that will require one. + /// + /// Saves current canvas so we can dispose + /// and replay the clip/transform stack on top of new canvas. void closeCurrentCanvas() { assert(_rootElement != null); // Place clean copy of current canvas with context stack restored and paint @@ -104,10 +127,6 @@ class CanvasPool extends _SaveStackTracking { } } - void allocateCanvas(html.HtmlElement rootElement) { - _rootElement = rootElement; - } - void _createCanvas() { bool requiresClearRect = false; bool reused = false; @@ -227,11 +246,6 @@ class CanvasPool extends _SaveStackTracking { } } reuse(); - resetTransform(); - } - - set initialTransform(ui.Offset transform) { - translate(transform.dx, transform.dy); } int _replaySingleSaveEntry(int clipDepth, Matrix4 prevTransform, @@ -311,7 +325,7 @@ class CanvasPool extends _SaveStackTracking { clipDepth, prevTransform, _currentTransform, clipStack); } - // Marks this pool for reuse. + /// Marks this pool for reuse. void reuse() { if (_canvas != null) { _restoreContextSave(); @@ -326,8 +340,11 @@ class CanvasPool extends _SaveStackTracking { _canvas = null; _context = null; _contextHandle = null; + _resetTransform(); } + /// Signals to canvas pool the end of drawing commands so cached resources + /// that are reused from last instance can be cleanup. void endOfPaint() { if (_reusablePool != null) { for (final html.CanvasElement e in _reusablePool!) { @@ -375,7 +392,7 @@ class CanvasPool extends _SaveStackTracking { double get dpi => EnginePlatformDispatcher.browserDevicePixelRatio * _density; - void resetTransform() { + void _resetTransform() { final html.CanvasElement? canvas = _canvas; if (canvas != null) { canvas.style.transformOrigin = ''; @@ -383,8 +400,8 @@ class CanvasPool extends _SaveStackTracking { } } - // Returns a "data://" URI containing a representation of the image in this - // canvas in PNG format. + /// Returns a "data://" URI containing a representation of the image in this + /// canvas in PNG format. String toDataUrl() => _canvas?.toDataUrl() ?? ''; @override @@ -518,6 +535,7 @@ class CanvasPool extends _SaveStackTracking { } } + /// Fill a virtually infinite rect with a color and optional blendMode. void drawColor(ui.Color color, ui.BlendMode blendMode) { final html.CanvasRenderingContext2D ctx = context; contextHandle.blendMode = blendMode; @@ -531,7 +549,7 @@ class CanvasPool extends _SaveStackTracking { ctx.fillRect(-10000, -10000, 20000, 20000); } - // Fill a virtually infinite rect with the color. + /// Fill a virtually infinite rect with the color. void fill() { final html.CanvasRenderingContext2D ctx = context; ctx.beginPath(); @@ -540,6 +558,7 @@ class CanvasPool extends _SaveStackTracking { ctx.fillRect(-10000, -10000, 20000, 20000); } + /// Draws a line from [p1] to [p2]. void strokeLine(ui.Offset p1, ui.Offset p2) { final html.CanvasRenderingContext2D ctx = context; ctx.beginPath(); @@ -554,6 +573,8 @@ class CanvasPool extends _SaveStackTracking { ctx.stroke(); } + /// Draws a set of points with given radius, lines between points or + /// a polygon. void drawPoints(ui.PointMode pointMode, Float32List points, double radius) { final html.CanvasRenderingContext2D ctx = context; final int len = points.length; @@ -634,6 +655,19 @@ class CanvasPool extends _SaveStackTracking { } } + /// Draws a rectangle filled or stroked based on [style]. + void drawRect(ui.Rect rect, ui.PaintingStyle? style) { + context.beginPath(); + final ui.Rect? shaderBounds = contextHandle._shaderBounds; + if (shaderBounds == null) { + context.rect(rect.left, rect.top, rect.width, rect.height); + } else { + context.rect(rect.left - shaderBounds.left, rect.top - shaderBounds.top, + rect.width, rect.height); + } + contextHandle.paint(style); + } + /// Applies path to drawing context, preparing for fill and other operations. /// /// WARNING: Don't refactor _runPath/_runPathWithOffset. Latency sensitive @@ -682,18 +716,7 @@ class CanvasPool extends _SaveStackTracking { } } - void drawRect(ui.Rect rect, ui.PaintingStyle? style) { - context.beginPath(); - final ui.Rect? shaderBounds = contextHandle._shaderBounds; - if (shaderBounds == null) { - context.rect(rect.left, rect.top, rect.width, rect.height); - } else { - context.rect(rect.left - shaderBounds.left, rect.top - shaderBounds.top, - rect.width, rect.height); - } - contextHandle.paint(style); - } - + /// Draws a rounded rectangle filled or stroked based on [style]. void drawRRect(ui.RRect roundRect, ui.PaintingStyle? style) { final ui.Rect? shaderBounds = contextHandle._shaderBounds; RRectToCanvasRenderer(context).render( @@ -702,6 +725,9 @@ class CanvasPool extends _SaveStackTracking { contextHandle.paint(style); } + /// Fills or strokes the area between [outer] and [inner] rounded rectangles. + /// + /// Typically used to draw a thick round border. void drawDRRect(ui.RRect outer, ui.RRect inner, ui.PaintingStyle? style) { final RRectRenderer renderer = RRectToCanvasRenderer(context); final ui.Rect? shaderBounds = contextHandle._shaderBounds; @@ -716,6 +742,7 @@ class CanvasPool extends _SaveStackTracking { contextHandle.paint(style); } + /// Draws an axis-aligned oval that fills the given axis-aligned rectangle. void drawOval(ui.Rect rect, ui.PaintingStyle? style) { context.beginPath(); final ui.Rect? shaderBounds = contextHandle._shaderBounds; @@ -728,6 +755,7 @@ class CanvasPool extends _SaveStackTracking { contextHandle.paint(style); } + /// Draws a circle centered at [c] with [radius]. void drawCircle(ui.Offset c, double radius, ui.PaintingStyle? style) { context.beginPath(); final ui.Rect? shaderBounds = contextHandle._shaderBounds; @@ -737,6 +765,7 @@ class CanvasPool extends _SaveStackTracking { contextHandle.paint(style); } + /// Draws or strokes a path based on [style] and current context state. void drawPath(ui.Path path, ui.PaintingStyle? style) { final ui.Rect? shaderBounds = contextHandle._shaderBounds; if (shaderBounds == null) { @@ -748,6 +777,7 @@ class CanvasPool extends _SaveStackTracking { contextHandle.paintPath(style, path.fillType); } + /// Draws a shadow for a Path representing the given material elevation. void drawShadow(ui.Path path, ui.Color color, double elevation, bool transparentOccluder) { final SurfaceShadowData? shadow = computeShadow(path.getBounds(), elevation); @@ -810,6 +840,11 @@ class CanvasPool extends _SaveStackTracking { } } + /// Disposes html canvas element(s) used by this pool when persistent surface + /// is disposed. + /// + /// When this pool is reused, [clear] is called instead to be able to + /// draw using existing canvas elements. void dispose() { // Webkit has a threshold for the amount of canvas pixels an app can // allocate. Even though our canvases are being garbage-collected as @@ -836,16 +871,18 @@ class CanvasPool extends _SaveStackTracking { } } -// Optimizes applying paint parameters to html canvas. -// -// See https://www.w3.org/TR/2dcontext/ for defaults used in this class -// to initialize current values. -// +/// Optimizes applying paint parameters to html canvas. +/// +/// See https://www.w3.org/TR/2dcontext/ for defaults used in this class +/// to initialize current values. class ContextStateHandle { + /// Associated canvas element context tracked by this context state. final html.CanvasRenderingContext2D context; final CanvasPool _canvasPool; + /// Dpi of context. final double density; + /// Initializes context state for a [CanvasPool]. ContextStateHandle(this._canvasPool, this.context, this.density); ui.BlendMode? _currentBlendMode = ui.BlendMode.srcOver; ui.StrokeCap? _currentStrokeCap = ui.StrokeCap.butt; @@ -856,6 +893,7 @@ class ContextStateHandle { Object? _currentStrokeStyle; double _currentLineWidth = 1.0; + /// See [html.CanvasRenderingContext2D]. set blendMode(ui.BlendMode? blendMode) { if (blendMode != _currentBlendMode) { _currentBlendMode = blendMode; @@ -864,6 +902,7 @@ class ContextStateHandle { } } + /// See [html.CanvasRenderingContext2D]. set strokeCap(ui.StrokeCap? strokeCap) { strokeCap ??= ui.StrokeCap.butt; if (strokeCap != _currentStrokeCap) { @@ -872,6 +911,7 @@ class ContextStateHandle { } } + /// See [html.CanvasRenderingContext2D]. set lineWidth(double lineWidth) { if (lineWidth != _currentLineWidth) { _currentLineWidth = lineWidth; @@ -879,6 +919,7 @@ class ContextStateHandle { } } + /// See [html.CanvasRenderingContext2D]. set strokeJoin(ui.StrokeJoin? strokeJoin) { strokeJoin ??= ui.StrokeJoin.miter; if (strokeJoin != _currentStrokeJoin) { @@ -887,6 +928,7 @@ class ContextStateHandle { } } + /// See [html.CanvasRenderingContext2D]. set fillStyle(Object? colorOrGradient) { if (!identical(colorOrGradient, _currentFillStyle)) { _currentFillStyle = colorOrGradient; @@ -894,6 +936,7 @@ class ContextStateHandle { } } + /// See [html.CanvasRenderingContext2D]. set strokeStyle(Object? colorOrGradient) { if (!identical(colorOrGradient, _currentStrokeStyle)) { _currentStrokeStyle = colorOrGradient; @@ -1052,6 +1095,7 @@ class ContextStateHandle { } } + /// Fills or strokes the currently active path. void paint(ui.PaintingStyle? style) { if (style == ui.PaintingStyle.stroke) { context.stroke(); @@ -1060,6 +1104,7 @@ class ContextStateHandle { } } + /// Fills or strokes the currently active path based on fill type. void paintPath(ui.PaintingStyle? style, ui.PathFillType pathFillType) { if (style == ui.PaintingStyle.stroke) { context.stroke(); @@ -1072,6 +1117,8 @@ class ContextStateHandle { } } + /// Resets drawing context state to defaults for + /// [html.CanvasRenderingContext2D]. void reset() { context.fillStyle = ''; // Read back fillStyle/strokeStyle values from context so that input such diff --git a/lib/web_ui/lib/src/engine/html/bitmap_canvas.dart b/lib/web_ui/lib/src/engine/html/bitmap_canvas.dart index a1e281957ac42..e856684c14e10 100644 --- a/lib/web_ui/lib/src/engine/html/bitmap_canvas.dart +++ b/lib/web_ui/lib/src/engine/html/bitmap_canvas.dart @@ -160,7 +160,7 @@ class BitmapCanvas extends EngineCanvas { _canvasPositionX = _bounds.left.floor() - kPaddingPixels; _canvasPositionY = _bounds.top.floor() - kPaddingPixels; _updateRootElementTransform(); - _canvasPool.allocateCanvas(rootElement as html.HtmlElement); + _canvasPool.mount(rootElement as html.HtmlElement); _setupInitialTransform(); } @@ -372,7 +372,7 @@ class BitmapCanvas extends EngineCanvas { _renderStrategy.isInsideSvgFilterTree || (_preserveImageData == false && _contains3dTransform) || (_childOverdraw && - _canvasPool.canvas == null && + _canvasPool.isEmpty && paint.maskFilter == null && paint.shader == null && paint.style != ui.PaintingStyle.stroke); @@ -386,7 +386,7 @@ class BitmapCanvas extends EngineCanvas { ((_childOverdraw || _renderStrategy.hasImageElements || _renderStrategy.hasParagraphs) && - _canvasPool.canvas == null && + _canvasPool.isEmpty && paint.maskFilter == null && paint.shader == null);