Changeset 280928 in webkit
- Timestamp:
- Aug 11, 2021, 1:32:32 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 8 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (1 diff)
-
LayoutTests/fast/scrolling/keyboard-scrolling-distance-downArrow-expected.txt (added)
-
LayoutTests/fast/scrolling/keyboard-scrolling-distance-downArrow.html (added)
-
LayoutTests/fast/scrolling/keyboard-scrolling-distance-pageDown-expected.txt (added)
-
LayoutTests/fast/scrolling/keyboard-scrolling-distance-pageDown.html (added)
-
LayoutTests/platform/wk2/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/page/EventHandler.cpp (modified) (1 diff)
-
Source/WebCore/platform/KeyboardScrollingAnimator.cpp (modified) (6 diffs)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r280927 r280928 1 2021-08-11 Dana Estra <destra@apple.com> 2 3 Start smooth keyboard scrolling animation when pageUp or pageDown key is pressed. 4 https://bugs.webkit.org/show_bug.cgi?id=228156 5 6 Reviewed by Tim Horton. 7 8 Tests check that at least 2 scroll events occur when the downArrow key or pageDown key is pressed, and 9 that with each event, the page's offset from its original position increases. 10 11 * fast/scrolling/keyboard-scrolling-distance-downArrow-expected.txt: Added. 12 * fast/scrolling/keyboard-scrolling-distance-downArrow.html: Added. 13 * fast/scrolling/keyboard-scrolling-distance-pageDown-expected.txt: Added. 14 * fast/scrolling/keyboard-scrolling-distance-pageDown.html: Added. 15 1 16 2021-08-11 Aditya Keerthi <akeerthi@apple.com> 2 17 -
trunk/LayoutTests/TestExpectations
r280904 r280928 93 93 printing/printing-events.html [ Skip ] 94 94 fast/forms/enterkeyhint-attribute-values.html [ Skip ] 95 fast/scrolling/keyboard-scrolling-distance-downArrow.html [ Skip ] 96 fast/scrolling/keyboard-scrolling-distance-pageDown.html [ Skip ] 95 97 96 98 # Highlighting marked text ranges from layout tests is only supported in WebKit2. -
trunk/LayoutTests/platform/wk2/TestExpectations
r280510 r280928 861 861 # WebKit2 only. 862 862 js/throw-large-string-oom.html [ Pass ] 863 fast/scrolling/keyboard-scrolling-distance-downArrow.html [ Pass ] 864 fast/scrolling/keyboard-scrolling-distance-pageDown.html [ Pass ] 863 865 fast/speechrecognition/permission-error.html [ Pass ] 864 866 fast/speechrecognition/start-recognition-then-stop.html [ Pass ] -
trunk/Source/WebCore/ChangeLog
r280927 r280928 1 2021-08-11 Dana Estra <destra@apple.com> 2 3 Start smooth keyboard scrolling animation when pageUp or pageDown key is pressed. 4 https://bugs.webkit.org/show_bug.cgi?id=228156 5 6 Reviewed by Tim Horton. 7 8 UIProcess now no longer handles scrollPageUp and scrollPageDown events. They return to eventHandler as 9 unhandled and the keyboard scroll animation is started. 10 11 Tests: fast/scrolling/keyboard-scrolling-distance-downArrow.html 12 fast/scrolling/keyboard-scrolling-distance-pageDown.html 13 14 * page/EventHandler.cpp: 15 (WebCore::EventHandler::defaultKeyboardEventHandler): 16 * platform/KeyboardScrollingAnimator.cpp: 17 (WebCore::KeyboardScrollingAnimator::keyboardScrollForKeyboardEvent const): 18 1 19 2021-08-11 Aditya Keerthi <akeerthi@apple.com> 2 20 -
trunk/Source/WebCore/page/EventHandler.cpp
r280807 r280928 3820 3820 else if (event.keyIdentifier() == "U+0008") 3821 3821 defaultBackspaceEventHandler(event); 3822 else if (event.keyIdentifier() == "PageUp" || event.keyIdentifier() == "PageDown") 3823 startKeyboardScrolling(event); 3822 3824 else { 3823 3825 FocusDirection direction = focusDirectionForKey(event.keyIdentifier()); -
trunk/Source/WebCore/platform/KeyboardScrollingAnimator.cpp
r280697 r280928 143 143 }(); 144 144 145 switch (granularity) { 146 case ScrollGranularity::ScrollByLine: 147 return scrollbar->lineStep(); 148 case ScrollGranularity::ScrollByPage: 149 return scrollbar->pageStep(); 150 case ScrollGranularity::ScrollByDocument: 151 return scrollbar->totalSize(); 152 case ScrollGranularity::ScrollByPixel: 153 return scrollbar->pixelStep(); 145 if (scrollbar) { 146 switch (granularity) { 147 case ScrollGranularity::ScrollByLine: 148 return scrollbar->lineStep(); 149 case ScrollGranularity::ScrollByPage: 150 return scrollbar->pageStep(); 151 case ScrollGranularity::ScrollByDocument: 152 return scrollbar->totalSize(); 153 case ScrollGranularity::ScrollByPixel: 154 return scrollbar->pixelStep(); 155 } 154 156 } 155 157 … … 161 163 // FIXME (bug 227459): This logic does not account for writing-mode. 162 164 163 enum class Key : uint8_t { LeftArrow, RightArrow, UpArrow, DownArrow, Space };165 enum class Key : uint8_t { LeftArrow, RightArrow, UpArrow, DownArrow, Space, PageUp, PageDown }; 164 166 165 167 Key key; … … 174 176 else if (event.charCode() == ' ') 175 177 key = Key::Space; 178 else if (event.keyIdentifier() == "PageUp") 179 key = Key::PageUp; 180 else if (event.keyIdentifier() == "PageDown") 181 key = Key::PageDown; 176 182 else 177 183 return std::nullopt; … … 190 196 return ScrollGranularity::ScrollByLine; 191 197 case Key::Space: 198 case Key::PageUp: 199 case Key::PageDown: 192 200 return ScrollGranularity::ScrollByPage; 193 201 }; … … 202 210 return ScrollDirection::ScrollRight; 203 211 case Key::UpArrow: 212 case Key::PageUp: 204 213 return ScrollDirection::ScrollUp; 205 214 case Key::DownArrow: 215 case Key::PageDown: 206 216 return ScrollDirection::ScrollDown; 207 217 case Key::Space: … … 212 222 213 223 float distance = scrollDistance(direction, granularity); 224 225 if (!distance) 226 return std::nullopt; 214 227 215 228 KeyboardScroll scroll; -
trunk/Source/WebKit/ChangeLog
r280925 r280928 1 2021-08-11 Dana Estra <destra@apple.com> 2 3 Start smooth keyboard scrolling animation when pageUp or pageDown key is pressed. 4 https://bugs.webkit.org/show_bug.cgi?id=228156 5 6 Reviewed by Tim Horton. 7 8 UIProcess now no longer handles scrollPageUp and scrollPageDown events. They return 9 to eventHandler as unhandled and the keyboard scroll animation is started. 10 11 * UIProcess/API/mac/WKWebViewMac.mm: 12 (-[WKWebView scrollPageDown:]): 13 (-[WKWebView scrollPageUp:]): 14 1 15 2021-08-11 Alex Christensen <achristensen@webkit.org> 2 16 -
trunk/Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm
r278253 r280928 241 241 WEBCORE_COMMAND(paste) 242 242 WEBCORE_COMMAND(pasteAsPlainText) 243 WEBCORE_COMMAND(scrollPageDown)244 WEBCORE_COMMAND(scrollPageUp)245 243 WEBCORE_COMMAND(scrollLineDown) 246 244 WEBCORE_COMMAND(scrollLineUp) … … 266 264 #undef WEBCORE_COMMAND 267 265 266 - (void)scrollPageDown:(id)sender 267 { 268 if (_impl->page().preferences().eventHandlerDrivenSmoothKeyboardScrollingEnabled()) { 269 [self.nextResponder tryToPerform:_cmd with:sender]; 270 return; 271 } 272 273 _impl->executeEditCommandForSelector(_cmd); 274 } 275 276 - (void)scrollPageUp:(id)sender 277 { 278 if (_impl->page().preferences().eventHandlerDrivenSmoothKeyboardScrollingEnabled()) { 279 [self.nextResponder tryToPerform:_cmd with:sender]; 280 return; 281 } 282 283 _impl->executeEditCommandForSelector(_cmd); 284 } 285 268 286 - (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pasteboard types:(NSArray *)types 269 287 {
Note:
See TracChangeset
for help on using the changeset viewer.