Diff
Modified: trunk/Source/WebKit/ChangeLog (238833 => 238834)
--- trunk/Source/WebKit/ChangeLog 2018-12-04 01:13:01 UTC (rev 238833)
+++ trunk/Source/WebKit/ChangeLog 2018-12-04 01:15:13 UTC (rev 238834)
@@ -1,3 +1,24 @@
+2018-12-03 Tim Horton <[email protected]>
+
+ Make it possible to disable animated keyboard scrolling behavior
+ https://bugs.webkit.org/show_bug.cgi?id=192331
+ <rdar://problem/45586859>
+
+ Reviewed by Simon Fraser.
+
+ * 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 Fujii Hironori <[email protected]>
Remove "using namespace WebKit" under Source/WebKit/WebProcess/InjectedBundle/API
Added: trunk/Source/WebKit/Platform/spi/ios/AccessibilitySupportSPI.h (0 => 238834)
--- trunk/Source/WebKit/Platform/spi/ios/AccessibilitySupportSPI.h (rev 0)
+++ trunk/Source/WebKit/Platform/spi/ios/AccessibilitySupportSPI.h 2018-12-04 01:15:13 UTC (rev 238834)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2018 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. ``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
+ * 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
+
+#if USE(APPLE_INTERNAL_SDK)
+// FIXME (46432011): We shouldn't need to wrap this include in extern "C".
+WTF_EXTERN_C_BEGIN
+#include <AccessibilitySupport.h>
+WTF_EXTERN_C_END
+#endif
+
+WTF_EXTERN_C_BEGIN
+
+extern Boolean _AXSKeyRepeatEnabled();
+extern CFTimeInterval _AXSKeyRepeatDelay();
+extern CFStringRef kAXSWebAccessibilityEventsEnabledNotification;
+extern Boolean _AXSWebAccessibilityEventsEnabled();
+
+WTF_EXTERN_C_END
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (238833 => 238834)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2018-12-04 01:13:01 UTC (rev 238833)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2018-12-04 01:15:13 UTC (rev 238834)
@@ -196,16 +196,9 @@
#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();
-}
+#import "AccessibilitySupportSPI.h"
+#import <wtf/darwin/WeakLinking.h>
#endif
-#endif
#if PLATFORM(MAC) && ENABLE(DRAG_SUPPORT)
Modified: trunk/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm (238833 => 238834)
--- trunk/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm 2018-12-04 01:13:01 UTC (rev 238833)
+++ trunk/Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm 2018-12-04 01:15:13 UTC (rev 238834)
@@ -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 @@
WebCore::FloatPoint _idealPosition;
WebCore::FloatPoint _currentPosition;
WebCore::FloatPoint _idealPositionForMinimumTravel;
+
+#if !ENABLE(ANIMATED_KEYBOARD_SCROLLING)
+ RetainPtr<NSTimer> _repeatTimer;
+#endif
}
- (instancetype)init
@@ -134,7 +139,9 @@
- (void)invalidate
{
[self stopAnimatedScroll];
+#if ENABLE(ANIMATED_KEYBOARD_SCROLLING)
[self stopDisplayLink];
+#endif
_scrollable = nil;
}
@@ -152,6 +159,7 @@
}
}
+#if ENABLE(ANIMATED_KEYBOARD_SCROLLING)
static WebCore::FloatSize perpendicularAbsoluteUnitVector(WebKit::ScrollingDirection direction)
{
switch (direction) {
@@ -163,6 +171,7 @@
return { 0, 1 };
}
}
+#endif
static WebCore::PhysicalBoxSide boxSide(WebKit::ScrollingDirection direction)
{
@@ -295,6 +304,7 @@
_hasPressedScrollingKey = YES;
_currentScroll = scroll;
+#if ENABLE(ANIMATED_KEYBOARD_SCROLLING)
if (scroll->increment == WebKit::ScrollingIncrement::Document) {
_velocity = { };
[self stopAnimatedScroll];
@@ -308,6 +318,10 @@
_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 @@
_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 @@
_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 @@
}
}
+#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,7 +604,9 @@
if (_delegateRespondsToWillScroll)
[_delegate keyboardScrollViewAnimatorWillScroll:self];
[scrollView setContentOffset:contentOffsetDelta animated:animated];
+#if ENABLE(ANIMATED_KEYBOARD_SCROLLING)
[scrollView _flashScrollIndicatorsPersistingPreviousFlashes:YES];
+#endif
}
- (void)scrollWithScrollToExtentAnimationTo:(CGPoint)offset
@@ -560,7 +613,9 @@
{
auto scrollView = _scrollView.getAutoreleased();
[scrollView _setContentOffsetWithDecelerationAnimation:offset];
+#if ENABLE(ANIMATED_KEYBOARD_SCROLLING)
[scrollView flashScrollIndicators];
+#endif
}
- (CGPoint)contentOffset
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (238833 => 238834)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2018-12-04 01:13:01 UTC (rev 238833)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2018-12-04 01:15:13 UTC (rev 238834)
@@ -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 */,