Simplify createMouseEvent in DragController
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Aug 2016 17:37:09 +0000 (17:37 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Aug 2016 17:37:09 +0000 (17:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=161168

Reviewed by Dan Bernstein.

* page/DragController.cpp:
(WebCore::createMouseEvent):
* platform/DragData.cpp:
(WebCore::DragData::modifierKeyState): Deleted.
* platform/DragData.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204972 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/DragController.cpp
Source/WebCore/platform/DragData.cpp
Source/WebCore/platform/DragData.h

index 6403753..03e288f 100644 (file)
@@ -1,3 +1,16 @@
+2016-08-24  Anders Carlsson  <andersca@apple.com>
+
+        Simplify createMouseEvent in DragController
+        https://bugs.webkit.org/show_bug.cgi?id=161168
+
+        Reviewed by Dan Bernstein.
+
+        * page/DragController.cpp:
+        (WebCore::createMouseEvent):
+        * platform/DragData.cpp:
+        (WebCore::DragData::modifierKeyState): Deleted.
+        * platform/DragData.h:
+
 2016-08-25  Chris Dumez  <cdumez@apple.com>
 
         DOMTokenList.value should be a stringifier attribute
index 73cec48..b7f830b 100644 (file)
@@ -97,11 +97,12 @@ bool isDraggableLink(const Element& element)
     
 static PlatformMouseEvent createMouseEvent(DragData& dragData)
 {
-    int keyState = dragData.modifierKeyState();
-    bool shiftKey = static_cast<bool>(keyState & PlatformEvent::ShiftKey);
-    bool ctrlKey = static_cast<bool>(keyState & PlatformEvent::CtrlKey);
-    bool altKey = static_cast<bool>(keyState & PlatformEvent::AltKey);
-    bool metaKey = static_cast<bool>(keyState & PlatformEvent::MetaKey);
+    bool shiftKey = false;
+    bool ctrlKey = false;
+    bool altKey = false;
+    bool metaKey = false;
+
+    PlatformKeyboardEvent::getCurrentModifierState(shiftKey, ctrlKey, altKey, metaKey);
 
     return PlatformMouseEvent(dragData.clientPosition(), dragData.globalPosition(),
                               LeftButton, PlatformEvent::MouseMoved, 0, shiftKey, ctrlKey, altKey,
index 18e1e1d..ab67c66 100644 (file)
@@ -53,24 +53,6 @@ DragData::DragData(const String&, const IntPoint& clientPosition, const IntPoint
 }
 #endif
 
-int DragData::modifierKeyState() const
-{
-    bool shiftKey, ctrlKey, altKey, metaKey;
-    shiftKey = ctrlKey = altKey = metaKey = false;
-    PlatformKeyboardEvent::getCurrentModifierState(shiftKey, ctrlKey, altKey, metaKey);
-    int keyState = 0;
-    if (shiftKey)
-        keyState = keyState | PlatformEvent::ShiftKey;
-    if (ctrlKey)
-        keyState = keyState | PlatformEvent::CtrlKey;
-    if (altKey)
-        keyState = keyState | PlatformEvent::AltKey;
-    if (metaKey)
-        keyState = keyState | PlatformEvent::MetaKey;
-    return keyState;
-}
-
 } // namespace WebCore
 
-
 #endif // ENABLE(DRAG_SUPPORT)
index acf7831..07e4ff7 100644 (file)
@@ -102,7 +102,6 @@ public:
     bool containsColor() const;
     bool containsFiles() const;
     unsigned numberOfFiles() const;
-    int modifierKeyState() const;
 #if PLATFORM(MAC)
     const String& pasteboardName() const { return m_pasteboardName; }
 #endif