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

Issue 652092 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

Scroll offset is not clamped correctly after transform change that cause overflow reclac

Reported by yang...@gmail.com, Oct 2 2016

Issue description

UserAgent: 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)
 
sp161002_145622.png
28.1 KB View Download
Cc: kkaluri@chromium.org
Labels: Needs-Feedback
@yangff1, Unable to reproduce the scenario, we tested the demo.html page in windows 10 with chrome latest stable version 53.0.2785.143 and with latest firefox browser and in both scenarios it's showing the empty red page.

Check the attached video and let us know whether it is right way to reproduce the issue?
Issue-652092.mp4
1.6 MB View Download

Comment 3 by yang...@gmail.com, 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`

Comment 4 by yang...@gmail.com, Oct 3 2016

And the whole things looks like this under 55.0.2879.0 (Official Build) canary (64-bit)
127.0.0.1_8111_demo.html - Google Chrome 10_3_2016 10_53_07 PM.mp4
9.5 MB View Download
Components: -Blink Blink>Animation
Cc: dstockwell@chromium.org
Labels: -OS-Windows Hotlist-Threaded-Rendering Hotlist-Fixit-PE2016 OS-All
Owner: majidvp@chromium.org
Status: Assigned (was: Unconfirmed)
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.
Animation-bug-20161003T142332
3.4 MB View Download

Comment 7 by suzyh@chromium.org, Oct 4 2016

Labels: Update-Monthly
Labeling with monthly update frequency on the assumption that this is not a regression
Labels: Hotlist-Interop
Labels: -Needs-Feedback
JSFiddle version of the test case to avoid the tedium of copy+paste+webserver:
https://jsfiddle.net/dvnr21pp/
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.
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. 


Status: Started (was: Assigned)
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.
 




Components: Blink>Scroll
Summary: Scroll offset is not clamped correctly after transform change that cause overflow reclac (was: Wrong position calculation for CSS3 animation)
Cc: skobes@chromium.org
Project Member

Comment 16 by bugdroid1@chromium.org, 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

Status: Fixed (was: Started)
Labels: Hotlist-Input-Dev

Sign in to add a comment