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

Conversation

dnfield
Copy link
Contributor

@dnfield dnfield commented Aug 1, 2019

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.

Copy link
Contributor

@mklim mklim left a 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;
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@mklim mklim Aug 1, 2019

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.

/// 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.
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG, thanks!

@dnfield dnfield requested a review from Piinks August 1, 2019 19:34
Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dnfield dnfield mentioned this pull request Aug 1, 2019
9 tasks
@dnfield
Copy link
Contributor Author

dnfield commented Aug 1, 2019

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;

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

@dnfield dnfield merged commit 63b253d into flutter:master Aug 3, 2019
@dnfield dnfield deleted the expose_z branch August 3, 2019 03:37
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 3, 2019
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Aug 3, 2019
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.
cfontas pushed a commit to cfontas/engine that referenced this pull request Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose scenic Z bounds to framework
6 participants