Index: Source/web/WebInputEventConversion.cpp |
diff --git a/Source/web/WebInputEventConversion.cpp b/Source/web/WebInputEventConversion.cpp |
index 09586f45a73f41cbb1bd634171343c8e73832508..2e25342b14e2d0f9121adf97091b4a45dd17bae5 100644 |
--- a/Source/web/WebInputEventConversion.cpp |
+++ b/Source/web/WebInputEventConversion.cpp |
@@ -104,11 +104,23 @@ PlatformMouseEventBuilder::PlatformMouseEventBuilder(Widget* widget, const WebMo |
m_modifiers |= PlatformEvent::AltKey; |
if (e.modifiers & WebInputEvent::MetaKey) |
m_modifiers |= PlatformEvent::MetaKey; |
+ if (e.modifiers & WebInputEvent::LeftButtonDown) |
+ m_modifiers |= PlatformEvent::LeftButtonDown; |
+ if (e.modifiers & WebInputEvent::MiddleButtonDown) |
+ m_modifiers |= PlatformEvent::MiddleButtonDown; |
+ if (e.modifiers & WebInputEvent::RightButtonDown) |
+ m_modifiers |= PlatformEvent::RightButtonDown; |
m_modifierFlags = e.modifiers; |
m_timestamp = e.timeStampSeconds; |
m_clickCount = e.clickCount; |
+ const unsigned buttonToModifier[] = { |
+ PlatformEvent::LeftButtonDown, |
+ PlatformEvent::MiddleButtonDown, |
+ PlatformEvent::RightButtonDown |
+ }; |
+ |
switch (e.type) { |
case WebInputEvent::MouseMove: |
case WebInputEvent::MouseLeave: // synthesize a move event |
@@ -121,6 +133,12 @@ PlatformMouseEventBuilder::PlatformMouseEventBuilder(Widget* widget, const WebMo |
case WebInputEvent::MouseUp: |
m_type = PlatformEvent::MouseReleased; |
+ |
+ // The MouseEvent spec requires that buttons indicates the state |
+ // immediately after the event takes place. To ensure consistency |
+ // between platforms here, we explicitly clear the button that is |
+ // in the process of being released. |
+ m_modifiers &= ~buttonToModifier[e.button]; |
break; |
default: |
@@ -152,6 +170,12 @@ PlatformWheelEventBuilder::PlatformWheelEventBuilder(Widget* widget, const WebMo |
m_modifiers |= PlatformEvent::AltKey; |
if (e.modifiers & WebInputEvent::MetaKey) |
m_modifiers |= PlatformEvent::MetaKey; |
+ if (e.modifiers & WebInputEvent::LeftButtonDown) |
+ m_modifiers |= PlatformEvent::LeftButtonDown; |
+ if (e.modifiers & WebInputEvent::MiddleButtonDown) |
+ m_modifiers |= PlatformEvent::MiddleButtonDown; |
+ if (e.modifiers & WebInputEvent::RightButtonDown) |
+ m_modifiers |= PlatformEvent::RightButtonDown; |
m_hasPreciseScrollingDeltas = e.hasPreciseScrollingDeltas; |
#if OS(MACOSX) |