Reviewed by Darin.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Feb 2004 00:45:07 +0000 (00:45 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Feb 2004 00:45:07 +0000 (00:45 +0000)
<rdar://problem/3537397>: REGRESSION (100-114): Return doesn't work in Japanese input method for some HomePage fields

        * kwq/KWQTextArea.mm:
        (-[KWQTextAreaTextView keyDown:]): Don't send events through DOM when there is marked
text.
        (-[KWQTextAreaTextView keyUp:]): Ditto.
        * kwq/KWQTextField.mm:
        (-[KWQTextField textView:shouldHandleEvent:]): Ditto.
        (-[KWQSecureTextField textView:shouldHandleEvent:]): Ditto.
* khtml/html/html_formimpl.cpp:
        (HTMLInputElementImpl::defaultEventHandler): No need to check for
marked text on "return" any more, because we won't send key events
through the DOM at all when there is marked text.
        * kwq/KWQLineEdit.h:
        * kwq/KWQLineEdit.mm: Removed haveMarkedText method, no longer
used by anything.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@6095 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog-2005-08-23
WebCore/khtml/html/html_formimpl.cpp
WebCore/kwq/KWQLineEdit.h
WebCore/kwq/KWQLineEdit.mm
WebCore/kwq/KWQTextArea.mm
WebCore/kwq/KWQTextField.mm

index 5dec03a16a743762484f2dfc69b4e08d2e25755e..84f65915cea2dbe5628b58374c71a28dc28b450c 100644 (file)
@@ -1,3 +1,24 @@
+2004-02-17  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Darin.
+
+       <rdar://problem/3537397>: REGRESSION (100-114): Return doesn't work in Japanese input method for some HomePage fields
+        
+        * kwq/KWQTextArea.mm:
+        (-[KWQTextAreaTextView keyDown:]): Don't send events through DOM when there is marked
+       text.
+        (-[KWQTextAreaTextView keyUp:]): Ditto.
+        * kwq/KWQTextField.mm:
+        (-[KWQTextField textView:shouldHandleEvent:]): Ditto.
+        (-[KWQSecureTextField textView:shouldHandleEvent:]): Ditto.
+       * khtml/html/html_formimpl.cpp:
+        (HTMLInputElementImpl::defaultEventHandler): No need to check for
+       marked text on "return" any more, because we won't send key events
+       through the DOM at all when there is marked text.
+        * kwq/KWQLineEdit.h:
+        * kwq/KWQLineEdit.mm: Removed haveMarkedText method, no longer
+       used by anything.
+
 2004-02-16  Chris Blumenberg  <cblu@apple.com>
 
        WebCore side of pasting image data.
index b06ce619bfd9e20d41b056b2250c0628f1864235..42d4f818a120657907cffbfd3926258c6dfc2c9a 100644 (file)
@@ -1835,12 +1835,8 @@ void HTMLInputElementImpl::defaultEventHandler(EventImpl *evt)
             case TEXT:
             case PASSWORD: {
                 // For enter, find the first successful image or submit element 
-                // send it a simulated mouse click only if the text input manager has 
-                // no marked text. If it does, then return needs to work in the
-                // "accept" role for the input method.
-                QWidget *widget = static_cast<RenderWidget *>(m_render)->widget();
-                bool hasMarkedText = widget ? static_cast<QLineEdit *>(widget)->hasMarkedText() : false;
-                if (!hasMarkedText && key == "Enter") {
+                // send it a simulated mouse click.
+                if (key == "Enter") {
                     m_form->submitClick();
                     evt->setDefaultHandled();
                 }
index 39fb4df2c4e01134698ed78c0a681e5d4fd51f42..fcdc157abea155e077ff2dd163f2ff60e3c57a64 100644 (file)
@@ -68,8 +68,6 @@ public:
 
     void clicked();
     
-    bool hasMarkedText();
-    
     virtual bool checksDescendantsForFocus() const;
 
 private:
index 0bf42aada8f73bead95d54b899eb22edba7ec443..715a7abbbc3195c19316c55e8e853f4a8fdcc0d5 100644 (file)
@@ -223,14 +223,6 @@ void QLineEdit::clicked()
     m_clicked.call();
 }
 
-bool QLineEdit::hasMarkedText()
-{
-    KWQ_BLOCK_EXCEPTIONS;
-    return [[NSInputManager currentInputManager] hasMarkedText];
-    KWQ_UNBLOCK_EXCEPTIONS;
-    return false;
-}
-
 void QLineEdit::setAlignment(AlignmentFlags alignment)
 {
     KWQ_BLOCK_EXCEPTIONS;
index 388207c92a252020f311e1597fe6703b0c23763b..787c8862b33b9a7d08d63e76006eeec07118a435 100644 (file)
@@ -709,7 +709,8 @@ static NSString *WebContinuousSpellCheckingEnabled = @"WebContinuousSpellCheckin
     if (disabled)
         return;
     WebCoreBridge *bridge = KWQKHTMLPart::bridgeForWidget(widget);
-    if (![bridge interceptKeyEvent:event toView:self]) {
+    if ([[NSInputManager currentInputManager] hasMarkedText] || 
+       ![bridge interceptKeyEvent:event toView:self]) {
        [super keyDown:event];
     }
 }
@@ -719,7 +720,9 @@ static NSString *WebContinuousSpellCheckingEnabled = @"WebContinuousSpellCheckin
     if (disabled)
         return;
     WebCoreBridge *bridge = KWQKHTMLPart::bridgeForWidget(widget);
-    [bridge interceptKeyEvent:event toView:self];
+    if (![[NSInputManager currentInputManager] hasMarkedText]) {
+       [bridge interceptKeyEvent:event toView:self];
+    }
     // Don't call super because NSTextView will simply pass the
     // event along the responder chain. This is arguably a bug in
     // NSTextView; see Radar 3507083.
index fb8e554e61dd7a565db6f2e64bb9798094e69319..8176cb09fa29f2ebb74efd59ded5bfdf07bbf52e 100644 (file)
     }
 
     NSEventType type = [event type];
-    if (type == NSKeyDown || type == NSKeyUp) {
+    if ((type == NSKeyDown || type == NSKeyUp) && 
+       ![[NSInputManager currentInputManager] hasMarkedText]) {
         WebCoreBridge *bridge = KWQKHTMLPart::bridgeForWidget(widget);
         BOOL intercepted = [bridge interceptKeyEvent:event toView:view];
         // Always return NO for key up events because we don't want them
        return YES;
     }
 
-    if ([event type] == NSKeyDown || [event type] == NSKeyUp) {
+    if (([event type] == NSKeyDown || [event type] == NSKeyUp) &&
+       ![[NSInputManager currentInputManager] hasMarkedText]) {
         WebCoreBridge *bridge = KWQKHTMLPart::bridgeForWidget(widget);
         return ![bridge interceptKeyEvent:event toView:view];
     }