Dragging file to browser sometime fails in OSR mode

Post Reply
tad.chen
Posts: 58
Joined: Fri Jan 04, 2019 1:39 am

Dragging file to browser sometime fails in OSR mode

Post by tad.chen »

In one of my website which needs account to log in, allow user to drag text file to an area, then the content of text file will be shown in the area. In normal mode, it works correctly. But in OSR mode, the content can't be shown. After that, I test it in some simple website which has the same function, both of the two modes can work correctly.

I don't know the reason. In OSR mode, browser will call chrmosr.InitializeDragAndDrop(Self) in the beginning, all the dragging is handled by CEF4Delphi. So, I don't know how to debug it.
User avatar
salvadordf
Posts: 2966
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Dragging file to browser sometime fails in OSR mode

Post by salvadordf »

Hi,

Try the SimpleOSRBrowser demo on that website.

If it doesn't work with SimpleOSRBrowser then try the official CEF sample application. It's available here :
https://cef-builds.spotifycdn.com/cef_binary_90.5.4%2Bgc6a4331%2Bchromium-90.0.4430.72_windows32_client.tar.bz2

Use this command to run cefclient in OSR mode :

Code: Select all

cefclient --off-screen-rendering-enabled
Try disabling GPU acceleration in your application if you had it enabled.
tad.chen
Posts: 58
Joined: Fri Jan 04, 2019 1:39 am

Re: Dragging file to browser sometime fails in OSR mode

Post by tad.chen »

SimpleOSRBrowser can work correctly. But the web page is in the popup window, not the default window. Because After I log in the website, it will popup a new tab or window where the area for dragging file is.

So I modify the code in chrmosrBeforePopup event to allow popup window (SimpleOSRBrowser' code blocks all popup windows and new tabs).

But I don't know whether Popup window is still is OSR mode. The dragging file icon is different in the popup window and the default window.

The CefClient can't work, because it blocks dragging file.
Last edited by tad.chen on Tue Apr 20, 2021 1:28 pm, edited 1 time in total.
User avatar
salvadordf
Posts: 2966
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Dragging file to browser sometime fails in OSR mode

Post by salvadordf »

Open the PopupBrowser demo with Delphi and add the InitializeDragAndDrop and ShutdownDragAndDrop calls to the child form.

Then test your website with the modified PopupBrowser demo.
tad.chen
Posts: 58
Joined: Fri Jan 04, 2019 1:39 am

Re: Dragging file to browser sometime fails in OSR mode

Post by tad.chen »

The PopupBrowser can work. And it can show the dragging file icon correctly (see attachment). But in SimpleOSRBrowser default window, the dragging file icon is very small.
You do not have the required permissions to view the files attached to this post.
tad.chen
Posts: 58
Joined: Fri Jan 04, 2019 1:39 am

Re: Dragging file to browser sometime fails in OSR mode

Post by tad.chen »

I made a mistake. The web page for dragging is in the second popup window, the web page sequence is default window => popup window => popup window (we want).

I check the code of PopupBrowser and find that Chromium1BeforePopup event is not handled in childform (may be a bug), which means that it will not use the childform to popup a new window if user click some link in the childform. Thus, when I find dragging file is OK, it's not childform, but internal popup window.

I modify the code of childform, let it popup window in a new childform. Then test again and find that childform even can't support dragging file. The forbid icon is shown when file is dragged over. But InitializeDragAndDrop is called in its CreateClientHandler function. I don't know the reason. But the Mainform supports dragging. The difference between mainform and childform is that mainform uses CEFWindowParent and childform uses bufferpanel. I don't know whether it's the reason.
User avatar
salvadordf
Posts: 2966
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Dragging file to browser sometime fails in OSR mode

Post by salvadordf »

Thanks for reporting this issue! :D

I just uploaded the fix for that demo and I also added a couple of buttons in the PopupBrowser.html file to test drag and drop.

The last button allows to drag a file and it works in the new child window.
tad.chen
Posts: 58
Joined: Fri Jan 04, 2019 1:39 am

Re: Dragging file to browser sometime fails in OSR mode

Post by tad.chen »

It works now. Thank you :D
Post Reply