Title: [215504] trunk/Source/WebKit2
Revision
215504
Author
[email protected]
Date
2017-04-18 22:59:27 -0700 (Tue, 18 Apr 2017)

Log Message

Dragging a few items over MiniBrowser has 0 in the red indicator.
https://bugs.webkit.org/show_bug.cgi?id=170874

Reviewed by Tim Horton.

When WebKit does not accept the drag items, the drag count badge should not be updated.
Also, if WebKit changes the drag count badge, it should be restored to its original
value when the drag exits.

* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::draggingEntered):
(WebKit::WebViewImpl::draggingUpdated):
(WebKit::WebViewImpl::draggingExited):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (215503 => 215504)


--- trunk/Source/WebKit2/ChangeLog	2017-04-19 05:58:44 UTC (rev 215503)
+++ trunk/Source/WebKit2/ChangeLog	2017-04-19 05:59:27 UTC (rev 215504)
@@ -1,3 +1,20 @@
+2017-04-18  Per Arne Vollan  <[email protected]>
+
+        Dragging a few items over MiniBrowser has 0 in the red indicator.
+        https://bugs.webkit.org/show_bug.cgi?id=170874
+
+        Reviewed by Tim Horton.
+
+        When WebKit does not accept the drag items, the drag count badge should not be updated.
+        Also, if WebKit changes the drag count badge, it should be restored to its original
+        value when the drag exits.
+
+        * UIProcess/Cocoa/WebViewImpl.h:
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::draggingEntered):
+        (WebKit::WebViewImpl::draggingUpdated):
+        (WebKit::WebViewImpl::draggingExited):
+
 2017-04-18  Wenson Hsieh  <[email protected]>
 
         [WK2] Add infrastructure and unit tests for file uploads using data interaction

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h (215503 => 215504)


--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h	2017-04-19 05:58:44 UTC (rev 215503)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h	2017-04-19 05:59:27 UTC (rev 215504)
@@ -713,6 +713,11 @@
     bool m_requiresUserActionForEditingControlsManager { false };
     bool m_editableElementIsFocused { false };
     bool m_isTextInsertionReplacingSoftSpace { false };
+    
+#if ENABLE(DRAG_SUPPORT)
+    NSInteger m_initialNumberOfValidItemsForDrop { 0 };
+#endif
+
 };
     
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm (215503 => 215504)


--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm	2017-04-19 05:58:44 UTC (rev 215503)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm	2017-04-19 05:59:27 UTC (rev 215504)
@@ -3600,6 +3600,7 @@
 
     m_page->resetCurrentDragInformation();
     m_page->dragEntered(dragData, draggingInfo.draggingPasteboard.name);
+    m_initialNumberOfValidItemsForDrop = draggingInfo.numberOfValidItemsForDrop;
     return NSDragOperationCopy;
 }
 
@@ -3616,6 +3617,10 @@
     m_page->dragUpdated(dragData, draggingInfo.draggingPasteboard.name);
 
     NSInteger numberOfValidItemsForDrop = m_page->currentDragNumberOfFilesToBeAccepted();
+
+    if (m_page->currentDragOperation() == WebCore::DragOperationNone)
+        numberOfValidItemsForDrop = m_initialNumberOfValidItemsForDrop;
+
     NSDraggingFormation draggingFormation = NSDraggingFormationNone;
     if (m_page->currentDragIsOverFileInput() && numberOfValidItemsForDrop > 0)
         draggingFormation = NSDraggingFormationList;
@@ -3635,6 +3640,8 @@
     WebCore::DragData dragData(draggingInfo, client, global, static_cast<WebCore::DragOperation>(draggingInfo.draggingSourceOperationMask), applicationFlagsForDrag(m_view, draggingInfo));
     m_page->dragExited(dragData, draggingInfo.draggingPasteboard.name);
     m_page->resetCurrentDragInformation();
+    draggingInfo.numberOfValidItemsForDrop = m_initialNumberOfValidItemsForDrop;
+    m_initialNumberOfValidItemsForDrop = 0;
 }
 
 bool WebViewImpl::prepareForDragOperation(id <NSDraggingInfo>)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to