Closed
Bug 1104356
Opened 10 years ago
Closed 9 years ago
scrollTo() smooth-scrolling behavior does not work on overflow:hidden elements
Categories
(Core :: Panning and Zooming, defect)
Core
Panning and Zooming
Tracking
()
People
(Reporter: justindarc, Assigned: kats)
References
Details
(Keywords: regression, Whiteboard: [ft:conndevices])
Attachments
(3 files, 1 obsolete file)
1.59 KB,
text/html
|
Details | |
58 bytes,
text/x-review-board-request
|
kip
:
review+
lizzard
:
approval-mozilla-aurora+
jocheng
:
approval‑mozilla‑b2g44+
|
Details |
58 bytes,
text/x-review-board-request
|
kip
:
review+
lizzard
:
approval-mozilla-aurora+
jocheng
:
approval‑mozilla‑b2g44+
|
Details |
The following demo works in Nightly Desktop, but does not work in B2G nightly builds. When passing the `behavior: 'smooth'` option, the result appears to be a NOOP.
http://jsbin.com/duqiqu
Comment 1•10 years ago
|
||
Modifying the demo to use "overflow: scroll" rather than "overflow: hidden" enables the smooth scrolling.
Perhaps for reasons described in Bug 942995 (APZC for overflow:hidden element should not allow panning), we are not creating the APZC for the overflow: hidden layers or otherwise disabling scrolling through touch gestures in a manner that affects the smooth scrolls.
Updated•10 years ago
|
Assignee: nobody → kgilbert
Comment 2•10 years ago
|
||
This can be reproduced on OSX with APZ enabled.
Assignee | ||
Comment 3•10 years ago
|
||
Yeah not having an APZC for overflow: hidden elements is intentional. Can we fall back to main-thread smooth scroll for this scenario?
Comment 4•10 years ago
|
||
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #3)
> Yeah not having an APZC for overflow: hidden elements is intentional. Can we
> fall back to main-thread smooth scroll for this scenario?
Yes, I have a main thread implementation that we could fall back to; however, the animation on the main thread would potentially not be as smooth, especially if there is long running Javascript.
Comment 5•10 years ago
|
||
Is the "we don't want APZC for overflow:hidden" a "we didn't get to changing the behaviour", or "this is the right thing to do"? I couldn't quite tell from the comments above.
Comment 6•10 years ago
|
||
(In reply to Milan Sreckovic [:milan] from comment #5)
> Is the "we don't want APZC for overflow:hidden" a "we didn't get to changing
> the behaviour", or "this is the right thing to do"? I couldn't quite tell
> from the comments above.
I suspect it's "we've never had a reason to have APZ for non-root overflow:hidden elements".
We do have APZ for a root overflow:hidden element, so that we can zoom it and scroll the zoomed content within the original bounds. To accomodate this, APZ has support for respecting overflow:hidden (i.e. not allowing you to scroll past the original bounds). In theory, we can enable APZ for non-root overflow:hidden elements the same way. However, there might be performance implications due to the extra layerization.
Reporter | ||
Comment 7•10 years ago
|
||
(In reply to Botond Ballo [:botond] from comment #6)
> (In reply to Milan Sreckovic [:milan] from comment #5)
> > Is the "we don't want APZC for overflow:hidden" a "we didn't get to changing
> > the behaviour", or "this is the right thing to do"? I couldn't quite tell
> > from the comments above.
>
> I suspect it's "we've never had a reason to have APZ for non-root
> overflow:hidden elements".
>
> We do have APZ for a root overflow:hidden element, so that we can zoom it
> and scroll the zoomed content within the original bounds. To accomodate
> this, APZ has support for respecting overflow:hidden (i.e. not allowing you
> to scroll past the original bounds). In theory, we can enable APZ for
> non-root overflow:hidden elements the same way. However, there might be
> performance implications due to the extra layerization.
This is along the same lines as my thoughts on this as well. Perhaps a sufficient compromise would be to promote an `overflow: hidden` element to an APZ layer if/when `scrollTo()/scrollBy()` is called on it? I understand that this may result in an initial latency while the layer gets created, but this seems like a reasonable expectation. Simply promoting every `overflow: hidden` element to its own APZ layer sounds like a bad idea in general to me. There are hundreds of cases where `overflow: hidden` is used to obscure parts of content within the bounds of an element where the element will never be scrolled.
Assignee | ||
Comment 8•10 years ago
|
||
I agree with all the stuff in comments 4-7. The one thing I would note is that simply forcing a layer for a scrollTo'd frame will not be enough. The way overflow:hidden works on the APZ side is that the APZ actually doesn't know that the layer is scrollable and so if we just ran the smooth-scroll animation on it as-is it would likely think it ran into the end of the document and hand off that scroll upwards through the handoff chain. We would need some extra plumbing to allow the APZ side to know how much the document is actually scrollable.
Also note that scrollBy() currently is always done on the main thread; we have bug 959793 open for making that work with APZ.
Assignee | ||
Updated•10 years ago
|
Summary: scrollTo() smooth behavior broke in B2G → scrollTo() smooth-scrolling behavior does not work on overflow:hidden elements
Comment 9•10 years ago
|
||
(In reply to Justin D'Arcangelo [:justindarc] from comment #7)
> (In reply to Botond Ballo [:botond] from comment #6)
> > (In reply to Milan Sreckovic [:milan] from comment #5)
> > > Is the "we don't want APZC for overflow:hidden" a "we didn't get to changing
> > > the behaviour", or "this is the right thing to do"? I couldn't quite tell
> > > from the comments above.
> >
> > I suspect it's "we've never had a reason to have APZ for non-root
> > overflow:hidden elements".
> >
> > We do have APZ for a root overflow:hidden element, so that we can zoom it
> > and scroll the zoomed content within the original bounds. To accomodate
> > this, APZ has support for respecting overflow:hidden (i.e. not allowing you
> > to scroll past the original bounds). In theory, we can enable APZ for
> > non-root overflow:hidden elements the same way. However, there might be
> > performance implications due to the extra layerization.
>
> This is along the same lines as my thoughts on this as well. Perhaps a
> sufficient compromise would be to promote an `overflow: hidden` element to
> an APZ layer if/when `scrollTo()/scrollBy()` is called on it? I understand
> that this may result in an initial latency while the layer gets created, but
> this seems like a reasonable expectation. Simply promoting every `overflow:
> hidden` element to its own APZ layer sounds like a bad idea in general to
> me. There are hundreds of cases where `overflow: hidden` is used to obscure
> parts of content within the bounds of an element where the element will
> never be scrolled.
Perhaps the initial latency could be eliminated by automatically promoting an 'overflow: hidden' element to an APZ layer if the 'scroll-behavior: smooth' property is set on it. This wouldn't work for all cases, as the CSSOM-View DOM methods can actually scroll smoothly without the default set in CSS; however, it could be a useful optimization for the common case.
Reporter | ||
Comment 10•10 years ago
|
||
(In reply to :kip (Kearwood Gilbert) from comment #9)
> Perhaps the initial latency could be eliminated by automatically promoting
> an 'overflow: hidden' element to an APZ layer if the 'scroll-behavior:
> smooth' property is set on it. This wouldn't work for all cases, as the
> CSSOM-View DOM methods can actually scroll smoothly without the default set
> in CSS; however, it could be a useful optimization for the common case.
+1 -- Sounds like a suitable optimization to me.
Assignee | ||
Comment 11•10 years ago
|
||
I'd rather use something like |will-change: scroll-position| to force layerization, rather than overloading the scroll-behaviour property to have this "secret" side-effect. I would say this sort of latency-hiding optimization is exactly what will-change was intended for.
Reporter | ||
Comment 12•10 years ago
|
||
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #11)
> I'd rather use something like |will-change: scroll-position| to force
> layerization, rather than overloading the scroll-behaviour property to have
> this "secret" side-effect. I would say this sort of latency-hiding
> optimization is exactly what will-change was intended for.
I was unaware that `scroll-position` was an acceptable value for `will-change`. If so, that would be even better.
Assignee | ||
Comment 13•10 years ago
|
||
I'm assuming it is based on https://developer.mozilla.org/en-US/docs/Web/CSS/will-change. If it doesn't exist yet we can probably add it.
Assignee | ||
Comment 14•9 years ago
|
||
This is a regression with APZ enabled in 46; the demo doesn't scroll at all if the smooth checkbox is enabled. We need to fix this before ship.
Assignee: kgilbert → bugmail.mozilla
Blocks: all-aboard-apz
status-firefox45:
--- → unaffected
status-firefox46:
--- → affected
status-firefox47:
--- → affected
Keywords: regression
Assignee | ||
Comment 15•9 years ago
|
||
This is the JSBin thing packaged up into a standalone test file.
Assignee | ||
Updated•9 years ago
|
OS: Gonk (Firefox OS) → All
Hardware: ARM → All
Assignee | ||
Comment 16•9 years ago
|
||
Here's a patch that fixes it by falling back to the main-thread machinery. It's small and should be safe to uplift to 46.
However a few lines below where I change this, I see that we set a displayport on the scrollframe if there isn't one already, so in theory that should cause the scrollframe to get layerized for APZ. For some reason it's not working the way it should so I want to investigate a bit more and figure out what's going on there.
Assignee | ||
Comment 17•9 years ago
|
||
[Tracking Requested - why for this release]: regression from 45 and older versions.
tracking-firefox46:
--- → ?
Comment 18•9 years ago
|
||
Tracking since this is a recent regression with APZ
tracking-firefox47:
--- → +
Assignee | ||
Comment 19•9 years ago
|
||
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #16)
> However a few lines below where I change this, I see that we set a
> displayport on the scrollframe if there isn't one already, so in theory that
> should cause the scrollframe to get layerized for APZ. For some reason it's
> not working the way it should so I want to investigate a bit more and figure
> out what's going on there.
Ah, this is because the scrollable rect size remains the same as the composition bounds, so even though it *does* get layerized, APZ can't scroll it past 0. I suppose we could change this but it seems more risky than just doing the main-thread scroll in this case.
Assignee | ||
Comment 20•9 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/33773/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/33773/
Attachment #8716282 -
Flags: review?(kgilbert)
Assignee | ||
Comment 21•9 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/33775/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/33775/
Attachment #8716283 -
Flags: review?(kgilbert)
Assignee | ||
Updated•9 years ago
|
Attachment #8715875 -
Attachment is obsolete: true
Assignee | ||
Comment 22•9 years ago
|
||
green try |
Comment 23•9 years ago
|
||
https://reviewboard.mozilla.org/r/33771/#review30487
This looks good, thanks!
Comment 24•9 years ago
|
||
Comment on attachment 8716282 [details]
MozReview Request: Bug 1104356 - When doing a smooth scroll on a non-APZ'd scrollframe, fall back to the main thread machinery. r?kip
https://reviewboard.mozilla.org/r/33773/#review30489
Looks good, thanks!
Attachment #8716282 -
Flags: review?(kgilbert) → review+
Updated•9 years ago
|
Attachment #8716283 -
Flags: review?(kgilbert) → review+
Comment 25•9 years ago
|
||
Comment on attachment 8716283 [details]
MozReview Request: Bug 1104356 - Add a reftest. r?kip
https://reviewboard.mozilla.org/r/33775/#review30493
Comment 26•9 years ago
|
||
Comment 27•9 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/17a54cf0454b
https://hg.mozilla.org/mozilla-central/rev/a556e78d4a62
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Assignee | ||
Comment 28•9 years ago
|
||
Comment on attachment 8716282 [details]
MozReview Request: Bug 1104356 - When doing a smooth scroll on a non-APZ'd scrollframe, fall back to the main thread machinery. r?kip
Approval Request Comment
[Feature/regressing bug #]: APZ
[User impact if declined]: doing a programmatic smooth scroll on an overflow:hidden frame will fail entirely
[Describe test coverage new/current, TreeHerder]: added a reftest
[Risks and why]: small patch, relatively low risk.
[String/UUID change made/needed]: none
Attachment #8716282 -
Flags: approval-mozilla-aurora?
Assignee | ||
Comment 29•9 years ago
|
||
Comment on attachment 8716283 [details]
MozReview Request: Bug 1104356 - Add a reftest. r?kip
Approval Request Comment
(This is a test that goes with the other patch)
Attachment #8716283 -
Flags: approval-mozilla-aurora?
Comment 30•9 years ago
|
||
Comment on attachment 8716282 [details]
MozReview Request: Bug 1104356 - When doing a smooth scroll on a non-APZ'd scrollframe, fall back to the main thread machinery. r?kip
Fix for scrolling in frames with APZ, includes tests, please uplift to aurora
Attachment #8716282 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment 31•9 years ago
|
||
Comment on attachment 8716283 [details]
MozReview Request: Bug 1104356 - Add a reftest. r?kip
New reftest for APZ, please uplift to aurora.
Attachment #8716283 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment 32•9 years ago
|
||
bugherder uplift |
Comment 33•9 years ago
|
||
Comment on attachment 8716282 [details]
MozReview Request: Bug 1104356 - When doing a smooth scroll on a non-APZ'd scrollframe, fall back to the main thread machinery. r?kip
NOTE: Please see https://wiki.mozilla.org/Release_Management/B2G_Landing to better understand the B2G approval process and landings.
[Approval Request Comment]
Bug caused by (feature/regressing bug #): APZ, and according to Bug 1262369 Comment 20
User impact if declined: doing a programmatic smooth scroll on an overflow:hidden frame will fail.
Testing completed: Tested on b2g44-v2.5 on nexus-player
Risk to taking this patch (and alternatives if risky): Small patch, relative low risk
String or UUID changes made by this patch: none
Attachment #8716282 -
Flags: approval‑mozilla‑b2g44?
Comment 34•9 years ago
|
||
Comment on attachment 8716283 [details]
MozReview Request: Bug 1104356 - Add a reftest. r?kip
As Comment 33, this should be uplifted as well.
Attachment #8716283 -
Flags: approval‑mozilla‑b2g44?
Updated•9 years ago
|
blocking-b2g: --- → 2.5+
Whiteboard: [ft:conndevices]
Comment 35•9 years ago
|
||
Comment on attachment 8716282 [details]
MozReview Request: Bug 1104356 - When doing a smooth scroll on a non-APZ'd scrollframe, fall back to the main thread machinery. r?kip
Approve for TV 2.5
Attachment #8716282 -
Flags: approval‑mozilla‑b2g44? → approval‑mozilla‑b2g44+
Comment 36•9 years ago
|
||
Comment on attachment 8716283 [details]
MozReview Request: Bug 1104356 - Add a reftest. r?kip
Approve for TV 2.5
Attachment #8716283 -
Flags: approval‑mozilla‑b2g44? → approval‑mozilla‑b2g44+
Assignee | ||
Comment 37•9 years ago
|
||
remote: https://hg.mozilla.org/releases/mozilla-b2g44_v2_5/rev/311b64761900
remote: https://hg.mozilla.org/releases/mozilla-b2g44_v2_5/rev/fee39861e880
status-b2g-v2.5:
--- → fixed
Comment 38•9 years ago
|
||
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #37)
> remote: https://hg.mozilla.org/releases/mozilla-b2g44_v2_5/rev/311b64761900
> remote: https://hg.mozilla.org/releases/mozilla-b2g44_v2_5/rev/fee39861e880
Thanks for the help.
You need to log in
before you can comment on or make changes to this bug.
Description
•