Changeset 188860 in webkit
- Timestamp:
- Aug 24, 2015 8:23:21 AM (9 years ago)
- Location:
- trunk/Source
- Files:
-
- 2 added
- 14 edited
- 1 copied
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r188820 r188860 2004 2004 page/UserContentURLPattern.cpp 2005 2005 page/VisitedLinkStore.cpp 2006 page/WheelEventDelta Tracker.cpp2006 page/WheelEventDeltaFilter.cpp 2007 2007 page/WheelEventTestTrigger.cpp 2008 2008 page/WindowFeatures.cpp -
trunk/Source/WebCore/ChangeLog
r188859 r188860 1 2015-08-24 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Use _NSScrollingPredominantAxisFilter for wheel event filtering on Mac 4 https://bugs.webkit.org/show_bug.cgi?id=147320 5 6 Reviewed by Simon Fraser. 7 8 Refactored to use a predominant axis filter instead of a predominant axis tracker. This allows us to 9 employ AppKit's _NSScrollingPredominantAxisFilter when possible, and use the wheel event delta tracker 10 as a fallback. Here, we refactor EventHandler to use the new filters for overflow scrolling and replace 11 the MainFrame's WheelEventDeltaTracker with an appropriate type of WheelEventDeltaFilter. 12 13 In the case where an _NSScrollingPredominantAxisFilter is unavailable, the platform-invariant wheel 14 event delta filter simply uses the existing wheel event delta tracker to compute the current predominant 15 axis. It uses the predominant axis to determine which axis (if any) should have its delta zeroed out. 16 17 This patch also introduces NSScrollingInputFilterSPI.h, which either imports the internal input filter 18 header from AppKit or declares relevant interfaces and functions. 19 20 No new tests, since this change does not add new functionality. 21 22 * CMakeLists.txt: Add page/WheelEventDeltaFilter.cpp. 23 * WebCore.vcxproj/WebCore.vcxproj: Add WheelEventDeltaFilter.cpp and WheelEventDeltaFilter.h. 24 * WebCore.vcxproj/WebCore.vcxproj.filters: Add WheelEventDeltaFilter.cpp and WheelEventDeltaFilter.h. 25 * WebCore.xcodeproj/project.pbxproj: Add WheelEventDeltaFilter.cpp, WheelEventDeltaFilter.h, and their Mac counterparts. 26 * page/EventHandler.cpp: 27 (WebCore::didScrollInScrollableArea): Refactored to no longer handle axes separately. 28 (WebCore::handleWheelEventInAppropriateEnclosingBox): Ditto. 29 (WebCore::EventHandler::platformRecordWheelEvent): Refactored to update the wheel delta filter. 30 (WebCore::EventHandler::clearLatchedState): Ditto. 31 (WebCore::EventHandler::defaultWheelEventHandler): Refactored to use wheel delta filters. No longer splits wheel events 32 and handles them on separate axes. 33 (WebCore::didScrollInScrollableAreaForSingleAxis): Deleted. 34 (WebCore::handleWheelEventInAppropriateEnclosingBoxForSingleAxis): Deleted. 35 * page/EventHandler.h: 36 * page/MainFrame.cpp: 37 (WebCore::MainFrame::MainFrame): Initializes the appropriate type of WheelEventDeltaFilter. 38 * page/MainFrame.h: 39 * page/WheelEventDeltaFilter.cpp: Added. 40 (WebCore::WheelEventDeltaFilter::WheelEventDeltaFilter): 41 (WebCore::WheelEventDeltaFilter::~WheelEventDeltaFilter): 42 (WebCore::WheelEventDeltaFilter::create): 43 (WebCore::BasicWheelEventDeltaFilter::BasicWheelEventDeltaFilter): 44 (WebCore::BasicWheelEventDeltaFilter::updateFromDelta): 45 (WebCore::BasicWheelEventDeltaFilter::beginFilteringDeltas): 46 (WebCore::BasicWheelEventDeltaFilter::endFilteringDeltas): 47 (WebCore::deltaIsPredominantlyVertical): 48 (WebCore::BasicWheelEventDeltaFilter::dominantScrollGestureDirection): 49 * page/WheelEventDeltaFilter.h: Refactored WheelEventDeltaTracker logic to work as a filter instead. 50 * page/mac/EventHandlerMac.mm: 51 (WebCore::EventHandler::platformPrepareForWheelEvents): Refactored to use wheel delta filters. 52 (WebCore::EventHandler::platformRecordWheelEvent): Ditto. 53 * page/mac/WheelEventDeltaFilterMac.h: Wraps the new _NSScrollingPredominantAxisFilter. 54 * page/mac/WheelEventDeltaFilterMac.mm: Added. 55 (WebCore::WheelEventDeltaFilterMac::WheelEventDeltaFilterMac): 56 (WebCore::WheelEventDeltaFilterMac::beginFilteringDeltas): 57 (WebCore::WheelEventDeltaFilterMac::updateFromDelta): 58 (WebCore::WheelEventDeltaFilterMac::endFilteringDeltas): 59 * platform/PlatformWheelEvent.h: 60 (WebCore::PlatformWheelEvent::copyWithDeltas): Used to create a copy of the platform wheel event with filtered deltas. 61 (WebCore::PlatformWheelEvent::copyIgnoringHorizontalDelta): Deleted. No longer necessary, since we won't be handling wheel 62 events on separate axes. 63 (WebCore::PlatformWheelEvent::copyIgnoringVerticalDelta): Ditto. 64 * platform/spi/mac/NSScrollingInputFilterSPI.h: Added. 65 1 66 2015-08-24 Michael Catanzaro <mcatanzaro@igalia.com> 2 67 -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
r188820 r188860 7342 7342 <ClCompile Include="..\page\VisitedLinkStore.cpp" /> 7343 7343 <ClCompile Include="..\fileapi\WebKitBlobBuilder.cpp" /> 7344 <ClCompile Include="..\page\WheelEventDelta Tracker.cpp" />7344 <ClCompile Include="..\page\WheelEventDeltaFilter.cpp" /> 7345 7345 <ClCompile Include="..\page\WheelEventTestTrigger.cpp" /> 7346 7346 <ClCompile Include="..\page\WindowFeatures.cpp" /> … … 20780 20780 <ClInclude Include="..\fileapi\WebKitBlobBuilder.h" /> 20781 20781 <ClInclude Include="..\page\WebKitPoint.h" /> 20782 <ClInclude Include="..\page\WheelEventDelta Tracker.h" />20782 <ClInclude Include="..\page\WheelEventDeltaFilter.h" /> 20783 20783 <ClInclude Include="..\page\WheelEventTestTrigger.h" /> 20784 20784 <ClInclude Include="..\page\WindowFeatures.h" /> -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
r188809 r188860 814 814 <Filter>page</Filter> 815 815 </ClCompile> 816 <ClCompile Include="..\page\WheelEventDelta Tracker.cpp">816 <ClCompile Include="..\page\WheelEventDeltaFilter.cpp"> 817 817 <Filter>page</Filter> 818 818 </ClCompile> … … 7845 7845 <Filter>page</Filter> 7846 7846 </ClInclude> 7847 <ClInclude Include="..\page\WheelEventDelta Tracker.h">7847 <ClInclude Include="..\page\WheelEventDeltaFilter.h"> 7848 7848 <Filter>page</Filter> 7849 7849 </ClInclude> -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r188851 r188860 1179 1179 2E0888D51148848A00AF4265 /* JSDOMFormData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E0888D31148848A00AF4265 /* JSDOMFormData.h */; }; 1180 1180 2E0888E6114884E200AF4265 /* JSDOMFormDataCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E0888E5114884E200AF4265 /* JSDOMFormDataCustom.cpp */; }; 1181 2E19516B1B6598D200DF6EEF /* WheelEventDeltaFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E19516A1B6598D200DF6EEF /* WheelEventDeltaFilter.cpp */; }; 1181 1182 2E2D99CD10E2BBDA00496337 /* JSBlob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E2D99CB10E2BBDA00496337 /* JSBlob.cpp */; }; 1182 1183 2E2D99CE10E2BBDA00496337 /* JSBlob.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E2D99CC10E2BBDA00496337 /* JSBlob.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 1219 1220 2E94F43B119207DA00B7F75D /* JSFileReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E94F439119207DA00B7F75D /* JSFileReader.cpp */; }; 1220 1221 2E94F43C119207DA00B7F75D /* JSFileReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E94F43A119207DA00B7F75D /* JSFileReader.h */; }; 1222 2E9B5D8F1B66A94E008C6A24 /* WheelEventDeltaFilterMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E9B5D8E1B66A94E008C6A24 /* WheelEventDeltaFilterMac.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1221 1223 2EA768040FE7126400AB9C8A /* WorkerScriptLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EA768030FE7126400AB9C8A /* WorkerScriptLoaderClient.h */; }; 1222 1224 2EB4BCD2121F03E300EC4885 /* BlobResourceHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2EB4BCD0121F03E300EC4885 /* BlobResourceHandle.cpp */; }; 1223 1225 2EB4BCD3121F03E300EC4885 /* BlobResourceHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EB4BCD1121F03E300EC4885 /* BlobResourceHandle.h */; }; 1226 2EBBC3D81B65988300F5253D /* WheelEventDeltaFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EBBC3D71B65988300F5253D /* WheelEventDeltaFilter.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1224 1227 2ECF7ADC10162B3800427DE7 /* JSErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2ECF7ADA10162B3800427DE7 /* JSErrorEvent.cpp */; }; 1225 1228 2ECF7ADD10162B3800427DE7 /* JSErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ECF7ADB10162B3800427DE7 /* JSErrorEvent.h */; }; … … 1236 1239 2EDF369D122C94B4002F7D4E /* FileReaderSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDF369B122C94B4002F7D4E /* FileReaderSync.h */; }; 1237 1240 2EDF369F122C94C8002F7D4E /* FileException.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDF369E122C94C8002F7D4E /* FileException.h */; }; 1241 2EEEE55C1B66A047008E2CBC /* WheelEventDeltaFilterMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2EEEE55B1B66A047008E2CBC /* WheelEventDeltaFilterMac.mm */; }; 1238 1242 2EF1BFEA121C9F4200C27627 /* FileStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2EF1BFE8121C9F4200C27627 /* FileStream.cpp */; }; 1239 1243 2EF1BFEB121C9F4200C27627 /* FileStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EF1BFE9121C9F4200C27627 /* FileStream.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 3514 3518 93EB169709F880C00091F8FF /* WebCoreSystemInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 93EB169609F880C00091F8FF /* WebCoreSystemInterface.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3515 3519 93EB355F09E37FD600F43799 /* MouseEventWithHitTestResults.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93EB355E09E37FD600F43799 /* MouseEventWithHitTestResults.cpp */; }; 3516 93EC44A1188F4BB800661DF1 /* WheelEventDeltaTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93EC449F188F4BB800661DF1 /* WheelEventDeltaTracker.cpp */; };3517 93EC44A2188F4BB800661DF1 /* WheelEventDeltaTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 93EC44A0188F4BB800661DF1 /* WheelEventDeltaTracker.h */; settings = {ATTRIBUTES = (Private, ); }; };3518 3520 93EF7D551954F13900DFB71D /* ScrollingStateNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93EF7D541954E98F00DFB71D /* ScrollingStateNode.mm */; }; 3519 3521 93F198E508245E59001E9ABC /* HTMLDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D23C02DE4396018635CA /* HTMLDocument.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 6461 6463 F3F5CF1112ED81A80084C569 /* InspectorConsoleInstrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F5CF1012ED81A80084C569 /* InspectorConsoleInstrumentation.h */; }; 6462 6464 F3F5CF1312ED81B30084C569 /* InspectorDatabaseInstrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F5CF1212ED81B30084C569 /* InspectorDatabaseInstrumentation.h */; }; 6465 F40EA8AB1B867E4400CE5581 /* NSScrollingInputFilterSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = F40EA8AA1B867D6500CE5581 /* NSScrollingInputFilterSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6463 6466 F42FFB461984B71600F6837F /* LengthRepeat.h in Headers */ = {isa = PBXBuildFile; fileRef = F42FFB451984B71600F6837F /* LengthRepeat.h */; }; 6464 6467 F45C231D1995B73B00A6E2E3 /* AxisScrollSnapOffsets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F45C231B1995B73B00A6E2E3 /* AxisScrollSnapOffsets.cpp */; }; … … 8388 8391 2E0888D31148848A00AF4265 /* JSDOMFormData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMFormData.h; sourceTree = "<group>"; }; 8389 8392 2E0888E5114884E200AF4265 /* JSDOMFormDataCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMFormDataCustom.cpp; sourceTree = "<group>"; }; 8393 2E19516A1B6598D200DF6EEF /* WheelEventDeltaFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WheelEventDeltaFilter.cpp; sourceTree = "<group>"; }; 8390 8394 2E2D99CB10E2BBDA00496337 /* JSBlob.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSBlob.cpp; sourceTree = "<group>"; }; 8391 8395 2E2D99CC10E2BBDA00496337 /* JSBlob.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBlob.h; sourceTree = "<group>"; }; … … 8430 8434 2E94F439119207DA00B7F75D /* JSFileReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFileReader.cpp; sourceTree = "<group>"; }; 8431 8435 2E94F43A119207DA00B7F75D /* JSFileReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFileReader.h; sourceTree = "<group>"; }; 8436 2E9B5D8E1B66A94E008C6A24 /* WheelEventDeltaFilterMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WheelEventDeltaFilterMac.h; sourceTree = "<group>"; }; 8432 8437 2EA768030FE7126400AB9C8A /* WorkerScriptLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerScriptLoaderClient.h; sourceTree = "<group>"; }; 8433 8438 2EB4BCD0121F03E300EC4885 /* BlobResourceHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BlobResourceHandle.cpp; sourceTree = "<group>"; }; 8434 8439 2EB4BCD1121F03E300EC4885 /* BlobResourceHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobResourceHandle.h; sourceTree = "<group>"; }; 8440 2EBBC3D71B65988300F5253D /* WheelEventDeltaFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WheelEventDeltaFilter.h; sourceTree = "<group>"; }; 8435 8441 2ECF7ADA10162B3800427DE7 /* JSErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSErrorEvent.cpp; sourceTree = "<group>"; }; 8436 8442 2ECF7ADB10162B3800427DE7 /* JSErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSErrorEvent.h; sourceTree = "<group>"; }; … … 8448 8454 2EDF369B122C94B4002F7D4E /* FileReaderSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileReaderSync.h; sourceTree = "<group>"; }; 8449 8455 2EDF369E122C94C8002F7D4E /* FileException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileException.h; sourceTree = "<group>"; }; 8456 2EEEE55B1B66A047008E2CBC /* WheelEventDeltaFilterMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WheelEventDeltaFilterMac.mm; sourceTree = "<group>"; }; 8450 8457 2EF1BFE8121C9F4200C27627 /* FileStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileStream.cpp; sourceTree = "<group>"; }; 8451 8458 2EF1BFE9121C9F4200C27627 /* FileStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileStream.h; sourceTree = "<group>"; }; … … 10869 10876 93EB169609F880C00091F8FF /* WebCoreSystemInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreSystemInterface.h; sourceTree = "<group>"; }; 10870 10877 93EB355E09E37FD600F43799 /* MouseEventWithHitTestResults.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseEventWithHitTestResults.cpp; sourceTree = "<group>"; }; 10871 93EC449F188F4BB800661DF1 /* WheelEventDeltaTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WheelEventDeltaTracker.cpp; sourceTree = "<group>"; };10872 93EC44A0188F4BB800661DF1 /* WheelEventDeltaTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WheelEventDeltaTracker.h; sourceTree = "<group>"; };10873 10878 93EEC1E509C2877700C515D1 /* Attr.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Attr.idl; sourceTree = "<group>"; }; 10874 10879 93EEC1E609C2877700C515D1 /* CharacterData.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CharacterData.idl; sourceTree = "<group>"; }; … … 14190 14195 F3F5CF1012ED81A80084C569 /* InspectorConsoleInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorConsoleInstrumentation.h; sourceTree = "<group>"; }; 14191 14196 F3F5CF1212ED81B30084C569 /* InspectorDatabaseInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDatabaseInstrumentation.h; sourceTree = "<group>"; }; 14197 F40EA8AA1B867D6500CE5581 /* NSScrollingInputFilterSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSScrollingInputFilterSPI.h; sourceTree = "<group>"; }; 14192 14198 F42FFB451984B71600F6837F /* LengthRepeat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LengthRepeat.h; sourceTree = "<group>"; }; 14193 14199 F45C231B1995B73B00A6E2E3 /* AxisScrollSnapOffsets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AxisScrollSnapOffsets.cpp; sourceTree = "<group>"; }; … … 17267 17273 494BD7930F55C8EE00747828 /* WebKitPoint.h */, 17268 17274 494BD7940F55C8EE00747828 /* WebKitPoint.idl */, 17269 93EC449F188F4BB800661DF1 /* WheelEventDeltaTracker.cpp */,17270 93EC44A0188F4BB800661DF1 /* WheelEventDeltaTracker.h */,17275 2E19516A1B6598D200DF6EEF /* WheelEventDeltaFilter.cpp */, 17276 2EBBC3D71B65988300F5253D /* WheelEventDeltaFilter.h */, 17271 17277 7AE335EF1ACB09E200E401EF /* WheelEventTestTrigger.cpp */, 17272 17278 7AE335F01ACB09E200E401EF /* WheelEventTestTrigger.h */, … … 18126 18132 937F4CCD1A2D4B0100BB39F5 /* NSMenuSPI.h */, 18127 18133 93F1E1EB1A40FDDC00348D13 /* NSPopoverSPI.h */, 18134 F40EA8AA1B867D6500CE5581 /* NSScrollingInputFilterSPI.h */, 18128 18135 2DCB837719F99BBA00A7FBE4 /* NSSharingServicePickerSPI.h */, 18129 18136 2DCB837819F99BBA00A7FBE4 /* NSSharingServiceSPI.h */, … … 18159 18166 26255F0218878E110006E1FD /* UserAgentMac.mm */, 18160 18167 F587854C02DE375901EA4122 /* WebCoreFrameView.h */, 18168 2EEEE55B1B66A047008E2CBC /* WheelEventDeltaFilterMac.mm */, 18169 2E9B5D8E1B66A94E008C6A24 /* WheelEventDeltaFilterMac.h */, 18161 18170 ); 18162 18171 path = mac; … … 24036 24045 FD31608012B026F700C1A359 /* AudioDSPKernel.h in Headers */, 24037 24046 FD31608212B026F700C1A359 /* AudioDSPKernelProcessor.h in Headers */, 24047 F40EA8AB1B867E4400CE5581 /* NSScrollingInputFilterSPI.h in Headers */, 24038 24048 FD31608312B026F700C1A359 /* AudioFileReader.h in Headers */, 24039 24049 CD5596921475B678001D0BD0 /* AudioFileReaderIOS.h in Headers */, … … 25360 25370 44DEF6431A6FF92700D45EEC /* IOReturnSPI.h in Headers */, 25361 25371 2D0B4AAB18DA1CCD00434DE1 /* IOSurface.h in Headers */, 25372 2E9B5D8F1B66A94E008C6A24 /* WheelEventDeltaFilterMac.h in Headers */, 25362 25373 1C21E57D183ED1FF001C289D /* IOSurfacePool.h in Headers */, 25363 25374 44DFF6431A6FF92700D45EEC /* IOSurfaceSPI.h in Headers */, … … 25716 25727 B59DD6A511902A62007E9684 /* JSSQLStatementCallback.h in Headers */, 25717 25728 B59DD6A911902A71007E9684 /* JSSQLStatementErrorCallback.h in Headers */, 25729 2EBBC3D81B65988300F5253D /* WheelEventDeltaFilter.h in Headers */, 25718 25730 BC82432A0D0CE8A200460C8F /* JSSQLTransaction.h in Headers */, 25719 25731 B59DD69D11902A42007E9684 /* JSSQLTransactionCallback.h in Headers */, … … 27438 27450 F55B3DE01251F12D003EF269 /* WeekInputType.h in Headers */, 27439 27451 85031B510A44EFC700F992E0 /* WheelEvent.h in Headers */, 27440 93EC44A2188F4BB800661DF1 /* WheelEventDeltaTracker.h in Headers */,27441 27452 7AE335F21ACB09E200E401EF /* WheelEventTestTrigger.h in Headers */, 27442 27453 9380F47409A11AB4001FDB34 /* Widget.h in Headers */, … … 30373 30384 B22279B00D00BF220071B782 /* SVGDescElement.cpp in Sources */, 30374 30385 B22279B30D00BF220071B782 /* SVGDocument.cpp in Sources */, 30386 2EEEE55C1B66A047008E2CBC /* WheelEventDeltaFilterMac.mm in Sources */, 30375 30387 B28C6A270D00C44800334AA4 /* SVGDocumentExtensions.cpp in Sources */, 30376 30388 B22279B60D00BF220071B782 /* SVGElement.cpp in Sources */, … … 30467 30479 B2227A8E0D00BF220071B782 /* SVGPolyElement.cpp in Sources */, 30468 30480 B2227A900D00BF220071B782 /* SVGPolygonElement.cpp in Sources */, 30481 2E19516B1B6598D200DF6EEF /* WheelEventDeltaFilter.cpp in Sources */, 30469 30482 B2227A930D00BF220071B782 /* SVGPolylineElement.cpp in Sources */, 30470 30483 B2227A960D00BF220071B782 /* SVGPreserveAspectRatio.cpp in Sources */, … … 30766 30779 F55B3DDF1251F12D003EF269 /* WeekInputType.cpp in Sources */, 30767 30780 85031B500A44EFC700F992E0 /* WheelEvent.cpp in Sources */, 30768 93EC44A1188F4BB800661DF1 /* WheelEventDeltaTracker.cpp in Sources */,30769 30781 7AE335F11ACB09E200E401EF /* WheelEventTestTrigger.cpp in Sources */, 30770 30782 9380F47309A11AB4001FDB34 /* Widget.cpp in Sources */, -
trunk/Source/WebCore/page/EventHandler.cpp
r186480 r188860 288 288 } 289 289 290 static inline bool didScrollInScrollableAreaForSingleAxis(ScrollableArea* scrollableArea, WheelEvent* wheelEvent, ScrollEventAxis axis) 291 { 292 float delta = axis == ScrollEventAxis::Vertical ? wheelEvent->deltaY() : wheelEvent->deltaX(); 293 ScrollDirection negativeDirection = axis == ScrollEventAxis::Vertical ? ScrollUp : ScrollLeft; 294 ScrollDirection positiveDirection = axis == ScrollEventAxis::Vertical ? ScrollDown : ScrollRight; 295 return scrollableArea->scroll(delta < 0 ? negativeDirection : positiveDirection, wheelGranularityToScrollGranularity(wheelEvent->deltaMode()), delta > 0 ? delta : -delta); 296 } 297 298 static inline bool handleWheelEventInAppropriateEnclosingBoxForSingleAxis(Node* startNode, WheelEvent* wheelEvent, Element** stopElement, ScrollEventAxis axis) 299 { 300 bool shouldHandleEvent = (axis == ScrollEventAxis::Vertical && wheelEvent->deltaY()) || (axis == ScrollEventAxis::Horizontal && wheelEvent->deltaX()); 290 static inline bool didScrollInScrollableArea(ScrollableArea* scrollableArea, WheelEvent* wheelEvent) 291 { 292 ScrollGranularity scrollGranularity = wheelGranularityToScrollGranularity(wheelEvent->deltaMode()); 293 bool didHandleWheelEvent = false; 294 if (float absoluteDelta = std::abs(wheelEvent->deltaX())) 295 didHandleWheelEvent |= scrollableArea->scroll(wheelEvent->deltaX() > 0 ? ScrollRight : ScrollLeft, scrollGranularity, absoluteDelta); 296 297 if (float absoluteDelta = std::abs(wheelEvent->deltaY())) 298 didHandleWheelEvent |= scrollableArea->scroll(wheelEvent->deltaY() > 0 ? ScrollDown : ScrollUp, scrollGranularity, absoluteDelta); 299 300 return didHandleWheelEvent; 301 } 302 303 static inline bool handleWheelEventInAppropriateEnclosingBox(Node* startNode, WheelEvent* wheelEvent, Element** stopElement, const FloatSize& filteredPlatformDelta) 304 { 305 bool shouldHandleEvent = wheelEvent->deltaX() || wheelEvent->deltaY(); 301 306 #if PLATFORM(MAC) 302 307 shouldHandleEvent |= wheelEvent->phase() == PlatformWheelEventPhaseEnded; … … 310 315 RenderBox& initialEnclosingBox = startNode->renderer()->enclosingBox(); 311 316 if (initialEnclosingBox.isListBox()) 312 return didScrollInScrollableArea ForSingleAxis(static_cast<RenderListBox*>(&initialEnclosingBox), wheelEvent, axis);317 return didScrollInScrollableArea(static_cast<RenderListBox*>(&initialEnclosingBox), wheelEvent); 313 318 314 319 RenderBox* currentEnclosingBox = &initialEnclosingBox; … … 318 323 bool scrollingWasHandled; 319 324 if (platformEvent != nullptr) 320 scrollingWasHandled = boxLayer->handleWheelEvent( axis == ScrollEventAxis::Vertical ? platformEvent->copyIgnoringHorizontalDelta() : platformEvent->copyIgnoringVerticalDelta());325 scrollingWasHandled = boxLayer->handleWheelEvent(platformEvent->copyWithDeltas(filteredPlatformDelta.width(), filteredPlatformDelta.height())); 321 326 else 322 scrollingWasHandled = didScrollInScrollableArea ForSingleAxis(boxLayer, wheelEvent, axis);327 scrollingWasHandled = didScrollInScrollableArea(boxLayer, wheelEvent); 323 328 324 329 if (scrollingWasHandled) { … … 2671 2676 void EventHandler::platformRecordWheelEvent(const PlatformWheelEvent& event) 2672 2677 { 2673 m_frame.mainFrame().wheelEventDelta Tracker()->recordWheelEventDelta(event);2678 m_frame.mainFrame().wheelEventDeltaFilter()->updateFromDelta(FloatSize(event.deltaX(), event.deltaY())); 2674 2679 } 2675 2680 … … 2776 2781 m_frame.mainFrame().resetLatchingState(); 2777 2782 #endif 2778 m_frame.mainFrame().wheelEventDelta Tracker()->endTrackingDeltas();2783 m_frame.mainFrame().wheelEventDeltaFilter()->endFilteringDeltas(); 2779 2784 } 2780 2785 … … 2784 2789 return; 2785 2790 2786 DominantScrollGestureDirection dominantDirection = DominantScrollGestureDirection::None; 2787 2791 FloatSize filteredPlatformDelta(wheelEvent->deltaX(), wheelEvent->deltaY()); 2792 if (const PlatformWheelEvent* platformWheelEvent = wheelEvent->wheelEvent()) { 2793 filteredPlatformDelta.setWidth(platformWheelEvent->deltaX()); 2794 filteredPlatformDelta.setHeight(platformWheelEvent->deltaY()); 2795 } 2796 2788 2797 #if PLATFORM(MAC) 2789 2798 ScrollLatchingState* latchedState = m_frame.mainFrame().latchingState(); 2790 2799 Element* stopElement = latchedState ? latchedState->previousWheelScrolledElement() : nullptr; 2791 2800 2792 // Workaround for scrolling issues <rdar://problem/14758615>. 2793 if (m_frame.mainFrame().wheelEventDeltaTracker()->isTrackingDeltas()) 2794 dominantDirection = m_frame.mainFrame().wheelEventDeltaTracker()->dominantScrollGestureDirection(); 2801 if (m_frame.mainFrame().wheelEventDeltaFilter()->isFilteringDeltas()) 2802 filteredPlatformDelta = m_frame.mainFrame().wheelEventDeltaFilter()->filteredDelta(); 2795 2803 #else 2796 2804 Element* stopElement = nullptr; 2797 2805 #endif 2798 2806 2799 // Break up into two scrolls if we need to. Diagonal movement on 2800 // a MacBook pro is an example of a 2-dimensional mouse wheel event (where both deltaX and deltaY can be set). 2801 if (dominantDirection != DominantScrollGestureDirection::Vertical && handleWheelEventInAppropriateEnclosingBoxForSingleAxis(startNode, wheelEvent, &stopElement, ScrollEventAxis::Horizontal)) 2802 wheelEvent->setDefaultHandled(); 2803 2804 if (dominantDirection != DominantScrollGestureDirection::Horizontal && handleWheelEventInAppropriateEnclosingBoxForSingleAxis(startNode, wheelEvent, &stopElement, ScrollEventAxis::Vertical)) 2807 2808 if (handleWheelEventInAppropriateEnclosingBox(startNode, wheelEvent, &stopElement, filteredPlatformDelta)) 2805 2809 wheelEvent->setDefaultHandled(); 2806 2810 -
trunk/Source/WebCore/page/EventHandler.h
r185231 r188860 38 38 #include "TextGranularity.h" 39 39 #include "Timer.h" 40 #include "WheelEventDelta Tracker.h"40 #include "WheelEventDeltaFilter.h" 41 41 #include <memory> 42 42 #include <wtf/Forward.h> -
trunk/Source/WebCore/page/MainFrame.cpp
r184066 r188860 33 33 #include "ScrollLatchingState.h" 34 34 #include "Settings.h" 35 #include "WheelEventDelta Tracker.h"35 #include "WheelEventDeltaFilter.h" 36 36 #include <wtf/NeverDestroyed.h> 37 37 38 38 #if PLATFORM(MAC) 39 39 #include "ServicesOverlayController.h" 40 #endif 40 #endif /* PLATFORM(MAC) */ 41 41 42 42 namespace WebCore { … … 50 50 #endif 51 51 #endif 52 , m_recentWheelEventDelta Tracker(std::make_unique<WheelEventDeltaTracker>())52 , m_recentWheelEventDeltaFilter(WheelEventDeltaFilter::create()) 53 53 , m_pageOverlayController(std::make_unique<PageOverlayController>(*this)) 54 54 , m_diagnosticLoggingClient(configuration.diagnosticLoggingClient) -
trunk/Source/WebCore/page/MainFrame.h
r184066 r188860 37 37 class ScrollLatchingState; 38 38 class ServicesOverlayController; 39 class WheelEventDelta Tracker;39 class WheelEventDeltaFilter; 40 40 41 41 class MainFrame final : public Frame { … … 48 48 void selfOnlyDeref(); 49 49 50 WheelEventDelta Tracker* wheelEventDeltaTracker() { return m_recentWheelEventDeltaTracker.get(); }50 WheelEventDeltaFilter* wheelEventDeltaFilter() { return m_recentWheelEventDeltaFilter.get(); } 51 51 PageOverlayController& pageOverlayController() { return *m_pageOverlayController; } 52 52 … … 78 78 #endif 79 79 80 std::unique_ptr<WheelEventDelta Tracker> m_recentWheelEventDeltaTracker;80 std::unique_ptr<WheelEventDeltaFilter> m_recentWheelEventDeltaFilter; 81 81 std::unique_ptr<PageOverlayController> m_pageOverlayController; 82 82 DiagnosticLoggingClient* m_diagnosticLoggingClient; -
trunk/Source/WebCore/page/WheelEventDeltaFilter.cpp
r188859 r188860 1 1 /* 2 * Copyright (C) 201 4Apple Inc. All rights reserved.2 * Copyright (C) 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 25 25 26 26 #include "config.h" 27 #include "WheelEventDeltaFilter.h" 27 28 28 #include "WheelEventDeltaTracker.h" 29 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100 30 #include "WheelEventDeltaFilterMac.h" 31 #endif 29 32 30 #include " PlatformWheelEvent.h"33 #include "FloatSize.h" 31 34 32 35 namespace WebCore { 33 34 WheelEventDeltaTracker::WheelEventDeltaTracker() 35 : m_isTrackingDeltas(false) 36 37 WheelEventDeltaFilter::WheelEventDeltaFilter() 36 38 { 37 39 } 38 40 39 WheelEventDelta Tracker::~WheelEventDeltaTracker()41 WheelEventDeltaFilter::~WheelEventDeltaFilter() 40 42 { 41 43 } 42 44 43 void WheelEventDeltaTracker::beginTrackingDeltas() 45 std::unique_ptr<WheelEventDeltaFilter> WheelEventDeltaFilter::create() 46 { 47 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100 48 return std::make_unique<WheelEventDeltaFilterMac>(); 49 #else 50 return std::make_unique<BasicWheelEventDeltaFilter>(); 51 #endif 52 } 53 54 BasicWheelEventDeltaFilter::BasicWheelEventDeltaFilter() 55 : WheelEventDeltaFilter() 56 { 57 } 58 59 const size_t basicWheelEventDeltaFilterWindowSize = 3; 60 61 void BasicWheelEventDeltaFilter::updateFromDelta(const FloatSize& delta) 62 { 63 m_currentFilteredDelta = delta; 64 if (!m_isFilteringDeltas) 65 return; 66 67 m_recentWheelEventDeltas.append(delta); 68 if (m_recentWheelEventDeltas.size() > basicWheelEventDeltaFilterWindowSize) 69 m_recentWheelEventDeltas.removeFirst(); 70 71 DominantScrollGestureDirection scrollDirection = dominantScrollGestureDirection(); 72 if (scrollDirection == DominantScrollGestureDirection::Vertical) 73 m_currentFilteredDelta.setWidth(0); 74 else if (scrollDirection == DominantScrollGestureDirection::Horizontal) 75 m_currentFilteredDelta.setHeight(0); 76 } 77 78 void BasicWheelEventDeltaFilter::beginFilteringDeltas() 44 79 { 45 80 m_recentWheelEventDeltas.clear(); 46 m_is TrackingDeltas = true;81 m_isFilteringDeltas = true; 47 82 } 48 83 49 void WheelEventDeltaTracker::endTrackingDeltas()84 void BasicWheelEventDeltaFilter::endFilteringDeltas() 50 85 { 51 m_isTrackingDeltas = false; 86 m_currentFilteredDelta = FloatSize(0, 0); 87 m_isFilteringDeltas = false; 52 88 } 53 89 54 void WheelEventDeltaTracker::recordWheelEventDelta(const PlatformWheelEvent& event) 55 { 56 m_recentWheelEventDeltas.append(FloatSize(event.deltaX(), event.deltaY())); 57 if (m_recentWheelEventDeltas.size() > recentEventCount) 58 m_recentWheelEventDeltas.removeFirst(); 59 } 60 61 static bool deltaIsPredominantlyVertical(const FloatSize& delta) 90 static inline bool deltaIsPredominantlyVertical(const FloatSize& delta) 62 91 { 63 92 return fabs(delta.height()) > fabs(delta.width()); 64 93 } 65 94 66 DominantScrollGestureDirection WheelEventDeltaTracker::dominantScrollGestureDirection() const95 DominantScrollGestureDirection BasicWheelEventDeltaFilter::dominantScrollGestureDirection() const 67 96 { 68 97 bool allVertical = m_recentWheelEventDeltas.size(); 69 98 bool allHorizontal = m_recentWheelEventDeltas.size(); 70 99 71 100 for (const auto& delta : m_recentWheelEventDeltas) { 72 101 bool isVertical = deltaIsPredominantlyVertical(delta); … … 77 106 if (allVertical) 78 107 return DominantScrollGestureDirection::Vertical; 79 108 80 109 if (allHorizontal) 81 110 return DominantScrollGestureDirection::Horizontal; … … 84 113 } 85 114 86 } // namespace WebCore115 }; -
trunk/Source/WebCore/page/WheelEventDeltaFilter.h
r188859 r188860 1 1 /* 2 * Copyright (C) 201 4Apple Inc. All rights reserved.2 * Copyright (C) 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 27 #ifndef WheelEventDeltaTracker_h 28 #define WheelEventDeltaTracker_h 26 #ifndef WheelEventDeltaFilter_h 27 #define WheelEventDeltaFilter_h 29 28 30 29 #include "FloatSize.h" … … 35 34 class PlatformWheelEvent; 36 35 37 const size_t recentEventCount = 3; 36 class WheelEventDeltaFilter { 37 public: 38 WheelEventDeltaFilter(); 39 virtual ~WheelEventDeltaFilter(); 40 41 WEBCORE_EXPORT static std::unique_ptr<WheelEventDeltaFilter> create(); 42 WEBCORE_EXPORT virtual void updateFromDelta(const FloatSize&) = 0; 43 WEBCORE_EXPORT virtual void beginFilteringDeltas() = 0; 44 WEBCORE_EXPORT virtual void endFilteringDeltas() = 0; 45 WEBCORE_EXPORT bool isFilteringDeltas() const 46 { 47 return m_isFilteringDeltas; 48 } 49 50 WEBCORE_EXPORT FloatSize filteredDelta() const 51 { 52 return m_currentFilteredDelta; 53 } 54 55 protected: 56 FloatSize m_currentFilteredDelta; 57 bool m_isFilteringDeltas { false }; 58 }; 38 59 39 60 enum class DominantScrollGestureDirection { … … 43 64 }; 44 65 45 class WheelEventDeltaTracker final{66 class BasicWheelEventDeltaFilter final : public WheelEventDeltaFilter { 46 67 public: 47 WEBCORE_EXPORT WheelEventDeltaTracker(); 48 WEBCORE_EXPORT ~WheelEventDeltaTracker(); 49 50 WEBCORE_EXPORT void beginTrackingDeltas(); 51 WEBCORE_EXPORT void endTrackingDeltas(); 52 53 bool isTrackingDeltas() const { return m_isTrackingDeltas; } 54 55 WEBCORE_EXPORT void recordWheelEventDelta(const PlatformWheelEvent&); 56 WEBCORE_EXPORT DominantScrollGestureDirection dominantScrollGestureDirection() const; 68 BasicWheelEventDeltaFilter(); 69 virtual void updateFromDelta(const FloatSize&) override; 70 virtual void beginFilteringDeltas() override; 71 virtual void endFilteringDeltas() override; 57 72 58 73 private: 74 DominantScrollGestureDirection dominantScrollGestureDirection() const; 75 59 76 Deque<FloatSize> m_recentWheelEventDeltas; 60 bool m_isTrackingDeltas;61 62 77 }; 63 78 64 } // namespace WebCore79 } 65 80 66 #endif // WheelEventDeltaTracker_h81 #endif -
trunk/Source/WebCore/page/mac/EventHandlerMac.mm
r187930 r188860 955 955 latchingState->setWidgetIsLatched(result.isOverWidget()); 956 956 isOverWidget = latchingState->widgetIsLatched(); 957 m_frame.mainFrame().wheelEventDelta Tracker()->beginTrackingDeltas();957 m_frame.mainFrame().wheelEventDeltaFilter()->beginFilteringDeltas(); 958 958 } 959 959 } … … 983 983 switch (wheelEvent.phase()) { 984 984 case PlatformWheelEventPhaseBegan: 985 m_frame.mainFrame().wheelEventDelta Tracker()->beginTrackingDeltas();985 m_frame.mainFrame().wheelEventDeltaFilter()->beginFilteringDeltas(); 986 986 break; 987 987 case PlatformWheelEventPhaseEnded: 988 m_frame.mainFrame().wheelEventDelta Tracker()->endTrackingDeltas();988 m_frame.mainFrame().wheelEventDeltaFilter()->endFilteringDeltas(); 989 989 break; 990 990 default: 991 991 break; 992 992 } 993 994 m_frame.mainFrame().wheelEventDeltaTracker()->recordWheelEventDelta(wheelEvent); 993 m_frame.mainFrame().wheelEventDeltaFilter()->updateFromDelta(FloatSize(wheelEvent.deltaX(), wheelEvent.deltaY())); 995 994 } 996 995 -
trunk/Source/WebCore/page/mac/WheelEventDeltaFilterMac.h
r188859 r188860 1 1 /* 2 * Copyright (C) 201 4Apple Inc. All rights reserved.2 * Copyright (C) 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #ifndef WheelEventDeltaFilterMac_h 27 #define WheelEventDeltaFilterMac_h 26 28 27 #ifndef WheelEventDeltaTracker_h 28 #define WheelEventDeltaTracker_h 29 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100 29 30 30 #include "FloatSize.h" 31 #include <wtf/Deque.h> 31 #include "WheelEventDeltaFilter.h" 32 #include <wtf/RetainPtr.h> 33 34 OBJC_CLASS _NSScrollingPredominantAxisFilter; 32 35 33 36 namespace WebCore { 34 37 35 class PlatformWheelEvent; 38 class WheelEventDeltaFilterMac final : public WheelEventDeltaFilter { 39 public: 40 WheelEventDeltaFilterMac(); 36 41 37 const size_t recentEventCount = 3; 42 virtual void updateFromDelta(const FloatSize&) override; 43 virtual void beginFilteringDeltas() override; 44 virtual void endFilteringDeltas() override; 38 45 39 enum class DominantScrollGestureDirection { 40 None, 41 Vertical, 42 Horizontal 46 private: 47 RetainPtr<_NSScrollingPredominantAxisFilter> m_predominantAxisFilter; 48 double m_beginFilteringDeltasTime { 0 }; 43 49 }; 44 50 45 class WheelEventDeltaTracker final { 46 public: 47 WEBCORE_EXPORT WheelEventDeltaTracker(); 48 WEBCORE_EXPORT ~WheelEventDeltaTracker(); 51 } 49 52 50 WEBCORE_EXPORT void beginTrackingDeltas(); 51 WEBCORE_EXPORT void endTrackingDeltas(); 53 #endif /* PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100 */ 52 54 53 bool isTrackingDeltas() const { return m_isTrackingDeltas; } 54 55 WEBCORE_EXPORT void recordWheelEventDelta(const PlatformWheelEvent&); 56 WEBCORE_EXPORT DominantScrollGestureDirection dominantScrollGestureDirection() const; 57 58 private: 59 Deque<FloatSize> m_recentWheelEventDeltas; 60 bool m_isTrackingDeltas; 61 62 }; 63 64 } // namespace WebCore 65 66 #endif // WheelEventDeltaTracker_h 55 #endif /* WheelEventDeltaFilterMac_h */ -
trunk/Source/WebCore/platform/PlatformWheelEvent.h
r182334 r188860 120 120 } 121 121 122 PlatformWheelEvent copy IgnoringHorizontalDelta() const122 PlatformWheelEvent copyWithDeltas(float deltaX, float deltaY) const 123 123 { 124 124 PlatformWheelEvent copy = *this; 125 copy.m_deltaX = 0; 126 return copy; 127 } 128 129 PlatformWheelEvent copyIgnoringVerticalDelta() const 130 { 131 PlatformWheelEvent copy = *this; 132 copy.m_deltaY = 0; 125 copy.m_deltaX = deltaX; 126 copy.m_deltaY = deltaY; 133 127 return copy; 134 128 } -
trunk/Source/WebKit2/ChangeLog
r188851 r188860 1 2015-08-24 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Use _NSScrollingPredominantAxisFilter for wheel event filtering on Mac 4 https://bugs.webkit.org/show_bug.cgi?id=147320 5 6 Reviewed by Simon Fraser. 7 8 Refactored to use a predominant axis filter instead of a predominant axis tracker. This allows us to 9 employ AppKit's _NSScrollingPredominantAxisFilter when possible, and use the wheel event delta tracker 10 as a fallback. Here, we refactor EventDispatcher to use the new filters for mainframe scrolling. 11 12 No new tests, since this change does not add new functionality. 13 14 * WebProcess/WebPage/EventDispatcher.cpp: Include WheelEventDeltaFilterMac.h when necessary. 15 (WebKit::EventDispatcher::EventDispatcher): Initialize a WheelEventDeltaFilterMac when possible. Otherwise, 16 fall back to a BasicWheelEventDeltaFilter. 17 (WebKit::EventDispatcher::wheelEvent): Use filtered deltas to initialize the platform wheel event instead 18 of zeroing out non-predominant axes. 19 * WebProcess/WebPage/EventDispatcher.h: Replace m_recentWheelEventDeltaTracker with m_recentWheelEventDeltaFilter. 20 1 21 2015-08-23 Andy Estes <aestes@apple.com> 2 22 -
trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp
r188793 r188860 55 55 EventDispatcher::EventDispatcher() 56 56 : m_queue(WorkQueue::create("com.apple.WebKit.EventDispatcher", WorkQueue::Type::Serial, WorkQueue::QOS::UserInteractive)) 57 , m_recentWheelEventDelta Tracker(std::make_unique<WheelEventDeltaTracker>())57 , m_recentWheelEventDeltaFilter(WheelEventDeltaFilter::create()) 58 58 { 59 59 } … … 96 96 switch (wheelEvent.phase()) { 97 97 case PlatformWheelEventPhaseBegan: 98 m_recentWheelEventDelta Tracker->beginTrackingDeltas();98 m_recentWheelEventDeltaFilter->beginFilteringDeltas(); 99 99 break; 100 100 case PlatformWheelEventPhaseEnded: 101 m_recentWheelEventDelta Tracker->endTrackingDeltas();101 m_recentWheelEventDeltaFilter->endFilteringDeltas(); 102 102 break; 103 103 default: … … 105 105 } 106 106 107 if (m_recentWheelEventDeltaTracker->isTrackingDeltas()) { 108 m_recentWheelEventDeltaTracker->recordWheelEventDelta(platformWheelEvent); 109 110 DominantScrollGestureDirection dominantDirection = DominantScrollGestureDirection::None; 111 dominantDirection = m_recentWheelEventDeltaTracker->dominantScrollGestureDirection(); 112 113 // Workaround for scrolling issues <rdar://problem/14758615>. 114 if (dominantDirection == DominantScrollGestureDirection::Vertical && platformWheelEvent.deltaX()) 115 platformWheelEvent = platformWheelEvent.copyIgnoringHorizontalDelta(); 116 else if (dominantDirection == DominantScrollGestureDirection::Horizontal && platformWheelEvent.deltaY()) 117 platformWheelEvent = platformWheelEvent.copyIgnoringVerticalDelta(); 107 if (m_recentWheelEventDeltaFilter->isFilteringDeltas()) { 108 m_recentWheelEventDeltaFilter->updateFromDelta(FloatSize(platformWheelEvent.deltaX(), platformWheelEvent.deltaY())); 109 FloatSize filteredDelta = m_recentWheelEventDeltaFilter->filteredDelta(); 110 platformWheelEvent = platformWheelEvent.copyWithDeltas(filteredDelta.width(), filteredDelta.height()); 118 111 } 119 112 #endif -
trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.h
r188594 r188860 29 29 #include "Connection.h" 30 30 31 #include <WebCore/WheelEventDelta Tracker.h>31 #include <WebCore/WheelEventDeltaFilter.h> 32 32 #include <WebEvent.h> 33 33 #include <memory> … … 96 96 HashMap<uint64_t, RefPtr<WebCore::ThreadedScrollingTree>> m_scrollingTrees; 97 97 #endif 98 std::unique_ptr<WebCore::WheelEventDelta Tracker> m_recentWheelEventDeltaTracker;98 std::unique_ptr<WebCore::WheelEventDeltaFilter> m_recentWheelEventDeltaFilter; 99 99 #if ENABLE(IOS_TOUCH_EVENTS) 100 100 Lock m_touchEventsLock;
Note: See TracChangeset
for help on using the changeset viewer.