New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 623277 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Jun 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Feature



Sign in to add a comment

TopControls height is overly plumbed/complex

Project Member Reported by danakj@chromium.org, Jun 25 2016

Issue description

- It's set in the ChromeFullscreenManager.java's constructor, and doesn't change. So it's a constant.
- CompositorViewHolder.java also can give a different size, but it uses the one from ChromeFullscreenManager.java unless it has a null pointer, then it uses 0.
- The browser divides the size by the DSF to get a value in DIP.
- We send it to the renderer in every resize instead of sending it when the renderer (or even the view) is constructed/initialized.
- From there it goes into blink via eventually WebViewImpl::resizeWithTopControls.
- From there-after it's a constant in blink, but it is repeatedly passed back to WebViewImpl::resizeWithTopControls from WebViewImpl::resize as if it can be changing.
- From WebViewImpl, it goes to the compositor (why did it go through blink to do that. does blink even use it? unclear!). We could send it from the RenderWidget to the compositor directly at startup (as a setting maybe?)
- In the compositor we have a number in DIP, so we have to multiply by the DSF of the renderer to get back the number from ChromeFullscreenManager. If they didn't match (moving renderers between external/dual screens, the dream) then it will be a different number, but one that represents the right intention, I think. Probably there will be rounding problems.

 

Comment 1 by danakj@chromium.org, Jun 25 2016

Cc: vmi...@chromium.org
Labels: -Type-Bug Type-Feature
I ran into this cuz I wanted to know the top controls height for computing a tile size via https://bugs.chromium.org/p/chromium/issues/detail?id=622885. I wanted a stable number that wouldn't change, which it turns out this number is. But it was really fun figuring out that was the case, and I see we pass it around a lot more than we should. Which means it could actually change dynamically one day given the current system, but that'd be weird and probably not intentional and would break using it for tile size.

Comment 2 by aelias@chromium.org, Jun 25 2016

It is intentional.  iOS Safari has a dynamically changing top controls height and we wanted to leave open the possibility of doing the same thing.  Secondly there are scenarios like devtools emulation where it may be more dynamic.  And I don't think plumbing a constant instead of a variable would be significantly less code.

I agree the DIP backconversion is a problem but the rest is fine.

Comment 3 by aelias@chromium.org, Jun 25 2016

I recommend making tile size independent of top controls height (always use the size assuming that top controls are hidden) It's quite important for it to match width exactly, but because most pages scroll vertically, a small mismatch there doesn't matter as long as it's stable over time.

Comment 4 by danakj@chromium.org, Jun 25 2016

Oh, huh. Do you know offhand if the viewport size has the top controls removed from it?

Comment 5 by danakj@chromium.org, Jun 25 2016

> would be significantly less code.

I agree, but it would be a lot easier to reason about given that it doesn't change. But I guess it's meant to change so it's meant to be thought of that way.

Comment 6 by aelias@chromium.org, Jun 25 2016

Cc: bokan@chromium.org
> Oh, huh. Do you know offhand if the viewport size has the top controls removed from it?

It depends.  That is also dynamically specified as part of ResizeParams:

  // Whether or not Blink's viewport size should be shrunk by the height of the
  // URL-bar (always false on platforms where URL-bar hiding isn't supported).
  bool top_controls_shrink_blink_size;


I realize this also may strike you as overcomplicated but we didn't add the complexity casually.  It's more that the problem is more complicated than one's initial intuition of it.

Comment 7 by danakj@chromium.org, Jun 25 2016

Ya, I was trying to find a way to get a "screen size" that will be stable so that we don't make new tiles every time the top controls changes. How would you recommend doing it? Is there some max size that top controls can be somewhere?

Comment 8 by danakj@chromium.org, Jun 25 2016

Hm, I was trying to find an easier way than giving a "screen size" to the LayerTreeHost, with the intention to do that eventually.

Maybe I need to do that in the same patch tho.

Comment 9 by aelias@chromium.org, Jun 25 2016

Hmm, I had to look it up a bit.  Unfortunately, physical_backing_size_/device_viewport_size is not stable.

There are two reasonable ways to get a stable viewport size in physical pixels:
1) OutputSurface::SurfaceSize()
2) (viewport_size + top_controls_shrink_blink_size ? top_controls_height : 0) * device_scale_factor

I actually propose that you take the intersection (min) of those two sizes.  The reason is WebView.  WebView can have the viewport (Android View size) either much larger or much smaller than the OutputSurface size (GL framebuffer size).  Taking the smaller of the two will solve  http://crbug.com/472813  while avoiding introducing the inverse problem for tiny WebViews.
Status: WontFix (was: Available)
Ok thanks for all the info and help. I'll port this over to 622885.

Sign in to add a comment