Scroll offset is not clamped correctly after transform change that cause overflow reclac
Reported by
yang...@gmail.com,
Oct 2 2016
|
|||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2877.0 Safari/537.36 Example URL: Steps to reproduce the problem: 1. Download this HTML file https://gist.github.com/Yangff/7f1f5a38ea30381eb6cf82c7b13efc31 2. Open it with chrome 3. click the Red page 4. Green page should slide in What is the expected behavior? Click the page, the Green page should slide in. What went wrong? As you can see in the attached screenshot. It goes out of page. If I resize the page (or do anything else that make chrome recalc the position) everything works well. Does it occur on multiple sites: Yes Is it a problem with a plugin? No Did this work before? N/A Does this work in other browsers? Yes Chrome version: 55.0.2877.0 Channel: canary OS Version: 10.0 Flash Version: Shockwave Flash 23.0 r0 There are three points to reproduce this issue. 1. The Green Page is append by `$('#container').append($dom)` 2. CSS3 animation is applied 3. Give inputbox focus This issue happens on PC (chrome), WebView (android), Chrome (android)
,
Oct 3 2016
,
Oct 3 2016
@kkaluri I'm using jquery. `<script src="//cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script>` maybe you need start a local http server so chrome can load this script. (or download the script and use local path instead of `//cdn.bootcss.com/jquery/3.1.1/jquery.min.js`
,
Oct 3 2016
And the whole things looks like this under 55.0.2879.0 (Official Build) canary (64-bit)
,
Oct 3 2016
,
Oct 3 2016
I can reproduce this bug on latest stable and Canary. The body position is incorrect once the animation starts which affects the animation. I have confirmed this on Mac and Linux too. Attached is a timeline recording.
,
Oct 4 2016
Labeling with monthly update frequency on the assumption that this is not a regression
,
Oct 26 2016
,
Oct 27 2016
JSFiddle version of the test case to avoid the tedium of copy+paste+webserver: https://jsfiddle.net/dvnr21pp/
,
Oct 27 2016
Here is a simplified repro: http://jsbin.com/bakitu/3/edit?html,output It is a combination of starting the animation and then causing the input to focus. This seems to cause the animation end style to get an incorrect value.
,
Oct 27 2016
So I spend some more time today to dig into this deeper. As far as I can tell, this being caused by |LayoutObject::scrollRectToVisible| which is invoked as part of focus code path for html input (See HTMLInputElement::updateFocusAppearance). I verified this by returning early in that function and the issue is fixed indeed. I am still not sure how that can cause this issue but just wanted to share what I know so far.
,
Nov 22 2016
,
Nov 24 2016
Upon further investigation, this is not an issue with animation position calculation. Instead I found a bug in our scroll offset clamping that happens when a transform change is causing an overflow recalculation. The original test page what animating transform (translateX) in a way that it was changing the containers layout overflow to change however we were failing to clamp the scroll offset correctly. The input.focus() was essentially scrolling us to a position which would later become invalid thanks to the translation caused by the animation. However, we would not do the clamping. This is not really about animation per-se but any translate would trigger this. The simple test I wrote in my fix shows this: https://codereview.chromium.org/2524333003/ Here is my simplified repro based on the original report: http://jsbin.com/guzigilapu/edit?html,console,output In general for best UX and visual effects, I suggest the input.focus() to be called after animation ends. This avoids unnecessary visual jumps and ensures we focus the element at its final resting position.
,
Nov 24 2016
,
Nov 24 2016
,
Nov 28 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/79f6f52c6732cd3082a9984329245b41c8c92a42 commit 79f6f52c6732cd3082a9984329245b41c8c92a42 Author: majidvp <majidvp@chromium.org> Date: Mon Nov 28 17:38:52 2016 Clamp scroll offset after overflow reclacs that are not layout inducing Changes in overflow content size and clip should trigger a re-clamping of the scroll offset even if the change is not layout inducing (e.g., transform) BUG= 652092 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Review-Url: https://codereview.chromium.org/2524333003 Cr-Commit-Position: refs/heads/master@{#434679} [add] https://crrev.com/79f6f52c6732cd3082a9984329245b41c8c92a42/third_party/WebKit/LayoutTests/fast/overflow/overflow-clamp-after-transform-related-content-size-change.html [modify] https://crrev.com/79f6f52c6732cd3082a9984329245b41c8c92a42/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp [modify] https://crrev.com/79f6f52c6732cd3082a9984329245b41c8c92a42/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h
,
Nov 28 2016
,
Jan 5 2017
|
|||||||||||
►
Sign in to add a comment |
|||||||||||
Comment 1 by kkaluri@chromium.org
, Oct 3 2016Labels: Needs-Feedback