DOMSnapshot: Offset parents of nodes with offsetRects in a LayoutTreeSnapshot

32 views
Skip to first unread message

Vocaloid Feuvre

unread,
Apr 25, 2021, 11:49:30 PM4/25/21
to chrome-debugging-protocol
Heyo,

How do I get the offset parents of nodes with offsetRects in a DOMSnapshot.LayoutTreeSnapshot? I was thinking that there should be a way since offsetRects is there. I'm currently trying to come up with an algorithm that checks the DOMSnapshot return object for them, but if someone here already knows how, that would save me a lot of time.

Thanks,
vocafeuvre

Andrey Kosyakov

unread,
Apr 26, 2021, 12:02:54 AM4/26/21
to Vocaloid Feuvre, chrome-debugging-protocol
Hi,

I don't think this is available at the moment. The offsetRects is a very experimental field that should probably not be there, at least in its current state -- there have been some concerns raised after it has been landed: https://chromium-review.googlesource.com/c/chromium/src/+/1612105). Is there a chance bounds will work for what you're looking to do?

Best regards,
Andrey.


--
You received this message because you are subscribed to the Google Groups "chrome-debugging-protocol" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chrome-debugging-p...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chrome-debugging-protocol/1aacf622-83a5-4a15-92eb-eaa053fb95abn%40googlegroups.com.

Vocaloid Feuvre

unread,
Apr 26, 2021, 12:20:31 AM4/26/21
to chrome-debugging-protocol
That's sad, right now am using bounds and detecting "offsetParents" by checking computedStyles, but I was betting on offsetRects + a better way of getting offsetParents to give me a cleaner approach. I guess I'll stick to my current solution for now.

This is a side question, but d'you think DOMSnapshot.TextBoxSnapshot and DOMSnapshot.LayoutTreeSnapshot is here to stay? Can be in another form somewhat (seeing what happened to the previous iteration .getSnapshot), but the functionality stays the same?

Thanks again,
vocafeuvre

Andrey Kosyakov

unread,
Apr 26, 2021, 12:53:50 AM4/26/21
to Vocaloid Feuvre, lo...@microsoft.com, chrome-debugging-protocol
On Sun, Apr 25, 2021 at 9:20 PM Vocaloid Feuvre <hiraf...@gmail.com> wrote:
That's sad, right now am using bounds and detecting "offsetParents" by checking computedStyles, but I was betting on offsetRects + a better way of getting offsetParents to give me a cleaner approach. I guess I'll stick to my current solution for now.

+lo...@microsoft.com, who originally added offsetRects. Long, would you be able to recommend something here? Perhaps you were solving a similar problem? Also, are you still using these fields?


This is a side question, but d'you think DOMSnapshot.TextBoxSnapshot and DOMSnapshot.LayoutTreeSnapshot is here to stay? Can be in another form somewhat (seeing what happened to the previous iteration .getSnapshot), but the functionality stays the same?

Yes, these are expected to stay, we tend to view them rather essential to what DOMSnapshot does.

Best regards,
Andrey.

 
Reply all
Reply to author
Forward
0 new messages