From bd663d44f78452899733d431eef7d25acdd793f5 Mon Sep 17 00:00:00 2001 From: "brettw@chromium.org" Date: Thu, 7 Jun 2012 23:06:36 +0000 Subject: Add some compile asserts for the Pepper event mask flags. TEST=compiles BUG=none Review URL: https://chromiumcodereview.appspot.com/10539052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141108 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/plugins/ppapi/event_conversion.cc | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'webkit') diff --git a/webkit/plugins/ppapi/event_conversion.cc b/webkit/plugins/ppapi/event_conversion.cc index 0a19415..68a9f6e 100644 --- a/webkit/plugins/ppapi/event_conversion.cc +++ b/webkit/plugins/ppapi/event_conversion.cc @@ -36,6 +36,43 @@ namespace ppapi { namespace { +// Verify the modifier flags WebKit uses match the Pepper ones. If these start +// not matching, we'll need to write conversion code to preserve the Pepper +// values (since plugins will be depending on them). +COMPILE_ASSERT(static_cast(PP_INPUTEVENT_MODIFIER_SHIFTKEY) == + static_cast(WebInputEvent::ShiftKey), + ShiftKeyMatches); +COMPILE_ASSERT(static_cast(PP_INPUTEVENT_MODIFIER_CONTROLKEY) == + static_cast(WebInputEvent::ControlKey), + ControlKeyMatches); +COMPILE_ASSERT(static_cast(PP_INPUTEVENT_MODIFIER_ALTKEY) == + static_cast(WebInputEvent::AltKey), + AltKeyMatches); +COMPILE_ASSERT(static_cast(PP_INPUTEVENT_MODIFIER_METAKEY) == + static_cast(WebInputEvent::MetaKey), + MetaKeyMatches); +COMPILE_ASSERT(static_cast(PP_INPUTEVENT_MODIFIER_ISKEYPAD) == + static_cast(WebInputEvent::IsKeyPad), + KeyPadMatches); +COMPILE_ASSERT(static_cast(PP_INPUTEVENT_MODIFIER_ISAUTOREPEAT) == + static_cast(WebInputEvent::IsAutoRepeat), + AutoRepeatMatches); +COMPILE_ASSERT(static_cast(PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN) == + static_cast(WebInputEvent::LeftButtonDown), + LeftButtonMatches); +COMPILE_ASSERT(static_cast(PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN) == + static_cast(WebInputEvent::MiddleButtonDown), + MiddleButtonMatches); +COMPILE_ASSERT(static_cast(PP_INPUTEVENT_MODIFIER_RIGHTBUTTONDOWN) == + static_cast(WebInputEvent::RightButtonDown), + RightButtonMatches); +COMPILE_ASSERT(static_cast(PP_INPUTEVENT_MODIFIER_CAPSLOCKKEY) == + static_cast(WebInputEvent::CapsLockOn), + CapsLockMatches); +COMPILE_ASSERT(static_cast(PP_INPUTEVENT_MODIFIER_NUMLOCKKEY) == + static_cast(WebInputEvent::NumLockOn), + NumLockMatches); + PP_InputEvent_Type ConvertEventTypes(WebInputEvent::Type wetype) { switch (wetype) { case WebInputEvent::MouseDown: -- cgit v1.1