Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
more
  • Loading branch information
dnfield committed May 24, 2022
commit af74e16a7bbc2aca746007246497792e0c280d8a
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ mixin RenderVisibilityDetectorBase on RenderObject {

static void forget(Key key) {
_updates.remove(key);
_lastVisibility.remove(key);

if (_updates.isEmpty) {
_timer?.cancel();
Expand Down Expand Up @@ -109,14 +110,13 @@ mixin RenderVisibilityDetectorBase on RenderObject {
// Remove all cached data so that we won't fire visibility callbacks when
// a timer expires or get stale old information the next time around.
forget(key);
_lastVisibility.remove(key);
} else {
markNeedsPaint();
// If an update is happening and some ancestor no longer paints this RO,
// the markNeedsPaint above will never cause the composition callback to
// fire and we could miss a hide event. This schedule will get
// over-written by subsequent updates in paint, if paint is called.
_scheduleUpdate(null);
_scheduleUpdate();
}
}

Expand All @@ -125,7 +125,7 @@ mixin RenderVisibilityDetectorBase on RenderObject {
/// The number of times the schedule update callback has been invoked from
/// [Layer.addCompositionCallback].
///
/// This is used for testing, and always returns 0 outside of debug mode.
/// This is used for testing, and always returns null outside of debug mode.
@visibleForTesting
int? get debugScheduleUpdateCount {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type as non-nullable int? (or make it return null in non-debug mode?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

if (kDebugMode) {
Expand All @@ -134,7 +134,7 @@ mixin RenderVisibilityDetectorBase on RenderObject {
return null;
}

void _scheduleUpdate(ContainerLayer? layer) {
void _scheduleUpdate([ContainerLayer? layer]) {
if (kDebugMode) {
_debugScheduleUpdateCount += 1;
}
Expand Down