This is a deceptively difficult problem in general. Our paint system uses the CSS definition of paint order which starts painting at stacking contexts and it is challenging to exclude non-stacked siblings of a non-stacked target element. Some other complications are whether ancestor effects/clips should be applied, and whether content behind the target should be included.
DataTransfer::NodeImage is an attempt at this. Another option is to get the entire page painted (examples: devtools uses PageHandler::CaptureScreenshot and printing uses SpoolSinglePage), then crop it to the target element. On Fri, Jan 7, 2022 at 7:01 AM 'Ramin Halavati' via blink-dev < blink-dev@chromium.org> wrote: > Hi, > > I am trying to find a way to get pixels for any general node in > *third_party/blink/renderer/modules/accessibility. *We already have > AXNodeObject::ImageDataUrl > <https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/accessibility/ax_node_object.cc;drc=a3ae56ec162fcbf9ee400e9ff80f1ae572957fd3;bpv=1;bpt=1;l=2355?gsn=ImageDataUrl&gs=kythe%3A%2F%2Fchromium.googlesource.com%2Fchromium%2Fsrc%3Flang%3Dc%252B%252B%3Fpath%3Dsrc%2Fthird_party%2Fblink%2Frenderer%2Fmodules%2Faccessibility%2Fax_node_object.cc%23rau1_dUeeJHt__0C5nqtyH5ouOMnhdEN55IRAHfVRMk&gs=kythe%3A%2F%2Fchromium.googlesource.com%2Fchromium%2Fsrc%3Flang%3Dc%252B%252B%3Fpath%3Dsrc%2Fthird_party%2Fblink%2Frenderer%2Fmodules%2Faccessibility%2Fax_node_object.h%23z0USMj0KE_TnmxgTOdb4D-K1NmRUt1i1gyvtbSdYs5w> > function > to return the bitmap of a certain node, but it is only supporting HTML > element types that already include a picture (namely image, canvas, video) > and I am trying to expand to to any general element type. > > So far I've been looking for a way to get access to a painter or > compositor, but I did not find any promising solution yet. Can you point me > in the right direction? Is it even expected at this abstraction level? > > Thanks, > Ramin > > P.S., Sorry for naive questions and please point me to the right email > thread if this is not. > > -- > You received this message because you are subscribed to the Google Groups > "blink-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to blink-dev+unsubscr...@chromium.org. > To view this discussion on the web visit > https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAORodQi_LSUFXWxpfAKQKKVhRzK1UvGVz%2B4unQUN2qskFSSafw%40mail.gmail.com > <https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAORodQi_LSUFXWxpfAKQKKVhRzK1UvGVz%2B4unQUN2qskFSSafw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "blink-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscr...@chromium.org. To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAJgFLLsRPzeSSa%2B6bVZcKyWmvP34B-%2BYT_Xm%3DPmYAyvaLtXbMg%40mail.gmail.com.