33 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
44
55use std:: cell:: { Cell , RefCell } ;
6- use std:: ops:: Deref ;
76use std:: rc:: Rc ;
87use std:: time:: Duration ;
98
@@ -12,7 +11,6 @@ use base::cross_process_instant::CrossProcessInstant;
1211use cssparser:: { Parser , ParserInput } ;
1312use dom_struct:: dom_struct;
1413use euclid:: default:: Rect ;
15- use js:: jsapi:: Rooted ;
1614use js:: rust:: { HandleObject , MutableHandleValue } ;
1715use style:: context:: QuirksMode ;
1816use style:: parser:: { Parse , ParserContext } ;
@@ -26,7 +24,6 @@ use super::bindings::codegen::Bindings::IntersectionObserverBinding::{
2624} ;
2725use super :: document:: Document ;
2826use super :: domrectreadonly:: DOMRectReadOnly ;
29- use super :: globalscope:: GlobalScope ;
3027use super :: intersectionobserverentry:: IntersectionObserverEntry ;
3128use super :: intersectionobserverrootmargin:: IntersectionObserverRootMargin ;
3229use super :: node:: { Node , NodeTraits } ;
@@ -417,10 +414,7 @@ impl IntersectionObserver {
417414 /// scrollbar for element or document. However, the behaviour is not clearly defined in the spec.
418415 ///
419416 /// <https://w3c.github.io/IntersectionObserver/#intersectionobserver-root-intersection-rectangle>
420- pub ( crate ) fn root_intersection_rectangle (
421- & self ,
422- document : & Document ,
423- ) -> Rect < Au > {
417+ pub ( crate ) fn root_intersection_rectangle ( & self , document : & Document ) -> Rect < Au > {
424418 let intersection_rectangle = match & self . root {
425419 // > If the IntersectionObserver is an implicit root observer,
426420 None => {
@@ -489,11 +483,7 @@ impl IntersectionObserver {
489483 // > Let registration be the IntersectionObserverRegistration record in target’s internal
490484 // > [[RegisteredIntersectionObservers]] slot whose observer property is equal to observer.
491485 // We will clone now to prevent borrow error, and set the value in the end of the loop.
492- let cx = GlobalScope :: get_cx ( ) ;
493- let mut unrooted = Rooted :: new_unrooted ( ) ;
494- let registration = target
495- . get_intersection_observer_registration ( self , cx, & mut unrooted)
496- . unwrap ( ) ;
486+ let registration = target. get_intersection_observer_registration ( self ) . unwrap ( ) ;
497487
498488 // Step 2
499489 // > If (time - registration.lastUpdateTime < observer.delay), skip further processing for target.
@@ -551,7 +541,9 @@ impl IntersectionObserver {
551541 // This is what we are currently using for getBoundingBox(). However, it is not correct,
552542 // mainly because it is not considering transform and scroll offset.
553543 // TODO: replace this once getBoundingBox() is implemented correctly.
554- target_rect = target. upcast :: < Node > ( ) . bounding_content_box_or_zero_no_reflow ( ) ;
544+ target_rect = target
545+ . upcast :: < Node > ( )
546+ . bounding_content_box_or_zero_no_reflow ( ) ;
555547
556548 // Step 8
557549 // > Let intersectionRect be the result of running the compute the intersection algorithm on
@@ -656,9 +648,6 @@ impl IntersectionObserver {
656648 registration. previous_threshold_index . set ( threshold_index) ;
657649 registration. previous_is_intersecting . set ( is_intersecting) ;
658650 registration. previous_is_visible . set ( is_visible) ;
659-
660- // Update the registration inside the element.
661- target. update_intersection_observer_registration ( registration. deref ( ) ) ;
662651 }
663652 }
664653}
0 commit comments