@@ -687,18 +687,18 @@ let preload_css (doc : Dom_html.element Js.t) =
687687[@@@ warning " -39" ]
688688
689689type position =
690- {html_top : int ; html_left : int ; body_top : int ; body_left : int }
690+ {html_top : float ; html_left : float ; body_top : float ; body_left : float }
691691[@@ deriving json ]
692692
693693[@@@ warning " +39" ]
694694
695- let top_position = {html_top = 0 ; html_left = 0 ; body_top = 0 ; body_left = 0 }
695+ let top_position = {html_top = 0. ; html_left = 0. ; body_top = 0. ; body_left = 0. }
696696
697697let createDocumentScroll () =
698- { html_top = Dom_html. document##.documentElement##.scrollTop
699- ; html_left = Dom_html. document##.documentElement##.scrollLeft
700- ; body_top = Dom_html. document##.body##.scrollTop
701- ; body_left = Dom_html. document##.body##.scrollLeft }
698+ { html_top = Js. to_float Dom_html. document##.documentElement##.scrollTop
699+ ; html_left = Js. to_float Dom_html. document##.documentElement##.scrollLeft
700+ ; body_top = Js. to_float Dom_html. document##.body##.scrollTop
701+ ; body_left = Js. to_float Dom_html. document##.body##.scrollLeft }
702702
703703(* With firefox, the scroll position is restored before to fire the
704704 popstate event. We maintain our own position. *)
@@ -719,10 +719,10 @@ let _ =
719719let getDocumentScroll () = ! current_position
720720
721721let setDocumentScroll pos =
722- Dom_html. document##.documentElement##.scrollTop := pos.html_top;
723- Dom_html. document##.documentElement##.scrollLeft := pos.html_left;
724- Dom_html. document##.body##.scrollTop := pos.body_top;
725- Dom_html. document##.body##.scrollLeft := pos.body_left;
722+ Dom_html. document##.documentElement##.scrollTop := Js. float pos.html_top;
723+ Dom_html. document##.documentElement##.scrollLeft := Js. float pos.html_left;
724+ Dom_html. document##.body##.scrollTop := Js. float pos.body_top;
725+ Dom_html. document##.body##.scrollLeft := Js. float pos.body_left;
726726 current_position := pos
727727
728728(* UGLY HACK for Opera bug: Opera seem does not always take into
0 commit comments