-
Notifications
You must be signed in to change notification settings - Fork 6k
expose max depth on Window #10414
expose max depth on Window #10414
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
// Platforms that do not explicitly set a depth will use this value, which | ||
// avoids the need to special case logic that wants to check the max depth on | ||
// the Dart side. | ||
static const double kUnsetDepth = 1.7976931348623157e+308; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Nothing to resolve) I'm a little concerned about if this could ever be potentially larger than std::numeric_limits<double>::max()
, and what would happen if it was. I'm not sure if that's an actual practical problem that we would expect to see sometimes or not though. From some cursory investigation it looks like it should be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would that not result in a compilation error?
This number is actually smaller than what a 64 bit double should be able to hold from what I can tell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would make sense to me, but I think it's undefined behavior and compiler dependent. In some cases I'm pretty sure it'll get silently truncated to whatever will fit. From what I could track down this should be fine going by the IEEE 754 standard for 64 bit types, which is "usually" how double is implemented in C++. So it's most likely good.
Edit: this sums it up well: https://stackoverflow.com/a/34295021.
lib/ui/window.dart
Outdated
/// The physical depth is the maximum elevation that the Window allows. | ||
/// | ||
/// Physical layers drawn at or above this elevation will have their elevation | ||
/// clamped to this value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Do you think it's worth mentioning that elevation is cumulative, and that's what's going to be considered instead of what's actually set on a particular entity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a line - does that sound right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
If flutter/flutter#37417 can land, I'd like to land this after that one, so it won't require a manual roll. |
/// do not specify a maximum elevation. | ||
double get physicalDepth => _physicalDepth; | ||
double _physicalDepth = double.maxFinite; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it worth mentioning that this only does anything on fuchsia today? I can imagine an Android developer arriving here and being very confused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
git@github.com:flutter/engine.git/compare/960501721b23...63b253d git log 9605017..63b253d --no-merges --oneline 2019-08-03 dnfield@google.com expose max depth on Window (flutter/engine#10414) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (franciscojma@google.com), and stop the roller if necessary.
Exposes max depth on Window. Currently, this value is dropped when updating the viewport metrics.
Also changes the C++ side default to the value of dart:core's double.maxFinite, which will allow platforms that do not expose this concept to work a bit better with code that wants to check it.
Fixes flutter/flutter#33853
This will break framework tests, which rely on being able to implement Window. It will require a manual roll.