WebKit Bugzilla
Attachment 356406 Details for
Bug 192331
: Make it possible to disable animated keyboard scrolling behavior
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192331-20181203144000.patch (text/plain), 10.76 KB, created by
Tim Horton
on 2018-12-03 14:40:00 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Tim Horton
Created:
2018-12-03 14:40:00 PST
Size:
10.76 KB
patch
obsolete
>Subversion Revision: 238816 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index c7f480a926fc0fe138a3ebdbee08842bffd14eb4..449a76bfa409ca66761aa5b3c3ecf849f22dc33b 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,24 @@ >+2018-12-03 Tim Horton <timothy_horton@apple.com> >+ >+ Make it possible to disable animated keyboard scrolling behavior >+ https://bugs.webkit.org/show_bug.cgi?id=192331 >+ <rdar://problem/45586859> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * UIProcess/API/Cocoa/WKWebView.mm: >+ * UIProcess/ios/WKKeyboardScrollingAnimator.mm: >+ (-[WKKeyboardScrollingAnimator invalidate]): >+ (-[WKKeyboardScrollingAnimator beginWithEvent:]): >+ (-[WKKeyboardScrollingAnimator stopAnimatedScroll]): >+ (-[WKKeyboardScrollingAnimator willStartInteractiveScroll]): >+ (-[WKKeyboardScrollingAnimator startRepeatTimerIfNeeded]): >+ (-[WKKeyboardScrollingAnimator stopRepeatTimer]): >+ (-[WKKeyboardScrollingAnimator performDiscreteScroll]): >+ (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]): >+ (-[WKKeyboardScrollViewAnimator scrollWithScrollToExtentAnimationTo:]): >+ * WebKit.xcodeproj/project.pbxproj: >+ > 2018-12-03 Daniel Bates <dabates@apple.com> > > [iOS] Do not handle key events that are key commands >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >index acd0fcab2e7f769b8e86f02211dfa45722a00e18..7405871f1446ec24e8fc3497058d88f99e84e22f 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >@@ -196,15 +196,8 @@ @end > #endif // PLATFORM(MAC) > > #if ENABLE(ACCESSIBILITY_EVENTS) >-#include <wtf/darwin/WeakLinking.h> >-#if __has_include(<AccessibilitySupport.h>) >-#include <AccessibilitySupport.h> >-#else >-extern "C" { >-CFStringRef kAXSWebAccessibilityEventsEnabledNotification; >-Boolean _AXSWebAccessibilityEventsEnabled(); >-} >-#endif >+#import "AccessibilitySupportSPI.h" >+#import <wtf/darwin/WeakLinking.h> > #endif > > #if PLATFORM(MAC) && ENABLE(DRAG_SUPPORT) >diff --git a/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm b/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm >index 32571907304dd90335be9fbe0a8b1183c6e7bac9..98547c7269b70c9fa78c35b97a3a5c9c2365fd8f 100644 >--- a/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm >+++ b/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm >@@ -28,6 +28,7 @@ > > #if PLATFORM(IOS_FAMILY) > >+#import "AccessibilitySupportSPI.h" > #import "UIKitSPI.h" > #import <QuartzCore/CADisplayLink.h> > #import <WebCore/FloatPoint.h> >@@ -107,6 +108,10 @@ @implementation WKKeyboardScrollingAnimator { > WebCore::FloatPoint _idealPosition; > WebCore::FloatPoint _currentPosition; > WebCore::FloatPoint _idealPositionForMinimumTravel; >+ >+#if !ENABLE(ANIMATED_KEYBOARD_SCROLLING) >+ RetainPtr<NSTimer> _repeatTimer; >+#endif > } > > - (instancetype)init >@@ -134,7 +139,9 @@ - (const WebKit::KeyboardScrollParameters &)parameters > - (void)invalidate > { > [self stopAnimatedScroll]; >+#if ENABLE(ANIMATED_KEYBOARD_SCROLLING) > [self stopDisplayLink]; >+#endif > _scrollable = nil; > } > >@@ -152,6 +159,7 @@ static WebCore::FloatSize unitVector(WebKit::ScrollingDirection direction) > } > } > >+#if ENABLE(ANIMATED_KEYBOARD_SCROLLING) > static WebCore::FloatSize perpendicularAbsoluteUnitVector(WebKit::ScrollingDirection direction) > { > switch (direction) { >@@ -163,6 +171,7 @@ static WebCore::FloatSize perpendicularAbsoluteUnitVector(WebKit::ScrollingDirec > return { 0, 1 }; > } > } >+#endif > > static WebCore::PhysicalBoxSide boxSide(WebKit::ScrollingDirection direction) > { >@@ -295,6 +304,7 @@ - (BOOL)beginWithEvent:(::WebEvent *)event > _hasPressedScrollingKey = YES; > _currentScroll = scroll; > >+#if ENABLE(ANIMATED_KEYBOARD_SCROLLING) > if (scroll->increment == WebKit::ScrollingIncrement::Document) { > _velocity = { }; > [self stopAnimatedScroll]; >@@ -308,6 +318,10 @@ - (BOOL)beginWithEvent:(::WebEvent *)event > _currentPosition = WebCore::FloatPoint([_scrollable contentOffset]); > _velocity += WebCore::FloatSize([_scrollable interactiveScrollVelocity]); > _idealPositionForMinimumTravel = _currentPosition + _currentScroll->offset; >+#else >+ [self startRepeatTimerIfNeeded]; >+ [self performDiscreteScroll]; >+#endif > > return YES; > } >@@ -362,8 +376,25 @@ - (void)stopAnimatedScroll > _idealPosition = [_scrollable boundedContentOffset:farthestPointInDirection(_currentPosition + displacement, _idealPositionForMinimumTravel, _currentScroll->direction)]; > > _currentScroll = std::nullopt; >+ >+#if !ENABLE(ANIMATED_KEYBOARD_SCROLLING) >+ [self stopRepeatTimer]; >+#endif > } > >+- (void)willStartInteractiveScroll >+{ >+ // If the user touches the screen to start an interactive scroll, stop everything. >+ _velocity = { }; >+ [self stopAnimatedScroll]; >+ >+#if ENABLE(ANIMATED_KEYBOARD_SCROLLING) >+ [self stopDisplayLink]; >+#endif >+} >+ >+#if ENABLE(ANIMATED_KEYBOARD_SCROLLING) >+ > - (void)startDisplayLinkIfNeeded > { > if (_displayLink) >@@ -379,14 +410,6 @@ - (void)stopDisplayLink > _displayLink = nil; > } > >-- (void)willStartInteractiveScroll >-{ >- // If the user touches the screen to start an interactive scroll, stop everything. >- _velocity = { }; >- [self stopAnimatedScroll]; >- [self stopDisplayLink]; >-} >- > - (void)displayLinkFired:(CADisplayLink *)sender > { > WebCore::FloatSize force; >@@ -442,6 +465,34 @@ - (void)displayLinkFired:(CADisplayLink *)sender > } > } > >+#else >+ >+- (void)startRepeatTimerIfNeeded >+{ >+ if (_repeatTimer) >+ return; >+ >+ if (!_AXSKeyRepeatEnabled()) >+ return; >+ >+ _repeatTimer = [NSTimer scheduledTimerWithTimeInterval:_AXSKeyRepeatDelay() target:self selector:@selector(performDiscreteScroll) userInfo:nil repeats:YES]; >+} >+ >+- (void)stopRepeatTimer >+{ >+ [_repeatTimer invalidate]; >+ _repeatTimer = nil; >+} >+ >+- (void)performDiscreteScroll >+{ >+ _currentPosition = WebCore::FloatPoint([_scrollable contentOffset]); >+ _idealPositionForMinimumTravel = _currentPosition + _currentScroll->offset; >+ [_scrollable scrollToContentOffset:[_scrollable boundedContentOffset:_idealPositionForMinimumTravel] animated:YES]; >+} >+ >+#endif >+ > @end > > @interface WKKeyboardScrollViewAnimator () <WKKeyboardScrollableInternal> >@@ -553,14 +604,18 @@ - (void)scrollToContentOffset:(WebCore::FloatPoint)contentOffsetDelta animated:( > if (_delegateRespondsToWillScroll) > [_delegate keyboardScrollViewAnimatorWillScroll:self]; > [scrollView setContentOffset:contentOffsetDelta animated:animated]; >+#if ENABLE(ANIMATED_KEYBOARD_SCROLLING) > [scrollView _flashScrollIndicatorsPersistingPreviousFlashes:YES]; >+#endif > } > > - (void)scrollWithScrollToExtentAnimationTo:(CGPoint)offset > { > auto scrollView = _scrollView.getAutoreleased(); > [scrollView _setContentOffsetWithDecelerationAnimation:offset]; >+#if ENABLE(ANIMATED_KEYBOARD_SCROLLING) > [scrollView flashScrollIndicators]; >+#endif > } > > - (CGPoint)contentOffset >diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >index d797156d415844199bdcd3ed13a7b7f363627cfb..627c52bf17ea3d1f9e1655246764a5ac43a0f552 100644 >--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj >+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >@@ -703,6 +703,7 @@ > 2DABA7761A82B42100EF0F1A /* APIHistoryClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DABA7751A82B42100EF0F1A /* APIHistoryClient.h */; }; > 2DACE64E18ADBFF000E4CA76 /* _WKThumbnailViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DACE64D18ADBFF000E4CA76 /* _WKThumbnailViewInternal.h */; }; > 2DAF06D618BD1A470081CEB1 /* SmartMagnificationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DAF06D418BD1A470081CEB1 /* SmartMagnificationController.h */; }; >+ 2DB7667121B5E48A0045DDB1 /* AccessibilitySupportSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DB7667021B5E48A0045DDB1 /* AccessibilitySupportSPI.h */; }; > 2DC18FAD218910490025A88D /* WKDrawingView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DC18FAB218910480025A88D /* WKDrawingView.h */; }; > 2DC18FB0218912640025A88D /* PencilKitSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DC18FAF218912640025A88D /* PencilKitSPI.h */; }; > 2DC18FB3218A6E9E0025A88D /* RemoteLayerTreeViews.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DC18FB1218A6E9E0025A88D /* RemoteLayerTreeViews.h */; }; >@@ -2761,6 +2762,7 @@ > 2DAF06D518BD1A470081CEB1 /* SmartMagnificationController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SmartMagnificationController.mm; path = ios/SmartMagnificationController.mm; sourceTree = "<group>"; }; > 2DAF06D818BD23BA0081CEB1 /* SmartMagnificationController.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; name = SmartMagnificationController.messages.in; path = ios/SmartMagnificationController.messages.in; sourceTree = "<group>"; }; > 2DAF4FFA1B636181006013D6 /* ViewGestureController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ViewGestureController.cpp; sourceTree = "<group>"; }; >+ 2DB7667021B5E48A0045DDB1 /* AccessibilitySupportSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilitySupportSPI.h; sourceTree = "<group>"; }; > 2DC18FAB218910480025A88D /* WKDrawingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKDrawingView.h; path = ios/WKDrawingView.h; sourceTree = "<group>"; }; > 2DC18FAC218910480025A88D /* WKDrawingView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKDrawingView.mm; path = ios/WKDrawingView.mm; sourceTree = "<group>"; }; > 2DC18FAF218912640025A88D /* PencilKitSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PencilKitSPI.h; sourceTree = "<group>"; }; >@@ -8616,6 +8618,7 @@ > CE1A0BCB1A48E6C60054EF74 /* ios */ = { > isa = PBXGroup; > children = ( >+ 2DB7667021B5E48A0045DDB1 /* AccessibilitySupportSPI.h */, > CE1A0BCC1A48E6C60054EF74 /* AssertionServicesSPI.h */, > CDA041F31ACE2105004A13EC /* BackBoardServicesSPI.h */, > 07A8F3861E64A8F900B668E8 /* CelestialSPI.h */, >@@ -8832,6 +8835,7 @@ > A115DC72191D82DA00DA8072 /* _WKWebViewPrintFormatter.h in Headers */, > A19DD3C01D07D16800AC823B /* _WKWebViewPrintFormatterInternal.h in Headers */, > A182D5B51BE6BD250087A7CC /* AccessibilityIOS.h in Headers */, >+ 2DB7667121B5E48A0045DDB1 /* AccessibilitySupportSPI.h in Headers */, > A7D792D81767CCA300881CBE /* ActivityAssertion.h in Headers */, > 634842511FB26E7100946E3C /* APIApplicationManifest.h in Headers */, > BC64697011DBE603006455B0 /* APIArray.h in Headers */,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192331
:
356406
|
356413
|
356427