Closed Bug 1515822 Opened 5 years ago Closed 5 years ago

scroll position sometimes is not saved inside display: contents

Categories

(Core :: Layout: Scrolling and Overflow, defect, P3)

64 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla67
Tracking Status
firefox67 --- fixed

People

(Reporter: wcpan, Assigned: wcpan)

References

Details

Attachments

(4 files)

Attached file scroll.html
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:64.0) Gecko/20100101 Firefox/64.0

Steps to reproduce:

1. Make a div display: contents, let's say its name is A.
2. Make a scroll-able div, put it inside the div A.
3. Use history.pushState/popstate to change the div A to display: none.

For more testing please see the attached file.


Actual results:

The scroll position does not restored.


Expected results:

The scroll position should be restored.
Attached patch wip.patchSplinter Review
Just a WIP that works, but I don't think it's optimal.

The reason why I cannot use IsDisplayContents is that at the time we call it in nsCSSFrameConstructor::RecreateFramesForContent, the flag has been unset.

:emilio, do you know we have any flags in servo to distinguish "display: contents" and "display: none" in this case?
Flags: needinfo?(emilio)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
display: contents is not a flag, but by the time you get there we have already forgotten of the old style.

So we need to walk the content tree in a similar fashion in ContentRemoved:

  https://searchfox.org/mozilla-central/rev/9528360768d81b1fc84258b5fb3601b5d4f40076/layout/base/nsCSSFrameConstructor.cpp#7451

So looks to me that all the ContentRemoved callers which aren't ContentRemoved itself and are REMOVE_FOR_RECONSTRUCTION call CaptureStateForFramesOf on their own. It would make sense to move the CaptureStateForFramesOf to ContentRemoved itself, and change the REMOVE_FOR_RECONSTRUCTION flag here:

  https://searchfox.org/mozilla-central/rev/9528360768d81b1fc84258b5fb3601b5d4f40076/layout/base/nsCSSFrameConstructor.cpp#7463

For aFlags. I think that's more correct anyway, actually.
Flags: needinfo?(emilio)
Move CaptureStateForFramesOf into ContentRemoved, so we can traverse frames
which were under display: contents as well.
Unfortunately I've lost my ssh key to push to try or autoland.
But the testcase passed on my machine.
(In reply to Wei-Cheng Pan [:wcpan] [:wcp] [:legnaleurc] (left Mozilla) from comment #5)
> Unfortunately I've lost my ssh key to push to try or autoland.

Here's a try run:

https://treeherder.mozilla.org/#/jobs?repo=try&revision=657e3158cb9632fd3260aadf8e00932e46124821
(In reply to Cameron McCormack (:heycam) (away Jan 1) from comment #6)
> Here's a try run:
> 
> https://treeherder.mozilla.org/#/
> jobs?repo=try&revision=657e3158cb9632fd3260aadf8e00932e46124821

Thanks!

I guess the assertion is a little bit aggressive.
I will try to get my try server key back, would be better.
Attachment #9033220 - Attachment description: Bug 1515822 - Capture frame state in nsCSSFrameConstructor::ContentRemoved. r=emilio → Bug 1515822 - Capture frame state in nsCSSFrameConstructor::ContentRemoved. r=emilio,mats

Since :mats is blocking review now, and I'm not sure when will he be available again, do we have other victim to review this bug?
Thanks.

Flags: needinfo?(emilio)

(In reply to Wei-Cheng Pan [:wcpan] [:wcp] [:legnaleurc] (left Mozilla) from comment #9)

Since :mats is blocking review now, and I'm not sure when will he be available again, do we have other victim to review this bug?
Thanks.

I suspect he just missed the Phabricator review request.

Flags: needinfo?(emilio) → needinfo?(mats)

(In reply to Emilio Cobos Álvarez (:emilio) from comment #10)

(In reply to Wei-Cheng Pan [:wcpan] [:wcp] [:legnaleurc] (left Mozilla) from comment #9)

Since :mats is blocking review now, and I'm not sure when will he be available again, do we have other victim to review this bug?
Thanks.

I suspect he just missed the Phabricator review request.

Hmm, I have no clue why it says I'm blocking review requests.
My bugzilla account certainly isn't blocking requests.
Does Phabricator also have setting for that? I couldn't find one...

Flags: needinfo?(mats)
Pushed by legnaleurc@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/46591113989e
Capture frame state in nsCSSFrameConstructor::ContentRemoved. r=emilio,mats
https://hg.mozilla.org/integration/autoland/rev/47cafac7c288
Add testcase. r=emilio

Thanks so much for your help! :)

(In reply to Mats Palmgren (:mats) from comment #11)

Hmm, I have no clue why it says I'm blocking review requests.
My bugzilla account certainly isn't blocking requests.
Does Phabricator also have setting for that? I couldn't find one...

In Phabricator there are two kinds of reviewers, blocking and non-blocking. Blocking reviewers need to approve the patch for it to land, non-blocking reviewers don't, as long as at least one of them have approved the patch.

So tagging you and Daniel both as a blocking reviewer, for example, would mean that I need review from both, tagging you both as a non-blocking reviewers means that I need review from at least one of you.

Assignee: nobody → legnaleurc
Status: NEW → ASSIGNED

(In reply to Wei-Cheng Pan [:wcpan] [:wcp] [:legnaleurc] (left Mozilla) from comment #13)

Thanks so much for your help! :)

NP, thank you for fixing it!

(In reply to Emilio Cobos Álvarez (:emilio) from comment #14)

In Phabricator there are two kinds of reviewers, blocking and non-blocking. Blocking reviewers need to approve the patch for it to land, non-blocking reviewers don't, as long as at least one of them have approved the patch.

Ah, Wei-Cheng's comment makes sense now. Thanks.

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: