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

Unified Diff: public/web/WebInputEvent.h

Issue 132183008: Prevent implicit WebInputEvent construction from WebInputEvent::Type (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove unncessary constructor guard Created 6 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: public/web/WebInputEvent.h
diff --git a/public/web/WebInputEvent.h b/public/web/WebInputEvent.h
index 3a56faef9d2716540c89a02ed419ae574578cf3a..78e33d89568b081b131fd5be51ed16f867a1c71b 100644
--- a/public/web/WebInputEvent.h
+++ b/public/web/WebInputEvent.h
@@ -58,15 +58,6 @@ namespace blink {
class WebInputEvent {
public:
- WebInputEvent(unsigned sizeParam = sizeof(WebInputEvent))
- {
- memset(this, 0, sizeParam);
- timeStampSeconds = 0.0;
- size = sizeParam;
- type = Undefined;
- modifiers = 0;
- }
-
// When we use an input method (or an input method editor), we receive
// two events for a keypress. The former event is a keydown, which
// provides a keycode, and the latter is a textinput, which provides
@@ -224,6 +215,16 @@ public:
{
return GestureTypeFirst <= type && type <= GestureTypeLast;
}
+
+protected:
+ explicit WebInputEvent(unsigned sizeParam)
+ {
+ memset(this, 0, sizeParam);
+ timeStampSeconds = 0.0;
+ size = sizeParam;
+ type = Undefined;
+ modifiers = 0;
+ }
};
// WebKeyboardEvent -----------------------------------------------------------
@@ -274,8 +275,8 @@ public:
// This is a string identifying the key pressed.
char keyIdentifier[keyIdentifierLengthCap];
- WebKeyboardEvent(unsigned sizeParam = sizeof(WebKeyboardEvent))
- : WebInputEvent(sizeParam)
+ WebKeyboardEvent()
+ : WebInputEvent(sizeof(WebKeyboardEvent))
, windowsKeyCode(0)
, nativeKeyCode(0)
, isSystemKey(false)
@@ -315,7 +316,23 @@ public:
int movementY;
int clickCount;
- WebMouseEvent(unsigned sizeParam = sizeof(WebMouseEvent))
+ WebMouseEvent()
+ : WebInputEvent(sizeof(WebMouseEvent))
+ , button(ButtonNone)
+ , x(0)
+ , y(0)
+ , windowX(0)
+ , windowY(0)
+ , globalX(0)
+ , globalY(0)
+ , movementX(0)
+ , movementY(0)
+ , clickCount(0)
+ {
+ }
+
+protected:
+ explicit WebMouseEvent(unsigned sizeParam)
: WebInputEvent(sizeParam)
, button(ButtonNone)
, x(0)
@@ -379,8 +396,8 @@ public:
int canRubberbandLeft;
int canRubberbandRight;
- WebMouseWheelEvent(unsigned sizeParam = sizeof(WebMouseWheelEvent))
- : WebMouseEvent(sizeParam)
+ WebMouseWheelEvent()
+ : WebMouseEvent(sizeof(WebMouseWheelEvent))
, deltaX(0.0f)
, deltaY(0.0f)
, wheelTicksX(0.0f)
@@ -465,8 +482,8 @@ public:
} pinchUpdate;
} data;
- WebGestureEvent(unsigned sizeParam = sizeof(WebGestureEvent))
- : WebInputEvent(sizeParam)
+ WebGestureEvent()
+ : WebInputEvent(sizeof(WebGestureEvent))
, x(0)
, y(0)
, globalX(0)
@@ -496,8 +513,8 @@ public:
// List of all touches which are currently down and are targeting the event recipient.
WebTouchPoint targetTouches[touchesLengthCap];
- WebTouchEvent(unsigned sizeParam = sizeof(WebTouchEvent))
- : WebInputEvent(sizeParam)
+ WebTouchEvent()
+ : WebInputEvent(sizeof(WebTouchEvent))
, touchesLength(0)
, changedTouchesLength(0)
, targetTouchesLength(0)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698