Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WPF - Ensure only single drag operation is emit on DragSourceEndedAt #4814

Merged
merged 3 commits into from
Jun 23, 2024

Conversation

WilliamTomOBrien
Copy link
Contributor

@WilliamTomOBrien WilliamTomOBrien commented May 29, 2024

Fixes: #4801

Summary:

  • This change ensures that only none, move, copy, or link can be passed the the browser host to signify a DragEnd event. Specifying multiple flags on the bitmask seems to prevent the event from firing, and therefore the result that is returned from DragDrop.DoDragDrop is compared to the last drag drop effect we have on record.
  • When doing further testing after creating the issue, I noticed that the dragEnd event was emit when I cancelled the drag drop. Beyond this, when testing and manually specifying the flag, I noticed the event was emit when using the none, move, copy, or link flags by themselves in the bitmask, and seemed to correlate with the event's dataTransfer.dropEvent field. Given the API specifies that can only be one of those four values (and not a mixture of them), that seemed reasonable. Furthermore, it seemed that the DoDragDrop function used within the StartDragging function would consistently return the mask with more than one value set.

Changes:

  • I have modified the implementation of the CefSharp.Wpf ChromiumWebBrowser's StartDragging method, but no significant changes were made to the structure of the code.

How Has This Been Tested?

This has been tested by going through the same process detailed in the issue here. This was done on Windows 11, with an x64 architecture, .NET Version 4.7.2, and the WPF implementation.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Updated documentation

Checklist:

  • Tested the code(if applicable)
  • Commented my code
  • Changed the documentation(if applicable) N/A
  • New files have a license disclaimer
  • The formatting is consistent with the project (project supports .editorconfig)

@AppVeyorBot
Copy link

@amaitland
Copy link
Member

Thanks for the PR 👍

We should compare this to the cefclient reference implementation.

@amaitland amaitland merged commit 4e3c287 into cefsharp:master Jun 23, 2024
1 check passed
@amaitland amaitland added this to the 126.2.x milestone Jun 23, 2024
@amaitland
Copy link
Member

Some quick testing and this look ok 👍 It probably needs more thorough testing though.

Rather than let it sit here I'll extract the logic out into a method and allow for customisation of the behaviour.

Someone can implement their own custom logic (or revert to the previous behaviour if they wanted).

Follow up PR #4845

@amaitland amaitland self-assigned this Jun 23, 2024
@amaitland amaitland linked an issue Jun 23, 2024 that may be closed by this pull request
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WPF - JavaScript DragEnd event not emitted
3 participants