webengine/osswebengine/WebKit/s60/webcoresupport/WebEditorClient.cpp
branchRCL_3
changeset 50 d96eed154187
parent 49 919f36ff910f
equal deleted inserted replaced
49:919f36ff910f 50:d96eed154187
    93 //-----------------------------------------------------------------------------
    93 //-----------------------------------------------------------------------------
    94 // WebEditorClient::shouldBeginEditing
    94 // WebEditorClient::shouldBeginEditing
    95 //-----------------------------------------------------------------------------
    95 //-----------------------------------------------------------------------------
    96 bool WebEditorClient::shouldBeginEditing(WebCore::Range*)
    96 bool WebEditorClient::shouldBeginEditing(WebCore::Range*)
    97 {
    97 {
    98     notImplemented();
    98     return true;
    99     return false;
       
   100 }
    99 }
   101 
   100 
   102 //-----------------------------------------------------------------------------
   101 //-----------------------------------------------------------------------------
   103 // WebEditorClient::shouldEndEditing
   102 // WebEditorClient::shouldEndEditing
   104 //-----------------------------------------------------------------------------
   103 //-----------------------------------------------------------------------------
   105 bool WebEditorClient::shouldEndEditing(WebCore::Range*)
   104 bool WebEditorClient::shouldEndEditing(WebCore::Range* range)
   106 {
   105 {
       
   106     if(range)
       
   107         return true;
   107     return m_shouldEndEditing;
   108     return m_shouldEndEditing;
   108 }
   109 }
   109 
   110 
   110 //-----------------------------------------------------------------------------
   111 //-----------------------------------------------------------------------------
   111 // WebEditorClient::shouldInsertText
   112 // WebEditorClient::shouldInsertText
   380                  frame->editor()->execCommand("MoveLeft");
   381                  frame->editor()->execCommand("MoveLeft");
   381                 }
   382                 }
   382                 m_webView->fepTextEditor()->HandleUpdateCursor();
   383                 m_webView->fepTextEditor()->HandleUpdateCursor();
   383                 if (frame->selectionController()->start() == startPos &&
   384                 if (frame->selectionController()->start() == startPos &&
   384                     frame->selectionController()->end() == endPos && !select) {
   385                     frame->selectionController()->end() == endPos && !select) {
   385                     m_shouldEndEditing = !(m_webView->fepTextEditor()->IsTextAreaFocused() || m_webView->fepTextEditor()->IsInputElementFocused());
   386                     m_shouldEndEditing = !(m_webView->fepTextEditor()->IsTextAreaFocused() 
       
   387                             || m_webView->fepTextEditor()->IsInputElementFocused()
       
   388                             || m_webView->fepTextEditor()->IsDivElementFocused() );
   386                 }
   389                 }
   387                 else {
   390                 else {
   388                     event->setDefaultHandled();
   391                     event->setDefaultHandled();
   389                 }
   392                 }
   390                 break;
   393                 break;
   403                  frame->editor()->execCommand("MoveRight");
   406                  frame->editor()->execCommand("MoveRight");
   404                 }
   407                 }
   405                 m_webView->fepTextEditor()->HandleUpdateCursor();
   408                 m_webView->fepTextEditor()->HandleUpdateCursor();
   406                 if (frame->selectionController()->start() == startPos &&
   409                 if (frame->selectionController()->start() == startPos &&
   407                     frame->selectionController()->end() == endPos && !select) {
   410                     frame->selectionController()->end() == endPos && !select) {
   408                     m_shouldEndEditing = !(m_webView->fepTextEditor()->IsTextAreaFocused() || m_webView->fepTextEditor()->IsInputElementFocused());
   411                     m_shouldEndEditing = !(m_webView->fepTextEditor()->IsTextAreaFocused() 
       
   412                             || m_webView->fepTextEditor()->IsInputElementFocused()
       
   413                             || m_webView->fepTextEditor()->IsDivElementFocused());
   409                 }
   414                 }
   410                 else {
   415                 else {
   411                     event->setDefaultHandled();
   416                     event->setDefaultHandled();
   412                 }
   417                 }
   413                 break;
   418                 break;
   451                 break;
   456                 break;
   452                 
   457                 
   453             case EKeyEnter:
   458             case EKeyEnter:
   454             case EKeyDevice3:    
   459             case EKeyDevice3:    
   455             	// If we are in a textarea, add a newline
   460             	// If we are in a textarea, add a newline
   456                 if (m_webView->fepTextEditor()->IsTextAreaFocused()) {
   461                 if (m_webView->fepTextEditor()->IsTextAreaFocused() || m_webView->fepTextEditor()->IsDivElementFocused()) {
   457                     if (m_webView->fepTextEditor()->DocumentLengthForFep() <
   462                     if (m_webView->fepTextEditor()->DocumentLengthForFep() <
   458                         m_webView->fepTextEditor()->DocumentMaximumLengthForFep()) {
   463                         m_webView->fepTextEditor()->DocumentMaximumLengthForFep()) {
   459                         frame->editor()->insertLineBreak();
   464                         frame->editor()->insertLineBreak();
   460                         m_webView->fepTextEditor()->UpdateEditingMode();
   465                         m_webView->fepTextEditor()->UpdateEditingMode();
   461                         m_webView->fepTextEditor()->HandleUpdateCursor();
   466                         m_webView->fepTextEditor()->HandleUpdateCursor();