Closed Bug 1599795 Opened 5 years ago Closed 5 years ago

IntersectionObserver does not work in out-of-process iframes

Categories

(Core :: Layout, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla75
Fission Milestone M6
Tracking Status
firefox75 --- fixed

People

(Reporter: mconley, Assigned: hiro)

References

(Blocks 1 open bug)

Details

Attachments

(4 files, 1 obsolete file)

STR:

  1. Visit https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#Thresholds
  2. Scroll down to the iframe hosting the thresholds demo (orange boxes with numbers in them)
  3. Scroll that subframe.

ER:

The numbers should change as the intersection amount changes while scrolling.

AR:

The numbers stay at 0%.

Note that IntersectionObserver works properly in the top-most frame - see https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#Thresholds

Set P3 for now.

Priority: -- → P3
Blocks: 1599913

Tracking for Fission Nightly (M6)

Fission Milestone: --- → M6

That works for me now with Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:74.0) Gecko/20100101 Firefox/74.0 ID:20200123115437.

Maybe bug 1608931 helped here which was also about crossing boundaries between the framescript and web content?

Mike, can you still reproduce?

Flags: needinfo?(mconley)
Blocks: 1612243

I believe this is still an issue in fission world.

Assignee: nobody → hikezoe.birchill
Status: NEW → ASSIGNED
Flags: needinfo?(mconley)

Hiro — As part of the work on this, do you believe it might help resolve bug 1602987? That is, if we need to pass the offset to the top of the OOP iframe down to the content process in order for IntersectionObserver to work correctly, I wonder if we can also use the same data to solve the a11y problem of getting abs coordinates in the content process.

Emilio — Correct me if I'm wrong here :) But I believe this was generally what was discussed at the All Hands.

Flags: needinfo?(hikezoe.birchill)
Flags: needinfo?(emilio)

Yes, that matches my understanding.

Flags: needinfo?(emilio)

If bug 1602987 needs positions in browser window coordinate system, BrowserChild::GetChildToParentConversionMatix is the way. If we need positions in the top level content document coordinate system, we need to subtract browser toolbar height, it's probably BrowserChild::mChromeOffset, that's said as far as I know in OOP iframe the mChromeOffset is zero, so we probably need to propagate it into OOP.

Anyways, it seems to me we already have enough information for bug 1602987.

CCing Jamie, for references.

Flags: needinfo?(hikezoe.birchill)

The ChildToParentConversionMatrix and the RemoteDocumentRect came from APZ
contain transformation of the offset from the embedder iframe, i.e, CSS padding
and border values for the iframe element. We need to offset the remote document
rect by this position to get correct intersection region for
IntersectionObserver in out-of-process iframes.

In out-of-process iframes, the refresh driver for the iframe process doesn't
trigger the UpdateIntersectionObservation function in cases where ancestor
document's viewports change because there is no way to know it happens inside
the iframe process. So instead, we trigger the function in
BrowserChild::RecvChildToParentMatrix which is called in response to APZ.

Depends on D61936

Attachment #9124903 - Attachment description: Bug 1599795 - Introduce BrowserChild::GetTopLeft() to get the offset from the iframe for remote document. r?mattwoodrow!,emilio!,botond! → Bug 1599795 - Introduce EffectsInfo::mEmbedderBorderToContentBoxOffset to get the offset from the iframe in the remote document. r?mattwoodrow!,emilio!,botond!

What we really needed in the first place was the size not the rect.

Attachment #9124903 - Attachment is obsolete: true
Pushed by hikezoe.birchill@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9a08329f60d4 Change the remote document rect to size in gfx. r=emilio https://hg.mozilla.org/integration/autoland/rev/ed241344c391 Trigger UpdateIntersectionObservation in response to APZ changes. r=emilio https://hg.mozilla.org/integration/autoland/rev/3985a60a75b3 Rename BrowserChild::GetRemoteDocumentRect to GetTopLevelViewportVisibleRectInBrowserCoords. r=emilio https://hg.mozilla.org/integration/autoland/rev/b8ad0267e88a Make IntersectionObserver work in fission world. r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/21715 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Depends on: 1614574
Upstream PR merged by moz-wptsync-bot

== Change summary for alert #24911 (as of Wed, 12 Feb 2020 00:02:20 GMT) ==

Improvements:

9% perf_reftest_singletons link-style-cache-1.html windows7-32-shippable opt e10s stylo 682.83 -> 622.56
3% tp5o_scroll linux64-shippable opt e10s stylo 1.18 -> 1.15

For up to date results, see: https://treeherder.mozilla.org/perf.html#/alerts?id=24911

Blocks: 1700245
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: