Bug 150168

Summary: Scrolling iframe inside scrollable div does not work with trackpad
Product: WebKit Reporter: Anders Johansson <anders>
Component: New BugsAssignee: Wenson Hsieh <wenson_hsieh>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, jonasw, martin, me, simon.fraser, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Mac   
OS: OS X 10.11   
Bug Depends on:    
Bug Blocks: 169129    
Attachments:
Description Flags
Testcase source
none
Patch bfulgham: review+, bfulgham: commit-queue-

Description Anders Johansson 2015-10-15 06:52:36 PDT
Created attachment 263154 [details]
Testcase source

Open http://output.jsbin.com/zetevuyaqa in Safari 9 or nightly and try to scroll the iframe (picture) with a MacBook trackpad. The frame will not scroll.

Scroll down the outer div to the bottom position and try to scroll the iframe again. The iframe can now be scrolled down, but not up.

If the outer div's scroll position is not an any of the top or bottom endpoints the iframe can not be scrolled at all.

It is not entirely consistent and sometimes the areas can be scrolled with quick and slightly angled scroll gestures.


Using a mouse with a wheel works as expected. Other browsers (FF, Chrome) including Safari 8 does not have the problem with a trackpad.
Comment 1 Anders Johansson 2015-10-16 02:37:55 PDT
Previous testpage apparently stopped working due to being created anonymously at JSBin. Here is a new one that hopefully will continue to work.

https://output.jsbin.com/mudada

It needs to be viewed on a full page since nesting inside other iframes won't show the problem.
Comment 2 Radar WebKit Bug Importer 2015-10-16 08:30:13 PDT
<rdar://problem/23143931>
Comment 3 Martin Hecko 2015-11-02 15:41:10 PST
I can verify that this is also happening on Safari 9.0.1 (10601.2.7.2) on OS X 10.10.5 as well as one of the recent nightlies r191902.
Comment 4 Wenson Hsieh 2015-11-06 14:39:40 PST
Created attachment 264957 [details]
Patch
Comment 5 Brent Fulgham 2015-11-06 17:13:39 PST
Comment on attachment 264957 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=264957&action=review

r=me. I had a suggestion for improving the test (to avoid flakiness on the test bots).

> LayoutTests/fast/scrolling/latching/scroll-iframe-in-overflow-expected.txt:2
> +The wrapper's scroll position is: 0

I would suggest these be PASS/FAIL results, to avoid flakiness due to different test machine resolutions and settings.

> LayoutTests/fast/scrolling/latching/scroll-iframe-in-overflow.html:30
> +        debug("The wrapper's scroll position is: " + wrapper.scrollTop);

I would suggest something like:
if (iframe.contentWindow.scrollY && !wrapper.scrollTop) {
    testPassed("The iframe scrolled but the wrapper did not.");
} else {
    testFailed("The iframe's scroll position is: " + iframe.contentWindow.scrollY + ", and the wrapper's scroll position is: " + wrapper.scrollTop);
}

> LayoutTests/fast/scrolling/latching/scroll-iframe-in-overflow.html:50
> +        eventSender.callAfterScrollingCompletes(checkForScroll);

Someday we should make this into a test library function so we can remove all this duplicate code! :-)
Comment 6 Wenson Hsieh 2015-11-06 17:40:59 PST
Comment on attachment 264957 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=264957&action=review

>> LayoutTests/fast/scrolling/latching/scroll-iframe-in-overflow-expected.txt:2
>> +The wrapper's scroll position is: 0
> 
> I would suggest these be PASS/FAIL results, to avoid flakiness due to different test machine resolutions and settings.

Will do.

>> LayoutTests/fast/scrolling/latching/scroll-iframe-in-overflow.html:30
>> +        debug("The wrapper's scroll position is: " + wrapper.scrollTop);
> 
> I would suggest something like:
> if (iframe.contentWindow.scrollY && !wrapper.scrollTop) {
>     testPassed("The iframe scrolled but the wrapper did not.");
> } else {
>     testFailed("The iframe's scroll position is: " + iframe.contentWindow.scrollY + ", and the wrapper's scroll position is: " + wrapper.scrollTop);
> }

Got it. Fixed!

>> LayoutTests/fast/scrolling/latching/scroll-iframe-in-overflow.html:50
>> +        eventSender.callAfterScrollingCompletes(checkForScroll);
> 
> Someday we should make this into a test library function so we can remove all this duplicate code! :-)

I agree -- maybe something like sendMomentumScroll(positionX, positionY, dragCount, momentumCount, dragDeltaX, dragDeltaY, momentumDeltaX, momentumDeltaY, handleScrollingComplete) that handles everything in scrollTest() here.
Comment 7 Wenson Hsieh 2015-11-06 18:32:28 PST
Committed r192124: <http://trac.webkit.org/changeset/192124>
Comment 8 Michael Kuryshev 2017-03-02 05:40:35 PST
Is it fixed yet? I've tried both Safari on the latest Mac OS Sierra and nightly build of webkit and scrolling down inside iframe doesn't work. Scrolling up works fine though.
Comment 9 Anders Johansson 2017-03-02 06:52:06 PST
Yes, works for me now, Safari on Sierra.

Updated my last test case with a working image.
Comment 10 Wenson Hsieh 2017-03-02 07:30:46 PST
(In reply to comment #8)
> Is it fixed yet? I've tried both Safari on the latest Mac OS Sierra and
> nightly build of webkit and scrolling down inside iframe doesn't work.
> Scrolling up works fine though.

Hi Michael,

Scrolling Anders' test case seems to be working for me as well. If you are still seeing an issue, could you file a followup bug and attach a video clip showing the problem you're seeing?

Thanks!
Wenson
Comment 11 Michael Kuryshev 2017-03-03 05:45:59 PST
Hi Wenson, Anders,

I've created followup bug report with minimal test case. Thanks.

https://bugs.webkit.org/show_bug.cgi?id=169129