OLD | NEW |
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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 return isGestureEventType(other.type); | 257 return isGestureEventType(other.type); |
258 if (isTouchEventType(type)) | 258 if (isTouchEventType(type)) |
259 return isTouchEventType(other.type); | 259 return isTouchEventType(other.type); |
260 if (isKeyboardEventType(type)) | 260 if (isKeyboardEventType(type)) |
261 return isKeyboardEventType(other.type); | 261 return isKeyboardEventType(other.type); |
262 return type == other.type; | 262 return type == other.type; |
263 } | 263 } |
264 | 264 |
265 BLINK_COMMON_EXPORT static const char* GetName(WebInputEvent::Type); | 265 BLINK_COMMON_EXPORT static const char* GetName(WebInputEvent::Type); |
266 | 266 |
| 267 float frameScale() const { return m_frameScale; } |
| 268 void setFrameScale(float scale) { m_frameScale = scale; } |
| 269 |
| 270 WebFloatPoint frameTranslate() const { return m_frameTranslate; } |
| 271 void setFrameTranslate(WebFloatPoint translate) { |
| 272 m_frameTranslate = translate; |
| 273 } |
| 274 |
267 protected: | 275 protected: |
| 276 // The root frame scale. |
| 277 float m_frameScale; |
| 278 |
| 279 // The root frame translation (applied post scale). |
| 280 WebFloatPoint m_frameTranslate; |
| 281 |
268 explicit WebInputEvent(unsigned sizeParam) { | 282 explicit WebInputEvent(unsigned sizeParam) { |
269 memset(this, 0, sizeParam); | 283 memset(this, 0, sizeParam); |
270 timeStampSeconds = 0.0; | 284 timeStampSeconds = 0.0; |
271 size = sizeParam; | 285 size = sizeParam; |
272 type = Undefined; | 286 type = Undefined; |
273 modifiers = 0; | 287 modifiers = 0; |
| 288 #if DCHECK_IS_ON() |
| 289 // If dcheck is on force failures if frame scale is not initialized |
| 290 // correctly by causing DIV0. |
| 291 m_frameScale = 0; |
| 292 #else |
| 293 m_frameScale = 1; |
| 294 #endif |
274 } | 295 } |
275 }; | 296 }; |
276 | 297 |
277 // WebKeyboardEvent ----------------------------------------------------------- | 298 // WebKeyboardEvent ----------------------------------------------------------- |
278 | 299 |
279 class WebKeyboardEvent : public WebInputEvent { | 300 class WebKeyboardEvent : public WebInputEvent { |
280 public: | 301 public: |
281 // Caps on string lengths so we can make them static arrays and keep | 302 // Caps on string lengths so we can make them static arrays and keep |
282 // them PODs. | 303 // them PODs. |
283 static const size_t textLengthCap = 4; | 304 static const size_t textLengthCap = 4; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 movedBeyondSlopRegion(false), | 516 movedBeyondSlopRegion(false), |
496 touchStartOrFirstTouchMove(false), | 517 touchStartOrFirstTouchMove(false), |
497 uniqueTouchEventId(0) {} | 518 uniqueTouchEventId(0) {} |
498 }; | 519 }; |
499 | 520 |
500 #pragma pack(pop) | 521 #pragma pack(pop) |
501 | 522 |
502 } // namespace blink | 523 } // namespace blink |
503 | 524 |
504 #endif | 525 #endif |
OLD | NEW |