[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 08:10:40 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit fb752c4f16eec2ed11829fd1225156d51451b654
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 10 18:46:43 2003 +0000

            Reviewed by John
    
    	Fix for this bug:
    
    	<rdar://problem/3477624>: REGRESSION (113): Using input method to
    	enter non-ascii text submits the form
    
    	This regression has been in the tree for a couple of versions now,
    	since we improved the way key events are processed. The solution
    	is to ask the text input manager if it has any marked text when
    	the return key (or enter key) is pressed, because if it does, the key
    	needs to work in the "accept" role for the input manager. Fixing
    	in this way has the pleasant effect of making return/enter key
    	behavior "do the right thing" based on context.
    
            * khtml/html/html_formimpl.cpp:
            (HTMLInputElementImpl::defaultEventHandler): Add check to see
    	if text input manager has marked text before submitting text
    	and password fields. Broke out key handling for checkboxes and
    	radios, since the old code for these widgets worked fine.
            * kwq/KWQLineEdit.h: Added hasMarkedText function.
            * kwq/KWQLineEdit.mm:
            (QLineEdit::hasMarkedText): Returns whether the current input
    	manager has marked text or not.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5438 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 4c721fc..fdda096 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,30 @@
+2003-11-10  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by John
+
+	Fix for this bug:
+
+	<rdar://problem/3477624>: REGRESSION (113): Using input method to 
+	enter non-ascii text submits the form
+
+	This regression has been in the tree for a couple of versions now, 
+	since we improved the way key events are processed. The solution
+	is to ask the text input manager if it has any marked text when
+	the return key (or enter key) is pressed, because if it does, the key
+	needs to work in the "accept" role for the input manager. Fixing
+	in this way has the pleasant effect of making return/enter key
+	behavior "do the right thing" based on context.
+
+        * khtml/html/html_formimpl.cpp:
+        (HTMLInputElementImpl::defaultEventHandler): Add check to see
+	if text input manager has marked text before submitting text
+	and password fields. Broke out key handling for checkboxes and
+	radios, since the old code for these widgets worked fine.
+        * kwq/KWQLineEdit.h: Added hasMarkedText function.
+        * kwq/KWQLineEdit.mm:
+        (QLineEdit::hasMarkedText): Returns whether the current input
+	manager has marked text or not.
+
 2003-11-09  Darin Adler  <darin at apple.com>
 
         Reviewed by Dave.
diff --git a/WebCore/khtml/html/html_formimpl.cpp b/WebCore/khtml/html/html_formimpl.cpp
index 16eae4a..ab237c1 100644
--- a/WebCore/khtml/html/html_formimpl.cpp
+++ b/WebCore/khtml/html/html_formimpl.cpp
@@ -1731,8 +1731,6 @@ void HTMLInputElementImpl::defaultEventHandler(EventImpl *evt)
                 break;
             case CHECKBOX:
             case RADIO:
-            case TEXT:
-            case PASSWORD:
                 // for return or enter, find the first successful image or submit element 
                 // send it a simulated mouse click
                 if (key == "U+00000d" || key == "Enter") {
@@ -1740,6 +1738,20 @@ void HTMLInputElementImpl::defaultEventHandler(EventImpl *evt)
                     evt->setDefaultHandled();
                 }
                 break;
+            case TEXT:
+            case PASSWORD: {
+                // For enter or return, 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 == "U+00000d" || key == "Enter")) {
+                    m_form->performSubmitClick();
+                    evt->setDefaultHandled();
+                }
+                break;
+            }
             default:
                 // not handled for the other widgets
                 break;
diff --git a/WebCore/kwq/KWQLineEdit.h b/WebCore/kwq/KWQLineEdit.h
index c80ca8b..0c67fdf 100644
--- a/WebCore/kwq/KWQLineEdit.h
+++ b/WebCore/kwq/KWQLineEdit.h
@@ -68,6 +68,8 @@ public:
 
     void clicked();
     
+    bool hasMarkedText();
+    
     virtual bool checksDescendantsForFocus() const;
 
 private:
diff --git a/WebCore/kwq/KWQLineEdit.mm b/WebCore/kwq/KWQLineEdit.mm
index 28e041e..0895953 100644
--- a/WebCore/kwq/KWQLineEdit.mm
+++ b/WebCore/kwq/KWQLineEdit.mm
@@ -218,6 +218,15 @@ void QLineEdit::clicked()
     m_clicked.call();
 }
 
+bool QLineEdit::hasMarkedText()
+{
+    bool result = false;
+    KWQ_BLOCK_EXCEPTIONS;
+    result = [[NSInputManager currentInputManager] hasMarkedText];
+    KWQ_UNBLOCK_EXCEPTIONS;
+    return result;
+}
+
 void QLineEdit::setAlignment(AlignmentFlags alignment)
 {
     KWQ_BLOCK_EXCEPTIONS;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list