A version of aura::Window::GetBoundsInRootWindow that doesn't apply transform? (or new one which does) |
|
Issue descriptionCurrentl window->GetBoundsInXxx returns the bounds whose origin is transformed (if any) [1], which may not work in typical usage and can cause a bug like crbug.com/800488 . For example, the following code: bounds = window->GetBoundsInRootScreen(); window->SetBoundsInScreen(bounds, <same_display>); can move the window, which may not be intuitive. My guess is that most usage would expect the bounds without transform applied is expected, and if that's the case, we may want to have a separate method/function to get the bounds whose origin is transformed. sky, jamescook@, WDYT? [1] https://cs.chromium.org/chromium/src/ui/aura/window.cc?rcl=b63dab27c02c3c30b4a08d98e23e06e0b59e16ba&l=473 https://cs.chromium.org/chromium/src/ui/compositor/layer.cc?rcl=b63dab27c02c3c30b4a08d98e23e06e0b59e16ba&l=1083
,
Feb 28 2018
I don't have a strong opinion. I would not expect the code snippet in the description to move the window. If the most common case is no-transform, I would be OK with GetBoundsInScreen() and GetBoundsInScreenTransformed(). If there's a lot of use of both cases, then sky's suggestion of Transformed/Untransformed makes sense to me. Either way it would be useful to have comments explaining with some examples of when a transform might exist.
,
Feb 28 2018
> I know event dispatch certainly wants transformed bounds. Event dispatch transform the event location but not the bounds. This only transform the origin, so event dispatching can't use this (and gfx:Rect can't always be transform to gfx::Rect, say rotated 45deg) This is the reason why I wonder if this is really useful. As a first step, I'll try CL on bots to see how many *tests* depends on this behavior.
,
Mar 2 2018
One correction in my example: SetBoundsInScreen applies the transform before setting the bounds, so that example actually works, because both path (get/set) does same transform only to the origin. What didn't work in my testing was Window::SetBounds() with assumption that parent's origin is same as root. This still have a issue, as we may save this bounds with transform, then reapply later without transform. I'll run test next week. |
|
►
Sign in to add a comment |
|
Comment 1 by sky@chromium.org
, Feb 28 2018