+2012-05-16 Varun Jain <varunjain@google.com>
+
+ [chromium] No modifier flags (shift/ctrl/alt) in drag&drop events on chromium linux
+ https://bugs.webkit.org/show_bug.cgi?id=86236
+
+ Reviewed by Tony Chang.
+
+ * ManualTests/chromium/modifiers-during-drag-and-drop.html: Added.
+
2012-05-16 Keishi Hattori <keishi@webkit.org>
[chromium] Add WebKit API to access inner text value of input element
--- /dev/null
+<html>
+<head>
+<script>
+ function logDrag(e) {
+ var l = document.getElementById('log');
+ l.innerHTML += 'shiftKey=' + e.shiftKey + ' ctrlKey=' + e.ctrlKey + ' altKey=' + e.altKey + ' metaKey=' + e.metaKey + '\n';
+ e.preventDefault();
+ }
+
+ document.addEventListener('DOMContentLoaded', function() {
+ document.addEventListener('dragenter', logDrag, false);
+ document.addEventListener('dragover', logDrag, false);
+ document.addEventListener('dragleave', logDrag, false);
+ document.addEventListener('drop', logDrag, false);
+ });
+</script>
+</head>
+
+<body>
+ <p>Drag the "Drag me" with any modifier keys pressed (Shift/Ctrl/Alt) and see if the log messages have the correct modifier state</p>
+ <div draggable='true' id='dragme'>
+ Drag me
+ </div>
+ <pre id='log'></pre>
+</body>
+</html>
+2012-05-16 Varun Jain <varunjain@google.com>
+
+ [chromium] No modifier flags (shift/ctrl/alt) in drag&drop events on chromium linux
+ https://bugs.webkit.org/show_bug.cgi?id=86236
+
+ Reviewed by Tony Chang.
+
+ ManualTests: ManualTests/chromium/modifiers-during-drag-and-drop.html
+
+ * page/DragController.cpp:
+ (WebCore::createMouseEvent):
+ * platform/DragData.cpp:
+ (WebCore):
+ (WebCore::DragData::modifierKeyState):
+ * platform/DragData.h:
+ (DragData):
+ * platform/chromium/ChromiumDataObject.cpp:
+ (WebCore::ChromiumDataObject::ChromiumDataObject):
+ * platform/chromium/ChromiumDataObject.h:
+ (WebCore::ChromiumDataObject::modifierKeyState):
+ (WebCore::ChromiumDataObject::setModifierKeyState):
+ (ChromiumDataObject):
+ * platform/chromium/DragDataChromium.cpp:
+ (WebCore::DragData::modifierKeyState):
+ (WebCore):
+
2012-05-16 Jer Noble <jer.noble@apple.com>
<video> elements with no video tracks report false for webkitSupportsFullscreen.
{
bool shiftKey, ctrlKey, altKey, metaKey;
shiftKey = ctrlKey = altKey = metaKey = false;
- PlatformKeyboardEvent::getCurrentModifierState(shiftKey, ctrlKey, altKey, metaKey);
+ int keyState = dragData->modifierKeyState();
+ shiftKey = static_cast<bool>(keyState & PlatformEvent::ShiftKey);
+ ctrlKey = static_cast<bool>(keyState & PlatformEvent::CtrlKey);
+ altKey = static_cast<bool>(keyState & PlatformEvent::AltKey);
+ metaKey = static_cast<bool>(keyState & PlatformEvent::MetaKey);
+
return PlatformMouseEvent(dragData->clientPosition(), dragData->globalPosition(),
LeftButton, PlatformEvent::MouseMoved, 0, shiftKey, ctrlKey, altKey,
metaKey, currentTime());
#include "config.h"
#include "DragData.h"
+#include "PlatformEvent.h"
+#include "PlatformKeyboardEvent.h"
#if ENABLE(DRAG_SUPPORT)
namespace WebCore {
}
#endif
+#if !PLATFORM(CHROMIUM)
+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;
+}
+#endif
+
+
} // namespace WebCore
#endif // ENABLE(DRAG_SUPPORT)
bool containsColor() const;
bool containsFiles() const;
unsigned numberOfFiles() const;
+ int modifierKeyState() const;
#if PLATFORM(MAC)
const String& pasteboardName() { return m_pasteboardName; }
#endif
}
ChromiumDataObject::ChromiumDataObject()
+ : m_modifierKeyState(0)
{
}
ChromiumDataObject::ChromiumDataObject(const ChromiumDataObject& other)
: RefCounted<ChromiumDataObject>()
, m_itemList(other.m_itemList)
+ , m_modifierKeyState(0)
{
}
// Used to handle files (images) being dragged out.
void addSharedBuffer(const String& name, PassRefPtr<SharedBuffer>);
+ int modifierKeyState() const { return m_modifierKeyState; }
+ void setModifierKeyState(int modifierKeyState) { m_modifierKeyState = modifierKeyState; }
+
private:
ChromiumDataObject();
explicit ChromiumDataObject(const ChromiumDataObject&);
void internalAddFileItem(PassRefPtr<ChromiumDataObjectItem>);
Vector<RefPtr<ChromiumDataObjectItem> > m_itemList;
+
+ // State of Shift/Ctrl/Alt/Meta keys.
+ int m_modifierKeyState;
};
} // namespace WebCore
return m_platformDragData->filenames().size();
}
+int DragData::modifierKeyState() const
+{
+ return m_platformDragData->modifierKeyState();
+}
+
void DragData::asFilenames(Vector<String>& result) const
{
const Vector<String>& filenames = m_platformDragData->filenames();
+2012-05-16 Varun Jain <varunjain@google.com>
+
+ [chromium] No modifier flags (shift/ctrl/alt) in drag&drop events on chromium linux
+ https://bugs.webkit.org/show_bug.cgi?id=86236
+
+ Reviewed by Tony Chang.
+
+ * public/WebView.h:
+ (WebView):
+ * src/WebViewImpl.cpp:
+ (WebKit::webInputEventKeyStateToPlatformEventKeyState):
+ (WebKit):
+ (WebKit::WebViewImpl::dragTargetDragEnter):
+ (WebKit::WebViewImpl::dragTargetDragOver):
+ (WebKit::WebViewImpl::dragTargetDrop):
+ (WebKit::WebViewImpl::dragTargetDragEnterOrOver):
+ * src/WebViewImpl.h:
+ (WebViewImpl):
+
2012-05-16 Yury Semikhatsky <yurys@chromium.org>
[Chromium] Web Inspector: DevToolsSanityTest.TestScriptsTabIsPopulatedOnInspectedPageRefresh is broken
// Callback methods when a drag-and-drop operation is trying to drop
// something on the WebView.
+ // FIXME: Remove this method after chromium changes catch up.
virtual WebDragOperation dragTargetDragEnter(
const WebDragData&,
const WebPoint& clientPoint, const WebPoint& screenPoint,
WebDragOperationsMask operationsAllowed) = 0;
+ virtual WebDragOperation dragTargetDragEnter(
+ const WebDragData&,
+ const WebPoint& clientPoint, const WebPoint& screenPoint,
+ WebDragOperationsMask operationsAllowed,
+ int keyModifiers) = 0;
+ // FIXME: Remove this method after chromium changes catch up.
virtual WebDragOperation dragTargetDragOver(
const WebPoint& clientPoint, const WebPoint& screenPoint,
WebDragOperationsMask operationsAllowed) = 0;
+ virtual WebDragOperation dragTargetDragOver(
+ const WebPoint& clientPoint, const WebPoint& screenPoint,
+ WebDragOperationsMask operationsAllowed,
+ int keyModifiers) = 0;
virtual void dragTargetDragLeave() = 0;
+ // FIXME: Remove this method after chromium changes catch up.
virtual void dragTargetDrop(
const WebPoint& clientPoint, const WebPoint& screenPoint) = 0;
+ virtual void dragTargetDrop(
+ const WebPoint& clientPoint, const WebPoint& screenPoint,
+ int keyModifiers) = 0;
// Support for resource loading initiated by plugins -------------------
static bool shouldUseExternalPopupMenus = false;
+static int webInputEventKeyStateToPlatformEventKeyState(int webInputEventKeyState)
+{
+ int platformEventKeyState = 0;
+ if (webInputEventKeyState & WebInputEvent::ShiftKey)
+ platformEventKeyState = platformEventKeyState | WebCore::PlatformEvent::ShiftKey;
+ if (webInputEventKeyState & WebInputEvent::ControlKey)
+ platformEventKeyState = platformEventKeyState | WebCore::PlatformEvent::CtrlKey;
+ if (webInputEventKeyState & WebInputEvent::AltKey)
+ platformEventKeyState = platformEventKeyState | WebCore::PlatformEvent::AltKey;
+ if (webInputEventKeyState & WebInputEvent::MetaKey)
+ platformEventKeyState = platformEventKeyState | WebCore::PlatformEvent::MetaKey;
+ return platformEventKeyState;
+}
+
// WebView ----------------------------------------------------------------
WebView* WebView::create(WebViewClient* client)
const WebPoint& clientPoint,
const WebPoint& screenPoint,
WebDragOperationsMask operationsAllowed)
+{
+ return dragTargetDragEnter(webDragData, clientPoint, screenPoint, operationsAllowed, 0);
+}
+
+WebDragOperation WebViewImpl::dragTargetDragEnter(
+ const WebDragData& webDragData,
+ const WebPoint& clientPoint,
+ const WebPoint& screenPoint,
+ WebDragOperationsMask operationsAllowed,
+ int keyModifiers)
{
ASSERT(!m_currentDragData);
m_currentDragData = webDragData;
m_operationsAllowed = operationsAllowed;
- return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragEnter);
+ return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragEnter, keyModifiers);
}
WebDragOperation WebViewImpl::dragTargetDragOver(
const WebPoint& clientPoint,
const WebPoint& screenPoint,
WebDragOperationsMask operationsAllowed)
+{
+ return dragTargetDragOver(clientPoint, screenPoint, operationsAllowed, 0);
+}
+
+WebDragOperation WebViewImpl::dragTargetDragOver(
+ const WebPoint& clientPoint,
+ const WebPoint& screenPoint,
+ WebDragOperationsMask operationsAllowed,
+ int keyModifiers)
{
m_operationsAllowed = operationsAllowed;
- return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragOver);
+ return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragOver, keyModifiers);
}
void WebViewImpl::dragTargetDragLeave()
void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint,
const WebPoint& screenPoint)
+{
+ dragTargetDrop(clientPoint, screenPoint, 0);
+}
+
+void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint,
+ const WebPoint& screenPoint,
+ int keyModifiers)
{
ASSERT(m_currentDragData);
return;
}
+ m_currentDragData->setModifierKeyState(webInputEventKeyStateToPlatformEventKeyState(keyModifiers));
DragData dragData(
m_currentDragData.get(),
clientPoint,
m_dragScrollTimer->stop();
}
-WebDragOperation WebViewImpl::dragTargetDragEnterOrOver(const WebPoint& clientPoint, const WebPoint& screenPoint, DragAction dragAction)
+WebDragOperation WebViewImpl::dragTargetDragEnterOrOver(const WebPoint& clientPoint, const WebPoint& screenPoint, DragAction dragAction, int keyModifiers)
{
ASSERT(m_currentDragData);
+ m_currentDragData->setModifierKeyState(webInputEventKeyStateToPlatformEventKeyState(keyModifiers));
DragData dragData(
m_currentDragData.get(),
clientPoint,
const WebPoint& clientPoint,
const WebPoint& screenPoint,
WebDragOperationsMask operationsAllowed);
+ virtual WebDragOperation dragTargetDragEnter(
+ const WebDragData&,
+ const WebPoint& clientPoint,
+ const WebPoint& screenPoint,
+ WebDragOperationsMask operationsAllowed,
+ int keyModifiers);
virtual WebDragOperation dragTargetDragOver(
const WebPoint& clientPoint,
const WebPoint& screenPoint,
WebDragOperationsMask operationsAllowed);
+ virtual WebDragOperation dragTargetDragOver(
+ const WebPoint& clientPoint,
+ const WebPoint& screenPoint,
+ WebDragOperationsMask operationsAllowed,
+ int keyModifiers);
virtual void dragTargetDragLeave();
virtual void dragTargetDrop(
const WebPoint& clientPoint,
const WebPoint& screenPoint);
+ virtual void dragTargetDrop(
+ const WebPoint& clientPoint,
+ const WebPoint& screenPoint,
+ int keyModifiers);
virtual unsigned long createUniqueIdentifierForRequest();
virtual void inspectElementAt(const WebPoint& point);
virtual WebString inspectorSettings() const;
// should be true.
WebDragOperation dragTargetDragEnterOrOver(const WebPoint& clientPoint,
const WebPoint& screenPoint,
- DragAction);
+ DragAction,
+ int keyModifiers);
void configureAutoResizeMode();