<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>212303</bug_id>
          
          <creation_ts>2020-05-23 09:54:11 -0700</creation_ts>
          <short_desc>[IntersectionObserver] Wrong isIntersecting value when thresholds are involved</short_desc>
          <delta_ts>2020-05-23 10:33:34 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>MOVED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Emilio Cobos Álvarez (:emilio)">emilio</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>koivisto</cc>
    
    <cc>rwlbuis</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1655623</commentid>
    <comment_count>0</comment_count>
    <who name="Emilio Cobos Álvarez (:emilio)">emilio</who>
    <bug_when>2020-05-23 09:54:11 -0700</bug_when>
    <thetext>What steps will reproduce the problem?
1. Open https://bugzilla.mozilla.org/attachment.cgi?id=9151272. Note that the expectation of that test-case is wrong.
2. Scroll down until the element is fully in view. Yo should see &quot;true, 1.0&quot; in the console.
3. Scroll back up until the element is no longer fully in view. You should see &quot;true, &lt;some number less than one&gt;&quot;, but you get &quot;false, &lt;some number less than one&gt;&quot; instead.

Per the spec, isIntersecting in that second notification should be true:

https://w3c.github.io/IntersectionObserver/#update-intersection-observations-algo:

&gt; Let isIntersecting be true if targetRect and rootBounds intersect or are edge-adjacent, even if the intersection has zero area (because rootBounds or targetRect have zero area); otherwise, let isIntersecting be false.

Chromium and WebKit seem to use `isIntersecting = thresholdIndex &gt; 0` or something of that sort.

https://webkit-search.igalia.com/webkit/rev/21a8aa0218f444efd453ffc7db766387d09b4200/Source/WebCore/dom/Document.cpp#7736

I think Firefox is right per spec on this one unless I&apos;m missing something.

I filed https://bugs.chromium.org/p/chromium/issues/detail?id=1085938 for Chrome.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1655629</commentid>
    <comment_count>1</comment_count>
    <who name="Emilio Cobos Álvarez (:emilio)">emilio</who>
    <bug_when>2020-05-23 10:14:42 -0700</bug_when>
    <thetext>So I dug a bit more and filed https://github.com/w3c/IntersectionObserver/issues/432. TLDR, no browser matches the spec, yay?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1655630</commentid>
    <comment_count>2</comment_count>
    <who name="Emilio Cobos Álvarez (:emilio)">emilio</who>
    <bug_when>2020-05-23 10:33:34 -0700</bug_when>
    <thetext>I&apos;m changing Firefox to match Chrome and WebKit here, though it&apos;s a bit sad of a feeling, because we all ended up implementing whatever was tested / implemented by chrome rather than the spec. Oh well.

Let&apos;s track this as a spec bug in https://github.com/w3c/IntersectionObserver/issues/432.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>