Changeset 19433 in webkit


Ignore:
Timestamp:
Feb 6, 2007 9:17:24 AM (17 years ago)
Author:
brmorris
Message:

w3liu, Reviewed by Yongjun Zhang <yongjun.zhang@nokia.com>

DESC: Should check meta for charset if meta exists EHSN-6UQ6CM
http://bugs.webkit.org/show_bug.cgi?id=12225

Location:
S60/branches/3.1m/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • S60/branches/3.1m/WebCore/ChangeLog

    r19431 r19433  
     1w3liu,  Reviewed by Yongjun Zhang <yongjun.zhang@nokia.com>
     2        DESC: Should check meta for charset if meta exists EHSN-6UQ6CM
     3        http://bugs.webkit.org/show_bug.cgi?id=12225
     4
     5        WARNING: NO TEST CASES ADDED OR CHANGED
     6
     7        * khtml/misc/decoder.cpp:
     8        (Decoder::decode):
     9
    110yongjzha, Reviewed by Zalan.
    211
  • S60/branches/3.1m/WebCore/khtml/misc/decoder.cpp

    r19052 r19433  
    485485            const char *pEnd = buffer.length();
    486486#endif
     487#if NOKIA_CHANGES
     488            bool hasMeta = buffer.find("<meta", 0, false);
     489            bool reachMeta = false;
     490#endif
    487491            while(ptr != pEnd)
    488492            {
     
    533537                    switch( id ) {
    534538                    case ID_META:
    535                     {
     539                        {
     540#if NOKIA_CHANGES
     541                        reachMeta = true;                       
     542#endif
    536543                        // found a meta tag...
    537544                        //ptr += 5;
     
    544551                        //if( (pos = str.find("http-equiv", pos)) == -1) break;
    545552                        //if( (pos = str.find("content-type", pos)) == -1) break;
    546             while( pos < ( int ) str.length() ) {
    547                 if( (pos = str.find("charset", pos, false)) == -1) break;
    548                 pos += 7;
     553                        while( pos < ( int ) str.length() ) {
     554                            if( (pos = str.find("charset", pos, false)) == -1) break;
     555                            pos += 7;
    549556                            // skip whitespace..
    550                 while(  pos < (int)str.length() && str[pos] <= ' ' ) pos++;
     557                            while(  pos < (int)str.length() && str[pos] <= ' ' ) pos++;
    551558                            if ( pos == ( int )str.length()) break;
    552559                            if ( str[pos++] != '=' ) continue;
    553560                            while ( pos < ( int )str.length() &&
    554                                     ( str[pos] <= ' ' ) || str[pos] == '=' || str[pos] == '"' || str[pos] == '\'')
    555                 pos++;
    556 
     561                                ( str[pos] <= ' ' ) || str[pos] == '=' || str[pos] == '"' || str[pos] == '\'')
     562                                pos++;
     563                           
    557564                            // end ?
    558565                            if ( pos == ( int )str.length() ) break;
    559                 uint endpos = pos;
    560                 while( endpos < str.length() &&
    561                                    (str[endpos] != ' ' && str[endpos] != '"' && str[endpos] != '\''
    562                                     && str[endpos] != ';' && str[endpos] != '>') )
    563                 endpos++;
    564 #ifdef DECODE_DEBUG
    565                 kdDebug( 6005 ) << "Decoder: found charset: " << str.mid(pos, endpos-pos) << endl;
    566 #endif
    567                 setEncoding(str.mid(pos, endpos-pos), EncodingFromMetaTag);
    568                 if( m_type == EncodingFromMetaTag ) goto found;
    569 
     566                            uint endpos = pos;
     567                            while( endpos < str.length() &&
     568                                (str[endpos] != ' ' && str[endpos] != '"' && str[endpos] != '\''
     569                                && str[endpos] != ';' && str[endpos] != '>') )
     570                                endpos++;
     571#ifdef DECODE_DEBUG
     572                            kdDebug( 6005 ) << "Decoder: found charset: " << str.mid(pos, endpos-pos) << endl;
     573#endif
     574                            setEncoding(str.mid(pos, endpos-pos), EncodingFromMetaTag);
     575                            if( m_type == EncodingFromMetaTag ) goto found;
     576                           
    570577                            if ( endpos >= str.length() || str[endpos] == '/' || str[endpos] == '>' ) break;
    571 
    572                 pos = endpos + 1;
    573             }
    574             }
     578                           
     579                            pos = endpos + 1;
     580                            }
     581                        }
    575582                    case (ID_META+ID_CLOSE_TAG):
    576583                    case ID_SCRIPT:
     
    597604                        break;
    598605                    default:
     606#if NOKIA_CHANGES
     607                        if (hasMeta && !reachMeta)
     608                            break;
     609#endif
    599610                        body = true;
    600611#ifdef DECODE_DEBUG
Note: See TracChangeset for help on using the changeset viewer.