Unverified Commit 34d84209 authored by Dan Field's avatar Dan Field Committed by GitHub

Avoid scheduling a forced frame when there is no child to the renderView (#102556)

parent bc7d3bbc
......@@ -235,10 +235,13 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
///
/// See [dart:ui.PlatformDispatcher.onMetricsChanged].
@protected
@visibleForTesting
void handleMetricsChanged() {
assert(renderView != null);
renderView.configuration = createViewConfiguration();
scheduleForcedFrame();
if (renderView.child != null) {
scheduleForcedFrame();
}
}
/// Called when the platform text scale factor changes.
......
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/rendering.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
test('handleMetricsChanged does not scheduleForcedFrame unless there is a child to the renderView', () async {
expect(SchedulerBinding.instance.hasScheduledFrame, false);
RendererBinding.instance.handleMetricsChanged();
expect(SchedulerBinding.instance.hasScheduledFrame, false);
RendererBinding.instance.renderView.child = RenderLimitedBox();
RendererBinding.instance.handleMetricsChanged();
expect(SchedulerBinding.instance.hasScheduledFrame, true);
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment