File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -370,7 +370,7 @@ pub const Element = struct {
370370 pub fn _getBoundingClientRect (self : * parser.Element , state : * SessionState ) ! DOMRect {
371371 // Since we are lazy rendering we need to do this check. We could store the renderer in a viewport such that it could cache these, but it would require tracking changes.
372372 const root = try parser .nodeGetRootNode (parser .elementToNode (self ));
373- if (root != parser .documentToNode (parser .documentHTMLToDocument (state .document .? ))) {
373+ if (root != parser .documentToNode (parser .documentHTMLToDocument (state .window . document .? ))) {
374374 return DOMRect { .x = 0 , .y = 0 , .width = 0 , .height = 0 };
375375 }
376376 return state .renderer .getRect (self );
@@ -381,7 +381,7 @@ pub const Element = struct {
381381 // Returns an empty array if the element is eventually detached from the main window
382382 pub fn _getClientRects (self : * parser.Element , state : * SessionState ) ! []DOMRect {
383383 const root = try parser .nodeGetRootNode (parser .elementToNode (self ));
384- if (root != parser .documentToNode (parser .documentHTMLToDocument (state .document .? ))) {
384+ if (root != parser .documentToNode (parser .documentHTMLToDocument (state .window . document .? ))) {
385385 return &.{};
386386 }
387387 const heap_ptr = try state .call_arena .create (DOMRect );
Original file line number Diff line number Diff line change @@ -255,10 +255,10 @@ pub const HTMLDocument = struct {
255255 // Thus we can add the HtmlHtmlElement and it's child HTMLBodyElement to the returned list.
256256 // TBD Should we instead return every parent that is an element? Note that a child does not physically need to be overlapping the parent.
257257 // Should we do a render pass on demand?
258- const doc_elem = try parser .documentGetDocumentElement (parser .documentHTMLToDocument (state .document .? )) orelse {
258+ const doc_elem = try parser .documentGetDocumentElement (parser .documentHTMLToDocument (state .window . document .? )) orelse {
259259 return list .items ;
260260 };
261- if (try parser .documentHTMLBody (state .document .? )) | body | {
261+ if (try parser .documentHTMLBody (state .window . document .? )) | body | {
262262 list .appendAssumeCapacity (try Element .toInterface (parser .bodyToElement (body )));
263263 }
264264 list .appendAssumeCapacity (try Element .toInterface (doc_elem ));
You can’t perform that action at this time.
0 commit comments