Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit 65f090e

Browse files
Use default initializers and default constructors in WebEvent.h
<https://webkit.org/b/211354> Reviewed by Daniel Bates. * Shared/WebEvent.h: (WebKit::WebWheelEvent): (WebKit::WebKeyboardEvent): (WebKit::WebPlatformTouchPoint): (WebKit::WebTouchEvent): - Change empty constructors to use `default`. - Use default initializers to make sure all fields are initialized. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@261066 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent c0bb331 commit 65f090e

File tree

2 files changed

+37
-21
lines changed

2 files changed

+37
-21
lines changed

Source/WebKit/ChangeLog

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
2020-05-03 David Kilzer <[email protected]>
2+
3+
Use default initializers and default constructors in WebEvent.h
4+
<https://webkit.org/b/211354>
5+
6+
Reviewed by Daniel Bates.
7+
8+
* Shared/WebEvent.h:
9+
(WebKit::WebWheelEvent):
10+
(WebKit::WebKeyboardEvent):
11+
(WebKit::WebPlatformTouchPoint):
12+
(WebKit::WebTouchEvent):
13+
- Change empty constructors to use `default`.
14+
- Use default initializers to make sure all fields are
15+
initialized.
16+
117
2020-05-02 Simon Fraser <[email protected]>
218

319
handleWheelEventPhase() should include the relevant ScrollingNodeID

Source/WebKit/Shared/WebEvent.h

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class WebWheelEvent : public WebEvent {
200200
PhaseMayBegin = 1 << 5,
201201
};
202202

203-
WebWheelEvent() { }
203+
WebWheelEvent() = default;
204204

205205
WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, OptionSet<Modifier>, WallTime timestamp);
206206
#if PLATFORM(COCOA)
@@ -233,13 +233,13 @@ class WebWheelEvent : public WebEvent {
233233
WebCore::IntPoint m_globalPosition;
234234
WebCore::FloatSize m_delta;
235235
WebCore::FloatSize m_wheelTicks;
236-
uint32_t m_granularity; // Granularity
237-
bool m_directionInvertedFromDevice;
236+
uint32_t m_granularity { ScrollByPageWheelEvent };
237+
bool m_directionInvertedFromDevice { false };
238238
uint32_t m_phase { Phase::PhaseNone };
239239
uint32_t m_momentumPhase { Phase::PhaseNone };
240240
#if PLATFORM(COCOA)
241-
bool m_hasPreciseScrollingDeltas;
242-
uint32_t m_scrollCount;
241+
bool m_hasPreciseScrollingDeltas { false };
242+
uint32_t m_scrollCount { 0 };
243243
WebCore::FloatSize m_unacceleratedScrollingDelta;
244244
#endif
245245
};
@@ -297,11 +297,11 @@ class WebKeyboardEvent : public WebEvent {
297297
String m_key;
298298
String m_code;
299299
String m_keyIdentifier;
300-
int32_t m_windowsVirtualKeyCode;
301-
int32_t m_nativeVirtualKeyCode;
302-
int32_t m_macCharCode;
300+
int32_t m_windowsVirtualKeyCode { 0 };
301+
int32_t m_nativeVirtualKeyCode { 0 };
302+
int32_t m_macCharCode { 0 };
303303
#if USE(APPKIT) || USE(UIKIT_KEYBOARD_ADDITIONS) || PLATFORM(GTK) || USE(LIBWPE)
304-
bool m_handledByInputMethod;
304+
bool m_handledByInputMethod { false };
305305
#endif
306306
#if PLATFORM(GTK) || USE(LIBWPE)
307307
Optional<Vector<WebCore::CompositionUnderline>> m_preeditUnderlines;
@@ -312,9 +312,9 @@ class WebKeyboardEvent : public WebEvent {
312312
#elif PLATFORM(GTK)
313313
Vector<String> m_commands;
314314
#endif
315-
bool m_isAutoRepeat;
316-
bool m_isKeypad;
317-
bool m_isSystemKey;
315+
bool m_isAutoRepeat { false };
316+
bool m_isKeypad { false };
317+
bool m_isSystemKey { false };
318318
};
319319

320320
#if ENABLE(TOUCH_EVENTS)
@@ -334,7 +334,7 @@ class WebPlatformTouchPoint {
334334
Stylus
335335
};
336336

337-
WebPlatformTouchPoint() { }
337+
WebPlatformTouchPoint() = default;
338338
WebPlatformTouchPoint(unsigned identifier, WebCore::IntPoint location, TouchPointState phase)
339339
: m_identifier(identifier)
340340
, m_location(location)
@@ -368,9 +368,9 @@ class WebPlatformTouchPoint {
368368
static Optional<WebPlatformTouchPoint> decode(IPC::Decoder&);
369369

370370
private:
371-
unsigned m_identifier;
371+
unsigned m_identifier { 0 };
372372
WebCore::IntPoint m_location;
373-
uint32_t m_phase;
373+
uint32_t m_phase { TouchReleased };
374374
#if ENABLE(IOS_TOUCH_EVENTS)
375375
double m_radiusX { 0 };
376376
double m_radiusY { 0 };
@@ -384,7 +384,7 @@ class WebPlatformTouchPoint {
384384

385385
class WebTouchEvent : public WebEvent {
386386
public:
387-
WebTouchEvent() { }
387+
WebTouchEvent() = default;
388388
WebTouchEvent(WebEvent::Type type, OptionSet<Modifier> modifiers, WallTime timestamp, const Vector<WebPlatformTouchPoint>& touchPoints, WebCore::IntPoint position, bool isPotentialTap, bool isGesture, float gestureScale, float gestureRotation)
389389
: WebEvent(type, modifiers, timestamp)
390390
, m_touchPoints(touchPoints)
@@ -420,11 +420,11 @@ class WebTouchEvent : public WebEvent {
420420
Vector<WebPlatformTouchPoint> m_touchPoints;
421421

422422
WebCore::IntPoint m_position;
423-
bool m_canPreventNativeGestures;
424-
bool m_isPotentialTap;
425-
bool m_isGesture;
426-
float m_gestureScale;
427-
float m_gestureRotation;
423+
bool m_canPreventNativeGestures { false };
424+
bool m_isPotentialTap { false };
425+
bool m_isGesture { false };
426+
float m_gestureScale { 0 };
427+
float m_gestureRotation { 0 };
428428
};
429429
#else
430430
// FIXME: Move this class to its own header file.

0 commit comments

Comments
 (0)