RuidSiel / chromiumembedded

Automatically exported from code.google.com/p/chromiumembedded
0 stars 1 forks source link

Support hit-testing #319

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
WebKit supports a notion of hit-testing (i.e., you can ask WebKit to tell you 
what DOM node, etc. is under a given point).  It'd be nice if CEF exposed this 
functionality to clients.

There are probably many use cases, but the one I'm running into at the moment 
is that I want to select the node (word or image, typically) beneath the user's 
mouse pointer when they right-click in my editor.  Being able to perform a hit 
test and query the HitTestResult would allow me to easily select the node under 
point.

Original issue reported on code.google.com by emerick on 30 Aug 2011 at 4:13

GoogleCodeExporter commented 9 years ago
Can you describe how hit-testing currently works in WebKit/Chromium (ie, 
references to the relevant JavaScript APIs or example code)?

Original comment by magreenb...@gmail.com on 30 Aug 2011 at 4:26

GoogleCodeExporter commented 9 years ago
Or is this something that would be done strictly on the C++ API side?

Original comment by magreenb...@gmail.com on 30 Aug 2011 at 4:34

GoogleCodeExporter commented 9 years ago
Yes, I was envisioning it happening strictly on the C++ side. In my particular
case, I would perform a hit test right before displaying my context menu;
if the result of the hit test contained a word or
image, I could then select it. 

Original comment by emer...@evernote.com on 30 Aug 2011 at 4:42

GoogleCodeExporter commented 9 years ago
@comment#3: It seems like this is something that should be possible currently 
using JavaScript. For example, you could use document.elementFromPoint(x,y) to 
retrieve the DOM element on right-click and then use JavaScript to select it. 
Have you explored this avenue?

Original comment by magreenb...@gmail.com on 30 Aug 2011 at 4:49

GoogleCodeExporter commented 9 years ago
I hadn't considered JavaScript, so yes, that does sound like it might work 
(thanks!).  In our application, we've tried to limit our use of JavaScript out 
of (perhaps unfounded) fears about V8's memory footprint and garbage 
collection.  I'd ultimately like to be able to do this from C++, but I 
definitely understand that this is probably a niche request.  :-)

Original comment by emerick on 30 Aug 2011 at 5:17

GoogleCodeExporter commented 9 years ago
Marking this issue as WontFix because JavaScript is a viable alternative.

Original comment by magreenb...@gmail.com on 8 Mar 2013 at 9:15

GoogleCodeExporter commented 9 years ago
My application requires a hit test for every mouse movement. Using JS every 
hitTest requires 4ms avg.
Thus, i request re-opening this ticket since using JS is not a performant way.

Original comment by acm...@googlemail.com on 1 Oct 2014 at 1:06