Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 bool shiftKey, bool ctrlKey, bool altKey, bool metaKey) | 48 bool shiftKey, bool ctrlKey, bool altKey, bool metaKey) |
| 49 : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp) | 49 : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp) |
| 50 , m_position(position) | 50 , m_position(position) |
| 51 , m_globalPosition(globalPosition) | 51 , m_globalPosition(globalPosition) |
| 52 , m_area(area) | 52 , m_area(area) |
| 53 { | 53 { |
| 54 memset(&m_data, 0, sizeof(m_data)); | 54 memset(&m_data, 0, sizeof(m_data)); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void setScrollGestureData(float deltaX, float deltaY, float velocityX, float velocityY, | 57 void setScrollGestureData(float deltaX, float deltaY, float velocityX, float velocityY, |
| 58 bool inertial, bool preventPropagation) | 58 bool inertial, int resendSource, bool preventPropagation) |
| 59 { | 59 { |
| 60 ASSERT(type() == PlatformEvent::GestureScrollBegin | 60 ASSERT(type() == PlatformEvent::GestureScrollBegin |
| 61 || type() == PlatformEvent::GestureScrollUpdate | 61 || type() == PlatformEvent::GestureScrollUpdate |
| 62 || type() == PlatformEvent::GestureScrollEnd); | 62 || type() == PlatformEvent::GestureScrollEnd); |
| 63 if (type() != GestureScrollUpdate) { | 63 if (type() != GestureScrollUpdate) { |
| 64 ASSERT(deltaX == 0); | 64 ASSERT(deltaX == 0); |
| 65 ASSERT(deltaY == 0); | 65 ASSERT(deltaY == 0); |
| 66 ASSERT(velocityX == 0); | 66 ASSERT(velocityX == 0); |
| 67 ASSERT(velocityY == 0); | 67 ASSERT(velocityY == 0); |
| 68 ASSERT(!preventPropagation); | 68 ASSERT(!preventPropagation); |
| 69 } | 69 } |
| 70 | 70 |
| 71 if (type() == PlatformEvent::GestureScrollBegin) | 71 if (type() == PlatformEvent::GestureScrollBegin) |
| 72 ASSERT(!inertial); | 72 ASSERT(!inertial); |
| 73 | 73 |
| 74 m_data.m_scroll.m_deltaX = deltaX; | 74 m_data.m_scroll.m_deltaX = deltaX; |
| 75 m_data.m_scroll.m_deltaY = deltaY; | 75 m_data.m_scroll.m_deltaY = deltaY; |
| 76 m_data.m_scroll.m_velocityX = velocityX; | 76 m_data.m_scroll.m_velocityX = velocityX; |
| 77 m_data.m_scroll.m_velocityY = velocityY; | 77 m_data.m_scroll.m_velocityY = velocityY; |
| 78 m_data.m_scroll.m_inertial = inertial; | 78 m_data.m_scroll.m_inertial = inertial; |
| 79 m_data.m_scroll.m_resendSource = resendSource; | |
| 79 m_data.m_scroll.m_preventPropagation = preventPropagation; | 80 m_data.m_scroll.m_preventPropagation = preventPropagation; |
| 80 } | 81 } |
| 81 | 82 |
| 82 const IntPoint& position() const { return m_position; } // PlatformWindow co ordinates. | 83 const IntPoint& position() const { return m_position; } // PlatformWindow co ordinates. |
| 83 const IntPoint& globalPosition() const { return m_globalPosition; } // Scree n coordinates. | 84 const IntPoint& globalPosition() const { return m_globalPosition; } // Scree n coordinates. |
| 84 | 85 |
| 85 const IntSize& area() const { return m_area; } | 86 const IntSize& area() const { return m_area; } |
| 86 | 87 |
| 87 float deltaX() const | 88 float deltaX() const |
| 88 { | 89 { |
| 89 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); | 90 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); |
| 90 return m_data.m_scroll.m_deltaX; | 91 return m_data.m_scroll.m_deltaX; |
| 91 } | 92 } |
| 92 | 93 |
| 93 float deltaY() const | 94 float deltaY() const |
| 94 { | 95 { |
| 95 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); | 96 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); |
| 96 return m_data.m_scroll.m_deltaY; | 97 return m_data.m_scroll.m_deltaY; |
| 97 } | 98 } |
| 98 | 99 |
| 99 int tapCount() const | 100 int tapCount() const |
| 100 { | 101 { |
| 101 ASSERT(m_type == PlatformEvent::GestureTap); | 102 ASSERT(m_type == PlatformEvent::GestureTap); |
| 102 return m_data.m_tap.m_tapCount; | 103 return m_data.m_tap.m_tapCount; |
| 103 } | 104 } |
| 104 | 105 |
| 105 float velocityX() const | 106 float velocityX() const |
| 106 { | 107 { |
| 107 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); | 108 ASSERT(m_type == PlatformEvent::GestureScrollUpdate || m_type == Platfor mEvent::GestureFlingStart); |
| 108 return m_data.m_scroll.m_velocityX; | 109 return m_data.m_scroll.m_velocityX; |
| 109 } | 110 } |
| 110 | 111 |
| 111 float velocityY() const | 112 float velocityY() const |
| 112 { | 113 { |
| 113 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); | 114 ASSERT(m_type == PlatformEvent::GestureScrollUpdate || m_type == Platfor mEvent::GestureFlingStart); |
| 114 return m_data.m_scroll.m_velocityY; | 115 return m_data.m_scroll.m_velocityY; |
| 115 } | 116 } |
| 116 | 117 |
| 117 bool inertial() const | 118 bool inertial() const |
| 118 { | 119 { |
| 119 ASSERT(m_type == PlatformEvent::GestureScrollUpdate || m_type == Platfor mEvent::GestureScrollEnd); | 120 ASSERT(m_type == PlatformEvent::GestureScrollUpdate || m_type == Platfor mEvent::GestureScrollEnd); |
| 120 return m_data.m_scroll.m_inertial; | 121 return m_data.m_scroll.m_inertial; |
| 121 } | 122 } |
| 122 | 123 |
| 124 int resendSource() const | |
| 125 { | |
|
tdresser
2015/09/11 15:25:20
Can we keep this consistent with the other accesso
wjmaclean
2015/09/11 15:31:01
Sure, I'll add an ASSERT in the next version of th
| |
| 126 if (isScrollEvent()) | |
| 127 return m_data.m_scroll.m_resendSource; | |
| 128 | |
| 129 return 0; | |
| 130 } | |
| 131 | |
| 123 bool preventPropagation() const | 132 bool preventPropagation() const |
| 124 { | 133 { |
| 125 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); | 134 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); |
| 126 return m_data.m_scroll.m_preventPropagation; | 135 return m_data.m_scroll.m_preventPropagation; |
| 127 } | 136 } |
| 128 | 137 |
| 129 float scale() const | 138 float scale() const |
| 130 { | 139 { |
| 131 ASSERT(m_type == PlatformEvent::GesturePinchUpdate); | 140 ASSERT(m_type == PlatformEvent::GesturePinchUpdate); |
| 132 return m_data.m_pinchUpdate.m_scale; | 141 return m_data.m_pinchUpdate.m_scale; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 int m_tapCount; | 187 int m_tapCount; |
| 179 } m_tap; | 188 } m_tap; |
| 180 | 189 |
| 181 struct { | 190 struct { |
| 182 float m_deltaX; | 191 float m_deltaX; |
| 183 float m_deltaY; | 192 float m_deltaY; |
| 184 float m_velocityX; | 193 float m_velocityX; |
| 185 float m_velocityY; | 194 float m_velocityY; |
| 186 int m_preventPropagation; | 195 int m_preventPropagation; |
| 187 bool m_inertial; | 196 bool m_inertial; |
| 197 int m_resendSource; | |
|
tdresser
2015/09/11 15:25:20
Why is this an int?
wjmaclean
2015/09/11 15:31:01
Since there can be multiple BrowserPlugins in a pa
tdresser
2015/09/11 15:34:10
Makes sense. Can we clarify the meaning with a bet
| |
| 188 } m_scroll; | 198 } m_scroll; |
| 189 | 199 |
| 190 struct { | 200 struct { |
| 191 float m_scale; | 201 float m_scale; |
| 192 } m_pinchUpdate; | 202 } m_pinchUpdate; |
| 193 } m_data; | 203 } m_data; |
| 194 }; | 204 }; |
| 195 | 205 |
| 196 } // namespace blink | 206 } // namespace blink |
| 197 | 207 |
| 198 #endif // PlatformGestureEvent_h | 208 #endif // PlatformGestureEvent_h |
| OLD | NEW |