+2007-12-13 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Adele.
+
+ http://bugs.webkit.org/show_bug.cgi?id=16421
+ REGRESSION(r28669): Page scrolls down when you hit space key in text area
+
+ * fast/events/space-scroll-event-expected.txt: Added.
+ * fast/events/space-scroll-event.html: Added.
+
2007-12-13 Justin Garcia <justin.garcia@apple.com>
Reviewed by Darin Adler.
--- /dev/null
+<body>
+<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=16421">bug 16241</a>:
+REGRESSION(r28669): Page scrolls down when you hit space key in text area.</p>
+<p>To test manually, press Space - the page should not scroll.</p>
+<div style="width:1;height:5000"></div>
+<script>
+document.onkeypress=function(){return false;}
+document.onscroll=function(){alert("FAIL - scrolled!");}
+
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ eventSender.keyDown(" ", []);
+}
+</script>
+</body>
+2007-12-13 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Adele.
+
+ http://bugs.webkit.org/show_bug.cgi?id=16421
+ REGRESSION(r28669): Page scrolls down when you hit space key in text area
+
+ Test: fast/events/space-scroll-event.html
+
+ * WebView.cpp:
+ (WebView::keyDown):
+ (WebView::keyPress):
+ Moved space handliing to keyPress() to fix this bug and to match IE. Scrolling via arrow keys is correctly handled
+ in keyDown().
+
2007-12-12 Brady Eidson <beidson@apple.com>
Reviewed by Sam Weinig
else if (virtualKeyCode == VK_BACK || (virtualKeyCode == VK_LEFT && keyEvent.ctrlKey()))
m_page->goBack();
- // Need to scroll the page if the arrow keys, space(shift), pgup/dn, or home/end are hit.
+ // Need to scroll the page if the arrow keys, pgup/dn, or home/end are hit.
ScrollDirection direction;
ScrollGranularity granularity;
switch (virtualKeyCode) {
granularity = ScrollByDocument;
direction = ScrollDown;
break;
- case VK_SPACE:
- granularity = ScrollByPage;
- direction = (GetKeyState(VK_SHIFT) & 0x8000) ? ScrollUp : ScrollDown;
- break;
case VK_PRIOR:
granularity = ScrollByPage;
direction = ScrollUp;
direction = ScrollDown;
break;
default:
- // We want to let Windows handle the WM_SYSCHAR event if we can't handle it
- // We do want to return true for regular key down case so the WM_CHAR handler won't pick up unhandled messages
return false;
}
Frame* frame = m_page->focusController()->focusedOrMainFrame();
PlatformKeyboardEvent keyEvent(m_viewWindow, charCode, keyData, PlatformKeyboardEvent::Char, systemKeyDown);
- return frame->eventHandler()->keyEvent(keyEvent);
+ if (frame->eventHandler()->keyEvent(keyEvent))
+ return true;
+
+ // Need to scroll the page if space is hit.
+ if (charCode == ' ') {
+ ScrollDirection direction = keyEvent.shiftKey() ? ScrollUp : ScrollDown;
+ if (!frame->eventHandler()->scrollOverflow(direction, ScrollByPage))
+ frame->view()->scroll(direction, ScrollByPage);
+ return true;
+ }
+ return false;
}
bool WebView::inResizer(LPARAM lParam)