Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove physical geometry #47825

Merged
merged 4 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ui/hooks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ _ViewConfiguration _buildViewConfiguration(
) {
return _ViewConfiguration(
devicePixelRatio: devicePixelRatio,
geometry: Rect.fromLTWH(0.0, 0.0, width, height),
size: Size(width, height),
viewPadding: ViewPadding._(
top: viewPaddingTop,
right: viewPaddingRight,
Expand Down
9 changes: 4 additions & 5 deletions lib/ui/platform_dispatcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1462,7 +1462,7 @@ class _PlatformConfiguration {
class _ViewConfiguration {
const _ViewConfiguration({
this.devicePixelRatio = 1.0,
this.geometry = Rect.zero,
this.size = Size.zero,
this.viewInsets = ViewPadding.zero,
this.viewPadding = ViewPadding.zero,
this.systemGestureInsets = ViewPadding.zero,
Expand All @@ -1479,9 +1479,8 @@ class _ViewConfiguration {
/// The pixel density of the output surface.
final double devicePixelRatio;

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

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

@override
String toString() {
return '$runtimeType[geometry: $geometry]';
return '$runtimeType[size: $size]';
}
}

Expand Down
23 changes: 1 addition & 22 deletions lib/ui/window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -138,25 +138,6 @@ class FlutterView {
/// The value here is equal to the value exposed on [display].
double get devicePixelRatio => _viewConfiguration.devicePixelRatio;

/// The dimensions and location of the rectangle into which the scene rendered
/// in this view will be drawn on the screen, in physical pixels.
///
/// When this changes, [PlatformDispatcher.onMetricsChanged] is called.
///
/// At startup, the size and location of the view may not be known before Dart
/// code runs. If this value is observed early in the application lifecycle,
/// it may report [Rect.zero].
///
/// This value does not take into account any on-screen keyboards or other
/// system UI. The [padding] and [viewInsets] properties provide a view into
/// how much of each side of the view may be obscured by system UI.
///
/// See also:
///
/// * [WidgetsBindingObserver], for a mechanism at the widgets layer to
/// observe when this value changes.
Rect get physicalGeometry => _viewConfiguration.geometry;

/// The dimensions of the rectangle into which the scene rendered in this view
/// will be drawn on the screen, in physical pixels.
///
Expand All @@ -179,11 +160,9 @@ class FlutterView {
///
/// See also:
///
/// * [physicalGeometry], which reports the location of the view as well as
/// its size.
/// * [WidgetsBindingObserver], for a mechanism at the widgets layer to
/// observe when this value changes.
Size get physicalSize => _viewConfiguration.geometry.size;
Size get physicalSize => _viewConfiguration.size;

/// The number of physical pixels on each side of the display rectangle into
/// which the view can render, but over which the operating system will likely
Expand Down
6 changes: 1 addition & 5 deletions lib/web_ui/lib/src/engine/platform_dispatcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,6 @@ class ViewConfiguration {
const ViewConfiguration({
this.view,
this.devicePixelRatio = 1.0,
this.geometry = ui.Rect.zero,
this.visible = false,
this.viewInsets = ui.ViewPadding.zero as ViewPadding,
this.viewPadding = ui.ViewPadding.zero as ViewPadding,
Expand All @@ -1353,7 +1352,6 @@ class ViewConfiguration {
ViewConfiguration copyWith({
EngineFlutterView? view,
double? devicePixelRatio,
ui.Rect? geometry,
bool? visible,
ViewPadding? viewInsets,
ViewPadding? viewPadding,
Expand All @@ -1365,7 +1363,6 @@ class ViewConfiguration {
return ViewConfiguration(
view: view ?? this.view,
devicePixelRatio: devicePixelRatio ?? this.devicePixelRatio,
geometry: geometry ?? this.geometry,
visible: visible ?? this.visible,
viewInsets: viewInsets ?? this.viewInsets,
viewPadding: viewPadding ?? this.viewPadding,
Expand All @@ -1378,7 +1375,6 @@ class ViewConfiguration {

final EngineFlutterView? view;
final double devicePixelRatio;
final ui.Rect geometry;
final bool visible;
final ViewPadding viewInsets;
final ViewPadding viewPadding;
Expand All @@ -1389,7 +1385,7 @@ class ViewConfiguration {

@override
String toString() {
return '$runtimeType[view: $view, geometry: $geometry]';
return '$runtimeType[view: $view]';
}
}

Expand Down
3 changes: 0 additions & 3 deletions lib/web_ui/lib/src/engine/window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ base class EngineFlutterView implements ui.FlutterView {
late final PlatformViewMessageHandler platformViewMessageHandler =
PlatformViewMessageHandler(platformViewsContainer: dom.platformViewsHost);

@override
ui.Rect get physicalGeometry => _viewConfiguration.geometry;

@override
ui.Size get physicalSize {
if (_physicalSize == null) {
Expand Down
1 change: 0 additions & 1 deletion lib/web_ui/lib/window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ abstract class FlutterView {
PlatformDispatcher get platformDispatcher;
int get viewId;
double get devicePixelRatio;
Rect get physicalGeometry;
Size get physicalSize;
ViewPadding get viewInsets;
ViewPadding get viewPadding;
Expand Down
2 changes: 1 addition & 1 deletion shell/common/fixtures/shell_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ List<int> getCurrentViewWidths() {
final List<int> result = <int>[];
for (final FlutterView view in PlatformDispatcher.instance.views) {
result.add(view.viewId);
result.add(view.physicalGeometry.width.round());
result.add(view.physicalSize.width.round());
}
return result;
}
Expand Down