Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit ff13610

Browse files
authored
Remove physical geometry (#47825)
Looks like this was proactively added in #20496, but never wired up to anything on any platform. It is also unused in framework and customer code; we never exposed this on e.g. MediaQuery. Related framework PR: flutter/flutter#138103 (Checks will fail until that PR is submitted).
1 parent 05a25f4 commit ff13610

File tree

7 files changed

+8
-38
lines changed

7 files changed

+8
-38
lines changed

lib/ui/hooks.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ _ViewConfiguration _buildViewConfiguration(
135135
) {
136136
return _ViewConfiguration(
137137
devicePixelRatio: devicePixelRatio,
138-
geometry: Rect.fromLTWH(0.0, 0.0, width, height),
138+
size: Size(width, height),
139139
viewPadding: ViewPadding._(
140140
top: viewPaddingTop,
141141
right: viewPaddingRight,

lib/ui/platform_dispatcher.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,7 +1462,7 @@ class _PlatformConfiguration {
14621462
class _ViewConfiguration {
14631463
const _ViewConfiguration({
14641464
this.devicePixelRatio = 1.0,
1465-
this.geometry = Rect.zero,
1465+
this.size = Size.zero,
14661466
this.viewInsets = ViewPadding.zero,
14671467
this.viewPadding = ViewPadding.zero,
14681468
this.systemGestureInsets = ViewPadding.zero,
@@ -1479,9 +1479,8 @@ class _ViewConfiguration {
14791479
/// The pixel density of the output surface.
14801480
final double devicePixelRatio;
14811481

1482-
/// The geometry requested for the view on the screen or within its parent
1483-
/// window, in logical pixels.
1484-
final Rect geometry;
1482+
/// The size requested for the view in logical pixels.
1483+
final Size size;
14851484

14861485
/// The number of physical pixels on each side of the display rectangle into
14871486
/// which the view can render, but over which the operating system will likely
@@ -1551,7 +1550,7 @@ class _ViewConfiguration {
15511550

15521551
@override
15531552
String toString() {
1554-
return '$runtimeType[geometry: $geometry]';
1553+
return '$runtimeType[size: $size]';
15551554
}
15561555
}
15571556

lib/ui/window.dart

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -138,25 +138,6 @@ class FlutterView {
138138
/// The value here is equal to the value exposed on [display].
139139
double get devicePixelRatio => _viewConfiguration.devicePixelRatio;
140140

141-
/// The dimensions and location of the rectangle into which the scene rendered
142-
/// in this view will be drawn on the screen, in physical pixels.
143-
///
144-
/// When this changes, [PlatformDispatcher.onMetricsChanged] is called.
145-
///
146-
/// At startup, the size and location of the view may not be known before Dart
147-
/// code runs. If this value is observed early in the application lifecycle,
148-
/// it may report [Rect.zero].
149-
///
150-
/// This value does not take into account any on-screen keyboards or other
151-
/// system UI. The [padding] and [viewInsets] properties provide a view into
152-
/// how much of each side of the view may be obscured by system UI.
153-
///
154-
/// See also:
155-
///
156-
/// * [WidgetsBindingObserver], for a mechanism at the widgets layer to
157-
/// observe when this value changes.
158-
Rect get physicalGeometry => _viewConfiguration.geometry;
159-
160141
/// The dimensions of the rectangle into which the scene rendered in this view
161142
/// will be drawn on the screen, in physical pixels.
162143
///
@@ -179,11 +160,9 @@ class FlutterView {
179160
///
180161
/// See also:
181162
///
182-
/// * [physicalGeometry], which reports the location of the view as well as
183-
/// its size.
184163
/// * [WidgetsBindingObserver], for a mechanism at the widgets layer to
185164
/// observe when this value changes.
186-
Size get physicalSize => _viewConfiguration.geometry.size;
165+
Size get physicalSize => _viewConfiguration.size;
187166

188167
/// The number of physical pixels on each side of the display rectangle into
189168
/// which the view can render, but over which the operating system will likely

lib/web_ui/lib/src/engine/platform_dispatcher.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,7 +1340,6 @@ class ViewConfiguration {
13401340
const ViewConfiguration({
13411341
this.view,
13421342
this.devicePixelRatio = 1.0,
1343-
this.geometry = ui.Rect.zero,
13441343
this.visible = false,
13451344
this.viewInsets = ui.ViewPadding.zero as ViewPadding,
13461345
this.viewPadding = ui.ViewPadding.zero as ViewPadding,
@@ -1353,7 +1352,6 @@ class ViewConfiguration {
13531352
ViewConfiguration copyWith({
13541353
EngineFlutterView? view,
13551354
double? devicePixelRatio,
1356-
ui.Rect? geometry,
13571355
bool? visible,
13581356
ViewPadding? viewInsets,
13591357
ViewPadding? viewPadding,
@@ -1365,7 +1363,6 @@ class ViewConfiguration {
13651363
return ViewConfiguration(
13661364
view: view ?? this.view,
13671365
devicePixelRatio: devicePixelRatio ?? this.devicePixelRatio,
1368-
geometry: geometry ?? this.geometry,
13691366
visible: visible ?? this.visible,
13701367
viewInsets: viewInsets ?? this.viewInsets,
13711368
viewPadding: viewPadding ?? this.viewPadding,
@@ -1378,7 +1375,6 @@ class ViewConfiguration {
13781375

13791376
final EngineFlutterView? view;
13801377
final double devicePixelRatio;
1381-
final ui.Rect geometry;
13821378
final bool visible;
13831379
final ViewPadding viewInsets;
13841380
final ViewPadding viewPadding;
@@ -1389,7 +1385,7 @@ class ViewConfiguration {
13891385

13901386
@override
13911387
String toString() {
1392-
return '$runtimeType[view: $view, geometry: $geometry]';
1388+
return '$runtimeType[view: $view]';
13931389
}
13941390
}
13951391

lib/web_ui/lib/src/engine/window.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ base class EngineFlutterView implements ui.FlutterView {
7373
late final PlatformViewMessageHandler platformViewMessageHandler =
7474
PlatformViewMessageHandler(platformViewsContainer: dom.platformViewsHost);
7575

76-
@override
77-
ui.Rect get physicalGeometry => _viewConfiguration.geometry;
78-
7976
@override
8077
ui.Size get physicalSize {
8178
if (_physicalSize == null) {

lib/web_ui/lib/window.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ abstract class FlutterView {
1515
PlatformDispatcher get platformDispatcher;
1616
int get viewId;
1717
double get devicePixelRatio;
18-
Rect get physicalGeometry;
1918
Size get physicalSize;
2019
ViewPadding get viewInsets;
2120
ViewPadding get viewPadding;

shell/common/fixtures/shell_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ List<int> getCurrentViewWidths() {
530530
final List<int> result = <int>[];
531531
for (final FlutterView view in PlatformDispatcher.instance.views) {
532532
result.add(view.viewId);
533-
result.add(view.physicalGeometry.width.round());
533+
result.add(view.physicalSize.width.round());
534534
}
535535
return result;
536536
}

0 commit comments

Comments
 (0)