webengine/osswebengine/WebKit/s60/webcoresupport/WebEditorClient.cpp
changeset 11 c8a366e56285
parent 10 a359256acfc6
child 15 60c5402cb945
--- a/webengine/osswebengine/WebKit/s60/webcoresupport/WebEditorClient.cpp	Thu Aug 27 07:44:59 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/webcoresupport/WebEditorClient.cpp	Thu Sep 24 12:53:48 2009 +0300
@@ -104,8 +104,7 @@
 //-----------------------------------------------------------------------------
 bool WebEditorClient::shouldEndEditing(WebCore::Range*)
 {
-    notImplemented();
-    return false;
+    return m_shouldEndEditing;
 }
 
 //-----------------------------------------------------------------------------
@@ -327,6 +326,7 @@
         return;
     }
 
+    m_shouldEndEditing = false;
     // Move to the right frame
     frame = m_webView->page()->focusController()->focusedOrMainFrame();
 
@@ -367,7 +367,18 @@
                 break;
 
             case EKeyLeftArrow:
-                frame->editor()->execCommand("MoveLeft");
+                if (select) //If shift is pressed then highlight the selection
+                {
+                //Webview Passes EEventKeyDown and EEventKey due to which 2 characters are getting selected in one key press
+                //Avoiding one Event so that for each key press it selects 1 character only
+                 if(kevent->isKeyDown())
+                    break;
+                 frame->editor()->execCommand("MoveLeftAndModifySelection");//from createCommandMap()
+                }
+                else
+                {
+                 frame->editor()->execCommand("MoveLeft");
+                }
                 m_webView->fepTextEditor()->HandleUpdateCursor();
                 if (frame->selectionController()->start() != startPos &&
                     frame->selectionController()->end() != endPos) {
@@ -376,7 +387,18 @@
                 break;
 
             case EKeyRightArrow:
-                frame->editor()->execCommand("MoveRight");
+                if (select)//If shift is pressed then highlight the selection
+                {
+                //Webview Passes EEventKeyDown and EEventKey due to which 2 characters are getting selected in one key press
+                //Avoiding one Event so that for each key press it selects 1 character only
+                 if(kevent->isKeyDown())
+                    break;
+                 frame->editor()->execCommand("MoveRightAndModifySelection");
+                }
+                else
+                {
+                 frame->editor()->execCommand("MoveRight");
+                }
                 m_webView->fepTextEditor()->HandleUpdateCursor();
                 if (frame->selectionController()->start() != startPos &&
                     frame->selectionController()->end() != endPos) {
@@ -391,6 +413,9 @@
                     frame->selectionController()->end() != endPos) {
                     event->setDefaultHandled();
                 }
+                else {
+                    m_shouldEndEditing = true;
+                }
                 break;
 
             case EKeyDownArrow:
@@ -400,9 +425,13 @@
                     frame->selectionController()->end() != endPos) {
                     event->setDefaultHandled();
                 }
+                else {
+                    m_shouldEndEditing = true;
+                }
                 break;
                 
             case EKeyEnter:
+            case EKeyDevice3:    
             	// If we are in a textarea, add a newline
                 if (m_webView->fepTextEditor()->IsTextAreaFocused()) {
                     if (m_webView->fepTextEditor()->DocumentLengthForFep() <