refix rebase regressions

This commit is contained in:
sjorsdonkers
2025-05-19 16:27:55 +02:00
committed by Sjors
parent 6c92d50c68
commit 226dafa9e3
2 changed files with 4 additions and 4 deletions

View File

@@ -370,7 +370,7 @@ pub const Element = struct {
pub fn _getBoundingClientRect(self: *parser.Element, state: *SessionState) !DOMRect {
// 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.
const root = try parser.nodeGetRootNode(parser.elementToNode(self));
if (root != parser.documentToNode(parser.documentHTMLToDocument(state.document.?))) {
if (root != parser.documentToNode(parser.documentHTMLToDocument(state.window.document.?))) {
return DOMRect{ .x = 0, .y = 0, .width = 0, .height = 0 };
}
return state.renderer.getRect(self);
@@ -381,7 +381,7 @@ pub const Element = struct {
// Returns an empty array if the element is eventually detached from the main window
pub fn _getClientRects(self: *parser.Element, state: *SessionState) ![]DOMRect {
const root = try parser.nodeGetRootNode(parser.elementToNode(self));
if (root != parser.documentToNode(parser.documentHTMLToDocument(state.document.?))) {
if (root != parser.documentToNode(parser.documentHTMLToDocument(state.window.document.?))) {
return &.{};
}
const heap_ptr = try state.call_arena.create(DOMRect);

View File

@@ -255,10 +255,10 @@ pub const HTMLDocument = struct {
// Thus we can add the HtmlHtmlElement and it's child HTMLBodyElement to the returned list.
// TBD Should we instead return every parent that is an element? Note that a child does not physically need to be overlapping the parent.
// Should we do a render pass on demand?
const doc_elem = try parser.documentGetDocumentElement(parser.documentHTMLToDocument(state.document.?)) orelse {
const doc_elem = try parser.documentGetDocumentElement(parser.documentHTMLToDocument(state.window.document.?)) orelse {
return list.items;
};
if (try parser.documentHTMLBody(state.document.?)) |body| {
if (try parser.documentHTMLBody(state.window.document.?)) |body| {
list.appendAssumeCapacity(try Element.toInterface(parser.bodyToElement(body)));
}
list.appendAssumeCapacity(try Element.toInterface(doc_elem));