Changeset 280642 in webkit
- Timestamp:
- Aug 4, 2021, 11:01:55 AM (5 years ago)
- Location:
- branches/safari-612.1-branch/Source/WebCore
- Files:
-
- 2 deleted
- 10 edited
-
ChangeLog (modified) (1 diff)
-
Sources.txt (modified) (1 diff)
-
WebCore.xcodeproj/project.pbxproj (modified) (4 diffs)
-
dom/Node.cpp (modified) (1 diff)
-
page/EventHandler.cpp (modified) (6 diffs)
-
page/EventHandler.h (modified) (1 diff)
-
platform/KeyboardScrollingAnimator.cpp (deleted)
-
platform/KeyboardScrollingAnimator.h (deleted)
-
platform/ScrollAnimator.cpp (modified) (3 diffs)
-
platform/ScrollAnimator.h (modified) (4 diffs)
-
platform/ScrollController.cpp (modified) (5 diffs)
-
platform/ScrollController.h (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-612.1-branch/Source/WebCore/ChangeLog
r280641 r280642 1 2021-08-04 Russell Epstein <repstein@apple.com> 2 3 Revert r280492. rdar://problem/81522050 4 1 5 2021-08-04 Russell Epstein <repstein@apple.com> 2 6 -
branches/safari-612.1-branch/Source/WebCore/Sources.txt
r280504 r280642 1748 1748 platform/FileStream.cpp 1749 1749 platform/FrameRateMonitor.cpp 1750 platform/KeyboardScrollingAnimator.cpp1751 1750 platform/LayoutUnit.cpp 1752 1751 platform/LegacySchemeRegistry.cpp -
branches/safari-612.1-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r280504 r280642 674 674 1FAFBF1915A5FA7400083A20 /* UTIUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FAFBF1615A5FA5200083A20 /* UTIUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; }; 675 675 1FC40FBA1655CCB90040F29E /* SubimageCacheWithTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FC40FB71655C5910040F29E /* SubimageCacheWithTimer.h */; }; 676 1FD992F826AA24F90088E596 /* KeyboardScrollingAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FD992F626AA24F80088E596 /* KeyboardScrollingAnimator.h */; settings = {ATTRIBUTES = (Private, ); }; };677 676 20D629271253690B00081543 /* InspectorInstrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = 20D629251253690B00081543 /* InspectorInstrumentation.h */; }; 678 677 225A16B50D5C11E900090295 /* WebEventRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = 225A16B30D5C11E900090295 /* WebEventRegion.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 7017 7016 1FC40FB71655C5910040F29E /* SubimageCacheWithTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubimageCacheWithTimer.h; sourceTree = "<group>"; }; 7018 7017 1FC40FB81655C5910040F29E /* SubimageCacheWithTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubimageCacheWithTimer.cpp; sourceTree = "<group>"; }; 7019 1FD992F626AA24F80088E596 /* KeyboardScrollingAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyboardScrollingAnimator.h; sourceTree = "<group>"; };7020 1FD992F926AA254D0088E596 /* KeyboardScrollingAnimator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeyboardScrollingAnimator.cpp; sourceTree = "<group>"; };7021 7018 20D629241253690B00081543 /* InspectorInstrumentation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorInstrumentation.cpp; sourceTree = "<group>"; }; 7022 7019 20D629251253690B00081543 /* InspectorInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorInstrumentation.h; sourceTree = "<group>"; }; … … 27566 27563 A8748BDF12CBF2DC001FBA41 /* HashTools.h */, 27567 27564 BC3BC29B0E91AB0F00835588 /* HostWindow.h */, 27568 1FD992F926AA254D0088E596 /* KeyboardScrollingAnimator.cpp */,27569 1FD992F626AA24F80088E596 /* KeyboardScrollingAnimator.h */,27570 27565 1AE00D57182DAC8D00087DD7 /* KeyedCoding.h */, 27571 27566 E15FF7D418C9553800FE4C87 /* KeypressCommand.h */, … … 33351 33346 85031B440A44EFC700F992E0 /* KeyboardEvent.h in Headers */, 33352 33347 1F020AEF26780FCE0000809A /* KeyboardScroll.h in Headers */, 33353 1FD992F826AA24F90088E596 /* KeyboardScrollingAnimator.h in Headers */,33354 33348 1AE00D59182DAC8D00087DD7 /* KeyedCoding.h in Headers */, 33355 33349 517A63C51B74318F00E7DCDC /* KeyedDecoderCF.h in Headers */, -
branches/safari-612.1-branch/Source/WebCore/dom/Node.cpp
r280492 r280642 2433 2433 return; 2434 2434 const AtomString& eventType = event.type(); 2435 if (eventType == eventNames().keydownEvent || eventType == eventNames().keypressEvent || eventType == eventNames().keyupEvent) {2435 if (eventType == eventNames().keydownEvent || eventType == eventNames().keypressEvent) { 2436 2436 if (is<KeyboardEvent>(event)) { 2437 2437 if (Frame* frame = document().frame()) -
branches/safari-612.1-branch/Source/WebCore/page/EventHandler.cpp
r280548 r280642 69 69 #include "InspectorInstrumentation.h" 70 70 #include "KeyboardEvent.h" 71 #include "KeyboardScroll ingAnimator.h"71 #include "KeyboardScroll.h" 72 72 #include "Logging.h" 73 73 #include "MouseEvent.h" … … 3810 3810 defaultSpaceEventHandler(event); 3811 3811 } 3812 if (event.type() == eventNames().keyupEvent) {3813 m_frame.editor().handleKeyboardEvent(event);3814 if (event.defaultHandled())3815 return;3816 stopKeyboardScrolling();3817 }3818 3812 } 3819 3813 … … 4210 4204 return; 4211 4205 4212 bool defaultHandled = m_frame.settings().eventHandlerDrivenSmoothKeyboardScrollingEnabled() ? startKeyboardScrolling(event) : view->logicalScroll(direction, ScrollByPage);4206 bool defaultHandled = m_frame.settings().eventHandlerDrivenSmoothKeyboardScrollingEnabled() ? handleKeyboardScrolling(event) : view->logicalScroll(direction, ScrollByPage); 4213 4207 if (defaultHandled) 4214 4208 event.setDefaultHandled(); … … 4250 4244 return m_frame.view()->horizontalScrollbar(); 4251 4245 }(); 4252 4246 4253 4247 switch (granularity) { 4254 4248 case ScrollGranularity::ScrollByLine: … … 4265 4259 } 4266 4260 4267 void EventHandler::stopKeyboardScrolling()4261 bool EventHandler::handleKeyboardScrolling(KeyboardEvent& event) 4268 4262 { 4269 4263 Ref protectedFrame = m_frame; 4270 FrameView* view = m_frame.view(); 4271 4272 KeyboardScrollingAnimator* animator = view->scrollAnimator().keyboardScrollingAnimator(); 4273 4274 if (animator) 4275 animator->handleKeyUpEvent(); 4276 } 4277 4278 bool EventHandler::startKeyboardScrolling(KeyboardEvent& event) 4279 { 4280 Ref protectedFrame = m_frame; 4281 FrameView* view = m_frame.view(); 4282 4283 KeyboardScrollingAnimator* animator = view->scrollAnimator().keyboardScrollingAnimator(); 4284 4285 if (animator) 4286 return animator->beginKeyboardScrollGesture(event); 4287 4288 return false; 4264 // FIXME (bug 227459): This logic does not account for writing-mode. 4265 4266 enum class Key : uint8_t { LeftArrow, RightArrow, UpArrow, DownArrow, Space }; 4267 4268 Key key; 4269 if (event.keyIdentifier() == "Left") 4270 key = Key::LeftArrow; 4271 else if (event.keyIdentifier() == "Right") 4272 key = Key::RightArrow; 4273 else if (event.keyIdentifier() == "Up") 4274 key = Key::UpArrow; 4275 else if (event.keyIdentifier() == "Down") 4276 key = Key::DownArrow; 4277 else if (event.charCode() == ' ') 4278 key = Key::Space; 4279 else 4280 return false; 4281 4282 auto granularity = [&] { 4283 switch (key) { 4284 case Key::LeftArrow: 4285 case Key::RightArrow: 4286 return event.altKey() ? ScrollGranularity::ScrollByPage : ScrollGranularity::ScrollByLine; 4287 case Key::UpArrow: 4288 case Key::DownArrow: 4289 if (event.metaKey()) 4290 return ScrollGranularity::ScrollByDocument; 4291 if (event.altKey()) 4292 return ScrollGranularity::ScrollByPage; 4293 return ScrollGranularity::ScrollByLine; 4294 case Key::Space: 4295 return ScrollGranularity::ScrollByPage; 4296 }; 4297 RELEASE_ASSERT_NOT_REACHED(); 4298 }(); 4299 4300 auto direction = [&] { 4301 switch (key) { 4302 case Key::LeftArrow: 4303 return ScrollDirection::ScrollLeft; 4304 case Key::RightArrow: 4305 return ScrollDirection::ScrollRight; 4306 case Key::UpArrow: 4307 return ScrollDirection::ScrollUp; 4308 case Key::DownArrow: 4309 return ScrollDirection::ScrollDown; 4310 case Key::Space: 4311 return event.shiftKey() ? ScrollDirection::ScrollUp : ScrollDirection::ScrollDown; 4312 } 4313 RELEASE_ASSERT_NOT_REACHED(); 4314 }(); 4315 4316 return EventHandler::scrollRecursively(direction, granularity, nullptr); 4289 4317 } 4290 4318 … … 4295 4323 if (!isSpatialNavigationEnabled(&m_frame)) { 4296 4324 if (m_frame.settings().eventHandlerDrivenSmoothKeyboardScrollingEnabled()) 4297 startKeyboardScrolling(event);4325 handleKeyboardScrolling(event); 4298 4326 return; 4299 4327 } -
branches/safari-612.1-branch/Source/WebCore/page/EventHandler.h
r280492 r280642 378 378 379 379 float scrollDistance(ScrollDirection, ScrollGranularity); 380 bool startKeyboardScrolling(KeyboardEvent&); 381 void stopKeyboardScrolling(); 380 bool handleKeyboardScrolling(KeyboardEvent&); 382 381 383 382 #if ENABLE(DRAG_SUPPORT) -
branches/safari-612.1-branch/Source/WebCore/platform/ScrollAnimator.cpp
r280492 r280642 34 34 35 35 #include "FloatPoint.h" 36 #include "KeyboardScrollingAnimator.h"37 36 #include "LayoutSize.h" 38 37 #include "PlatformWheelEvent.h" … … 69 68 m_scrollableArea.setScrollBehaviorStatus(ScrollBehaviorStatus::NotInAnimation); 70 69 })) 71 , m_keyboardScrollingAnimator(makeUnique<KeyboardScrollingAnimator>(*this, m_scrollController))72 70 { 73 71 } … … 335 333 if (m_scrollControllerAnimationTimer.isActive()) 336 334 return; 337 335 338 336 m_scrollControllerAnimationTimer.startRepeating(1_s / 60.); 339 337 } -
branches/safari-612.1-branch/Source/WebCore/platform/ScrollAnimator.h
r280492 r280642 35 35 #include "PlatformWheelEvent.h" 36 36 #include "ScrollController.h" 37 #include "ScrollTypes.h" 37 38 #include "Timer.h" 38 39 #include "WheelEventTestMonitor.h" … … 43 44 44 45 class FloatPoint; 45 class KeyboardScrollingAnimator;46 46 class PlatformTouchEvent; 47 47 class ScrollAnimation; … … 81 81 82 82 virtual bool handleWheelEvent(const PlatformWheelEvent&); 83 84 KeyboardScrollingAnimator *keyboardScrollingAnimator() const override { return m_keyboardScrollingAnimator.get(); }85 83 86 84 #if ENABLE(TOUCH_EVENTS) … … 181 179 182 180 std::unique_ptr<ScrollAnimation> m_scrollAnimation; 183 std::unique_ptr<KeyboardScrollingAnimator> m_keyboardScrollingAnimator;184 181 }; 185 182 -
branches/safari-612.1-branch/Source/WebCore/platform/ScrollController.cpp
r280492 r280642 27 27 #include "ScrollController.h" 28 28 29 #include "KeyboardScrollingAnimator.h"30 29 #include "LayoutSize.h" 31 30 #include "Logging.h" … … 45 44 void ScrollController::animationCallback(MonotonicTime currentTime) 46 45 { 47 LOG_WITH_STREAM(Scrolling, stream << "ScrollController " << this << " animationCallback: isAnimatingRubberBand " << m_isAnimatingRubberBand << " isAnimatingScrollSnap " << m_isAnimatingScrollSnap << "isAnimatingKeyboardScrolling" << m_isAnimatingKeyboardScrolling);46 LOG_WITH_STREAM(Scrolling, stream << "ScrollController " << this << " animationCallback: isAnimatingRubberBand " << m_isAnimatingRubberBand << " isAnimatingScrollSnap " << m_isAnimatingScrollSnap); 48 47 49 48 updateScrollSnapAnimatingState(currentTime); 50 49 updateRubberBandAnimatingState(currentTime); 51 updateKeyboardScrollingAnimatingState(currentTime);52 50 } 53 51 54 52 void ScrollController::startOrStopAnimationCallbacks() 55 53 { 56 bool needsCallbacks = m_isAnimatingRubberBand || m_isAnimatingScrollSnap || m_isAnimatingKeyboardScrolling;54 bool needsCallbacks = m_isAnimatingRubberBand || m_isAnimatingScrollSnap; 57 55 if (needsCallbacks == m_isRunningAnimatingCallback) 58 56 return; … … 68 66 } 69 67 70 void ScrollController::beginKeyboardScrolling()71 {72 setIsAnimatingKeyboardScrolling(true);73 }74 75 void ScrollController::stopKeyboardScrolling()76 {77 setIsAnimatingKeyboardScrolling(false);78 }79 80 68 void ScrollController::setIsAnimatingRubberBand(bool isAnimatingRubberBand) 81 69 { … … 93 81 94 82 m_isAnimatingScrollSnap = isAnimatingScrollSnap; 95 startOrStopAnimationCallbacks();96 }97 98 void ScrollController::setIsAnimatingKeyboardScrolling(bool isAnimatingKeyboardScrolling)99 {100 if (isAnimatingKeyboardScrolling == m_isAnimatingKeyboardScrolling)101 return;102 103 m_isAnimatingKeyboardScrolling = isAnimatingKeyboardScrolling;104 83 startOrStopAnimationCallbacks(); 105 84 } … … 220 199 221 200 } 222 223 void ScrollController::updateKeyboardScrollingAnimatingState(MonotonicTime currentTime)224 {225 if (!m_isAnimatingKeyboardScrolling)226 return;227 228 m_client.keyboardScrollingAnimator()->updateKeyboardScrollPosition(currentTime);229 }230 231 201 // Currently, only Mac supports momentum srolling-based scrollsnapping and rubber banding 232 202 // so all of these methods are a noop on non-Mac platforms. -
branches/safari-612.1-branch/Source/WebCore/platform/ScrollController.h
r280492 r280642 39 39 namespace WebCore { 40 40 41 class KeyboardScrollingAnimator;42 41 class LayoutSize; 43 42 class PlatformWheelEvent; … … 73 72 virtual void startAnimationCallback(ScrollController&) = 0; 74 73 virtual void stopAnimationCallback(ScrollController&) = 0; 75 76 virtual void updateKeyboardScrollPosition(MonotonicTime) { }77 virtual KeyboardScrollingAnimator *keyboardScrollingAnimator() const { return nullptr; }78 74 79 75 #if ENABLE(RUBBER_BANDING) … … 126 122 void stopAllTimers(); 127 123 void scrollPositionChanged(); 128 129 void beginKeyboardScrolling();130 void stopKeyboardScrolling();131 124 132 125 // Should be called periodically by the client. Started by startAnimationCallback(), stopped by stopAnimationCallback(). … … 171 164 void updateScrollSnapAnimatingState(MonotonicTime); 172 165 void updateRubberBandAnimatingState(MonotonicTime); 173 void updateKeyboardScrollingAnimatingState(MonotonicTime); 174 166 175 167 void setIsAnimatingRubberBand(bool); 176 168 void setIsAnimatingScrollSnap(bool); 177 void setIsAnimatingKeyboardScrolling(bool);178 169 179 170 #if PLATFORM(MAC) … … 209 200 bool m_isAnimatingRubberBand { false }; 210 201 bool m_isAnimatingScrollSnap { false }; 211 bool m_isAnimatingKeyboardScrolling { false };212 202 213 203 #if PLATFORM(MAC)
Note:
See TracChangeset
for help on using the changeset viewer.