webengine/osswebengine/WebKit/s60/webview/WebTextFormatMask.cpp
branchRCL_3
changeset 48 79859ed3eea9
parent 47 e1bea15f9a39
child 49 919f36ff910f
equal deleted inserted replaced
47:e1bea15f9a39 48:79859ed3eea9
    20 
    20 
    21 #include "WebTextFormatMask.h"
    21 #include "WebTextFormatMask.h"
    22 
    22 
    23 #include "Frame.h"
    23 #include "Frame.h"
    24 #include "Editor.h"
    24 #include "Editor.h"
    25 #include "String.h"
    25 #include "string.h"
    26 #include "HtmlNames.h"
    26 #include "HTMLNames.h"
    27 #include "HtmlInputElement.h"
    27 #include "HTMLInputElement.h"
    28 
    28 
    29 #include "Text.h"
    29 #include "Text.h"
    30 #include "CString.h"
    30 #include "CString.h"
    31 #include "DeprecatedCString.h"
    31 #include "DeprecatedCString.h"
    32 #include "SelectionController.h"
    32 #include "SelectionController.h"
    59 }
    59 }
    60 
    60 
    61 void WebTextFormatMask::buildMaskList(const String& str)
    61 void WebTextFormatMask::buildMaskList(const String& str)
    62 {
    62 {
    63     // *M or *m
    63     // *M or *m
    64     if (str.isEmpty() || str=="*m") {
    64     if (str.isEmpty() || str=="*M" || str=="*m") {
    65         m_acceptAll = true;
    65         m_acceptAll = true;
    66         return;
    66         return;
    67     }
    67     }
    68 
    68 
    69     // parse the string
    69     // parse the string
   190         }
   190         }
   191 
   191 
   192         m_currentMask = m_currentMask->nextMask();
   192         m_currentMask = m_currentMask->nextMask();
   193     }
   193     }
   194 
   194 
   195        // this check doesn't seem to be proper as the check is done for 
   195     // did we use up all the masks?
   196        // the partial text.Because the checkText() is called for every character input by user,
   196     if(m_currentMask && m_currentMask->multitude() != kInfinite)
   197        // there are remaining masks after complete text length has been checked, 
   197         return false;
   198        // that is valid case and it should not return false. 
       
   199        // If text length is bigger than mask length then that case is handled within for loop 
       
   200        //before this condition check. So it is redundant in current implementation
       
   201        // did we use up all the masks?
       
   202        /* if(m_currentMask && m_currentMask->multitude() != kInfinite)
       
   203         return false;*/
       
   204 
   198 
   205     return (eb.m_start == -1);
   199     return (eb.m_start == -1);
   206 }
   200 }
   207 
   201 
   208 MaskBase* WebTextFormatMask::getMask(int aOffset)
   202 MaskBase* WebTextFormatMask::getMask(int aOffset)
   219     return NULL;
   213     return NULL;
   220 }
   214 }
   221 
   215 
   222 int WebTextFormatMask::getMultitude()
   216 int WebTextFormatMask::getMultitude()
   223 {
   217 {
   224     int length = 0;
       
   225     int count = 0;
   218     int count = 0;
   226     MaskBase* m = m_masks;
   219     MaskBase* m = m_masks;
   227     while (m) {
   220     while (m) {
   228          length = m->multitude();
   221 
   229          if (length == kInfinite){
   222         if (m->multitude() == kInfinite){
   230              return kInfinite;    
   223             return kInfinite;    
   231          }        
   224         }        
   232          else if(length > 1){
   225         else {
   233              count += length;
   226             count += m->multitude();           
   234              break;
   227         }
   235          }
   228         m = m->nextMask();                
   236          else{
       
   237              count += length;           
       
   238          }
       
   239          m = m->nextMask();   
       
   240     }
   229     }
   241         
   230         
   242     return (count)?count:kInfinite;    
   231     return (count)?count:kInfinite;    
   243 }
   232 }
   244 
   233 
   284         msk->m_next = m;
   273         msk->m_next = m;
   285     }
   274     }
   286 
   275 
   287     return true;
   276     return true;
   288 }
   277 }
   289 
       
   290 bool WebTextFormatMask::acceptAll()
       
   291     {
       
   292     return m_acceptAll;
       
   293     }
       
   294 
   278 
   295 MaskComposite::MaskComposite(TInputFormatMaskType t, int mul) 
   279 MaskComposite::MaskComposite(TInputFormatMaskType t, int mul) 
   296             : MaskSingle(t), m_offset(0), m_length(mul)
   280             : MaskSingle(t), m_offset(0), m_length(mul)
   297 {
   281 {
   298 }
   282 }