Bug 200776

Summary: IntersectionObserverEntry#intersectionRatio can be larger than 1
Product: WebKit Reporter: Tim Guan-tin Chien [:timdream] <timdream>
Component: Layout and RenderingAssignee: Ali Juma <ajuma>
Status: RESOLVED FIXED    
Severity: Normal CC: ajuma, bfulgham, cdumez, commit-queue, dbates, esprehn+autocc, ews-watchlist, kangil.han, simon.fraser, timdream, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
test case
none
Patch none

Description Tim Guan-tin Chien [:timdream] 2019-08-15 11:18:14 PDT
Created attachment 376398 [details]
test case

STR: Load the minimal test case. the callback will put the intersectionRatio on the page.

Expected: The intersectionRatio should be exactly 1 in this case because the element is entirely in the viewport.

Actual: It's 1.0270270109176636.

The spec states it should be a number between 0 and 1. https://w3c.github.io/IntersectionObserver/#dom-intersectionobserverentry-intersectionratio

This is also reproducible on Chrome but not Firefox.
Comment 1 Tim Guan-tin Chien [:timdream] 2019-08-15 11:19:41 PDT
Tested on Release 89 (Safari 13.1, WebKit 14609.1.1)
Comment 2 Tim Guan-tin Chien [:timdream] 2019-08-15 11:25:23 PDT
Filed on Chromium as https://bugs.chromium.org/p/chromium/issues/detail?id=994298
Comment 3 Tim Guan-tin Chien [:timdream] 2019-08-15 13:20:08 PDT
Still producible on WebKit Nightly Version 12.1.2 (14607.3.9, 609+)
Comment 4 Radar WebKit Bug Importer 2019-08-15 16:26:54 PDT
<rdar://problem/54368559>
Comment 5 Ali Juma 2019-09-13 08:54:10 PDT
Created attachment 378731 [details]
Patch
Comment 6 WebKit Commit Bot 2019-09-13 11:47:01 PDT
Comment on attachment 378731 [details]
Patch

Clearing flags on attachment: 378731

Committed r249845: <https://trac.webkit.org/changeset/249845>
Comment 7 WebKit Commit Bot 2019-09-13 11:47:03 PDT
All reviewed patches have been landed.  Closing bug.