webengine/osswebengine/WebKit/s60/webview/WebTextFormatMask.cpp
changeset 10 a359256acfc6
parent 1 7c90e6132015
child 27 6297cdf66332
equal deleted inserted replaced
5:10e98eab6f85 10:a359256acfc6
   197         return false;
   197         return false;
   198 
   198 
   199     return (eb.m_start == -1);
   199     return (eb.m_start == -1);
   200 }
   200 }
   201 
   201 
       
   202 MaskBase* WebTextFormatMask::getMask(int aOffset)
       
   203 {
       
   204     MaskBase* m = m_masks;
       
   205     int i = 0; 
       
   206     while(m) {
       
   207         if (i == aOffset) {
       
   208             return m;    
       
   209         }
       
   210         m = m->nextMask();
       
   211         ++i;              
       
   212     }
       
   213     return NULL;
       
   214 }
       
   215 
   202 int WebTextFormatMask::getMultitude()
   216 int WebTextFormatMask::getMultitude()
   203 {
   217 {
   204     int count = 0;
   218     int count = 0;
   205     MaskBase* m = m_masks;
   219     MaskBase* m = m_masks;
   206     while (m) {
   220     while (m) {
   228             return m->getInputFormatMaskType();    
   242             return m->getInputFormatMaskType();    
   229         }
   243         }
   230         else if (i==aOffset) {
   244         else if (i==aOffset) {
   231 
   245 
   232             TInputFormatMaskType ifmt = m->getInputFormatMaskType();
   246             TInputFormatMaskType ifmt = m->getInputFormatMaskType();
   233             if (ifmt == EStatic){
       
   234                 MaskStatic* ms = static_cast<MaskStatic*>(m);
       
   235                 if (ms) {                
       
   236                     //make sure not to re-write the static text if it already exists
       
   237                     if (frame->document() &&
       
   238                         frame->document()->focusedNode() &&
       
   239                         frame->document()->focusedNode()->hasTagName(HTMLNames::inputTag) ) {         
       
   240                     
       
   241                         HTMLInputElement* ie = static_cast<HTMLInputElement*>(frame->document()->focusedNode());                      
       
   242                         int len = ie->value().length();
       
   243 
       
   244                         if (len<=aOffset) {                            
       
   245                             UChar c = ms->getStatic();                            
       
   246                             frame->editor()->insertTextWithoutSendingTextEvent(String(&c,1), false);
       
   247                         }
       
   248                     }
       
   249                 }            
       
   250             }
       
   251             return ifmt;            
   247             return ifmt;            
   252         }
   248         }
   253         m = m->nextMask();
   249         m = m->nextMask();
   254         ++i;                
   250         ++i;                
   255     }
   251     }