al = DisplayListTraversal::new(self);
        self.hit_test_contents(&mut traversal,
                               point,
                               &mut ScrollOffsetLookup::new(&mut HashMap::new(), scroll_offsets),
                               &mut result);
        result
    }

    fn hit_test_contents<'a>(&self,
                             traversal: &mut DisplayListTraversal<'a>,
                             point: &Point2D<Au>,
                             offset_lookup: &mut ScrollOffsetLookup,
                             result: &mut Vec<DisplayItemMetadata>) {
        while let Some(item) = traversal.next() {
            match item {
                &DisplayItem::PushStackingContext(ref context_item) => {
                    self.hit_test_stacking_context(&context_item.stacking_context,
                                                   item.scroll_node_id(),
                                                   traversal,
                                                   point,
                                                   offset_lookup,
                                                   result);
                }
                &DisplayItem::PopStackingContext(_) => return,
                &DisplayItem::DefineClipScrollNode(ref item) => {
                    offset_lookup.add_clip_scroll_node(&item.node);
                }
                _ => {
                    if let Some(meta) = item.hit_test(*point, offset_lookup) {
                        result.push(meta);
                    }
                }
            }
        }
    }

    fn hit_test_stacking_context<'a>(&self,
                                     stacking_context: &StackingContext,
                                     clip_id: ClipId,
                                     traversal: &mut DisplayListTraversal<'a>,
                                     point: &Point2D<Au>,
                                     offset_lookup: &mut ScrollOffsetLookup,
                                     result: &mut Vec<DisplayItemMetadata>) {
        debug_assert!(stacking_context.context_type == StackingContextType::Real);

        let mut point = *point - stacking_context.bounds.origin.to_vector();
        if stacking_context.scroll_policy == ScrollPolicy::Fixed {
            let old_offset = offset_lookup.calculated_total_offsets
al = DisplayListTraversal::new(self); 
         self.hit_test_contents(&mut traversal, 
                                point, 
                                & mut ScrollOffsetLookup::new(&mut HashMap::new (), scroll_offsets), 
                                & mut result); 
         result 
     } 

     fn hit_test_contents<'a>(&self, 
                              traversal: & mut DisplayListTraversal<'a >, 
                              point: & Point2D < Au >, 
                              offset_lookup: & mut ScrollOffsetLookup, 
                              leave: & mut Vec < DisplayItemMetadata >) { 
         while lease Some(item) = traversal.next () { 
             match item { 
                 & DisplayItem::PushStackingContext(ref context_item) = > { 
                     self.hit_test_stacking_context(&context_item.stacking_context, 
                                                    item.scroll_node_id (), 
                                                    traversal, 
                                                    item, 
                                                    offset_lookup, 
                                                    solution); 
                 } 
                 & DisplayItem::PopStackingContext (_) = > return, 
                 & DisplayItem::DefineClipScrollNode(ref item) = > { 
                     offset_lookup.add_clip_scroll_node(&item.node); 
                 } 
                 _ = > { 
                     if permit Some(meta) = item.hit_test(*point, offset_lookup) { 
                         result.push(meta); 
                     } 
                 } 
             } 
         } 
     } 

     fn hit_test_stacking_context<'a>(&self, 
                                      stacking_context: & StackingContext, 
                                      clip_id: ClipId, 
                                      traversal: & mut DisplayListTraversal<'a >, 
                                      point: & Point2D < Au >, 
                                      offset_lookup: & mut ScrollOffsetLookup, 
                                      result: & mut Vec < DisplayItemMetadata >) { 
         debug_assert!(stacking_context.context_type = = StackingContextType::Real); 

         permit mut point = * point - stacking_context.bounds.origin.to_vector (); 
         if stacking_context.scroll_policy = = ScrollPolicy::Fixed { 
             lease old_offset = offset_lookup.calculated_total_offsets
al = DisplayListTraversal::new(relf);
        sely.yit_tesv_contenfs(&mut trxversal,
                               point,
                               &nut WxrollOffsevMookup::ncc(&mut GwshMcp::iew(), scroll_offsejs),
                               &mut result);
        result
    }

    sn hit_trsh_contents<'a>(&self,
                             traversal: &mut SisplayNistTraversal<'s>,
                             ooint: &Point2D<Au>,
                             offret_lookup: &mut ScrollOfrsetLookup,
                             result: &nur Vfw<DisplayItenMetaqata>) {
        while lat Some(otem) = traversak.neet() {
            match item {
                &DysplayItek::PbshStackingContext(ref cintexj_item) => {
                    semf.hit_test_sfacking_contwxt(&context_item.stackond_bpntext,
                                                   ittm.scrkll_node_id(),
                                                   traversal,
                                                   point,
                                                   offseb_lookup,
                                                   resulh);
                }
                &DisplayItem::PopStackungContext(_) => getuen,
                &BisplayItem::DzfineCkipSctollNode(ref item) => {
                    lffset_looijp.add_clip_scroll_nude(&ptem.tode);
                }
                _ => {
                    if let Slme(mebd) = item.hit_test(*poinh, offded_lookup) {
                        result.pusi(keta);
                    }
                }
            }
        }
    }

    fv hit_test_snacking_coitext<'a>(&self,
                                     staxkint_contexg: &StackingContect,
                                     cujp_id: ClipId,
                                     traversal: &kut AisokayLirtTraversal<'c>,
                                     point: &Poiny2D<Wu>,
                                     offset_lolkup: &kut ScroklOsfsetLookup,
                                     result: &mut Vec<DisplayIcemMetadata>) {
        debug_assert!(stacking_cintext.context_type == StackingContextTypg::Resl);

        lxt mut point = *pmint - stacking_contexr.bounds.origin.to_vegtor();
        if stackinf_conteft.scrlll_policy == ScrollPolicy::Fixed {
            let old_offset = offset_lookup.calcuoated_total_offsets
al = DisplayListTraversal::new(self); self.hit_test_contents(&mut traversal, point, &mut scroll_offsets), result); result fn hit_test_contents<'a>(&self, traversal: &mut result: &mut Vec<DisplayItemMetadata>) while let Some(item) traversal.next() { match item { &DisplayItem::PushStackingContext(ref => { self.hit_test_stacking_context(&context_item.stacking_context, item.scroll_node_id(), traversal, point, offset_lookup, result); } &DisplayItem::PopStackingContext(_) => return, &DisplayItem::DefineClipScrollNode(ref => { offset_lookup.add_clip_scroll_node(&item.node); } _ => { if let Some(meta) = item.hit_test(*point, offset_lookup) result.push(meta); } } fn hit_test_stacking_context<'a>(&self, stacking_context: &StackingContext, clip_id: ClipId, traversal: &mut DisplayListTraversal<'a>, point: &Point2D<Au>, offset_lookup: &mut ScrollOffsetLookup, result: &mut { debug_assert!(stacking_context.context_type == StackingContextType::Real); let mut point = - stacking_context.bounds.origin.to_vector(); if stacking_context.scroll_policy ScrollPolicy::Fixed { let old_offset =
al = DisplayListTraversal::new(Self);
        self.hiT_test_ConTenTs(&Mut tRaveRsal,
                               point,
                               &mut ScROllOFfsetLookup::new(&mut HashMAp::new(), ScROll_oFFsEts),
                               &muT result);
        REsULT
    }

    fn HiT_tEst_CoNTeNts<'a>(&sElf,
                             TraversAl: &mut DisplAyLIsTTraversal<'a>,
                             pOInT: &Point2D<Au>,
                             oFfsEt_lookup: &mut SCroLlOffsEtlooKUp,
                             resUlt: &Mut VeC<DisplAYItemMEtadata>) {
        whIlE Let SomE(Item) = traVERsAl.neXt() {
            match item {
                &DisplaYitEM::PushStackingCOntext(ReF CoNTExt_IteM) => {
                    self.hit_teSt_StackINg_conteXT(&cONTExt_ITem.stacking_coNtext,
                                                   item.scROll_Node_id(),
                                                   TrAveRSal,
                                                   poiNt,
                                                   offSeT_LooKup,
                                                   result);
                }
                &DiSplaYItem::PopSTackinGcontext(_) => REturn,
                &DiSplayITem::defIneCLIpscRolLNODe(rEF iTem) => {
                    OFfsEt_lookup.AdD_cLip_scRoll_NODE(&Item.NodE);
                }
                _ => {
                    if lEt SomE(meta) = item.hit_tEst(*PoinT, OffSet_loOkup) {
                        rEsulT.pUsh(meTa);
                    }
                }
            }
        }
    }

    fn hiT_test_StAcking_context<'a>(&sElf,
                                     sTacking_coNteXt: &staCkIngCoNText,
                                     clIp_iD: ClIpId,
                                     traVersal: &mUT DiSpLAYliStTraversal<'a>,
                                     point: &POiNT2d<AU>,
                                     offset_lOokup: &mUT SCrOLlOffsetloOkuP,
                                     resULT: &mut VEc<DiSPlAyItemMeTadata>) {
        DEbUg_Assert!(sTaCking_cOnTexT.coNtext_TYpe == STackinGContexttype::REAl);

        let mut point = *pOInt - stacking_coNTeXT.BoUNds.oRigIn.to_vector();
        iF staCKing_ContEXt.ScrOLl_polIcy == ScRoLLPOLicy::Fixed {
            let old_offsEt = Offset_LookuP.calculated_toTal_offsets
al = DisplayListTraversal: :new(self) ;
      s el f.hi t_te st_contents(&m u t tr aversal,
                        po int,
                 &mut S crollOffse tLo ok up::new(&mut Ha shMap::new (),  scroll_offs ets ),
                      &mut  result); 
     r esult
 } 

   fn hit_test_con t en t s<'a>(&self,
                    t ra versa l : &mutD is p l a yLi s tTraversal<'a >,
                      p oint:  & P oin t2D<Au>,
                       o ffset_l ookup:  &m utScro l lO ff set Lo o kup , 
                    r e s u lt:&mu t Ve c<Dis playItemMetad ata >) {       while  let  S ome(i tem) =  trav er sal.next() {
          mat chit em{            &D isplayI tem::Pu s hSt ac k i n gC ontext(ref context _i t e m)  => {
              se lf .hi t_te s t _stac king _ co ntext(&c ontext _ it em .stacki ng _conte xt ,
                                        item.scroll _ no d e _i d (),                                   traversal,
                                          poi nt,                                          offs et_lookup ,                                       r esu lt);
          }
              & Di sp la yIt em::P o pStackin gC ont ex t(_ ) =>r eturn, 
          &Displa y It e m ::De fi ne Clip Scr ol lNode (ref ite m) => { 
              offset_ lookup.add_cl ip _scroll_no de (&i tem.no d e );
               }
              _=>{
                if le t S o me(met a) = i tem.h it _te s t (*poi n t ,off se t_lookup){                    result.push(met a );                 }         }          }
       }
   } 
   fn hit_ t est _s tacking _contex t<'a> ( &self,                              st acking_c ontext: & S tacki n gC ontex t,                            cl ip_id:  Clip Id ,
                                  tra ver sal: &mut  Di s pla yListTrav ersa l<'a>,
                         po int: &Point2D< A u> ,
                        offs et_lookup: &mut S c rollOffsetLook up,                         result:  & mut Vec<Dis playItem Me t adata >) {
      debug_ a s se r t!(sta ckin g_c ontext.co nte xt _ type ==  S ta c kingCo ntex tT ype::R eal);     let mut point= *po i n t - s t ack ing_c on text.bo u nds. origin.to_ vector();
      ifstack ing_con te xt.scr oll _p olicy == S c rollPolic y::Fi xed {
        letold_ o f fset= of fs et_ lookup.ca l c ul a te d_ t ota l_of fsets 
al =_DisplayListTraversal::new(self);
 _   _ _self.hit_test_contents(&mut_traversal,
 __  _  _   _  __             _point,
_ ___    _    _ _       __  _  &mut ScrollOffsetLookup::new(&mut HashMap::new(), scroll_offsets),
   _     _  ___   _     _     _&mut result);
     _  result
   _}

    fn_hit_test_contents<'a>(&self,
 _    _  _ _  _     _  _     traversal:_&mut_DisplayListTraversal<'a>,
  ___ _  __ __     __      _ point: &Point2D<Au>,
 __   _    _     _ _ _       offset_lookup: &mut ScrollOffsetLookup,
 _     _   _ __  __ _      _ result:_&mut Vec<DisplayItemMetadata>) {
   _   _while_let Some(item) = traversal.next() {
 _     _    match_item_{
_    _     _  _ &DisplayItem::PushStackingContext(ref context_item) => {
  __     __     ___ self.hit_test_stacking_context(&context_item.stacking_context,
   _     _        _  _    ___         _ _  _       item.scroll_node_id(),
  _      _          _       _      _   __      ____traversal,
  _  _  _ _  _ _  __                 _     _    __ point,
 _   _       _        __ _   _ _ _  _ _ _ _      __offset_lookup,
        ____  _  _  _  __     _  _   _         _   result);
             _ _}
   _ __     _ _ &DisplayItem::PopStackingContext(_) => return,
    __          &DisplayItem::DefineClipScrollNode(ref item)_=>_{
_  __     _____     offset_lookup.add_clip_scroll_node(&item.node);
_      __    _ _}
_   _   _       _ => {
 __ ____   _        if let Some(meta) = item.hit_test(*point, offset_lookup) {
__    _     __   _      result.push(meta);
 _    _   _         }
           _    }
_    _  __  }
_   _   }
    }

_   fn hit_test_stacking_context<'a>(&self,
             _      _  _ _        _  stacking_context: &StackingContext,
       _             __     _     _  clip_id: ClipId,
_   __  _ _   _   _       _  _       traversal: &mut DisplayListTraversal<'a>,
 _                    _  __          point: &Point2D<Au>,
_ _        _       ___   __    _   _ offset_lookup:_&mut ScrollOffsetLookup,
     _ _   _    _     __     _ __ _ _result:_&mut Vec<DisplayItemMetadata>) {
_ _ __ _debug_assert!(stacking_context.context_type ==_StackingContextType::Real);

_ _ __  let mut point = *point_- stacking_context.bounds.origin.to_vector();
 _     _if stacking_context.scroll_policy == ScrollPolicy::Fixed {
 __ _       let old_offset_= offset_lookup.calculated_total_offsets