Changeset 70836 in webkit
- Timestamp:
- Oct 28, 2010 8:20:24 PM (14 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 6 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r70833 r70836 1 2010-10-28 Adam Roben <aroben@apple.com> 2 3 Move some function definitions from WebEvent.h into new .cpp files 4 5 Someday maybe we'll split the classes into their own header files, 6 too. 7 8 Fixes <http://webkit.org/b/48604>. 9 10 Reviewed by Anders Carlsson. 11 12 * Shared/WebEvent.h: Moved code from here... 13 14 * Shared/WebEvent.cpp: Added. 15 * Shared/WebKeyboardEvent.cpp: Added. 16 * Shared/WebMouseEvent.cpp: Added. 17 * Shared/WebPlatformTouchPoint.cpp: Added. 18 * Shared/WebTouchEvent.cpp: Added. 19 * Shared/WebWheelEvent.cpp: Added. 20 ...to here. Also changed WebTouchEvent::touchPoints not to copy the 21 Vector. 22 23 * WebKit2.pro: 24 * WebKit2.xcodeproj/project.pbxproj: 25 * win/WebKit2.vcproj: 26 Added the new files. 27 1 28 2010-10-28 Anders Carlsson <andersca@apple.com> 2 29 -
trunk/WebKit2/Shared/WebEvent.h
r68538 r70836 79 79 80 80 protected: 81 WebEvent() 82 { 83 } 84 85 WebEvent(Type type, Modifiers modifiers, double timestamp) 86 : m_type(type) 87 , m_modifiers(modifiers) 88 , m_timestamp(timestamp) 89 { 90 } 91 92 void encode(CoreIPC::ArgumentEncoder* encoder) const 93 { 94 encoder->encode(m_type); 95 encoder->encode(m_modifiers); 96 encoder->encode(m_timestamp); 97 } 98 99 static bool decode(CoreIPC::ArgumentDecoder* decoder, WebEvent& t) 100 { 101 if (!decoder->decode(t.m_type)) 102 return false; 103 if (!decoder->decode(t.m_modifiers)) 104 return false; 105 if (!decoder->decode(t.m_timestamp)) 106 return false; 107 108 return true; 109 } 81 WebEvent() { } 82 83 WebEvent(Type, Modifiers, double timestamp); 84 85 void encode(CoreIPC::ArgumentEncoder*) const; 86 static bool decode(CoreIPC::ArgumentDecoder*, WebEvent&); 110 87 111 88 private: … … 115 92 }; 116 93 94 // FIXME: Move this class to its own header file. 117 95 class WebMouseEvent : public WebEvent { 118 96 public: … … 124 102 }; 125 103 126 WebMouseEvent() 127 { 128 } 129 130 WebMouseEvent(Type type, Button button, int x, int y, int globalX, int globalY, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, double timestamp) 131 : WebEvent(type, modifiers, timestamp) 132 , m_button(button) 133 , m_positionX(x) 134 , m_positionY(y) 135 , m_globalPositionX(globalX) 136 , m_globalPositionY(globalY) 137 , m_deltaX(deltaX) 138 , m_deltaY(deltaY) 139 , m_deltaZ(deltaZ) 140 , m_clickCount(clickCount) 141 { 142 ASSERT(isMouseEventType(type)); 143 } 104 WebMouseEvent() { } 105 106 WebMouseEvent(Type, Button, int x, int y, int globalX, int globalY, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, double timestamp); 144 107 145 108 Button button() const { return m_button; } … … 153 116 int clickCount() const { return m_clickCount; } 154 117 155 void encode(CoreIPC::ArgumentEncoder* encoder) const 156 { 157 encoder->encodeBytes(reinterpret_cast<const uint8_t*>(this), sizeof(*this)); 158 } 159 160 static bool decode(CoreIPC::ArgumentDecoder* decoder, WebMouseEvent& t) 161 { 162 return decoder->decodeBytes(reinterpret_cast<uint8_t*>(&t), sizeof(t)); 163 } 164 165 private: 166 static bool isMouseEventType(Type type) 167 { 168 return type == MouseDown || type == MouseUp || type == MouseMove; 169 } 118 void encode(CoreIPC::ArgumentEncoder*) const; 119 static bool decode(CoreIPC::ArgumentDecoder*, WebMouseEvent&); 120 121 private: 122 static bool isMouseEventType(Type); 170 123 171 124 Button m_button; … … 180 133 }; 181 134 135 // FIXME: Move this class to its own header file. 182 136 class WebWheelEvent : public WebEvent { 183 137 public: … … 187 141 }; 188 142 189 WebWheelEvent() 190 { 191 } 192 193 WebWheelEvent(Type type, int x, int y, int globalX, int globalY, float deltaX, float deltaY, float wheelTicksX, float wheelTicksY, Granularity granularity, Modifiers modifiers, double timestamp) 194 : WebEvent(type, modifiers, timestamp) 195 , m_positionX(x) 196 , m_positionY(y) 197 , m_globalPositionX(globalX) 198 , m_globalPositionY(globalY) 199 , m_deltaX(deltaX) 200 , m_deltaY(deltaY) 201 , m_wheelTicksX(wheelTicksX) 202 , m_wheelTicksY(wheelTicksY) 203 , m_granularity(granularity) 204 { 205 ASSERT(isWheelEventType(type)); 206 } 143 WebWheelEvent() { } 144 145 WebWheelEvent(Type, int x, int y, int globalX, int globalY, float deltaX, float deltaY, float wheelTicksX, float wheelTicksY, Granularity, Modifiers, double timestamp); 207 146 208 147 int positionX() const { return m_positionX; } … … 216 155 Granularity granularity() const { return (Granularity)m_granularity; } 217 156 218 void encode(CoreIPC::ArgumentEncoder* encoder) const 219 { 220 encoder->encodeBytes(reinterpret_cast<const uint8_t*>(this), sizeof(*this)); 221 } 222 223 static bool decode(CoreIPC::ArgumentDecoder* decoder, WebWheelEvent& t) 224 { 225 return decoder->decodeBytes(reinterpret_cast<uint8_t*>(&t), sizeof(t)); 226 } 227 228 private: 229 static bool isWheelEventType(Type type) 230 { 231 return type == Wheel; 232 } 157 void encode(CoreIPC::ArgumentEncoder*) const; 158 static bool decode(CoreIPC::ArgumentDecoder*, WebWheelEvent&); 159 160 private: 161 static bool isWheelEventType(Type); 233 162 234 163 int m_positionX; … … 243 172 }; 244 173 174 // FIXME: Move this class to its own header file. 245 175 class WebKeyboardEvent : public WebEvent { 246 176 public: 247 WebKeyboardEvent() 248 { 249 } 250 251 WebKeyboardEvent(Type type, const String& text, const String& unmodifiedText, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers modifiers, double timestamp) 252 : WebEvent(type, modifiers, timestamp) 253 , m_text(text) 254 , m_unmodifiedText(unmodifiedText) 255 , m_keyIdentifier(keyIdentifier) 256 , m_windowsVirtualKeyCode(windowsVirtualKeyCode) 257 , m_nativeVirtualKeyCode(nativeVirtualKeyCode) 258 , m_isAutoRepeat(isAutoRepeat) 259 , m_isKeypad(isKeypad) 260 , m_isSystemKey(isSystemKey) 261 { 262 ASSERT(isKeyboardEventType(type)); 263 } 177 WebKeyboardEvent() { } 178 179 WebKeyboardEvent(Type, const String& text, const String& unmodifiedText, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers, double timestamp); 264 180 265 181 const String& text() const { return m_text; } … … 272 188 bool isSystemKey() const { return m_isSystemKey; } 273 189 274 void encode(CoreIPC::ArgumentEncoder* encoder) const 275 { 276 WebEvent::encode(encoder); 277 278 encoder->encode(m_text); 279 encoder->encode(m_unmodifiedText); 280 encoder->encode(m_keyIdentifier); 281 encoder->encode(m_windowsVirtualKeyCode); 282 encoder->encode(m_nativeVirtualKeyCode); 283 encoder->encode(m_isAutoRepeat); 284 encoder->encode(m_isKeypad); 285 encoder->encode(m_isSystemKey); 286 } 287 288 static bool decode(CoreIPC::ArgumentDecoder* decoder, WebKeyboardEvent& t) 289 { 290 if (!WebEvent::decode(decoder, t)) 291 return false; 292 293 String text; 294 if (!decoder->decode(text)) 295 return false; 296 t.m_text = text; 297 298 String unmodifiedText; 299 if (!decoder->decode(unmodifiedText)) 300 return false; 301 t.m_unmodifiedText = unmodifiedText; 302 303 String keyIdentifier; 304 if (!decoder->decode(keyIdentifier)) 305 return false; 306 t.m_keyIdentifier = keyIdentifier; 307 308 if (!decoder->decode(t.m_windowsVirtualKeyCode)) 309 return false; 310 if (!decoder->decode(t.m_nativeVirtualKeyCode)) 311 return false; 312 if (!decoder->decode(t.m_isAutoRepeat)) 313 return false; 314 if (!decoder->decode(t.m_isKeypad)) 315 return false; 316 if (!decoder->decode(t.m_isSystemKey)) 317 return false; 318 return true; 319 } 320 321 static bool isKeyboardEventType(Type type) 322 { 323 return type == RawKeyDown || type == KeyDown || type == KeyUp || type == Char; 324 } 190 void encode(CoreIPC::ArgumentEncoder*) const; 191 static bool decode(CoreIPC::ArgumentDecoder*, WebKeyboardEvent&); 192 193 static bool isKeyboardEventType(Type); 325 194 326 195 private: … … 337 206 #if ENABLE(TOUCH_EVENTS) 338 207 208 // FIXME: Move this class to its own header file. 209 // FIXME: Having "Platform" in the name makes it sound like this event is platform-specific or low- 210 // level in some way. That doesn't seem to be the case. 339 211 class WebPlatformTouchPoint { 340 212 public: … … 347 219 }; 348 220 349 WebPlatformTouchPoint() 350 { 351 } 352 353 WebPlatformTouchPoint(unsigned id, TouchPointState state, int screenPosX, int screenPosY, int posX, int posY) 354 : m_id(id) 355 , m_state(state) 356 , m_screenPosX(screenPosX) 357 , m_screenPosY(screenPosY) 358 , m_posX(posX) 359 , m_posY(posY) 360 { 361 } 221 WebPlatformTouchPoint() { } 222 223 WebPlatformTouchPoint(unsigned id, TouchPointState, int screenPosX, int screenPosY, int posX, int posY); 362 224 363 225 unsigned id() const { return m_id; } … … 371 233 void setState(TouchPointState state) { m_state = state; } 372 234 373 void encode(CoreIPC::ArgumentEncoder* encoder) const 374 { 375 encoder->encodeBytes(reinterpret_cast<const uint8_t*>(this), sizeof(*this)); 376 } 377 378 static bool decode(CoreIPC::ArgumentDecoder* decoder, WebPlatformTouchPoint& t) 379 { 380 return decoder->decodeBytes(reinterpret_cast<uint8_t*>(&t), sizeof(t)); 381 } 235 void encode(CoreIPC::ArgumentEncoder*) const; 236 static bool decode(CoreIPC::ArgumentDecoder*, WebPlatformTouchPoint&); 382 237 383 238 private: … … 389 244 }; 390 245 246 // FIXME: Move this class to its own header file. 391 247 class WebTouchEvent : public WebEvent { 392 248 public: 393 394 WebTouchEvent() 395 { 396 } 249 WebTouchEvent() { } 397 250 398 WebTouchEvent(WebEvent::Type type, Vector<WebPlatformTouchPoint> touchPoints, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, Modifiers modifiers, double timestamp) 399 : WebEvent(type, modifiers, timestamp) 400 , m_type(type) 401 , m_touchPoints(touchPoints) 402 , m_ctrlKey(ctrlKey) 403 , m_altKey(altKey) 404 , m_shiftKey(shiftKey) 405 , m_metaKey(metaKey) 406 { 407 ASSERT(isTouchEventType(type)); 408 } 409 410 const Vector<WebPlatformTouchPoint> touchPoints() const { return m_touchPoints; } 411 412 void encode(CoreIPC::ArgumentEncoder* encoder) const 413 { 414 WebEvent::encode(encoder); 415 encoder->encode(m_touchPoints); 416 } 417 418 static bool decode(CoreIPC::ArgumentDecoder* decoder, WebTouchEvent& t) 419 { 420 if (!WebEvent::decode(decoder, t)) 421 return false; 422 423 if (!decoder->decode(t.m_touchPoints)) 424 return false; 425 426 return true; 427 } 251 // FIXME: It would be nice not to have to copy the Vector here. 252 WebTouchEvent(Type, Vector<WebPlatformTouchPoint>, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, Modifiers, double timestamp); 253 254 const Vector<WebPlatformTouchPoint>& touchPoints() const { return m_touchPoints; } 255 256 void encode(CoreIPC::ArgumentEncoder*) const; 257 static bool decode(CoreIPC::ArgumentDecoder*, WebTouchEvent&); 428 258 429 259 private: 430 static bool isTouchEventType(Type type) 431 { 432 return type == TouchStart || type == TouchMove || type == TouchEnd; 433 } 260 static bool isTouchEventType(Type); 434 261 435 262 Type m_type; … … 441 268 double m_timestamp; 442 269 }; 443 #endif 270 271 #endif // ENABLE(TOUCH_EVENTS) 444 272 445 273 } // namespace WebKit -
trunk/WebKit2/WebKit2.pro
r70723 r70836 377 377 Shared/VisitedLinkTable.cpp \ 378 378 Shared/WebError.cpp \ 379 Shared/WebEvent.cpp \ 379 380 Shared/WebEventConversion.cpp \ 381 Shared/WebKeyboardEvent.cpp \ 382 Shared/WebMouseEvent.cpp \ 380 383 Shared/WebPageCreationParameters.cpp \ 384 Shared/WebPlatformTouchPoint.cpp \ 381 385 Shared/WebPopupItem.cpp \ 386 Shared/WebPreferencesStore.cpp \ 382 387 Shared/WebProcessCreationParameters.cpp \ 383 Shared/Web PreferencesStore.cpp \388 Shared/WebTouchEvent.cpp \ 384 389 Shared/WebURLRequest.cpp \ 385 390 Shared/WebURLResponse.cpp \ 391 Shared/WebWheelEvent.cpp \ 386 392 UIProcess/API/C/WKBackForwardList.cpp \ 387 393 UIProcess/API/C/WKContext.cpp \ -
trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj
r70828 r70836 459 459 C01A260112662F2100C9ED55 /* BackingStoreCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C01A260012662F2100C9ED55 /* BackingStoreCG.cpp */; }; 460 460 C02BFF1E1251502E009CCBEA /* NativeWebKeyboardEventMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = C02BFF1D1251502E009CCBEA /* NativeWebKeyboardEventMac.mm */; }; 461 C0337DAE127A24FE008FF4F4 /* WebEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0337DAD127A24FE008FF4F4 /* WebEvent.cpp */; }; 462 C0337DB0127A28D0008FF4F4 /* WebMouseEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0337DAF127A28D0008FF4F4 /* WebMouseEvent.cpp */; }; 463 C0337DD1127A2980008FF4F4 /* WebWheelEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0337DD0127A2980008FF4F4 /* WebWheelEvent.cpp */; }; 464 C0337DD3127A2A0E008FF4F4 /* WebKeyboardEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0337DD2127A2A0E008FF4F4 /* WebKeyboardEvent.cpp */; }; 465 C0337DD8127A51B6008FF4F4 /* WebTouchEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0337DD7127A51B6008FF4F4 /* WebTouchEvent.cpp */; }; 466 C0337DDD127A521C008FF4F4 /* WebPlatformTouchPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0337DDC127A521C008FF4F4 /* WebPlatformTouchPoint.cpp */; }; 461 467 C06C6095124C144B0001682F /* WebPageCreationParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C06C6093124C14430001682F /* WebPageCreationParameters.cpp */; }; 462 468 C09AE5E9125257C20025825D /* WKNativeEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C09AE5E8125257C20025825D /* WKNativeEvent.h */; settings = {ATTRIBUTES = (Public, ); }; }; … … 970 976 C02BFF1512514FD8009CCBEA /* NativeWebKeyboardEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeWebKeyboardEvent.h; sourceTree = "<group>"; }; 971 977 C02BFF1D1251502E009CCBEA /* NativeWebKeyboardEventMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NativeWebKeyboardEventMac.mm; sourceTree = "<group>"; }; 978 C0337DAD127A24FE008FF4F4 /* WebEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebEvent.cpp; sourceTree = "<group>"; }; 979 C0337DAF127A28D0008FF4F4 /* WebMouseEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebMouseEvent.cpp; sourceTree = "<group>"; }; 980 C0337DD0127A2980008FF4F4 /* WebWheelEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebWheelEvent.cpp; sourceTree = "<group>"; }; 981 C0337DD2127A2A0E008FF4F4 /* WebKeyboardEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKeyboardEvent.cpp; sourceTree = "<group>"; }; 982 C0337DD7127A51B6008FF4F4 /* WebTouchEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebTouchEvent.cpp; sourceTree = "<group>"; }; 983 C0337DDC127A521C008FF4F4 /* WebPlatformTouchPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPlatformTouchPoint.cpp; sourceTree = "<group>"; }; 972 984 C06C6093124C14430001682F /* WebPageCreationParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageCreationParameters.cpp; sourceTree = "<group>"; }; 973 985 C06C6094124C14430001682F /* WebPageCreationParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageCreationParameters.h; sourceTree = "<group>"; }; … … 1274 1286 BC575612126E0138006F0F12 /* WebError.cpp */, 1275 1287 516A4A5B120A2CCD00C05B7F /* WebError.h */, 1288 C0337DAD127A24FE008FF4F4 /* WebEvent.cpp */, 1276 1289 BC032DAF10F4380F0058C15A /* WebEvent.h */, 1277 1290 BC032DB010F4380F0058C15A /* WebEventConversion.cpp */, 1278 1291 BC032DB110F4380F0058C15A /* WebEventConversion.h */, 1292 C0337DD2127A2A0E008FF4F4 /* WebKeyboardEvent.cpp */, 1293 C0337DAF127A28D0008FF4F4 /* WebMouseEvent.cpp */, 1279 1294 BCF69F981176CED600471A52 /* WebNavigationDataStore.h */, 1280 1295 BC33DD671238464600360F3F /* WebNumber.h */, … … 1283 1298 C06C6093124C14430001682F /* WebPageCreationParameters.cpp */, 1284 1299 C06C6094124C14430001682F /* WebPageCreationParameters.h */, 1300 C0337DDC127A521C008FF4F4 /* WebPlatformTouchPoint.cpp */, 1285 1301 BC306823125A6B9400E71278 /* WebProcessCreationParameters.cpp */, 1286 1302 BC306822125A6B9400E71278 /* WebProcessCreationParameters.h */, … … 1289 1305 A72D5D7F1236CBA800A88B15 /* WebSerializedScriptValue.h */, 1290 1306 BCF04C8E11FF9F6E00F86A58 /* WebString.h */, 1307 C0337DD7127A51B6008FF4F4 /* WebTouchEvent.cpp */, 1291 1308 BCDB86C01200FB97007254BE /* WebURL.h */, 1292 1309 BCE2315C122C30CA00D5C35A /* WebURLRequest.cpp */, … … 1295 1312 BC90A1D0122DD55E00CC8C50 /* WebURLResponse.h */, 1296 1313 F6113E24126CE1820057D0A7 /* WebUserContentURLPattern.h */, 1314 C0337DD0127A2980008FF4F4 /* WebWheelEvent.cpp */, 1297 1315 ); 1298 1316 path = Shared; … … 2521 2539 1A6161D51278981C003ACD86 /* Download.cpp in Sources */, 2522 2540 1A61639612789B2F003ACD86 /* DownloadMac.mm in Sources */, 2541 C0337DAE127A24FE008FF4F4 /* WebEvent.cpp in Sources */, 2542 C0337DB0127A28D0008FF4F4 /* WebMouseEvent.cpp in Sources */, 2543 C0337DD1127A2980008FF4F4 /* WebWheelEvent.cpp in Sources */, 2544 C0337DD3127A2A0E008FF4F4 /* WebKeyboardEvent.cpp in Sources */, 2545 C0337DD8127A51B6008FF4F4 /* WebTouchEvent.cpp in Sources */, 2546 C0337DDD127A521C008FF4F4 /* WebPlatformTouchPoint.cpp in Sources */, 2523 2547 ); 2524 2548 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebKit2/win/WebKit2.vcproj
r70723 r70836 506 506 </File> 507 507 <File 508 RelativePath="..\Shared\WebEvent.cpp" 509 > 510 </File> 511 <File 508 512 RelativePath="..\Shared\WebEvent.h" 509 513 > … … 518 522 </File> 519 523 <File 524 RelativePath="..\Shared\WebKeyboardEvent.cpp" 525 > 526 </File> 527 <File 528 RelativePath="..\Shared\WebMouseEvent.cpp" 529 > 530 </File> 531 <File 520 532 RelativePath="..\Shared\WebNavigationDataStore.h" 521 533 > … … 534 546 </File> 535 547 <File 548 RelativePath="..\Shared\WebPlatformTouchPoint.cpp" 549 > 550 </File> 551 <File 536 552 RelativePath="..\Shared\WebPopupItem.cpp" 537 553 > … … 566 582 </File> 567 583 <File 584 RelativePath="..\Shared\WebTouchEvent.cpp" 585 > 586 </File> 587 <File 568 588 RelativePath="..\Shared\WebURL.h" 569 589 > … … 587 607 <File 588 608 RelativePath="..\Shared\WebUserContentURLPattern.h" 609 > 610 </File> 611 <File 612 RelativePath="..\Shared\WebWheelEvent.cpp" 589 613 > 590 614 </File>
Note: See TracChangeset
for help on using the changeset viewer.