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

Issue 713696 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Aug 13
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug

Blocked on:
issue 810213

Blocking:
issue 732555
issue 696199
issue 801350



Sign in to add a comment

Handle Touch Selection Handles for Surface Sync / Viz on Android

Project Member Reported by samans@chromium.org, Apr 20 2017

Issue description

Currently the renderer notifies the browser about the selected area using CompositorFrameMetadata::selection and then the Android browser places the touch selection handles accordingly. In order to keep the renderer and browser in sync, the renderer allocates a new LocalSurfaceId when |selection| changes so that the browser doesn't fall behind in updating the location of touch selection handles. Since the browser will do the LocalSurfaceId allocation for the renderer after we have surface sync, this is not desirable. The IPC round trip to browser to allocate a new LocalSurfaceId can significantly affect performance, and it should be noted that |selection| is calculated on the impl thread, so the IPC overhead affects the impl thread as opposed to main thread which is worse. We probably need a similar solution to  crbug.com/689754 : the renderer should embed the touch selection handles instead of the browser. It can either create them itself or the browser can draw them and pass the SurfaceId to renderer to embed. This will unblock surface sync on Android and can potentially have additional performance wins because the browser won't have to generate a new CompositorFrame if the renderer embeds touch handle selection directly.
 

Comment 1 by samans@chromium.org, Apr 20 2017

Blocking: 672962
Blocking: 601863
Cc: rjkroege@chromium.org aelias@chromium.org boliu@chromium.org
+aelias@, boliu@: Chrome for Android folks
+rjkroege@: FYI

Comment 3 by fsamuel@google.com, Apr 20 2017

Cc: piman@chromium.org danakj@chromium.org enne@chromium.org
+some cc folks because we're proposing reducing display compositor special casing for android-y things! Yay: piman@, danakj@, enne@

Comment 4 by sadrul@chromium.org, Apr 20 2017

I notice that this is specifically for android, but for the record: we should do the same for aura too [eventually, if not at the same time as android].

Comment 5 by boliu@chromium.org, Apr 20 2017

works for chrome I think, but webview is still using native (ie non-composited) selection controls; updates are best effort rather than having some hard synchronization guarantees, but still has to have communication back to browser :/

Comment 6 by aelias@chromium.org, Apr 20 2017

Cc: amaralp@chromium.org
Another problem is hit testing.  The handles are not only visually on top, but also first in line to absorb touch input.  They generate selection move events and also action popup show/hide events (on single-tap).  One of the reasons for the current architecture is we wanted to avoid cluttering LayerTreeHostImpl and creating a new impl -> main channel for that stuff.  I still feel that would be quite ugly to do and would prefer not to move in that direction.

I don't think small performance tunings on the order of 2 IPC per frame are worth worrying about because the handles aren't present 99% of the time.  The only thing I'm concerned about is the asynchronicity of display (slippage behind scroll).  If I understand correctly, you have an approach that avoids slippage, in that case can we WontFix this?
#6: What's the approach to avoid slippage?

Comment 8 by aelias@chromium.org, Apr 20 2017

"the renderer allocates a new LocalSurfaceId when |selection| changes so that the browser doesn't fall behind in updating the location of touch selection handles" and the (synchronous?) round-trip to the browser?  I'm not sure I totally understand the design but it sounds like machinery to avoid slippage?  Correct me if I'm wrong.

Comment 9 by fsamuel@google.com, Apr 20 2017

This assumes the display compositor lives on the same thread as browser UI, and that the renderer is allocating the LocalSurfaceId. This mechanism is not compatible with putting the compositor in the gpu (now called viz) process. That's the main issue.

 
Labels: OS-Android OS-Chrome OS-Windows
Summary: Renderer should embed touch selection handles (was: Renderer should embed touch selection handles on Android)
OK.  I'd suggest taking the approach in #0 purely for display of handles in Chrome but retain most of the browser machinery for input handling and for WebView.  Also, note that this issue affects all touch platforms as the code is mostly shared.
Quick comment on #5: It looks like WebView actually hides selection handles when scrolling, so keeping things strictly in sync is not an issue, and allocating a new surface id every time we scroll is not necessary in WebView case.
Yes, WebView hides them specifically in order to conceal the slippage bug which it already incurs due to its using native Android PopupWindow instead of the compositor.

Note that WebView uses the PopupWindow in order for the handle to be able to stick out further than the extent of the WebView.  Although we're not certain whether or not any app actually benefits from this, so we're considering experimenting with deleting the WebView-specific path.
I wish we would just hide the handles while scrolling. It's not like the user will try to scroll and move the handles at the same time (I don't think it's even possible if the user tries). It just adds unnecessary complexity and overhead that is not too bad for the current architecture but will get worse.
What if the user is dragging the selection handle off the bottom of the screen? Scroll should happen while the selection extends and hence you must show the starting selection handle while you drag the ending handle down.


Well, I'm not entirely sure what will happen but I assume WebView already has a solution for it. Mikhail was also saying that on touch Chrome OS we hide the handles while scrolling, so I'm just suggesting maybe matching the behavior of other platforms is not too bad if it turns out the performance toll outweighs the benefits to users.
Sync'ing selection handles is a nice polish feature so I think we should do it right :-) Chromium / Chrome is intended to be a high quality product used by many, many people so the details matter in my personal opinion.
Agree with fsamuel. jdduke spent quite a bit of time to make it possible to show the handles when scrolling. It's a nice polish feature. 
Blocking: 696199
Cc: weiliangc@chromium.org
Cc: varkha@chromium.org
Blocking: -601863 732555
This is an viz for Chrome Android blocker.
Components: -Internals>MUS
Blocking: -672962
Blockedon: 689754
We're planning on initially handling this using the same method as the omnibox (see blocking  issue 689754 ). After that is resolved, we should follow up on the performance implications and likely implement a more optimized path for selection handles only - see this doc:
https://docs.google.com/document/d/1sZqQnJwvFyCiPjNsXq90ghaPtdSBaOnvDYlbjPOGEzw/edit#heading=h.4ioun51jsve1

as well as option 2 of this doc: https://docs.google.com/document/d/1nawFPSv7FMT1FjZ5rbm4aBVIfGND7ZtVZWSqVJe01L0/edit#, which summarizes a similar idea.
Cc: -mfomitchev@chromium.org
Blockedon: -689754
Blocking: 801350
Labels: -OS-Windows -Pri-3 -OS-Chrome Pri-2
Owner: cblume@chromium.org
Status: Assigned (was: Available)
Summary: Handle Touch Selection Handles for Surface Sync / Viz on Android (was: Renderer should embed touch selection handles)
Blockedon: 810213
Owner: ericrk@chromium.org
Labels: Android-OOPD-Finch
Owner: fsam...@chromium.org
fsameul@ is working on this.
Status: Fixed (was: Assigned)
This is fixed so I'm marking it as so.

Sign in to add a comment