[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
kocienda
kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:59:33 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit b89bcdf0733fa0a3a27dc303fd31d98148cd8d30
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Oct 3 18:46:38 2003 +0000
WebCore:
Reviewed by Darin, with much help from Maciej and Hyatt
Fix for these bugs:
<rdar://problem/3441321>: Form buttons do not respond to key events when focused
<rdar://problem/3441060>: Form buttons do not scroll to view when focused
* khtml/html/html_formimpl.cpp:
(HTMLInputElementImpl::simulateMouseClickForEvent): Added helper to simulate
mouse clicks in elements. Used to trigger button actions in response to
keyboard events.
(HTMLInputElementImpl::defaultEventHandler): Improved handler to process
key press events for radio, checkbox, image, reset, and submit buttons.
* khtml/html/html_formimpl.h: Added simulateMouseClickForEvent function.
* khtml/xml/dom2_eventsimpl.h:
(DOM::EventImpl::isKeyboardEvent): Added type check virtual function.
(DOM::KeyEventImpl::isKeyboardEvent): Ditto.
* kwq/KWQButton.h:
* kwq/KWQButton.mm:
(-[KWQButton simulateClick]): New method. This makes AppKit do a
button click programatically for button types. For <input type=image>,
we just simulate a the click in the DOM since there is no real "clickable"
AppKit widget.
(-[KWQButton becomeFirstResponder]): Fixes the button scroll to visible when
focused issue.
(-[KWQButton resignFirstResponder]): Correctly give up focus when user clicks
into the page body when a button has the focus.
(QButton::simulateClick): QWidget bridge to the KWQButton simulateClick
method.
WebKit:
Reviewed by Darin, with much help from Maciej and Hyatt
Fix for this bug:
<rdar://problem/3441321>: Form buttons do not respond to key events when focused
* WebView.subproj/WebFrameView.m:
(-[WebFrameView _firstResponderIsControl]): Added to tell if the focus
is on a form control.
(-[WebFrameView keyDown:]): Call new _firstResponderIsControl method to see
whether space bar key events should propagate. Adding this check keeps us
from blocking the event here and allows AppKit to handle it.
* WebView.subproj/WebFrameViewPrivate.h: Add new _firstResponderIsControl
method.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5129 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 33ebab0..e5bccbd 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,35 @@
+2003-10-03 Ken Kocienda <kocienda at apple.com>
+
+ Reviewed by Darin, with much help from Maciej and Hyatt
+
+ Fix for these bugs:
+
+ <rdar://problem/3441321>: Form buttons do not respond to key events when focused
+ <rdar://problem/3441060>: Form buttons do not scroll to view when focused
+
+ * khtml/html/html_formimpl.cpp:
+ (HTMLInputElementImpl::simulateMouseClickForEvent): Added helper to simulate
+ mouse clicks in elements. Used to trigger button actions in response to
+ keyboard events.
+ (HTMLInputElementImpl::defaultEventHandler): Improved handler to process
+ key press events for radio, checkbox, image, reset, and submit buttons.
+ * khtml/html/html_formimpl.h: Added simulateMouseClickForEvent function.
+ * khtml/xml/dom2_eventsimpl.h:
+ (DOM::EventImpl::isKeyboardEvent): Added type check virtual function.
+ (DOM::KeyEventImpl::isKeyboardEvent): Ditto.
+ * kwq/KWQButton.h:
+ * kwq/KWQButton.mm:
+ (-[KWQButton simulateClick]): New method. This makes AppKit do a
+ button click programatically for button types. For <input type=image>,
+ we just simulate a the click in the DOM since there is no real "clickable"
+ AppKit widget.
+ (-[KWQButton becomeFirstResponder]): Fixes the button scroll to visible when
+ focused issue.
+ (-[KWQButton resignFirstResponder]): Correctly give up focus when user clicks
+ into the page body when a button has the focus.
+ (QButton::simulateClick): QWidget bridge to the KWQButton simulateClick
+ method.
+
2003-10-03 David Hyatt <hyatt at apple.com>
Removing redundant layouts and adding a few !needsLayout and !normalChildNeedsLayout
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 33ebab0..e5bccbd 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,35 @@
+2003-10-03 Ken Kocienda <kocienda at apple.com>
+
+ Reviewed by Darin, with much help from Maciej and Hyatt
+
+ Fix for these bugs:
+
+ <rdar://problem/3441321>: Form buttons do not respond to key events when focused
+ <rdar://problem/3441060>: Form buttons do not scroll to view when focused
+
+ * khtml/html/html_formimpl.cpp:
+ (HTMLInputElementImpl::simulateMouseClickForEvent): Added helper to simulate
+ mouse clicks in elements. Used to trigger button actions in response to
+ keyboard events.
+ (HTMLInputElementImpl::defaultEventHandler): Improved handler to process
+ key press events for radio, checkbox, image, reset, and submit buttons.
+ * khtml/html/html_formimpl.h: Added simulateMouseClickForEvent function.
+ * khtml/xml/dom2_eventsimpl.h:
+ (DOM::EventImpl::isKeyboardEvent): Added type check virtual function.
+ (DOM::KeyEventImpl::isKeyboardEvent): Ditto.
+ * kwq/KWQButton.h:
+ * kwq/KWQButton.mm:
+ (-[KWQButton simulateClick]): New method. This makes AppKit do a
+ button click programatically for button types. For <input type=image>,
+ we just simulate a the click in the DOM since there is no real "clickable"
+ AppKit widget.
+ (-[KWQButton becomeFirstResponder]): Fixes the button scroll to visible when
+ focused issue.
+ (-[KWQButton resignFirstResponder]): Correctly give up focus when user clicks
+ into the page body when a button has the focus.
+ (QButton::simulateClick): QWidget bridge to the KWQButton simulateClick
+ method.
+
2003-10-03 David Hyatt <hyatt at apple.com>
Removing redundant layouts and adding a few !needsLayout and !normalChildNeedsLayout
diff --git a/WebCore/khtml/html/html_formimpl.cpp b/WebCore/khtml/html/html_formimpl.cpp
index 15251fc..3f76c43 100644
--- a/WebCore/khtml/html/html_formimpl.cpp
+++ b/WebCore/khtml/html/html_formimpl.cpp
@@ -1652,6 +1652,32 @@ void HTMLInputElementImpl::focus()
getDocument()->setFocusNode(this);
}
+#if APPLE_CHANGES
+void HTMLInputElementImpl::simulateButtonClickForEvent(EventImpl *evt)
+{
+ assert(m_type == CHECKBOX || m_type == IMAGE || m_type == RADIO ||
+ m_type == RESET || m_type == SUBMIT);
+
+ if (m_render) {
+ if (m_type == IMAGE) {
+ // have to send simulated clicks differently for image types
+ // since they to not have a widget
+ int x = 0;
+ int y = 0;
+ if (m_render)
+ m_render->absolutePosition(x,y);
+ QMouseEvent e2(QEvent::MouseButtonRelease, QPoint(x,y), Qt::LeftButton, 0);
+ dispatchMouseEvent(&e2, EventImpl::KHTML_CLICK_EVENT);
+ }
+ else {
+ static_cast<QButton *>(static_cast<RenderWidget *>(m_render)->widget())->simulateClick();
+ }
+ }
+
+ evt->setDefaultHandled();
+}
+#endif
+
void HTMLInputElementImpl::defaultEventHandler(EventImpl *evt)
{
if (evt->isMouseEvent() &&
@@ -1690,6 +1716,49 @@ void HTMLInputElementImpl::defaultEventHandler(EventImpl *evt)
m_activeSubmit = false;
}
}
+
+#if APPLE_CHANGES
+ // Use key press event here since sending simulated mouse events
+ // on key down blocks the proper sending of the key press event.
+ if (evt->id() == EventImpl::KHTML_KEYPRESS_EVENT) {
+
+ if (!m_form || !m_render || !evt->isKeyboardEvent())
+ return;
+
+ unsigned long keyVal = static_cast<KeyEventImpl *>(evt)->keyVal();
+
+ switch (m_type) {
+ case IMAGE:
+ case RESET:
+ case SUBMIT:
+ // simulate mouse click for spacebar, return, and enter
+ if (keyVal == ' ' || keyVal == '\r' || keyVal == 0x3) {
+ simulateButtonClickForEvent(evt);
+ }
+ break;
+ case CHECKBOX:
+ case RADIO:
+ // for return or enter, find the first successful image or submit element
+ // send it a simulated mouse click
+ if (keyVal == '\r' || keyVal == 0x3) {
+ QPtrListIterator<HTMLGenericFormElementImpl> it(m_form->formElements);
+ for (; it.current(); ++it) {
+ if (it.current()->id() == ID_INPUT) {
+ HTMLInputElementImpl *element = static_cast<HTMLInputElementImpl *>(it.current());
+ if (element->isSuccessfulSubmitButton()) {
+ element->simulateButtonClickForEvent(evt);
+ break;
+ }
+ }
+ }
+ }
+ break;
+ default:
+ // not handled for the other widgets
+ break;
+ }
+ }
+#endif
HTMLGenericFormElementImpl::defaultEventHandler(evt);
}
diff --git a/WebCore/khtml/html/html_formimpl.h b/WebCore/khtml/html/html_formimpl.h
index 52e256a..38a1308 100644
--- a/WebCore/khtml/html/html_formimpl.h
+++ b/WebCore/khtml/html/html_formimpl.h
@@ -316,6 +316,11 @@ public:
DOMString altText() const;
+#if APPLE_CHANGES
+private:
+ void simulateButtonClickForEvent(EventImpl *evt);
+#endif
+
protected:
DOMString m_value;
diff --git a/WebCore/khtml/xml/dom2_eventsimpl.h b/WebCore/khtml/xml/dom2_eventsimpl.h
index e5f3069..6eee0d2 100644
--- a/WebCore/khtml/xml/dom2_eventsimpl.h
+++ b/WebCore/khtml/xml/dom2_eventsimpl.h
@@ -113,6 +113,7 @@ public:
virtual bool isUIEvent() { return false; }
virtual bool isMouseEvent() { return false; }
virtual bool isMutationEvent() { return false; }
+ virtual bool isKeyboardEvent() { return false; }
virtual DOMString eventModuleName() { return ""; }
virtual bool propagationStopped() { return m_propagationStopped; }
@@ -488,6 +489,8 @@ public:
*/
unsigned long virtKeyVal() const { return m_virtKeyVal; }
+ virtual bool isKeyboardEvent() { return true; }
+
QKeyEvent *qKeyEvent;
private:
diff --git a/WebCore/kwq/KWQButton.h b/WebCore/kwq/KWQButton.h
index 25d9654..8309e5b 100644
--- a/WebCore/kwq/KWQButton.h
+++ b/WebCore/kwq/KWQButton.h
@@ -39,6 +39,7 @@ public:
QString text() const;
virtual void clicked();
+ virtual void simulateClick();
// QWidget overrides
virtual void setFont(const QFont &);
diff --git a/WebCore/kwq/KWQButton.mm b/WebCore/kwq/KWQButton.mm
index ed119ef..61ffa62 100644
--- a/WebCore/kwq/KWQButton.mm
+++ b/WebCore/kwq/KWQButton.mm
@@ -25,8 +25,10 @@
#import "KWQButton.h"
+#import "KWQAssertions.h"
#import "KWQCheckBox.h"
#import "KWQKHTMLPart.h"
+#import "KWQNSViewExtras.h"
#import "WebCoreBridge.h"
#import "render_form.h"
@@ -40,6 +42,7 @@
- (id)initWithQButton:(QButton *)b;
- (void)sendConsumedMouseUpIfNeeded;
+- (void)simulateClick;
@end
@@ -66,6 +69,11 @@
}
}
+-(void)simulateClick
+{
+ [self performClick:self];
+}
+
-(void)mouseDown:(NSEvent *)event
{
needToSendConsumedMouseUp = YES;
@@ -73,6 +81,29 @@
[self sendConsumedMouseUpIfNeeded];
}
+- (BOOL)becomeFirstResponder
+{
+ BOOL become = [super becomeFirstResponder];
+ if (become) {
+ QFocusEvent event(QEvent::FocusIn);
+ const_cast<QObject *>(button->eventFilterObject())->eventFilter(button, &event);
+ if (!KWQKHTMLPart::currentEventIsMouseDownInWidget(button)) {
+ [self _KWQ_scrollFrameToVisible];
+ }
+ }
+ return become;
+}
+
+- (BOOL)resignFirstResponder
+{
+ BOOL resign = [super resignFirstResponder];
+ if (resign) {
+ QFocusEvent event(QEvent::FocusOut);
+ const_cast<QObject *>(button->eventFilterObject())->eventFilter(button, &event);
+ }
+ return resign;
+}
+
-(NSView *)nextKeyView
{
return button && inNextValidKeyView
@@ -157,6 +188,12 @@ void QButton::clicked()
}
}
+void QButton::simulateClick()
+{
+ KWQButton *button = (KWQButton *)getView();
+ [button simulateClick];
+}
+
void QButton::setFont(const QFont &f)
{
QWidget::setFont(f);
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 055f89c..75f467e 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,20 @@
+2003-10-03 Ken Kocienda <kocienda at apple.com>
+
+ Reviewed by Darin, with much help from Maciej and Hyatt
+
+ Fix for this bug:
+
+ <rdar://problem/3441321>: Form buttons do not respond to key events when focused
+
+ * WebView.subproj/WebFrameView.m:
+ (-[WebFrameView _firstResponderIsControl]): Added to tell if the focus
+ is on a form control.
+ (-[WebFrameView keyDown:]): Call new _firstResponderIsControl method to see
+ whether space bar key events should propagate. Adding this check keeps us
+ from blocking the event here and allows AppKit to handle it.
+ * WebView.subproj/WebFrameViewPrivate.h: Add new _firstResponderIsControl
+ method.
+
2003-10-02 Maciej Stachowiak <mjs at apple.com>
Folded Private implementation files into the regular ones as the
diff --git a/WebKit/WebView.subproj/WebFrameView.m b/WebKit/WebView.subproj/WebFrameView.m
index b980514..8bf16ad 100644
--- a/WebKit/WebView.subproj/WebFrameView.m
+++ b/WebKit/WebView.subproj/WebFrameView.m
@@ -396,6 +396,11 @@ static NSMutableDictionary *viewTypes;
[self _tile];
}
+- (BOOL)_firstResponderIsControl
+{
+ return [[[self window] firstResponder] isKindOfClass:[NSControl class]];
+}
+
@end
@implementation WebFrameView
@@ -526,7 +531,10 @@ static NSMutableDictionary *viewTypes;
callSuper = NO;
break;
case SpaceKey:
- if (![self allowsScrolling]) {
+ // Checking for a control will allow events to percolate
+ // correctly when the focus is on a form control and we
+ // are in full keyboard access mode.
+ if (![self allowsScrolling] || [self _firstResponderIsControl]) {
callSuper = YES;
break;
}
diff --git a/WebKit/WebView.subproj/WebFrameViewInternal.h b/WebKit/WebView.subproj/WebFrameViewInternal.h
index be15284..c2a4acd 100644
--- a/WebKit/WebView.subproj/WebFrameViewInternal.h
+++ b/WebKit/WebView.subproj/WebFrameViewInternal.h
@@ -57,5 +57,6 @@
- (void)_tile;
- (void)_drawBorder;
- (BOOL)_shouldDrawBorder;
+- (BOOL)_firstResponderIsControl;
@end
diff --git a/WebKit/WebView.subproj/WebFrameViewPrivate.h b/WebKit/WebView.subproj/WebFrameViewPrivate.h
index be15284..c2a4acd 100644
--- a/WebKit/WebView.subproj/WebFrameViewPrivate.h
+++ b/WebKit/WebView.subproj/WebFrameViewPrivate.h
@@ -57,5 +57,6 @@
- (void)_tile;
- (void)_drawBorder;
- (BOOL)_shouldDrawBorder;
+- (BOOL)_firstResponderIsControl;
@end
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list