Skip to content

Commit

Permalink
Rename RenderView.window to RenderView.view (#124060)
Browse files Browse the repository at this point in the history
  • Loading branch information
goderbauer authored Apr 4, 2023
1 parent f9857df commit 25a2dfb
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 24 deletions.
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/rendering/binding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
_debugIsRenderViewInitialized = true;
return true;
}());
renderView = RenderView(configuration: createViewConfiguration(), window: platformDispatcher.implicitView!);
renderView = RenderView(configuration: createViewConfiguration(), view: platformDispatcher.implicitView!);
renderView.prepareInitialFrame();
}
bool _debugIsRenderViewInitialized = false;
Expand Down
20 changes: 10 additions & 10 deletions packages/flutter/lib/src/rendering/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
RenderView({
RenderBox? child,
required ViewConfiguration configuration,
required ui.FlutterView window,
required ui.FlutterView view,
}) : _configuration = configuration,
_window = window {
_view = view {
this.child = child;
}

Expand Down Expand Up @@ -99,7 +99,7 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
markNeedsLayout();
}

final ui.FlutterView _window;
final ui.FlutterView _view;

/// Whether Flutter should automatically compute the desired system UI.
///
Expand Down Expand Up @@ -234,7 +234,7 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
if (automaticSystemUiAdjustment) {
_updateSystemChrome();
}
_window.render(scene);
_view.render(scene);
scene.dispose();
assert(() {
if (debugRepaintRainbowEnabled || debugRepaintTextRainbowEnabled) {
Expand All @@ -255,7 +255,7 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
/// A [SemanticsUpdate] is produced by a [SemanticsOwner] during the
/// [EnginePhase.flushSemantics] phase.
void updateSemantics(ui.SemanticsUpdate update) {
_window.updateSemantics(update);
_view.updateSemantics(update);
}

void _updateSystemChrome() {
Expand Down Expand Up @@ -287,7 +287,7 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
bounds.center.dx,
// The vertical center of the system status bar. The system status bar
// height is kept as top window padding.
_window.padding.top / 2.0,
_view.padding.top / 2.0,
);
// Center of the navigation bar
final Offset bottom = Offset(
Expand All @@ -298,7 +298,7 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
// from the bottom because available pixels are in (0..bottom) range.
// I.e. for a device with 1920 height, bound.bottom is 1920, but the most
// bottom drawn pixel is at 1919 position.
bounds.bottom - 1.0 - _window.padding.bottom / 2.0,
bounds.bottom - 1.0 - _view.padding.bottom / 2.0,
);
final SystemUiOverlayStyle? upperOverlayStyle = layer!.find<SystemUiOverlayStyle>(top);
// Only android has a customizable system navigation bar.
Expand Down Expand Up @@ -374,10 +374,10 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
properties.add(DiagnosticsNode.message('debug mode enabled - ${kIsWeb ? 'Web' : Platform.operatingSystem}'));
return true;
}());
properties.add(DiagnosticsProperty<Size>('window size', _window.physicalSize, tooltip: 'in physical pixels'));
properties.add(DoubleProperty('device pixel ratio', _window.devicePixelRatio, tooltip: 'physical pixels per logical pixel'));
properties.add(DiagnosticsProperty<Size>('view size', _view.physicalSize, tooltip: 'in physical pixels'));
properties.add(DoubleProperty('device pixel ratio', _view.devicePixelRatio, tooltip: 'physical pixels per logical pixel'));
properties.add(DiagnosticsProperty<ViewConfiguration>('configuration', configuration, tooltip: 'in logical pixels'));
if (_window.platformDispatcher.semanticsEnabled) {
if (_view.platformDispatcher.semanticsEnabled) {
properties.add(DiagnosticsNode.message('semantics enabled'));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ void main() {
r'^'
r'RenderView#[0-9a-f]{5}\n'
r' debug mode enabled - [a-zA-Z]+\n'
r' window size: Size\(2400\.0, 1800\.0\) \(in physical pixels\)\n'
r' view size: Size\(2400\.0, 1800\.0\) \(in physical pixels\)\n'
r' device pixel ratio: 3\.0 \(physical pixels per logical pixel\)\n'
r' configuration: Size\(800\.0, 600\.0\) at 3\.0x \(in logical pixels\)\n'
r'$',
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter/test/rendering/independent_layout_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void main() {
expect(offscreen.child.hasSize, isFalse);
expect(offscreen.painted, isFalse);
// Attach the offscreen to a custom render view and owner
final RenderView renderView = RenderView(configuration: testConfiguration, window: RendererBinding.instance.platformDispatcher.views.single);
final RenderView renderView = RenderView(configuration: testConfiguration, view: RendererBinding.instance.platformDispatcher.views.single);
final PipelineOwner pipelineOwner = PipelineOwner();
renderView.attach(pipelineOwner);
renderView.child = offscreen.root;
Expand Down Expand Up @@ -75,7 +75,7 @@ void main() {
expect(offscreen.child.hasSize, isFalse);
expect(offscreen.painted, isFalse);
// Attach the offscreen to a custom render view and owner
final RenderView renderView = RenderView(configuration: testConfiguration, window: RendererBinding.instance.platformDispatcher.views.single);
final RenderView renderView = RenderView(configuration: testConfiguration, view: RendererBinding.instance.platformDispatcher.views.single);
final PipelineOwner pipelineOwner = PipelineOwner();
renderView.attach(pipelineOwner);
renderView.child = offscreen.root;
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter/test/rendering/layers_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ void main() {
test('switching layer link of an attached leader layer should not crash', () {
final LayerLink link = LayerLink();
final LeaderLayer leaderLayer = LeaderLayer(link: link);
final RenderView view = RenderView(configuration: const ViewConfiguration(), window: RendererBinding.instance.platformDispatcher.views.single);
final RenderView view = RenderView(configuration: const ViewConfiguration(), view: RendererBinding.instance.platformDispatcher.views.single);
leaderLayer.attach(view);
final LayerLink link2 = LayerLink();
leaderLayer.link = link2;
Expand All @@ -182,7 +182,7 @@ void main() {
final LayerLink link = LayerLink();
final LeaderLayer leaderLayer1 = LeaderLayer(link: link);
final LeaderLayer leaderLayer2 = LeaderLayer(link: link);
final RenderView view = RenderView(configuration: const ViewConfiguration(), window: RendererBinding.instance.platformDispatcher.views.single);
final RenderView view = RenderView(configuration: const ViewConfiguration(), view: RendererBinding.instance.platformDispatcher.views.single);
leaderLayer1.attach(view);
leaderLayer2.attach(view);
leaderLayer2.detach();
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter/test/rendering/view_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void main() {
test('does not replace the root layer unnecessarily', () {
final RenderView view = RenderView(
configuration: createViewConfiguration(),
window: RendererBinding.instance.platformDispatcher.views.single,
view: RendererBinding.instance.platformDispatcher.views.single,
);
final PipelineOwner owner = PipelineOwner();
view.attach(owner);
Expand All @@ -48,7 +48,7 @@ void main() {
test('does not replace the root layer unnecessarily when view resizes', () {
final RenderView view = RenderView(
configuration: createViewConfiguration(size: const Size(100.0, 100.0)),
window: RendererBinding.instance.platformDispatcher.views.single,
view: RendererBinding.instance.platformDispatcher.views.single,
);
final PipelineOwner owner = PipelineOwner();
view.attach(owner);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ class ScheduledFrameTrackingBindings extends AutomatedTestWidgetsFlutterBinding
}

class OffscreenRenderView extends RenderView {
OffscreenRenderView({required FlutterView view}) : super(
OffscreenRenderView({required super.view}) : super(
configuration: const ViewConfiguration(size: _kTestViewSize),
window: view,
);

@override
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter/test/widgets/keep_alive_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void main() {
expect(tester.binding.renderView.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes(
'RenderView#00000\n'
' │ debug mode enabled - ${Platform.operatingSystem}\n'
' │ window size: Size(2400.0, 1800.0) (in physical pixels)\n'
' │ view size: Size(2400.0, 1800.0) (in physical pixels)\n'
' │ device pixel ratio: 3.0 (physical pixels per logical pixel)\n'
' │ configuration: Size(800.0, 600.0) at 3.0x (in logical pixels)\n'
' │\n'
Expand Down Expand Up @@ -381,7 +381,7 @@ void main() {
expect(tester.binding.renderView.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes(
'RenderView#00000\n'
' │ debug mode enabled - ${Platform.operatingSystem}\n'
' │ window size: Size(2400.0, 1800.0) (in physical pixels)\n'
' │ view size: Size(2400.0, 1800.0) (in physical pixels)\n'
' │ device pixel ratio: 3.0 (physical pixels per logical pixel)\n'
' │ configuration: Size(800.0, 600.0) at 3.0x (in logical pixels)\n'
' │\n'
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter_test/lib/src/binding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1764,7 +1764,7 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
renderView = _LiveTestRenderView(
configuration: createViewConfiguration(),
onNeedPaint: _handleViewNeedsPaint,
window: platformDispatcher.implicitView!,
view: platformDispatcher.implicitView!,
);
renderView.prepareInitialFrame();
}
Expand Down Expand Up @@ -2063,7 +2063,7 @@ class _LiveTestRenderView extends RenderView {
_LiveTestRenderView({
required super.configuration,
required this.onNeedPaint,
required super.window,
required super.view,
});

@override
Expand Down

0 comments on commit 25a2dfb

Please sign in to comment.