CefRenderHandler::OnTextSelectionChanged not fired

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

CefRenderHandler::OnTextSelectionChanged not fired

Postby Czarek » Sat Aug 18, 2018 11:25 am

When I select text programmatically using javascript API the OnTextSelectionChanged callback is not getting called. Is this expected? I am creating unit tests and when I execute CefBrowser.SendMouseClickEvent to emulate mouse selection it works fine, but when I try to do the same using javascript code it doesn't work.

Code: Select all
        const selection = window.getSelection();
        const range = document.createRange();
        range.selectNodeContents(node);
        selection.removeAllRanges();
        selection.addRange(range);


Another thing I noticed is that in CEF unittest text selection is accomplished by making two SendMouseClickEvent calls. When I try to do the same in my app it doesn't work. It starts working only after I make an additional SendMouseMoveEvent between these two clicks. However there is no mouse move event done in CEF unit tests, so I wonder why it works in CEF unit tests. CEF tests code here:

https://github.com/chromiumembedded/cef ... st.cc#L943

CEF 3359.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: CefRenderHandler::OnTextSelectionChanged not fired

Postby shagkur » Wed Aug 22, 2018 2:50 am

Yes that's expected. This handler is called via IPC from the renderer process which for this is expecting to be triggered by mouse events.
The test case does a mouse down followed by a mouse up. And is just clicking inside a text edit box which, by definition, does a select all of the text inside.
shagkur
Newbie
 
Posts: 3
Joined: Mon Jan 22, 2018 9:43 am


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 77 guests