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

Unified Diff: third_party/WebKit/public/platform/WebInputEvent.h

Issue 2573073003: Collapse the API surface on WebInputEvent via accessor functions. (Closed)
Patch Set: Created 4 years 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 | « third_party/WebKit/Source/web/tests/WebViewTest.cpp ('k') | ui/content_accelerators/accelerator_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/public/platform/WebInputEvent.h
diff --git a/third_party/WebKit/public/platform/WebInputEvent.h b/third_party/WebKit/public/platform/WebInputEvent.h
index a364830d6b0dcb8f6766f523e803c159e3931a2e..5482219b8fbb1834e69c80cd3a1f786d393fb989 100644
--- a/third_party/WebKit/public/platform/WebInputEvent.h
+++ b/third_party/WebKit/public/platform/WebInputEvent.h
@@ -227,12 +227,6 @@ class WebInputEvent {
static constexpr double TimeStampForTesting = 123.0;
- double timeStampSeconds; // Seconds since platform start with microsecond
- // resolution.
- unsigned size; // The size of this structure, for serialization.
- Type type;
- int modifiers;
-
// Returns true if the WebInputEvent |type| is a mouse event.
static bool isMouseEventType(int type) {
return MouseTypeFirst <= type && type <= MouseTypeLast;
@@ -254,24 +248,29 @@ class WebInputEvent {
}
bool isSameEventClass(const WebInputEvent& other) const {
- if (isMouseEventType(type))
- return isMouseEventType(other.type);
- if (isGestureEventType(type))
- return isGestureEventType(other.type);
- if (isTouchEventType(type))
- return isTouchEventType(other.type);
- if (isKeyboardEventType(type))
- return isKeyboardEventType(other.type);
- return type == other.type;
+ if (isMouseEventType(m_type))
+ return isMouseEventType(other.m_type);
+ if (isGestureEventType(m_type))
+ return isGestureEventType(other.m_type);
+ if (isTouchEventType(m_type))
+ return isTouchEventType(other.m_type);
+ if (isKeyboardEventType(m_type))
+ return isKeyboardEventType(other.m_type);
+ return m_type == other.m_type;
}
BLINK_COMMON_EXPORT static const char* GetName(WebInputEvent::Type);
- void setType(Type typeParam) { type = typeParam; }
+ Type type() const { return m_type; }
+ void setType(Type typeParam) { m_type = typeParam; }
+
+ int modifiers() const { return m_modifiers; }
+ void setModifiers(int modifiersParam) { m_modifiers = modifiersParam; }
- void setModifiers(int modifiersParam) { modifiers = modifiersParam; }
+ double timeStampSeconds() const { return m_timeStampSeconds; }
+ void setTimeStampSeconds(double seconds) { m_timeStampSeconds = seconds; }
- void setTimeStampSeconds(double seconds) { timeStampSeconds = seconds; }
+ unsigned size() const { return m_size; }
protected:
WebInputEvent(unsigned sizeParam,
@@ -279,18 +278,24 @@ class WebInputEvent {
int modifiersParam,
double timeStampSecondsParam) {
memset(this, 0, sizeParam);
esprehn 2016/12/14 19:03:05 It's very weird to memset yourself once you're a r
dtapuska 2017/01/12 16:45:13 I've added a TODO. I think the memset is necessary
- timeStampSeconds = timeStampSecondsParam;
- size = sizeParam;
- type = typeParam;
- modifiers = modifiersParam;
+ m_timeStampSeconds = timeStampSecondsParam;
+ m_size = sizeParam;
+ m_type = typeParam;
+ m_modifiers = modifiersParam;
}
explicit WebInputEvent(unsigned sizeParam) {
memset(this, 0, sizeParam);
- timeStampSeconds = 0.0;
- size = sizeParam;
- type = Undefined;
+ m_timeStampSeconds = 0.0;
esprehn 2016/12/14 19:03:05 this is a duplicate of the memset?
dtapuska 2017/01/12 16:45:13 The code was that way before and I presume someone
+ m_size = sizeParam;
+ m_type = Undefined;
}
+
+ double m_timeStampSeconds; // Seconds since platform start with microsecond
+ // resolution.
+ unsigned m_size; // The size of this structure, for serialization.
+ Type m_type;
+ int m_modifiers;
};
// WebKeyboardEvent -----------------------------------------------------------
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebViewTest.cpp ('k') | ui/content_accelerators/accelerator_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698