Commit Graph

18 Commits

Author SHA1 Message Date
Michael Goderbauer
4534a24c09
Reapply "Dynamic view sizing" (#140165) (#140918)
This reverts commit
d24c01bd0c.

The original change was reverted because it caused some apps to get
stuck on the splash screen on some phones.

An investigation determined that this was due to a rounding error.
Example: The device reports a physical size of 1008.0 x 2198.0 with a
dpr of 1.912500023841858. Flutter would translate that to a logical size
of 527.0588169589221 x 1149.2810314243163 and use that as the input for
its layout algorithm. Since the constraints here are tight, the layout
algorithm would determine that the resulting logical size of the root
render object must be 527.0588169589221 x 1149.2810314243163.
Translating this back to physical pixels by applying the dpr resulted in
a physical size of 1007.9999999999999 x 2198.0 for the frame. Android
now rejected that frame because it didn't match the expected size of
1008.0 x 2198.0 and since no frame had been rendered would never take
down the splash screen.

Prior to dynamically sized views, this wasn't an issue because we would
hard-code the frame size to whatever the requested size was.

Changes in this PR over the original PR:

* The issue has been fixed now by constraining the calculated physical
size to the input physical constraints which makes sure that we always
end up with a size that is acceptable to the operating system.
* The `ViewConfiguration` was refactored to use the slightly more
convenient `BoxConstraints` over the `ViewConstraints` to represent
constraints. Both essentially represent the same thing, but
`BoxConstraints` are more powerful and we avoid a couple of translations
between the two by translating the` ViewConstraints` from the
`FlutterView` to `BoxConstraints` directly when the `ViewConfiguration`
is created.

All changes over the original PR are contained in the second commit of
this PR.

Fixes b/316813075
Part of https://github.com/flutter/flutter/issues/134501.
2024-01-09 14:10:43 -08:00
Bartek Pacia
8c02a22403
Use SemanticsUpdateBuilder again, remove all references to temporary SemanticsUpdateBuilderNew (#139942)
This PR removes all usages of the temporary `SemanticsUpdateBuilderNew` API in favor of `SemanticsUpdateBuilder`. These two APIs are the same as of now.

This is mainly targeted at https://github.com/flutter/flutter/issues/17988

Steps:
part 1: [engine] add `SemanticsUpdateBuilderNew` https://github.com/flutter/engine/pull/47961
part 2: [flutter] use `SemanticsUpdateBuilderNew` https://github.com/flutter/flutter/pull/138331
part 3: [engine] update `SemanticsUpdateBuilder` to be the same as `SemanticsUpdateBuilderNew` https://github.com/flutter/engine/pull/48882
**part 4: [flutter] use (now updated) `SemanticsUpdateBuilder` again** <-- we are here
part 5: [engine] remove `SemanticsBuilderNew`
2023-12-16 15:23:24 +00:00
Lau Ching Jun
d24c01bd0c
Revert "Dynamic view sizing" (#140165)
Reverts flutter/flutter#138648

This caused the app to be stuck in the splash screen on certain phone models.

Context: b/316244317
2023-12-14 19:42:06 +00:00
Bartek Pacia
948523b80c
Add accessibility identifier to SemanticsProperties (#138331)
This PR adds `String? identifier` to `Semantics` and `SemanticsProperties`. The `identifier` will be exposed on Android as `resource-id` and on iOS as `accessibilityIdentifier`.

Mainly targeted at #17988

Initial Engine PR with Android support: https://github.com/flutter/engine/pull/47961
iOS Engine PR: https://github.com/flutter/engine/pull/48858

### Migration

This change breaks the SemanticsUpdateBuilder API which is on the Framework<-->Engine border. For more details see [engine PR](https://github.com/flutter/engine/pull/47961).

Steps:
part 1: [engine] add `SemanticsUpdateBuilderNew` https://github.com/flutter/engine/pull/47961
**part 2: [flutter] use `SemanticsUpdateBuilderNew`**  <-- we are here
part 3: [engine] update `SemanticsUpdateBuilder` to be the same as `SemanticsUpdateBuilderNew`*
part 4: [flutter] use (now updated) `SemanticsUpdateBuilder` again.
part 5: [engine] remove `SemanticsBuilderNew`
2023-12-11 18:03:07 +00:00
Michael Goderbauer
4f8a99147a
Dynamic view sizing (#138648)
Towards https://github.com/flutter/flutter/issues/134501.

This change is based on https://github.com/flutter/engine/pull/48090. It changes the `RenderView` to be dynamically sized based on its content if the `FlutterView` it is configured with allows it (i.e. the `FlutterView` has loose `FlutterView.physicalConstraints`). For that, it uses those `physicalConstraints` as input to the layout algorithm by passing them on to its child (after translating them to logical constraints via the device pixel ratio). The resulting `Size` that the `RenderView` would like to be is then communicated back to the engine by passing it to the `FlutterView.render` call.

Tests will fail until https://github.com/flutter/engine/pull/48090 has rolled into the framework.
2023-11-29 20:45:18 +00:00
Michael Goderbauer
bf5d2b875f
Prepare for dynamically sized views (#138565)
Towards https://github.com/flutter/flutter/issues/134501.

Required to roll https://github.com/flutter/engine/pull/48090 into the framework.

**DO NOT SUBMIT until https://github.com/flutter/flutter/pull/138648 and https://github.com/flutter/engine/pull/48090 are ready.**
2023-11-27 17:41:22 +00:00
Michael Goderbauer
1ef6e99867
Remove physicalGeometry (#138103)
Looks like this was proactively added in https://github.com/flutter/engine/pull/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 engine PR: https://github.com/flutter/engine/pull/47825
2023-11-08 21:43:59 +00:00
pdblasi-google
07f7ffde50
Adds TestDisplay API for testing Display features (#127525)
* Adds `TestDisplay`
* Updates `TestPlatformDispatcher` to wrap all `Display`s and relate them to their appropriate `TestFlutterView`
* Updates `TestFlutterView` to tie `devicePixelRatio` to its display as per the documentation on `Display`

Closes #127225
2023-05-26 00:04:05 +00:00
pdblasi-google
0ba64488da
Reland: Updates flutter/test/material to no longer use TestWindow (#122643)
Reland: Updates `flutter/test/material` to no longer use `TestWindow`
2023-03-15 00:08:18 +00:00
yaakovschectman
46a8106781
Revert "Updates flutter/test/material to no longer use TestWindow (#122337)" (#122636)
This reverts commit b2fc5f9770.
2023-03-14 17:34:33 -04:00
pdblasi-google
b2fc5f9770
Updates flutter/test/material to no longer use TestWindow (#122337)
Updates `flutter/test/material` to no longer use `TestWindow`
2023-03-14 21:13:05 +00:00
pdblasi-google
7dd53fefe9
Reland (3): Removes single window assumptions from flutter_test (#122422)
Reland (3): Removes single window assumptions from `flutter_test`
2023-03-13 21:50:24 +00:00
Casey Hillers
1f42612323
Revert PRs relating to single window assumption (#122369)
* Revert "Remove references to BindingBase.window (#122119)"

This reverts commit c7681f00cf.

* Revert "Remove another reference to BindingBase.window (#122341)"

This reverts commit 6ec4445063.

* Revert "Reland (2): Removes single window assumptions from `flutter_test` (#122233)"

This reverts commit eb3d317ea0.

* Revert "Remove single view assumption from TestViewConfiguration (#122352)"

This reverts commit 927289fb4e.

* Revert "Updates `flutter/test/cupertino` to no longer use `TestWindow` (#122325)"

This reverts commit 67e17e45f0.

* Revert "Updates `flutter/test/gestures` to no longer reference `TestWindow` (#122327)"

This reverts commit c2a5111cc0.

* Revert "Updates `flutter/test/rendering` to no longer use `TestWindow` (#122347)"

This reverts commit 28b65e089b.

* Revert "Updates `flutter_localizations/test` to stop using `TestWindow` (#122321)"

This reverts commit 01367d52d7.
2023-03-09 22:53:38 -08:00
pdblasi-google
eb3d317ea0
Reland (2): Removes single window assumptions from flutter_test (#122233)
Reland (2): Removes single window assumptions from `flutter_test`
2023-03-09 00:52:05 +00:00
Casey Hillers
0091601057
Revert "Reland: Removes single window assumptions from flutter_test (#122060)" (#122193)
Revert "Reland: Removes single window assumptions from `flutter_test`"
2023-03-08 19:42:03 +00:00
pdblasi-google
a626f4db6f
Reland: Removes single window assumptions from flutter_test (#122060)
Reland: Removes single window assumptions from `flutter_test`
2023-03-07 21:12:59 +00:00
pdblasi-google
a53105d941
Revert "Removes single window assumptions from flutter_test (#121549)" (#122037)
This reverts commit f2dd19d5b6.
2023-03-06 11:49:40 -08:00
pdblasi-google
f2dd19d5b6
Removes single window assumptions from flutter_test (#121549)
Removes single window assumptions from `flutter_test`
2023-03-06 18:38:14 +00:00