Closed Bug 1665447 Opened 4 years ago Closed 4 years ago

IntersectionObserverEntry.intersectionRect for an ib split element has incorrect values

Categories

(Core :: Layout, defect)

Firefox 81
defect

Tracking

()

VERIFIED FIXED
83 Branch
Tracking Status
relnote-firefox --- 81+
firefox-esr78 --- unaffected
firefox81 + verified
firefox82 + verified
firefox83 + verified

People

(Reporter: account, Assigned: emilio)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:82.0) Gecko/20100101 Firefox/82.0

Steps to reproduce:

  1. Render an inline element that contains a block element. Ensure the inline element is fully visible in the viewport
  2. Create an IntersectionObserver and observe the inline element

Actual results:

When the IntersectionObserver fires, the IntersectionObserverEntry.intersectionRect has incorrect values. These values do not match up with the boundingClientRect values.

Expected results:

Since the observed element is fully visible (intersectionRatio === 1), I would expect that the boundingClientRect and intersectionRect properties have the same values (top/left/height/width). This is true in Safari (13.1.1), Chrome (85.0.4183.102), Chrome Canary (87.0.4265.0), and Edge (86.0.622.3). Failing in Firefox :( (82.0a1)

This is pretty similar to https://bugzilla.mozilla.org/show_bug.cgi?id=1581876, but for different properties of the IntersectionObserverEntry (intersectionRect instead of intersectionRatio/isIntersecting). The attached file in the original comment is a modification of the test case added in 1581876 (https://hg.mozilla.org/mozilla-central/rev/8992f6cfc323)

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Layout
Product: Firefox → Core

Yeah, good catch, I should've tested intersectionRect as well :(

The good thing is that the boundingClientRect matches at least :P

Assignee: nobody → emilio
Status: UNCONFIRMED → NEW
Depends on: 1581876
Ever confirmed: true
Flags: needinfo?(emilio)
Severity: -- → S3
Status: NEW → ASSIGNED

Right now the BoxToRect callback assumes that when it gets a
RECTS_ACCOUNT_FOR_TRANSFORMS flag, the "relative to" is an ancestor.

This holds for all the callers of GetAllInFlowRectsUnion except for 1,
which was introduced in bug 1581876, because they pass
GetContainingBlockForClientRect (that is, the root frame) as the root.

But that caller passes target, so IB split continuations or such would
get two siblings as the from/to frames, messing up the bounds.

An alternative would be to not pass the RECTS_ACCOUNT_FOR_TRANSFORMS
flag for that call (as it's computing a rect relative to self, but I
don't think that'd be quite correct in the presence of fragmentation
with transformed containers (if that's possible at all? would need to
think harder...), and it seems like the API should just behave more
generally, or assert otherwise.

To that effect, this patch adds an assertion to TransformRectToAncestor
that would've caught this bug.

Flags: needinfo?(emilio)
See Also: → 1668113

Comment on attachment 9178642 [details]
Bug 1665447 - Fix BoxToRect when the "relative to" frame is not an ancestor. r=dholbert,mstange

Beta/Release Uplift Approval Request

  • User impact if declined: NOTE: The release request should probably be conditional on confirming that bug 1668113 is fixed by this.

The beta request probably still stands, this fixes a regression from bug 1581876.

  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: If possible, test bug 1668113, otherwise no test needed, if the automated test passes.
  • List of other uplifts needed: none
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Simple fix for an assumption in a layout API that the caller in bug 1581876 broke.
  • String changes made/needed: none
Attachment #9178642 - Flags: approval-mozilla-release?
Attachment #9178642 - Flags: approval-mozilla-beta?
Flags: qe-verify+
Blocks: 1668156
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/92f24022a62c
Fix BoxToRect when the "relative to" frame is not an ancestor. r=dholbert,mstange
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/25861 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 83 Branch

Comment on attachment 9178642 [details]
Bug 1665447 - Fix BoxToRect when the "relative to" frame is not an ancestor. r=dholbert,mstange

approved for 82.0b6

Attachment #9178642 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Version: Firefox 82 → Firefox 81
Upstream PR merged by moz-wptsync-bot

Comment on attachment 9178642 [details]
Bug 1665447 - Fix BoxToRect when the "relative to" frame is not an ancestor. r=dholbert,mstange

The duplicate bug seems like a pretty high risk for retention given the extensive amount of virtual schooling happening currently and Blackboard's place in the market. While we'd normally prefer more bake time than this has had, it seems worth taking the risk given the relative simplicity of the patch and inclusion of automated tests. Approved for 81.0.1.

Attachment #9178642 - Flags: approval-mozilla-release? → approval-mozilla-release+

Added to the Firefox 81.0.1 relnotes:

Fixed missing content on Blackboard course listings

See Also: → 1661595
QA Whiteboard: [qa-triaged]

Hey Emilio, we tried to sign-up to BlackBoard but didn't manage to get courses to check this out. Looking at https://bugzilla.mozilla.org/show_bug.cgi?id=1668113#c13 seems like the fix worked but we can't confirm that on our side. If the automated tests passed and we already have confirmation in Bug 1668113, I guess we are safe to call this verified. Can you please share your opinion about this?

Flags: needinfo?(emilio)

Yeah, that seems fine. https://github.com/webcompat/web-bugs/issues/58869 is another thing that should be tested by this.

Flags: needinfo?(emilio)

Thank you! Removing qe+ flag as per Comment 16 and Comment 17.

QA Whiteboard: [qa-triaged]
Flags: qe-verify+

The reporter of bug 1668113 has confirmed that 81.0.1 fixed the Blackboard bug. I don't see where we verified comment 17, though.

For the https://www.mediasetplay.mediaset.it/ site from Comment 17 we have the following results with testing on Windows 10, MacOS 10.15 and Ubuntu 18.04
Latest Nightly 83.0a1: verified-fixed
Latest Beta 82.0b5: not fixed
Latest Release 81.0.1: verified-fixed

Hey Ryan, should we submit a new bug in Bugzilla for Beta and investigate further there?

Flags: needinfo?(ryanvm)

per comment 9, this will be in 82.0b6 not 82.0b5.

Flags: needinfo?(ryanvm)

Thanks Julien, marking this verified on Nightly and Release and will verify on Beta when it is landed.

For the https://www.mediasetplay.mediaset.it/ site from Comment 17

Verified-fixed on latest Firefox Beta 82.0b6 on Windows 10, macOS 10.15 and Ubuntu 18.04.

Status: RESOLVED → VERIFIED
See Also: → 1667521
No longer depends on: 1581876
Regressed by: 1581876
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: