Title: [265756] trunk/Source
Revision
265756
Author
[email protected]
Date
2020-08-17 09:33:54 -0700 (Mon, 17 Aug 2020)

Log Message

Clean up DragApplicationFlags after switch to OptionSet<>
<https://webkit.org/b/215349>

Reviewed by Darin Adler.

Change WebCore::DragApplicationFlags to an enum class.

Source/WebCore:

No new tests since no change in behavior.

* page/gtk/DragControllerGtk.cpp:
(WebCore::DragController::isCopyKeyDown):
* page/mac/DragControllerMac.mm:
(WebCore::DragController::isCopyKeyDown):
(WebCore::DragController::dragOperation):
* platform/DragData.h:

Source/WebKit:

* UIProcess/API/gtk/DropTargetGtk3.cpp:
(WebKit::DropTarget::drop):
- Switch to use OptionSet<WebCore::DragApplicationFlags>.
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::applicationFlagsForDrag):
* WebProcess/WebPage/WebPage.h:
- Update forward declaration.

Source/WebKitLegacy/mac:

* WebView/WebView.mm:
(-[WebView applicationFlags:]): Deleted.
(-[WebView _applicationFlagsForDrag:]):
- Rename -applicationFlags: to -_applicationFlagsForDrag: since
  it's only used internally.
- Switch to return OptionSet<WebCore::DragApplicationFlags>.
(-[WebView draggingEntered:]):
(-[WebView draggingUpdated:]):
(-[WebView draggingExited:]):
(-[WebView performDragOperation:]):
- Switch to calling -_applicationFlagsForDrag:.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (265755 => 265756)


--- trunk/Source/WebCore/ChangeLog	2020-08-17 14:06:16 UTC (rev 265755)
+++ trunk/Source/WebCore/ChangeLog	2020-08-17 16:33:54 UTC (rev 265756)
@@ -1,3 +1,21 @@
+2020-08-17  David Kilzer  <[email protected]>
+
+        Clean up DragApplicationFlags after switch to OptionSet<>
+        <https://webkit.org/b/215349>
+
+        Reviewed by Darin Adler.
+
+        Change WebCore::DragApplicationFlags to an enum class.
+
+        No new tests since no change in behavior.
+
+        * page/gtk/DragControllerGtk.cpp:
+        (WebCore::DragController::isCopyKeyDown):
+        * page/mac/DragControllerMac.mm:
+        (WebCore::DragController::isCopyKeyDown):
+        (WebCore::DragController::dragOperation):
+        * platform/DragData.h:
+
 2020-08-17  Yusuke Suzuki  <[email protected]>
 
         JSDOMConstructorNotConstructable should be a constructor

Modified: trunk/Source/WebCore/page/gtk/DragControllerGtk.cpp (265755 => 265756)


--- trunk/Source/WebCore/page/gtk/DragControllerGtk.cpp	2020-08-17 14:06:16 UTC (rev 265755)
+++ trunk/Source/WebCore/page/gtk/DragControllerGtk.cpp	2020-08-17 16:33:54 UTC (rev 265756)
@@ -47,7 +47,7 @@
 
 bool DragController::isCopyKeyDown(const DragData& dragData)
 {
-    return dragData.flags().contains(DragApplicationIsCopyKeyDown);
+    return dragData.flags().contains(DragApplicationFlags::IsCopyKeyDown);
 }
 
 Optional<DragOperation> DragController::dragOperation(const DragData& dragData)

Modified: trunk/Source/WebCore/page/mac/DragControllerMac.mm (265755 => 265756)


--- trunk/Source/WebCore/page/mac/DragControllerMac.mm	2020-08-17 14:06:16 UTC (rev 265755)
+++ trunk/Source/WebCore/page/mac/DragControllerMac.mm	2020-08-17 16:33:54 UTC (rev 265756)
@@ -61,12 +61,12 @@
 
 bool DragController::isCopyKeyDown(const DragData& dragData)
 {
-    return dragData.flags().contains(DragApplicationIsCopyKeyDown);
+    return dragData.flags().contains(DragApplicationFlags::IsCopyKeyDown);
 }
     
 Optional<DragOperation> DragController::dragOperation(const DragData& dragData)
 {
-    if (dragData.flags().contains(DragApplicationIsModal))
+    if (dragData.flags().contains(DragApplicationFlags::IsModal))
         return WTF::nullopt;
 
     bool mayContainURL;
@@ -78,7 +78,7 @@
     if (!mayContainURL && !dragData.containsPromise())
         return WTF::nullopt;
 
-    if (!m_documentUnderMouse || (!(dragData.flags().containsAll({ DragApplicationHasAttachedSheet, DragApplicationIsSource }))))
+    if (!m_documentUnderMouse || (!(dragData.flags().containsAll({ DragApplicationFlags::HasAttachedSheet, DragApplicationFlags::IsSource }))))
         return DragOperation::Copy;
 
     return WTF::nullopt;

Modified: trunk/Source/WebCore/platform/DragData.h (265755 => 265756)


--- trunk/Source/WebCore/platform/DragData.h	2020-08-17 14:06:16 UTC (rev 265755)
+++ trunk/Source/WebCore/platform/DragData.h	2020-08-17 16:33:54 UTC (rev 265756)
@@ -58,11 +58,11 @@
 
 namespace WebCore {
 
-enum DragApplicationFlags : uint8_t {
-    DragApplicationIsModal = 1,
-    DragApplicationIsSource = 2,
-    DragApplicationHasAttachedSheet = 4,
-    DragApplicationIsCopyKeyDown = 8
+enum class DragApplicationFlags : uint8_t {
+    IsModal = 1,
+    IsSource = 2,
+    HasAttachedSheet = 4,
+    IsCopyKeyDown = 8
 };
 
 #if PLATFORM(WIN)
@@ -148,10 +148,10 @@
 template<> struct EnumTraits<WebCore::DragApplicationFlags> {
     using values = EnumValues<
         WebCore::DragApplicationFlags,
-        WebCore::DragApplicationFlags::DragApplicationIsModal,
-        WebCore::DragApplicationFlags::DragApplicationIsSource,
-        WebCore::DragApplicationFlags::DragApplicationHasAttachedSheet,
-        WebCore::DragApplicationFlags::DragApplicationIsCopyKeyDown
+        WebCore::DragApplicationFlags::IsModal,
+        WebCore::DragApplicationFlags::IsSource,
+        WebCore::DragApplicationFlags::HasAttachedSheet,
+        WebCore::DragApplicationFlags::IsCopyKeyDown
     >;
 };
 

Modified: trunk/Source/WebKit/ChangeLog (265755 => 265756)


--- trunk/Source/WebKit/ChangeLog	2020-08-17 14:06:16 UTC (rev 265755)
+++ trunk/Source/WebKit/ChangeLog	2020-08-17 16:33:54 UTC (rev 265756)
@@ -1,3 +1,20 @@
+2020-08-17  David Kilzer  <[email protected]>
+
+        Clean up DragApplicationFlags after switch to OptionSet<>
+        <https://webkit.org/b/215349>
+
+        Reviewed by Darin Adler.
+
+        Change WebCore::DragApplicationFlags to an enum class.
+
+        * UIProcess/API/gtk/DropTargetGtk3.cpp:
+        (WebKit::DropTarget::drop):
+        - Switch to use OptionSet<WebCore::DragApplicationFlags>.
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::applicationFlagsForDrag):
+        * WebProcess/WebPage/WebPage.h:
+        - Update forward declaration.
+
 2020-08-17  Carlos Garcia Campos  <[email protected]>
 
         [GTK][WPE] Remove support for NPAPI plugins

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


--- trunk/Source/WebKit/UIProcess/API/gtk/DropTargetGtk3.cpp	2020-08-17 14:06:16 UTC (rev 265755)
+++ trunk/Source/WebKit/UIProcess/API/gtk/DropTargetGtk3.cpp	2020-08-17 16:33:54 UTC (rev 265756)
@@ -268,10 +268,10 @@
     auto* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(m_webView));
     ASSERT(page);
 
-    uint32_t flags = 0;
+    OptionSet<DragApplicationFlags> flags;
     if (gdk_drag_context_get_selected_action(m_drop.get()) == GDK_ACTION_COPY)
-        flags |= DragApplicationIsCopyKeyDown;
-    DragData dragData(&m_selectionData.value(), position, convertWidgetPointToScreenPoint(m_webView, position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(m_drop.get())), static_cast<DragApplicationFlags>(flags));
+        flags.add(DragApplicationFlags::IsCopyKeyDown);
+    DragData dragData(&m_selectionData.value(), position, convertWidgetPointToScreenPoint(m_webView, position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(m_drop.get())), flags);
     page->performDragOperation(dragData, { }, { }, { });
     gtk_drag_finish(m_drop.get(), TRUE, FALSE, time);
 

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (265755 => 265756)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2020-08-17 14:06:16 UTC (rev 265755)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2020-08-17 16:33:54 UTC (rev 265756)
@@ -3934,13 +3934,13 @@
     ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     OptionSet<WebCore::DragApplicationFlags> flags;
     if ([NSApp modalWindow])
-        flags.add(WebCore::DragApplicationIsModal);
+        flags.add(WebCore::DragApplicationFlags::IsModal);
     if (view.window.attachedSheet)
-        flags.add(WebCore::DragApplicationHasAttachedSheet);
+        flags.add(WebCore::DragApplicationFlags::HasAttachedSheet);
     if (draggingInfo.draggingSource == view)
-        flags.add(WebCore::DragApplicationIsSource);
+        flags.add(WebCore::DragApplicationFlags::IsSource);
     if ([NSApp currentEvent].modifierFlags & NSEventModifierFlagOption)
-        flags.add(WebCore::DragApplicationIsCopyKeyDown);
+        flags.add(WebCore::DragApplicationFlags::IsCopyKeyDown);
     return flags;
 
 }

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (265755 => 265756)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2020-08-17 14:06:16 UTC (rev 265755)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2020-08-17 16:33:54 UTC (rev 265756)
@@ -193,9 +193,9 @@
 class TextCheckingRequest;
 class VisiblePosition;
 
-enum DragApplicationFlags : uint8_t;
 enum SyntheticClickType : int8_t;
 enum class DOMPasteAccessResponse : uint8_t;
+enum class DragApplicationFlags : uint8_t;
 enum class DragHandlingMethod : uint8_t;
 enum class EventMakesGamepadsVisible : bool;
 enum class SelectionDirection : uint8_t;

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (265755 => 265756)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2020-08-17 14:06:16 UTC (rev 265755)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2020-08-17 16:33:54 UTC (rev 265756)
@@ -1,3 +1,24 @@
+2020-08-17  David Kilzer  <[email protected]>
+
+        Clean up DragApplicationFlags after switch to OptionSet<>
+        <https://webkit.org/b/215349>
+
+        Reviewed by Darin Adler.
+
+        Change WebCore::DragApplicationFlags to an enum class.
+
+        * WebView/WebView.mm:
+        (-[WebView applicationFlags:]): Deleted.
+        (-[WebView _applicationFlagsForDrag:]):
+        - Rename -applicationFlags: to -_applicationFlagsForDrag: since
+          it's only used internally.
+        - Switch to return OptionSet<WebCore::DragApplicationFlags>.
+        (-[WebView draggingEntered:]):
+        (-[WebView draggingUpdated:]):
+        (-[WebView draggingExited:]):
+        (-[WebView performDragOperation:]):
+        - Switch to calling -_applicationFlagsForDrag:.
+
 2020-08-12  Keith Rollin  <[email protected]>
 
         Remove the need for defining USE_NEW_BUILD_SYSTEM

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (265755 => 265756)


--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2020-08-17 14:06:16 UTC (rev 265755)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2020-08-17 16:33:54 UTC (rev 265756)
@@ -6876,18 +6876,18 @@
     return [documentView _shouldAutoscrollForDraggingInfo:draggingInfo];
 }
 
-- (WebCore::DragApplicationFlags)applicationFlags:(id <NSDraggingInfo>)draggingInfo
+- (OptionSet<WebCore::DragApplicationFlags>)_applicationFlagsForDrag:(id <NSDraggingInfo>)draggingInfo
 {
-    uint32_t flags = 0;
+    OptionSet<WebCore::DragApplicationFlags> flags;
     if ([NSApp modalWindow])
-        flags = WebCore::DragApplicationIsModal;
+        flags.add(WebCore::DragApplicationFlags::IsModal);
     if ([[self window] attachedSheet])
-        flags |= WebCore::DragApplicationHasAttachedSheet;
+        flags.add(WebCore::DragApplicationFlags::HasAttachedSheet);
     if ([draggingInfo draggingSource] == self)
-        flags |= WebCore::DragApplicationIsSource;
+        flags.add(WebCore::DragApplicationFlags::IsSource);
     if ([[NSApp currentEvent] modifierFlags] & NSEventModifierFlagOption)
-        flags |= WebCore::DragApplicationIsCopyKeyDown;
-    return static_cast<WebCore::DragApplicationFlags>(flags);
+        flags.add(WebCore::DragApplicationFlags::IsCopyKeyDown);
+    return flags;
 }
 
 - (OptionSet<WebCore::DragDestinationAction>)actionMaskForDraggingInfo:(id <NSDraggingInfo>)draggingInfo
@@ -6900,7 +6900,7 @@
     WebCore::IntPoint client([draggingInfo draggingLocation]);
     WebCore::IntPoint global(WebCore::globalPoint([draggingInfo draggingLocation], [self window]));
 
-    WebCore::DragData dragData(draggingInfo, client, global, coreDragOperationMask([draggingInfo draggingSourceOperationMask]), [self applicationFlags:draggingInfo], [self actionMaskForDraggingInfo:draggingInfo]);
+    WebCore::DragData dragData(draggingInfo, client, global, coreDragOperationMask([draggingInfo draggingSourceOperationMask]), [self _applicationFlagsForDrag:draggingInfo], [self actionMaskForDraggingInfo:draggingInfo]);
     return kit(core(self)->dragController().dragEntered(dragData));
 }
 
@@ -6913,7 +6913,7 @@
     WebCore::IntPoint client([draggingInfo draggingLocation]);
     WebCore::IntPoint global(WebCore::globalPoint([draggingInfo draggingLocation], [self window]));
 
-    WebCore::DragData dragData(draggingInfo, client, global, coreDragOperationMask([draggingInfo draggingSourceOperationMask]), [self applicationFlags:draggingInfo], [self actionMaskForDraggingInfo:draggingInfo]);
+    WebCore::DragData dragData(draggingInfo, client, global, coreDragOperationMask([draggingInfo draggingSourceOperationMask]), [self _applicationFlagsForDrag:draggingInfo], [self actionMaskForDraggingInfo:draggingInfo]);
     return kit(page->dragController().dragUpdated(dragData));
 }
 
@@ -6925,7 +6925,7 @@
 
     WebCore::IntPoint client([draggingInfo draggingLocation]);
     WebCore::IntPoint global(WebCore::globalPoint([draggingInfo draggingLocation], [self window]));
-    WebCore::DragData dragData(draggingInfo, client, global, coreDragOperationMask([draggingInfo draggingSourceOperationMask]), [self applicationFlags:draggingInfo]);
+    WebCore::DragData dragData(draggingInfo, client, global, coreDragOperationMask([draggingInfo draggingSourceOperationMask]), [self _applicationFlagsForDrag:draggingInfo]);
     page->dragController().dragExited(dragData);
 }
 
@@ -6938,7 +6938,7 @@
 {
     WebCore::IntPoint client([draggingInfo draggingLocation]);
     WebCore::IntPoint global(WebCore::globalPoint([draggingInfo draggingLocation], [self window]));
-    auto* dragData = new WebCore::DragData(draggingInfo, client, global, coreDragOperationMask([draggingInfo draggingSourceOperationMask]), [self applicationFlags:draggingInfo]);
+    auto* dragData = new WebCore::DragData(draggingInfo, client, global, coreDragOperationMask([draggingInfo draggingSourceOperationMask]), [self _applicationFlagsForDrag:draggingInfo]);
 
     NSArray* types = draggingInfo.draggingPasteboard.types;
     if (![types containsObject:WebArchivePboardType] && [types containsObject:WebCore::legacyFilesPromisePasteboardType()]) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to