Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(527)

Side by Side Diff: Source/web/WebInputEventConversion.cpp

Issue 727593003: Implement MouseEvent buttons attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 PlatformMouseEventBuilder::PlatformMouseEventBuilder(Widget* widget, const WebMo useEvent& e) 89 PlatformMouseEventBuilder::PlatformMouseEventBuilder(Widget* widget, const WebMo useEvent& e)
90 { 90 {
91 // FIXME: Widget is always toplevel, unless it's a popup. We may be able 91 // FIXME: Widget is always toplevel, unless it's a popup. We may be able
92 // to get rid of this once we abstract popups into a WebKit API. 92 // to get rid of this once we abstract popups into a WebKit API.
93 m_position = widget->convertFromContainingWindow(flooredIntPoint(convertHitP ointToWindow(widget, IntPoint(e.x, e.y)))); 93 m_position = widget->convertFromContainingWindow(flooredIntPoint(convertHitP ointToWindow(widget, IntPoint(e.x, e.y))));
94 m_globalPosition = IntPoint(e.globalX, e.globalY); 94 m_globalPosition = IntPoint(e.globalX, e.globalY);
95 m_movementDelta = IntPoint(scaleDeltaToWindow(widget, e.movementX), scaleDel taToWindow(widget, e.movementY)); 95 m_movementDelta = IntPoint(scaleDeltaToWindow(widget, e.movementX), scaleDel taToWindow(widget, e.movementY));
96 m_button = static_cast<MouseButton>(e.button); 96 m_button = static_cast<MouseButton>(e.button);
97 97
98 m_buttons = 0;
99 if (e.modifiers & WebInputEvent::LeftButtonDown)
Rick Byers 2014/11/14 19:48:09 Please extend the unit tests in WebInputEventConve
Rick Byers 2014/11/14 19:48:09 Oh cool, I didn't realize this data was already pr
zino 2014/11/18 14:19:35 Windows / Linux / Mac works well via layout tests
zino 2014/11/18 14:19:35 I don't think we may need it in new implementation
Rick Byers 2014/11/18 20:29:18 I guess your changes in WebInputConversion.cpp are
Rick Byers 2014/11/18 20:29:18 The behavior I'm worried about here isn't covered
zino 2014/11/24 13:07:07 The modifiers value is passed from ui::EventFlagsF
Rick Byers 2014/11/25 17:44:27 Sounds good, thanks for digging into this!
100 m_buttons |= 1;
101 if (e.modifiers & WebInputEvent::RightButtonDown)
102 m_buttons |= 2;
103 if (e.modifiers & WebInputEvent::MiddleButtonDown)
104 m_buttons |= 4;
105
98 m_modifiers = 0; 106 m_modifiers = 0;
99 if (e.modifiers & WebInputEvent::ShiftKey) 107 if (e.modifiers & WebInputEvent::ShiftKey)
100 m_modifiers |= PlatformEvent::ShiftKey; 108 m_modifiers |= PlatformEvent::ShiftKey;
101 if (e.modifiers & WebInputEvent::ControlKey) 109 if (e.modifiers & WebInputEvent::ControlKey)
102 m_modifiers |= PlatformEvent::CtrlKey; 110 m_modifiers |= PlatformEvent::CtrlKey;
103 if (e.modifiers & WebInputEvent::AltKey) 111 if (e.modifiers & WebInputEvent::AltKey)
104 m_modifiers |= PlatformEvent::AltKey; 112 m_modifiers |= PlatformEvent::AltKey;
105 if (e.modifiers & WebInputEvent::MetaKey) 113 if (e.modifiers & WebInputEvent::MetaKey)
106 m_modifiers |= PlatformEvent::MetaKey; 114 m_modifiers |= PlatformEvent::MetaKey;
107 115
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 modifiers = getWebInputModifiers(event); 822 modifiers = getWebInputModifiers(event);
815 823
816 globalX = event.screenX(); 824 globalX = event.screenX();
817 globalY = event.screenY(); 825 globalY = event.screenY();
818 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL ocation(), *renderObject); 826 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL ocation(), *renderObject);
819 x = localPoint.x(); 827 x = localPoint.x();
820 y = localPoint.y(); 828 y = localPoint.y();
821 } 829 }
822 830
823 } // namespace blink 831 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698