Skip to content

Conversation

@sjorsdonkers
Copy link
Contributor

@sjorsdonkers sjorsdonkers commented May 13, 2025

  • element.scrollIntoViewIfNeeded
  • DOM.scrollIntoViewIfNeeded
  • DOM.getContentQuads
  • innerHeight
  • innerWidth

@sjorsdonkers sjorsdonkers changed the base branch from main to requestAnimationFrame May 13, 2025 16:20
@sjorsdonkers sjorsdonkers force-pushed the DOM-scoll-and-quads branch from 60c2198 to 85f83e8 Compare May 13, 2025 16:20
Base automatically changed from requestAnimationFrame to main May 13, 2025 16:24
@sjorsdonkers sjorsdonkers force-pushed the DOM-scoll-and-quads branch from 85f83e8 to 4cb14cd Compare May 13, 2025 16:25
}

pub fn _scrollIntoViewIfNeeded(_: *parser.Element, center_if_needed: ?bool) void {
_ = center_if_needed;
Copy link
Contributor Author

@sjorsdonkers sjorsdonkers May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could register the element in the renderer..

@sjorsdonkers sjorsdonkers changed the title [WIP] scrollIntoViewIfNeeded & getContentQuads scrollIntoViewIfNeeded, getContentQuads, innerWidth/Heigh May 14, 2025
@sjorsdonkers sjorsdonkers marked this pull request as ready for review May 14, 2025 09:53
fn getNode(arena: Allocator, browser_context: anytype, node_id: ?Node.Id, backend_node_id: ?Node.Id, object_id: ?[]const u8) !*Node {
const input_node_id = node_id orelse backend_node_id;
if (input_node_id) |input_node_id_| {
return browser_context.node_registry.lookup_by_id.get(input_node_id_) orelse return error.NodeNotFound;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would a getById function on registry be useful?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To reduce: .lookup_ _. I personally am not a fan of convenience functions.

const parser_node = try bc.inspector.getNodePtr(cmd.arena, params.objectId.?);
const node = try bc.node_registry.register(@ptrCast(parser_node));
return cmd.sendResult(.{ .node = bc.nodeWriter(node, .{}) }, .{});
const parser_node = try browser_context.inspector.getNodePtr(arena, object_id_);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know what getNodePtr is doing. It's ok that its memory (from the arena) will be gone after this function returns?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the object_group may be returned on the allocator, which is not used. (Arena is also used for temporary error strings, but not returned (returned as error enum))

@sjorsdonkers sjorsdonkers force-pushed the DOM-scoll-and-quads branch from 93f51de to f74647c Compare May 14, 2025 15:14
@karlseguin karlseguin merged commit 46546de into main May 15, 2025
9 checks passed
@karlseguin karlseguin deleted the DOM-scoll-and-quads branch May 15, 2025 01:12
@github-actions github-actions bot locked and limited conversation to collaborators May 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants