I was debugging an Overlay issue and felt I could have identified the problem faster if the existing assertions provided more information about the current state of the OverlayEntry and Overlay.
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.21.2 to 2.21.3.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/github/codeql-action/blob/main/CHANGELOG.md">github/codeql-action's changelog</a>.</em></p>
<blockquote>
<h1>CodeQL Action Changelog</h1>
<p>See the <a href="https://github.com/github/codeql-action/releases">releases page</a> for the relevant changes to the CodeQL CLI and language packs.</p>
<h2>[UNRELEASED]</h2>
<p>No user facing changes.</p>
<h2>2.21.3 - 08 Aug 2023</h2>
<ul>
<li>We are rolling out a feature in August 2023 that will improve multi-threaded performance on larger runners. <a href="https://redirect.github.com/github/codeql-action/pull/1817">#1817</a></li>
<li>We are rolling out a feature in August 2023 that adds beta support for <a href="https://projectlombok.org/">Project Lombok</a> when analyzing Java. <a href="https://redirect.github.com/github/codeql-action/pull/1809">#1809</a></li>
<li>Reduce disk space usage when downloading the CodeQL bundle. <a href="https://redirect.github.com/github/codeql-action/pull/1820">#1820</a></li>
</ul>
<h2>2.21.2 - 28 Jul 2023</h2>
<ul>
<li>Update default CodeQL bundle version to 2.14.1. <a href="https://redirect.github.com/github/codeql-action/pull/1797">#1797</a></li>
<li>Avoid duplicating the analysis summary within the logs. <a href="https://redirect.github.com/github/codeql-action/pull/1811">#1811</a></li>
</ul>
<h2>2.21.1 - 26 Jul 2023</h2>
<ul>
<li>Improve the handling of fatal errors from the CodeQL CLI. <a href="https://redirect.github.com/github/codeql-action/pull/1795">#1795</a></li>
<li>Add the <code>sarif-output</code> output to the analyze action that contains the path to the directory of the generated SARIF. <a href="https://redirect.github.com/github/codeql-action/pull/1799">#1799</a></li>
</ul>
<h2>2.21.0 - 19 Jul 2023</h2>
<ul>
<li>CodeQL Action now requires CodeQL CLI 2.9.4 or later. For more information, see the corresponding changelog entry for CodeQL Action version 2.20.4. <a href="https://redirect.github.com/github/codeql-action/pull/1724">#1724</a></li>
</ul>
<h2>2.20.4 - 14 Jul 2023</h2>
<ul>
<li>This is the last release of the Action that supports CodeQL CLI versions 2.8.5 to 2.9.3. These versions of the CodeQL CLI were deprecated on June 20, 2023 alongside GitHub Enterprise Server 3.5 and will not be supported by the next release of the CodeQL Action (2.21.0).
<ul>
<li>If you are using one of these versions, please update to CodeQL CLI version 2.9.4 or later. For instance, if you have specified a custom version of the CLI using the 'tools' input to the 'init' Action, you can remove this input to use the default version.</li>
<li>Alternatively, if you want to continue using a version of the CodeQL CLI between 2.8.5 and 2.9.3, you can replace 'github/codeql-action/<em><a href="https://github.com/v2"><code>@âv2</code></a>' by 'github/codeql-action/</em><a href="https://github.com/v2"><code>@âv2</code></a>.20.4' in your code scanning workflow to ensure you continue using this version of the CodeQL Action.</li>
</ul>
</li>
<li>We are rolling out a feature in July 2023 that will slightly reduce the default amount of RAM used for query execution, in proportion to the runner's total memory. This will help to avoid out-of-memory failures on larger runners. <a href="https://redirect.github.com/github/codeql-action/pull/1760">#1760</a></li>
<li>Update default CodeQL bundle version to 2.14.0. <a href="https://redirect.github.com/github/codeql-action/pull/1762">#1762</a></li>
</ul>
<h2>2.20.3 - 06 Jul 2023</h2>
<ul>
<li>Update default CodeQL bundle version to 2.13.5. <a href="https://redirect.github.com/github/codeql-action/pull/1743">#1743</a></li>
</ul>
<h2>2.20.2 - 03 Jul 2023</h2>
<p>No user facing changes.</p>
<h2>2.20.1 - 21 Jun 2023</h2>
<ul>
<li>Update default CodeQL bundle version to 2.13.4. <a href="https://redirect.github.com/github/codeql-action/pull/1721">#1721</a></li>
<li>Experimental: add a new <code>resolve-environment</code> action which attempts to infer a configuration for the build environment that is required to build a given project. Do not use this in production as it is part of an internal experiment and subject to change at any time.</li>
</ul>
<h2>2.20.0 - 13 Jun 2023</h2>
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="5b6282e01c"><code>5b6282e</code></a> Merge pull request <a href="https://redirect.github.com/github/codeql-action/issues/1829">#1829</a> from github/update-v2.21.3-f9a7c6738</li>
<li><a href="f0f7a35b85"><code>f0f7a35</code></a> Add changenote for Lombok rollout</li>
<li><a href="dda4ed3db4"><code>dda4ed3</code></a> Update changelog for v2.21.3</li>
<li><a href="f9a7c6738f"><code>f9a7c67</code></a> Merge pull request <a href="https://redirect.github.com/github/codeql-action/issues/1827">#1827</a> from github/dependabot/npm_and_yarn/npm-5103036bd1</li>
<li><a href="31b9dd18d4"><code>31b9dd1</code></a> Update checked-in dependencies</li>
<li><a href="7e2f56aae3"><code>7e2f56a</code></a> Bump the npm group with 3 updates</li>
<li><a href="878ae4a749"><code>878ae4a</code></a> Merge pull request <a href="https://redirect.github.com/github/codeql-action/issues/1823">#1823</a> from github/henrymercer/setup-swift-more-consistent</li>
<li><a href="63602c0f72"><code>63602c0</code></a> Merge pull request <a href="https://redirect.github.com/github/codeql-action/issues/1824">#1824</a> from github/henrymercer/cli-notifications-fix</li>
<li><a href="66dc883276"><code>66dc883</code></a> Merge pull request <a href="https://redirect.github.com/github/codeql-action/issues/1826">#1826</a> from github/henrymercer/increase-reserved-scaling-fa...</li>
<li><a href="2203178090"><code>2203178</code></a> Increase scaling factor for reserved RAM to 5%</li>
<li>Additional commits viewable in <a href="0ba4244466...5b6282e01c">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github/codeql-action&package-manager=github_actions&previous-version=2.21.2&new-version=2.21.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
This wraps up the platform view improvements discussed in https://github.com/flutter/flutter/issues/127030.
- Splits `HtmlElementView` into 2 files that are conditionally imported.
- The non-web version can be instantiated but it throws if it ends up being built in a widget tree.
- Out-of-the-box view factories that create visible & invisible DOM elements given a `tagName` parameter.
- New `HtmlElementView.fromTagName()` constructor that uses the default factories to create DOM elements.
- Tests covering the new API.
Depends on https://github.com/flutter/engine/pull/43828
Fixes https://github.com/flutter/flutter/issues/127030
Fixes https://github.com/flutter/flutter/issues/59413
This relocates `mock_canvas.dart` and `recording_canvas.dart` from `flutter/test/rendering` to `flutter_test`.
The testing functionality afforded by mock_canvas should be available to everyone, not just the framework. :)
mock_canvas.dart needed a bit of cleanup - things like formatting and super parameters.
This adds a macrobenchmark representative of a real world application that uses SVG icons. The scenario of rasterizing complex paths that don't change over time does not seem to be covered by any other macrobenchmark and shows a significantly slower impeller performance compared to skia.
It's actually bit problematic to measure this because on A15 the CPU load with impeller is high enough to trigger CPU frequency change. So in order to get consistent reading I had to add a spinning background thread that would keep the CPU at highest frequency.
```objc
[NSThread detachNewThreadWithBlock:^{
while (true) {
pthread_yield_np();
}
}];
```
```bash
flutter drive --profile --local-engine=ios_profile -t test_driver/run_app.dart --driver test_driver/path_tessellation_static_perf_test.dart
```
| average_frame_build_time_millis |Time|
|--|--|
| Impeller | 0.46686524822695047 |
| Skia | 0.4625749999999999 |
| Skia - No RasterCache | 0.47173750000000086|
| average_frame_rasterizer_time_millis | Time |
|--|--|
| Impeller | 6.654328519855595 |
| Skia - Raster Cache | 0.2534123711340209 * |
| Skia - No RasterCache | 0.53424375 |
* Adding the `GeometryPainter` seems to have triggered the complexity threshold for raster cache.
<img alt="screenshot" width="320" src="https://github.com/flutter/flutter/assets/96958/7a2f9384-b512-477b-bffa-058d4d284a41"/>
Fixes https://github.com/flutter/flutter/issues/89939 and updates the look of the Android context menu to match API 34.
## The problem
Before this PR, setting `surface` in the color scheme caused the background color of the Android context menu to change, but it wasn't possible to change the text color.
```dart
MaterialApp(
theme: ThemeData(
// Using a dark theme made the context menu text color be white.
colorScheme: ThemeData.dark().colorScheme.copyWith(
// Setting the surface here worked.
surface: Colors.white,
// But there was no way to set the text color. This didn't work.
onSurface: Colors.black,
),
),
),
```
| Expected (after PR) | Actual (before PR) |
| --- | --- |
| <img width="239" alt="Screenshot 2023-08-07 at 11 45 37 AM" src="https://github.com/flutter/flutter/assets/389558/a9fb75e5-b6c3-4f8e-8c59-2021780c44a7"> | <img width="250" alt="Screenshot 2023-08-07 at 11 51 10 AM" src="https://github.com/flutter/flutter/assets/389558/a5abd2d2-49bb-47a0-836f-864d56af2f58"> |
## Other examples
<table>
<tr>
<th>Scenario</th>
<th>Result</th>
</tr>
<tr>
<td>
```dart
MaterialApp(
theme: ThemeData(
colorScheme: ThemeData.light(),
),
...
),
```
</td>
<td>
<img width="244" alt="Screenshot 2023-08-07 at 11 42 05 AM" src="https://github.com/flutter/flutter/assets/389558/74c6870b-5ff7-4b1a-9e0c-b2bb4809ef1e">
</td>
</tr>
<tr>
<td>
```dart
MaterialApp(
theme: ThemeData(
colorScheme: ThemeData.dark(),
),
...
),
```
</td>
<td>
<img width="239" alt="Screenshot 2023-08-07 at 11 42 23 AM" src="https://github.com/flutter/flutter/assets/389558/91fe32f8-bd62-4d9b-96e8-ae5a9a769745">
</td>
</tr>
<tr>
<td>
```dart
MaterialApp(
theme: ThemeData(
colorScheme: ThemeData.light().colorScheme.copyWith(
surface: Colors.blue,
onSurface: Colors.red,
),
),
...
),
```
</td>
<td>
<img width="240" alt="Screenshot 2023-08-07 at 11 43 06 AM" src="https://github.com/flutter/flutter/assets/389558/e5752f8b-3738-4391-9055-15c38bd4af21">
</td>
</tr>
<tr>
<td>
```dart
MaterialApp(
theme: ThemeData(
colorScheme: ThemeData.light().colorScheme.copyWith(
surface: Colors.blue,
onSurface: Colors.red,
),
),
...
),
```
</td>
<td>
<img width="244" alt="Screenshot 2023-08-07 at 11 42 47 AM" src="https://github.com/flutter/flutter/assets/389558/68cc68f0-b338-4d94-8810-d8e46fb1e48e">
</td>
</tr>
</table>
This is a follow up to the following pull requests:
- https://github.com/flutter/flutter/pull/124514
I was finally able to reproduce this bug and found out why it was happening. Consider this code:
```dart
GestureDetector(
behavior: HitTestBehavior.translucent,
// Note: Make sure onTap is not null to ensure events
// are captured by `GestureDetector`
onTap: () {},
child: _shouldShowSlider
? Slider(value: _value, onChanged: _handleSlide)
: const SizedBox.shrink().
)
```
Runtime exception happens when:
1. User taps and holds the Slider (drag callback captured by `GestureDetector`)
2. `_shouldShowSlider` changes to false, Slider disappears and unmounts, and unregisters `_handleSlide`. But the callback is still registered by `GestureDetector`
3. Users moves finger as if Slider were still there
4. Drag callback is invoked, `_SliderState.showValueIndicator` is called
5. Exception - Slider is already disposed
This pull request fixes it by adding a mounted check inside `_SliderState.showValueIndicator` to ensure the Slider is actually mounted at the time of invoking drag event callback. I've added a unit test that will fail without this change.
The error stack trace is:
```
The following assertion was thrown while handling a gesture:
This widget has been unmounted, so the State no longer has a context (and should be considered
defunct).
Consider canceling any active work during "dispose" or using the "mounted" getter to determine if
the State is still active.
When the exception was thrown, this was the stack:
#0 State.context.<anonymous closure> (package:flutter/src/widgets/framework.dart:950:9)
#1 State.context (package:flutter/src/widgets/framework.dart:956:6)
#2 _SliderState.showValueIndicator (package:flutter/src/material/slider.dart:968:18)
#3 _RenderSlider._startInteraction (package:flutter/src/material/slider.dart:1487:12)
#4 _RenderSlider._handleDragStart (package:flutter/src/material/slider.dart:1541:5)
#5 DragGestureRecognizer._checkStart.<anonymous closure> (package:flutter/src/gestures/monodrag.dart:531:53)
#6 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:275:24)
#7 DragGestureRecognizer._checkStart (package:flutter/src/gestures/monodrag.dart:531:7)
#8 DragGestureRecognizer._checkDrag (package:flutter/src/gestures/monodrag.dart:498:5)
#9 DragGestureRecognizer.acceptGesture (package:flutter/src/gestures/monodrag.dart:431:7)
#10 _CombiningGestureArenaMember.acceptGesture (package:flutter/src/gestures/team.dart:45:14)
#11 GestureArenaManager._resolveInFavorOf (package:flutter/src/gestures/arena.dart:281:12)
#12 GestureArenaManager._resolve (package:flutter/src/gestures/arena.dart:239:9)
#13 GestureArenaEntry.resolve (package:flutter/src/gestures/arena.dart:53:12)
#14 _CombiningGestureArenaMember._resolve (package:flutter/src/gestures/team.dart:85:15)
#15 _CombiningGestureArenaEntry.resolve (package:flutter/src/gestures/team.dart:19:15)
#16 OneSequenceGestureRecognizer.resolve (package:flutter/src/gestures/recognizer.dart:375:13)
#17 DragGestureRecognizer.handleEvent (package:flutter/src/gestures/monodrag.dart:414:13)
#18 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:98:12)
#19 PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:143:9)
#20 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:625:13)
#21 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:141:18)
#22 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:127:7)
#23 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:488:19)
#24 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:468:22)
#25 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:439:11)
#26 GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:413:7)
#27 GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:376:5)
#28 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:323:7)
#29 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:292:9)
#30 _invoke1 (dart:ui/hooks.dart:186:13)
#31 PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:433:7)
#32 _dispatchPointerDataPacket (dart:ui/hooks.dart:119:31)
Handler: "onStart"
Recognizer:
HorizontalDragGestureRecognizer#a5df2
```
*List which issues are fixed by this PR. You must list at least one issue.*
Internal bug: b/273666179, b/192329942
*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*