[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
mjs
mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:01:57 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit bb798fe2d1988d1f833d0e43dfc22f624a8626a9
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sun Nov 17 13:52:47 2002 +0000
WebCore:
- fixed 2949193 - implement onKeyDown, onKeyPress, and onKeyUp event handlers
* khtml/html/html_formimpl.cpp:
(HTMLGenericFormElementImpl::defaultEventHandler):
* kwq/KWQEvent.h:
* kwq/KWQEvent.mm:
(QKeyEvent::QKeyEvent): Implemented.
(QKeyEvent::key): Likewise.
(QKeyEvent::state): Likewise.
(QKeyEvent::accept): Likewise.
(QKeyEvent::ignore): Likewise.
(QKeyEvent::isAutoRepeat): Likewise.
(QKeyEvent::text): Likewise.
(QKeyEvent::ascii): Likewise.
(QKeyEvent::count): Likewise.
(QKeyEvent::isAccepted): Likewise.
* kwq/KWQKHTMLPart.h:
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::keyEvent): Translate the event to a QEvent and send
it through the DOM event mechanism.
* kwq/WebCoreBridge.h:
* kwq/WebCoreBridge.mm:
(-[WebCoreBridge interceptKeyEvent:toView:]): Pass event to the
KWQ part.
* kwq/WebCoreBridgePrivate.h: Added.
* WebCore.pbproj/project.pbxproj: Added new file.
WebKit:
- fixed 2949193 - implement onKeyDown, onKeyPress, and onKeyUp event handlers
* WebView.subproj/WebHTMLViewPrivate.h:
* WebView.subproj/WebHTMLViewPrivate.m:
(+[WebHTMLView load]): Pose as NSWindow too now.
(-[WebHTMLView _interceptKeyEvent:toView:]): Pass event to WebCore and
see if WebCore wants to block it.
(-[WebNSWindow sendEvent:]): For all key events that would go to a
subview of a WebHTMLView, let the WebHTMLView take a first crack
at it.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2718 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index da427aa..cad669c 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,32 @@
+2002-11-17 Maciej Stachowiak <mjs at apple.com>
+
+ - fixed 2949193 - implement onKeyDown, onKeyPress, and onKeyUp event handlers
+
+ * khtml/html/html_formimpl.cpp:
+ (HTMLGenericFormElementImpl::defaultEventHandler):
+ * kwq/KWQEvent.h:
+ * kwq/KWQEvent.mm:
+ (QKeyEvent::QKeyEvent): Implemented.
+ (QKeyEvent::key): Likewise.
+ (QKeyEvent::state): Likewise.
+ (QKeyEvent::accept): Likewise.
+ (QKeyEvent::ignore): Likewise.
+ (QKeyEvent::isAutoRepeat): Likewise.
+ (QKeyEvent::text): Likewise.
+ (QKeyEvent::ascii): Likewise.
+ (QKeyEvent::count): Likewise.
+ (QKeyEvent::isAccepted): Likewise.
+ * kwq/KWQKHTMLPart.h:
+ * kwq/KWQKHTMLPart.mm:
+ (KWQKHTMLPart::keyEvent): Translate the event to a QEvent and send
+ it through the DOM event mechanism.
+ * kwq/WebCoreBridge.h:
+ * kwq/WebCoreBridge.mm:
+ (-[WebCoreBridge interceptKeyEvent:toView:]): Pass event to the
+ KWQ part.
+ * kwq/WebCoreBridgePrivate.h: Added.
+ * WebCore.pbproj/project.pbxproj: Added new file.
+
2002-11-17 David Hyatt <hyatt at apple.com>
Don't discard linefeeds after elements with no close tag
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index da427aa..cad669c 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,32 @@
+2002-11-17 Maciej Stachowiak <mjs at apple.com>
+
+ - fixed 2949193 - implement onKeyDown, onKeyPress, and onKeyUp event handlers
+
+ * khtml/html/html_formimpl.cpp:
+ (HTMLGenericFormElementImpl::defaultEventHandler):
+ * kwq/KWQEvent.h:
+ * kwq/KWQEvent.mm:
+ (QKeyEvent::QKeyEvent): Implemented.
+ (QKeyEvent::key): Likewise.
+ (QKeyEvent::state): Likewise.
+ (QKeyEvent::accept): Likewise.
+ (QKeyEvent::ignore): Likewise.
+ (QKeyEvent::isAutoRepeat): Likewise.
+ (QKeyEvent::text): Likewise.
+ (QKeyEvent::ascii): Likewise.
+ (QKeyEvent::count): Likewise.
+ (QKeyEvent::isAccepted): Likewise.
+ * kwq/KWQKHTMLPart.h:
+ * kwq/KWQKHTMLPart.mm:
+ (KWQKHTMLPart::keyEvent): Translate the event to a QEvent and send
+ it through the DOM event mechanism.
+ * kwq/WebCoreBridge.h:
+ * kwq/WebCoreBridge.mm:
+ (-[WebCoreBridge interceptKeyEvent:toView:]): Pass event to the
+ KWQ part.
+ * kwq/WebCoreBridgePrivate.h: Added.
+ * WebCore.pbproj/project.pbxproj: Added new file.
+
2002-11-17 David Hyatt <hyatt at apple.com>
Don't discard linefeeds after elements with no close tag
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index da427aa..cad669c 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,32 @@
+2002-11-17 Maciej Stachowiak <mjs at apple.com>
+
+ - fixed 2949193 - implement onKeyDown, onKeyPress, and onKeyUp event handlers
+
+ * khtml/html/html_formimpl.cpp:
+ (HTMLGenericFormElementImpl::defaultEventHandler):
+ * kwq/KWQEvent.h:
+ * kwq/KWQEvent.mm:
+ (QKeyEvent::QKeyEvent): Implemented.
+ (QKeyEvent::key): Likewise.
+ (QKeyEvent::state): Likewise.
+ (QKeyEvent::accept): Likewise.
+ (QKeyEvent::ignore): Likewise.
+ (QKeyEvent::isAutoRepeat): Likewise.
+ (QKeyEvent::text): Likewise.
+ (QKeyEvent::ascii): Likewise.
+ (QKeyEvent::count): Likewise.
+ (QKeyEvent::isAccepted): Likewise.
+ * kwq/KWQKHTMLPart.h:
+ * kwq/KWQKHTMLPart.mm:
+ (KWQKHTMLPart::keyEvent): Translate the event to a QEvent and send
+ it through the DOM event mechanism.
+ * kwq/WebCoreBridge.h:
+ * kwq/WebCoreBridge.mm:
+ (-[WebCoreBridge interceptKeyEvent:toView:]): Pass event to the
+ KWQ part.
+ * kwq/WebCoreBridgePrivate.h: Added.
+ * WebCore.pbproj/project.pbxproj: Added new file.
+
2002-11-17 David Hyatt <hyatt at apple.com>
Don't discard linefeeds after elements with no close tag
diff --git a/WebCore/WebCore.pbproj/project.pbxproj b/WebCore/WebCore.pbproj/project.pbxproj
index 83de1b3..85abe21 100644
--- a/WebCore/WebCore.pbproj/project.pbxproj
+++ b/WebCore/WebCore.pbproj/project.pbxproj
@@ -475,6 +475,7 @@
931C8A180380288B008635CE,
BC7294FA03804B3C00A80166,
BC7294FE03804B5600A80166,
+ 656ACA640387B476001C1259,
);
isa = PBXHeadersBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -855,6 +856,28 @@
//512
//513
//514
+//650
+//651
+//652
+//653
+//654
+ 656ACA630387B475001C1259 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ path = WebCoreBridgePrivate.h;
+ refType = 4;
+ };
+ 656ACA640387B476001C1259 = {
+ fileRef = 656ACA630387B475001C1259;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+//650
+//651
+//652
+//653
+//654
//930
//931
//932
@@ -5877,6 +5900,7 @@
children = (
F587854702DE375901EA4122,
F587854802DE375901EA4122,
+ 656ACA630387B475001C1259,
F5B2A4FC02E2220F018635CB,
F5B2A4FD02E2220F018635CB,
F587854902DE375901EA4122,
diff --git a/WebCore/khtml/html/html_formimpl.cpp b/WebCore/khtml/html/html_formimpl.cpp
index d0879ca..dc34d5e 100644
--- a/WebCore/khtml/html/html_formimpl.cpp
+++ b/WebCore/khtml/html/html_formimpl.cpp
@@ -693,6 +693,10 @@ void HTMLGenericFormElementImpl::defaultEventHandler(EventImpl *evt)
}
}
+#if APPLE_CHANGES
+ // We don't want this default key event handling, we'll count on
+ // Cocoa event dispatch if the event doesn't get blocked.
+#else
if (evt->id()==EventImpl::KHTML_KEYDOWN_EVENT ||
evt->id()==EventImpl::KHTML_KEYUP_EVENT)
{
@@ -700,6 +704,7 @@ void HTMLGenericFormElementImpl::defaultEventHandler(EventImpl *evt)
if (k->keyVal() == QChar('\n').unicode() && m_render && m_render->isWidget() && k->qKeyEvent)
QApplication::sendEvent(static_cast<RenderWidget *>(m_render)->widget(), k->qKeyEvent);
}
+#endif
if (evt->id()==EventImpl::DOMFOCUSOUT_EVENT && isEditable() && m_render->isWidget()) {
KHTMLPartBrowserExtension *ext = static_cast<KHTMLPartBrowserExtension *>(view->part()->browserExtension());
diff --git a/WebCore/kwq/KWQEvent.h b/WebCore/kwq/KWQEvent.h
index 4e91f1c..026e8e2 100644
--- a/WebCore/kwq/KWQEvent.h
+++ b/WebCore/kwq/KWQEvent.h
@@ -109,6 +109,14 @@ public:
int count() const;
QString text() const;
int ascii() const;
+ private:
+ int _key;
+ int _ascii;
+ ButtonState _state;
+ QString _text;
+ bool _autoRepeat;
+ int _count;
+ bool _isAccepted;
};
class QFocusEvent {
diff --git a/WebCore/kwq/KWQEvent.mm b/WebCore/kwq/KWQEvent.mm
index 134746d..4b6d35d 100644
--- a/WebCore/kwq/KWQEvent.mm
+++ b/WebCore/kwq/KWQEvent.mm
@@ -59,60 +59,59 @@ QTimerEvent::QTimerEvent(int t)
}
-QKeyEvent::QKeyEvent(Type t, int, int, int, const QString &, bool, ushort)
- : QEvent(t)
+QKeyEvent::QKeyEvent(Type t, int key, int ascii, int buttonState, const QString &text, bool autoRepeat, ushort count)
+ : QEvent(t),
+ _key(key),
+ _ascii(ascii),
+ _state((ButtonState)buttonState),
+ _text(text),
+ _autoRepeat(autoRepeat),
+ _count(count),
+ _isAccepted(false)
{
- ERROR("not yet implemented");
}
int QKeyEvent::key() const
{
- ERROR("not yet implemented");
- return 0;
+ return _key;
}
Qt::ButtonState QKeyEvent::state() const
{
- ERROR("not yet implemented");
- return Qt::NoButton;
+ return _state;
}
void QKeyEvent::accept()
{
- ERROR("not yet implemented");
+ _isAccepted = true;
}
void QKeyEvent::ignore()
{
- ERROR("not yet implemented");
+ _isAccepted = false;
}
bool QKeyEvent::isAutoRepeat() const
{
- ERROR("not yet implemented");
- return false;
+ return _autoRepeat;
}
QString QKeyEvent::text(void) const
{
- ERROR("not yet implemented");
- return QString();
+ return _text;
}
int QKeyEvent::ascii(void) const
{
- ERROR("not yet implemented");
- return 0;
+ return _ascii;
}
int QKeyEvent::count(void) const
{
- ERROR("not yet implemented");
- return 0;
+ return _count;
}
bool QKeyEvent::isAccepted(void) const
{
- ERROR("not yet implemented");
- return false;
+ return _isAccepted;
}
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index 0cde4dd..2cb3ac0 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -148,6 +148,8 @@ public:
void setCurrentEvent(NSEvent *event);
void addMetaData(const QString &key, const QString &value);
+
+ bool KWQKHTMLPart::keyEvent(NSEvent *event);
private:
void setPolicyBaseURL(const DOM::DOMString &);
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 75395c6..f589505 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -34,6 +34,7 @@
#import "khtmlview.h"
#import "WebCoreBridge.h"
+#import "WebCoreBridgePrivate.h"
#import "WebCoreViewFactory.h"
#import "KWQDummyView.h"
@@ -572,3 +573,44 @@ void KWQKHTMLPart::addMetaData(const QString &key, const QString &value)
{
d->m_job->addMetaData(key, value);
}
+
+
+bool KWQKHTMLPart::keyEvent(NSEvent *event)
+{
+ ASSERT([event type] == NSKeyDown || [event type] == NSKeyUp);
+
+ const char *characters = [[event characters] lossyCString];
+ int ascii = (characters != nil && strlen(characters) == 1) ? characters[0] : 0;
+
+
+ QKeyEvent qEvent([event type] == NSKeyDown ? QEvent::KeyPress : QEvent::KeyRelease,
+ [event keyCode],
+ ascii,
+ [_bridge stateForEvent:event],
+ QString::fromNSString([event characters]),
+ [event isARepeat]);
+
+ ASSERT(part->xmlDocImpl());
+
+ if (!part->xmlDocImpl()->focusNode()) {
+ // Too early for events - possible unmatched key up from
+ // pressing return in the location bar.
+ return false;
+ }
+
+ bool result = part->xmlDocImpl()->focusNode()->dispatchKeyEvent(&qEvent);
+
+ // We want to send both a down and a press for the initial key event
+ if (![event isARepeat]) {
+ QKeyEvent qEvent([event type] == NSKeyDown ? QEvent::KeyPress : QEvent::KeyRelease,
+ [event keyCode],
+ ascii,
+ [_bridge stateForEvent:event],
+ QString::fromNSString([event characters]),
+ true);
+
+ result = result && part->xmlDocImpl()->focusNode()->dispatchKeyEvent(&qEvent);
+ }
+
+ return result;
+}
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index dfae706..368f918 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -164,6 +164,8 @@ enum FrameBorderStyle {
+ (NSString *)stringWithData:(NSData *)data textEncoding:(CFStringEncoding)textEncoding;
+ (NSString *)stringWithData:(NSData *)data textEncodingName:(NSString *)textEncodingName;
+- (BOOL)interceptKeyEvent:(NSEvent *)event toView:(NSView *)view;
+
@end
// The WebCoreBridge protocol contains methods for use by the WebCore side of the bridge.
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 3684287..57ffa65 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -818,4 +818,9 @@ static NSAttributedString *attributedString(DOM::NodeImpl *_startNode, int start
return renderer ? !renderer->layouted() : false;
}
+- (BOOL)interceptKeyEvent:(NSEvent *)event toView:(NSView *)view
+{
+ return _part->kwq->keyEvent(event);
+}
+
@end
diff --git a/WebCore/kwq/KWQKLibrary.h b/WebCore/kwq/WebCoreBridgePrivate.h
similarity index 91%
copy from WebCore/kwq/KWQKLibrary.h
copy to WebCore/kwq/WebCoreBridgePrivate.h
index e169eec..96a7a73 100644
--- a/WebCore/kwq/KWQKLibrary.h
+++ b/WebCore/kwq/WebCoreBridgePrivate.h
@@ -23,10 +23,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "KWQKIOGlobal.h"
+#import <WebCore/WebCoreBridge.h>
-class KLibrary
-{
-public:
- void unload() { }
-};
+ at interface WebCoreBridge (WebCorePrivate)
+
+- (int)stateForEvent:(NSEvent *)event;
+
+ at end
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 93c3c59..6a43789 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,16 @@
+2002-11-17 Maciej Stachowiak <mjs at apple.com>
+
+ - fixed 2949193 - implement onKeyDown, onKeyPress, and onKeyUp event handlers
+
+ * WebView.subproj/WebHTMLViewPrivate.h:
+ * WebView.subproj/WebHTMLViewPrivate.m:
+ (+[WebHTMLView load]): Pose as NSWindow too now.
+ (-[WebHTMLView _interceptKeyEvent:toView:]): Pass event to WebCore and
+ see if WebCore wants to block it.
+ (-[WebNSWindow sendEvent:]): For all key events that would go to a
+ subview of a WebHTMLView, let the WebHTMLView take a first crack
+ at it.
+
2002-11-15 Darin Adler <darin at apple.com>
- fixed 3079214 -- text/plain page shows up slowly, a few pages at a time
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 93c3c59..6a43789 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,16 @@
+2002-11-17 Maciej Stachowiak <mjs at apple.com>
+
+ - fixed 2949193 - implement onKeyDown, onKeyPress, and onKeyUp event handlers
+
+ * WebView.subproj/WebHTMLViewPrivate.h:
+ * WebView.subproj/WebHTMLViewPrivate.m:
+ (+[WebHTMLView load]): Pose as NSWindow too now.
+ (-[WebHTMLView _interceptKeyEvent:toView:]): Pass event to WebCore and
+ see if WebCore wants to block it.
+ (-[WebNSWindow sendEvent:]): For all key events that would go to a
+ subview of a WebHTMLView, let the WebHTMLView take a first crack
+ at it.
+
2002-11-15 Darin Adler <darin at apple.com>
- fixed 3079214 -- text/plain page shows up slowly, a few pages at a time
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.h b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
index d9e4663..09461be 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.h
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
@@ -52,6 +52,7 @@
- (BOOL)_insideAnotherHTMLView;
- (void)_updateMouseoverWithEvent:(NSEvent *)event;
+- (BOOL)_interceptKeyEvent:(NSEvent *)event toView:(NSView *)view;
+ (NSArray *)_pasteboardTypes;
- (void)_writeSelectionToPasteboard:(NSPasteboard *)pasteboard;
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.m b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
index f89a71d..d082d92 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.m
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
@@ -45,6 +45,11 @@
}
@end
+ at interface WebNSWindow : NSWindow
+{
+}
+ at end
+
@interface NSMutableDictionary (WebHTMLViewExtras)
- (void)_web_setObjectIfNotNil:(id)object forKey:(id)key;
@end
@@ -64,12 +69,14 @@
@implementation WebHTMLView (WebPrivate)
// Danger Will Robinson. We have to poseAsClass: as early as possible
-// so that any NSViews will be created with the appropriate poser.
+// so that any NSViews and NSWindows will be created with the
+// appropriate poser.
+ (void)load
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[[WebNSView class] poseAsClass:[NSView class]];
[[WebNSTextView class] poseAsClass:[NSTextView class]];
+ [[WebNSWindow class] poseAsClass:[NSWindow class]];
[pool release];
}
@@ -274,6 +281,12 @@
}
}
+- (BOOL)_interceptKeyEvent:(NSEvent *)event toView:(NSView *)view
+{
+ return [[self _bridge] interceptKeyEvent:event toView:view];
+}
+
+
+ (NSArray *)_pasteboardTypes
{
return [NSArray arrayWithObjects:NSStringPboardType,
@@ -413,6 +426,37 @@ static BOOL inNSTextViewDrawRect;
@end
+ at implementation WebNSWindow
+
+- (void)sendEvent:(NSEvent *)event
+{
+ if ([event type] == NSKeyDown || [event type] == NSKeyUp) {
+ NSResponder *responder = [self firstResponder];
+
+ NSView *view;
+ while (responder != nil && ![responder isKindOfClass:[WebNSView class]]) {
+ responder = [responder nextResponder];
+ }
+
+ view = (NSView *)responder;
+
+ NSView *ancestorHTMLView = view;
+ while (ancestorHTMLView != nil && ![ancestorHTMLView isKindOfClass:[WebHTMLView class]]) {
+ ancestorHTMLView = [ancestorHTMLView superview];
+ }
+
+ if (ancestorHTMLView != nil) {
+ if ([(WebHTMLView *)ancestorHTMLView _interceptKeyEvent:event toView:view]) {
+
+ }
+ }
+ }
+
+ [super sendEvent:event];
+}
+
+ at end
+
@implementation NSMutableDictionary (WebHTMLViewExtras)
- (void)_web_setObjectIfNotNil:(id)object forKey:(id)key
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list