Title: [265649] trunk/Source/WebKit
Revision
265649
Author
[email protected]
Date
2020-08-13 23:00:32 -0700 (Thu, 13 Aug 2020)

Log Message

[GTK] Do not accept drag operations when the matched target list is empty
https://bugs.webkit.org/show_bug.cgi?id=215372

Reviewed by Adrian Perez de Castro.

Do not initialize m_selectionData if we don't have valid targets.

* UIProcess/API/gtk/DropTargetGtk3.cpp:
(WebKit::DropTarget::accept):
(WebKit::DropTarget::leaveTimerFired):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (265648 => 265649)


--- trunk/Source/WebKit/ChangeLog	2020-08-14 05:59:19 UTC (rev 265648)
+++ trunk/Source/WebKit/ChangeLog	2020-08-14 06:00:32 UTC (rev 265649)
@@ -1,3 +1,16 @@
+2020-08-13  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Do not accept drag operations when the matched target list is empty
+        https://bugs.webkit.org/show_bug.cgi?id=215372
+
+        Reviewed by Adrian Perez de Castro.
+
+        Do not initialize m_selectionData if we don't have valid targets.
+
+        * UIProcess/API/gtk/DropTargetGtk3.cpp:
+        (WebKit::DropTarget::accept):
+        (WebKit::DropTarget::leaveTimerFired):
+
 2020-08-13  Brady Eidson  <[email protected]>
 
         (WK2 only) gamepad mapping stops being reported as “standard” in new tabs.

Modified: trunk/Source/WebKit/UIProcess/API/gtk/DropTargetGtk3.cpp (265648 => 265649)


--- trunk/Source/WebKit/UIProcess/API/gtk/DropTargetGtk3.cpp	2020-08-14 05:59:19 UTC (rev 265648)
+++ trunk/Source/WebKit/UIProcess/API/gtk/DropTargetGtk3.cpp	2020-08-14 06:00:32 UTC (rev 265649)
@@ -105,7 +105,7 @@
     }
 
     m_dataRequestCount = 0;
-    m_selectionData = SelectionData();
+    m_selectionData = WTF::nullopt;
 
     // WebCore needs the selection data to decide, so we need to preload the
     // data of targets we support. Once all data requests are done we start
@@ -131,7 +131,11 @@
         }
     }
 
+    if (targets.isEmpty())
+        return;
+
     m_dataRequestCount = targets.size();
+    m_selectionData = SelectionData();
     for (auto* atom : targets)
         gtk_drag_get_data(m_webView, m_drop.get(), atom, time);
 }
@@ -239,7 +243,8 @@
     auto* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(m_webView));
     ASSERT(page);
 
-    DragData dragData(&m_selectionData.value(), *m_position, convertWidgetPointToScreenPoint(m_webView, *m_position), { });
+    SelectionData emptyData;
+    DragData dragData(m_selectionData ? &m_selectionData.value() : &emptyData, *m_position, convertWidgetPointToScreenPoint(m_webView, *m_position), { });
     page->dragExited(dragData);
     page->resetCurrentDragInformation();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to