84 #include "WidgetExtension.h" |
84 #include "WidgetExtension.h" |
85 #include "Cache.h" |
85 #include "Cache.h" |
86 #include "RenderWidget.h" |
86 #include "RenderWidget.h" |
87 #include "HTMLNames.h" |
87 #include "HTMLNames.h" |
88 #include "HTMLInputElement.h" |
88 #include "HTMLInputElement.h" |
|
89 #include "HTMLDivElement.h" |
|
90 #include "HtmlTextAreaElement.h" |
89 |
91 |
90 using namespace HTMLNames; |
92 using namespace HTMLNames; |
91 |
93 |
92 #include <AknUtils.h> |
94 #include <AknUtils.h> |
93 #include <cuseragent.h> |
95 #include <cuseragent.h> |
1212 consumed = downEventConsumed || handleTabbedNavigation(m_currentEventKey, m_currentEventCode); |
1214 consumed = downEventConsumed || handleTabbedNavigation(m_currentEventKey, m_currentEventCode); |
1213 } |
1215 } |
1214 else { |
1216 else { |
1215 //Check is editable node and couples of NULL checking |
1217 //Check is editable node and couples of NULL checking |
1216 if( m_isEditable && frame && frame->document() && frame->document()->focusedNode() ) { |
1218 if( m_isEditable && frame && frame->document() && frame->document()->focusedNode() ) { |
|
1219 TInt length = 0; |
1217 //Is inputTag |
1220 //Is inputTag |
1218 TBool isInputTag = frame->document()->focusedNode()->hasTagName(inputTag); |
1221 TBool isInputTag = frame->document()->focusedNode()->hasTagName(inputTag); |
1219 HTMLInputElement* ie = static_cast<HTMLInputElement*>(frame->document()->focusedNode()); |
1222 TBool isdivTag = frame->document()->focusedNode()->hasTagName(divTag); |
1220 TInt length = 0; |
1223 TBool isTextAreaTag = frame->document()->focusedNode()->hasTagName(textareaTag); |
1221 //Null checking etc. |
1224 |
1222 if( ie && isInputTag ) { |
1225 if(isInputTag) { |
1223 //Get length of inputelement string |
1226 HTMLInputElement* ie = static_cast<HTMLInputElement*>(frame->document()->focusedNode()); |
1224 length = ie->value().length(); |
1227 //Null checking etc. |
|
1228 if( ie ) { |
|
1229 //Get length of inputelement string |
|
1230 length = ie->value().length(); |
|
1231 } |
1225 } |
1232 } |
|
1233 else if(isdivTag) { |
|
1234 HTMLDivElement* ie = static_cast<HTMLDivElement*>(frame->document()->focusedNode()); |
|
1235 if( ie ) { |
|
1236 //Get length of inputelement string |
|
1237 length = ie->innerText().length(); |
|
1238 } |
|
1239 } |
|
1240 else if (isTextAreaTag) |
|
1241 { |
|
1242 HTMLTextAreaElement* ie = static_cast<HTMLTextAreaElement*>(frame->document()->focusedNode()); |
|
1243 if( ie ) { |
|
1244 //Get length of inputelement string |
|
1245 length = ie->value().length(); |
|
1246 } |
|
1247 } |
|
1248 |
1226 //Check is there data in input field |
1249 //Check is there data in input field |
1227 if( length > 0 || !ie ) { |
1250 if( length > 0) { |
1228 //If there is data, do the old thing |
1251 //If there is data, do the old thing |
1229 consumed = ( !m_isEditable && //avoid showing the cursor when we are in the input box |
1252 consumed = ( !m_isEditable && //avoid showing the cursor when we are in the input box |
1230 handleKeyNavigation(keyevent, eventcode, frame)) || |
1253 handleKeyNavigation(keyevent, eventcode, frame)) || |
1231 downEventConsumed; |
1254 downEventConsumed; |
1232 } |
1255 } |