Title: [284166] trunk/Source/WebCore
Revision
284166
Author
simon.fra...@apple.com
Date
2021-10-14 09:38:59 -0700 (Thu, 14 Oct 2021)

Log Message

Move KeyboardScroll into platform code
https://bugs.webkit.org/show_bug.cgi?id=231712

Reviewed by Beth Dakin.

KeyboardScroll is used by platform/KeyboardScrollingAnimator.*, and itself only uses
platform types, so it can also be in platform. This fixes a layering violation.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/KeyboardScroll.cpp: Renamed from Source/WebCore/page/KeyboardScroll.cpp.
* platform/KeyboardScroll.h: Renamed from Source/WebCore/page/KeyboardScroll.h.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (284165 => 284166)


--- trunk/Source/WebCore/ChangeLog	2021-10-14 16:08:07 UTC (rev 284165)
+++ trunk/Source/WebCore/ChangeLog	2021-10-14 16:38:59 UTC (rev 284166)
@@ -1,3 +1,18 @@
+2021-10-14  Simon Fraser  <simon.fra...@apple.com>
+
+        Move KeyboardScroll into platform code
+        https://bugs.webkit.org/show_bug.cgi?id=231712
+
+        Reviewed by Beth Dakin.
+
+        KeyboardScroll is used by platform/KeyboardScrollingAnimator.*, and itself only uses
+        platform types, so it can also be in platform. This fixes a layering violation.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/KeyboardScroll.cpp: Renamed from Source/WebCore/page/KeyboardScroll.cpp.
+        * platform/KeyboardScroll.h: Renamed from Source/WebCore/page/KeyboardScroll.h.
+
 2021-10-14  David Kilzer  <ddkil...@apple.com>
 
         WebCore::CaptionUserPreferencesMediaAF should use a weak observer with CFNotificationCenter

Modified: trunk/Source/WebCore/Headers.cmake (284165 => 284166)


--- trunk/Source/WebCore/Headers.cmake	2021-10-14 16:08:07 UTC (rev 284165)
+++ trunk/Source/WebCore/Headers.cmake	2021-10-14 16:38:59 UTC (rev 284166)
@@ -948,7 +948,6 @@
     page/FrameViewLayoutContext.h
     page/GlobalFrameIdentifier.h
     page/GlobalWindowIdentifier.h
-    page/KeyboardScroll.h
     page/LayoutMilestone.h
     page/MediaCanStartListener.h
     page/MediaControlsContextMenuItem.h
@@ -1086,6 +1085,7 @@
     platform/FileStreamClient.h
     platform/FloatConversion.h
     platform/HostWindow.h
+    platform/KeyboardScroll.h
     platform/KeyedCoding.h
     platform/KeypressCommand.h
     platform/LayoutUnit.h

Modified: trunk/Source/WebCore/Sources.txt (284165 => 284166)


--- trunk/Source/WebCore/Sources.txt	2021-10-14 16:08:07 UTC (rev 284165)
+++ trunk/Source/WebCore/Sources.txt	2021-10-14 16:38:59 UTC (rev 284166)
@@ -1686,7 +1686,6 @@
 page/FrameViewLayoutContext.cpp
 page/History.cpp
 page/ImageOverlayController.cpp
-page/KeyboardScroll.cpp
 page/IntersectionObserver.cpp
 page/IntersectionObserverEntry.cpp
 page/Location.cpp
@@ -1809,6 +1808,7 @@
 platform/FileMonitor.cpp
 platform/FileStream.cpp
 platform/FrameRateMonitor.cpp
+platform/KeyboardScroll.cpp
 platform/KeyboardScrollingAnimator.cpp
 platform/LayoutUnit.cpp
 platform/LegacySchemeRegistry.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (284165 => 284166)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-10-14 16:08:07 UTC (rev 284165)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-10-14 16:38:59 UTC (rev 284166)
@@ -371,6 +371,7 @@
 		0FDA7C1F188322FC00C954B5 /* JSGestureEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FDA7C1D188322FC00C954B5 /* JSGestureEvent.h */; };
 		0FDA7C271883333200C954B5 /* JSWebKitPlaybackTargetAvailabilityEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FDA7C251883333200C954B5 /* JSWebKitPlaybackTargetAvailabilityEvent.h */; };
 		0FDCD7F31D47E655009F08BC /* LogInitialization.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FDCD7F21D47E655009F08BC /* LogInitialization.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		0FE27FCB2717D5FF0003AAAE /* KeyboardScroll.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE27FC72717ADF70003AAAE /* KeyboardScroll.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0FE5806419327A6200DE32EB /* ScrollingTreeMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE5806219327A6200DE32EB /* ScrollingTreeMac.h */; };
 		0FE5FBD31C3DD51E0007A2CA /* DisplayList.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE5FBCB1C3DD51E0007A2CA /* DisplayList.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0FE5FBD51C3DD51E0007A2CA /* DisplayListItems.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE5FBCD1C3DD51E0007A2CA /* DisplayListItems.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -674,7 +675,6 @@
 		1DB66D3B2537A95600B671B9 /* AudioOutputUnitAdaptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 1DB66D37253678EA00B671B9 /* AudioOutputUnitAdaptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1DBC1B562347B3D200B901AF /* PictureInPictureObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 1DBC1B552347B3D200B901AF /* PictureInPictureObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1DF7E81F251A9E0600DB8F61 /* TextTrackRepresentation.h in Headers */ = {isa = PBXBuildFile; fileRef = CDD1E525167BA56400CE820B /* TextTrackRepresentation.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		1F020AEF26780FCE0000809A /* KeyboardScroll.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F020AED26780FCE0000809A /* KeyboardScroll.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1F36EA9C1E21BA1700621E25 /* WebBackgroundTaskController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F36EA9A1E21BA1700621E25 /* WebBackgroundTaskController.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1F72BF0B187FD45C0009BCB3 /* TileControllerMemoryHandlerIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F72BF09187FD4270009BCB3 /* TileControllerMemoryHandlerIOS.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1F8756B21E22C3350042C40D /* WebSQLiteDatabaseTrackerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F8756B11E22BEEF0042C40D /* WebSQLiteDatabaseTrackerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -6426,6 +6426,8 @@
 		0FDCD7F21D47E655009F08BC /* LogInitialization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LogInitialization.h; sourceTree = "<group>"; };
 		0FDF45A61BD1C6FD00E4FA8C /* PlatformCAAnimation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformCAAnimation.cpp; sourceTree = "<group>"; };
 		0FDF45A81BD1C82500E4FA8C /* TimingFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimingFunction.cpp; sourceTree = "<group>"; };
+		0FE27FC62717ADF70003AAAE /* KeyboardScroll.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = KeyboardScroll.cpp; sourceTree = "<group>"; };
+		0FE27FC72717ADF70003AAAE /* KeyboardScroll.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KeyboardScroll.h; sourceTree = "<group>"; };
 		0FE5806119327A6200DE32EB /* ScrollingTreeMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollingTreeMac.mm; sourceTree = "<group>"; };
 		0FE5806219327A6200DE32EB /* ScrollingTreeMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollingTreeMac.h; sourceTree = "<group>"; };
 		0FE5FBCA1C3DD51E0007A2CA /* DisplayList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayList.cpp; sourceTree = "<group>"; };
@@ -7128,10 +7130,8 @@
 		1DEF06DC233D2E1C00EE228D /* DocumentPictureInPicture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentPictureInPicture.cpp; sourceTree = "<group>"; };
 		1DEF06DD233D2E1C00EE228D /* DocumentPictureInPicture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentPictureInPicture.h; sourceTree = "<group>"; };
 		1DEF06DE233D2E1C00EE228D /* Document+PictureInPicture.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Document+PictureInPicture.idl"; sourceTree = "<group>"; };
-		1F020AED26780FCE0000809A /* KeyboardScroll.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyboardScroll.h; sourceTree = "<group>"; };
 		1F36EA9A1E21BA1700621E25 /* WebBackgroundTaskController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebBackgroundTaskController.h; sourceTree = "<group>"; };
 		1F36EA9B1E21BA1700621E25 /* WebBackgroundTaskController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebBackgroundTaskController.mm; sourceTree = "<group>"; };
-		1F53039A26854E6600236303 /* KeyboardScroll.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = KeyboardScroll.cpp; sourceTree = "<group>"; };
 		1F72BF08187FD4270009BCB3 /* TileControllerMemoryHandlerIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TileControllerMemoryHandlerIOS.cpp; sourceTree = "<group>"; };
 		1F72BF09187FD4270009BCB3 /* TileControllerMemoryHandlerIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TileControllerMemoryHandlerIOS.h; sourceTree = "<group>"; };
 		1F8756B01E22BEEF0042C40D /* WebSQLiteDatabaseTrackerClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebSQLiteDatabaseTrackerClient.mm; sourceTree = "<group>"; };
@@ -22545,8 +22545,6 @@
 				0F4710D81DB6FE22002DCEC3 /* IntersectionObserverEntry.cpp */,
 				0F4710D91DB6FE22002DCEC3 /* IntersectionObserverEntry.h */,
 				0F4710DA1DB6FE22002DCEC3 /* IntersectionObserverEntry.idl */,
-				1F53039A26854E6600236303 /* KeyboardScroll.cpp */,
-				1F020AED26780FCE0000809A /* KeyboardScroll.h */,
 				931D72F515FE695300C4C07E /* LayoutMilestone.h */,
 				BCE1C41A0D982980003B02F2 /* Location.cpp */,
 				BCE1C4190D982980003B02F2 /* Location.h */,
@@ -28269,6 +28267,8 @@
 				4190F3A3249D152800531C57 /* FrameRateMonitor.h */,
 				A8748BDF12CBF2DC001FBA41 /* HashTools.h */,
 				BC3BC29B0E91AB0F00835588 /* HostWindow.h */,
+				0FE27FC62717ADF70003AAAE /* KeyboardScroll.cpp */,
+				0FE27FC72717ADF70003AAAE /* KeyboardScroll.h */,
 				1FD992F926AA254D0088E596 /* KeyboardScrollingAnimator.cpp */,
 				1FD992F626AA24F80088E596 /* KeyboardScrollingAnimator.h */,
 				1AE00D57182DAC8D00087DD7 /* KeyedCoding.h */,
@@ -34175,7 +34175,7 @@
 				BCEFE1EB0DCA5F6400739219 /* JSXSLTProcessor.h in Headers */,
 				83B74EF61F3E0BF200996BC7 /* KeepaliveRequestTracker.h in Headers */,
 				85031B440A44EFC700F992E0 /* KeyboardEvent.h in Headers */,
-				1F020AEF26780FCE0000809A /* KeyboardScroll.h in Headers */,
+				0FE27FCB2717D5FF0003AAAE /* KeyboardScroll.h in Headers */,
 				1FD992F826AA24F90088E596 /* KeyboardScrollingAnimator.h in Headers */,
 				1AE00D59182DAC8D00087DD7 /* KeyedCoding.h in Headers */,
 				517A63C51B74318F00E7DCDC /* KeyedDecoderCF.h in Headers */,

Modified: trunk/Source/WebCore/page/EventHandler.h (284165 => 284166)


--- trunk/Source/WebCore/page/EventHandler.h	2021-10-14 16:08:07 UTC (rev 284165)
+++ trunk/Source/WebCore/page/EventHandler.h	2021-10-14 16:38:59 UTC (rev 284166)
@@ -29,7 +29,6 @@
 #include "DragActions.h"
 #include "FocusDirection.h"
 #include "HitTestRequest.h"
-#include "KeyboardScroll.h"
 #include "LayoutPoint.h"
 #include "PlatformMouseEvent.h"
 #include "RenderObject.h"

Deleted: trunk/Source/WebCore/page/KeyboardScroll.cpp (284165 => 284166)


--- trunk/Source/WebCore/page/KeyboardScroll.cpp	2021-10-14 16:08:07 UTC (rev 284165)
+++ trunk/Source/WebCore/page/KeyboardScroll.cpp	2021-10-14 16:38:59 UTC (rev 284166)
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2021 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "KeyboardScroll.h"
-
-namespace WebCore {
-
-FloatSize unitVectorForScrollDirection(ScrollDirection direction)
-{
-    switch (direction) {
-    case ScrollDirection::ScrollUp:
-        return { 0, -1 };
-    case ScrollDirection::ScrollDown:
-        return { 0, 1 };
-    case ScrollDirection::ScrollLeft:
-        return { -1, 0 };
-    case ScrollDirection::ScrollRight:
-        return { 1, 0 };
-    }
-
-    RELEASE_ASSERT_NOT_REACHED();
-}
-
-}

Deleted: trunk/Source/WebCore/page/KeyboardScroll.h (284165 => 284166)


--- trunk/Source/WebCore/page/KeyboardScroll.h	2021-10-14 16:08:07 UTC (rev 284165)
+++ trunk/Source/WebCore/page/KeyboardScroll.h	2021-10-14 16:38:59 UTC (rev 284166)
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2021 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "FloatSize.h"
-#include "ScrollTypes.h"
-
-namespace WebCore {
-
-WEBCORE_EXPORT FloatSize unitVectorForScrollDirection(ScrollDirection);
-
-struct KeyboardScroll {
-    FloatSize offset; // Points per increment.
-    FloatSize maximumVelocity; // Points per second.
-    FloatSize force;
-
-    ScrollGranularity granularity;
-    ScrollDirection direction;
-};
-
-struct KeyboardScrollParameters {
-    float springMass { 1 };
-    float springStiffness { 109 };
-    float springDamping { 20 };
-
-    float maximumVelocityMultiplier { 25 };
-    float timeToMaximumVelocity { 1 };
-
-    float rubberBandForce { 5000 };
-
-    static const KeyboardScrollParameters& parameters()
-    {
-        static const KeyboardScrollParameters parameters;
-        return parameters;
-    }
-};
-
-} // namespace WebCore

Copied: trunk/Source/WebCore/platform/KeyboardScroll.cpp (from rev 284165, trunk/Source/WebCore/page/KeyboardScroll.cpp) (0 => 284166)


--- trunk/Source/WebCore/platform/KeyboardScroll.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/KeyboardScroll.cpp	2021-10-14 16:38:59 UTC (rev 284166)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "KeyboardScroll.h"
+
+namespace WebCore {
+
+FloatSize unitVectorForScrollDirection(ScrollDirection direction)
+{
+    switch (direction) {
+    case ScrollDirection::ScrollUp:
+        return { 0, -1 };
+    case ScrollDirection::ScrollDown:
+        return { 0, 1 };
+    case ScrollDirection::ScrollLeft:
+        return { -1, 0 };
+    case ScrollDirection::ScrollRight:
+        return { 1, 0 };
+    }
+
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+}

Copied: trunk/Source/WebCore/platform/KeyboardScroll.h (from rev 284165, trunk/Source/WebCore/page/KeyboardScroll.h) (0 => 284166)


--- trunk/Source/WebCore/platform/KeyboardScroll.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/KeyboardScroll.h	2021-10-14 16:38:59 UTC (rev 284166)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "FloatSize.h"
+#include "ScrollTypes.h"
+
+namespace WebCore {
+
+WEBCORE_EXPORT FloatSize unitVectorForScrollDirection(ScrollDirection);
+
+struct KeyboardScroll {
+    FloatSize offset; // Points per increment.
+    FloatSize maximumVelocity; // Points per second.
+    FloatSize force;
+
+    ScrollGranularity granularity;
+    ScrollDirection direction;
+};
+
+struct KeyboardScrollParameters {
+    float springMass { 1 };
+    float springStiffness { 109 };
+    float springDamping { 20 };
+
+    float maximumVelocityMultiplier { 25 };
+    float timeToMaximumVelocity { 1 };
+
+    float rubberBandForce { 5000 };
+
+    static const KeyboardScrollParameters& parameters()
+    {
+        static const KeyboardScrollParameters parameters;
+        return parameters;
+    }
+};
+
+} // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to