Changeset 20657 for S60/trunk/WebCore

Show
Ignore:
Timestamp:
04/02/07 10:39:53 (22 months ago)
Author:
zbujtas
Message:

2007-04-02 yongjzha <yonjun.zhang@nokia.com>

Reviewed by bjutas@gmail.com.
DESC: suppress false memory leaking alert.
http://bugs.webkit.org/show_bug.cgi?id=13253

  • khtml/css/css_base.h: (DOM::):
  • khtml/css/cssparser.h: (DOM::Value::): (DOM::qString): (DOM::domString): (DOM::atomicString): (DOM::):
Location:
S60/trunk/WebCore
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • S60/trunk/WebCore/ChangeLog

    r20587 r20657  
     12007-04-02  yongjzha  <yonjun.zhang@nokia.com> 
     2 
     3        Reviewed by bjutas@gmail.com. 
     4        DESC: suppress false memory leaking alert. 
     5        http://bugs.webkit.org/show_bug.cgi?id=13253 
     6 
     7        * khtml/css/css_base.h: 
     8        (DOM::): 
     9        * khtml/css/cssparser.h: 
     10        (DOM::Value::): 
     11        (DOM::qString): 
     12        (DOM::domString): 
     13        (DOM::atomicString): 
     14        (DOM::): 
     15 
    116yongjzha  <yongjun.zhang@nokia.com> 
    217 
  • S60/trunk/WebCore/khtml/css/css_base.h

    r14549 r20657  
    5050    class DocumentImpl; 
    5151 
    52     struct CSSNamespace { 
     52    struct CSSNamespace  
     53    OOM_MODIFIED     
     54    { 
    5355        DOMString m_prefix; 
    5456        DOMString m_uri; 
     
    7880    { 
    7981    public: 
    80         CSSSelector() 
    81             : tagHistory(0), simpleSelector(0), nextSelector(0), attr(0), tag(anyQName), 
     82    CSSSelector() 
     83        : tagHistory(0), simpleSelector(0), nextSelector(0), attr(0), tag(anyQName), 
    8284              relation( Descendant ), match( None ), 
    8385              pseudoId( 0 ), _pseudoType(PseudoNotParsed) 
    8486        {} 
    8587 
    86         ~CSSSelector() { 
    87             delete tagHistory; 
     88    ~CSSSelector() { 
     89        delete tagHistory; 
    8890            delete simpleSelector; 
    8991            delete nextSelector; 
    90         } 
     92    } 
    9193 
    9294        MAIN_THREAD_ALLOCATED; 
     
    9799        CSSSelector* next() { return nextSelector; } 
    98100 
    99         /** 
    100         * Print debug output for this selector 
    101         */ 
    102         void print(); 
    103  
    104         /** 
    105         * Re-create selector text from selector's data 
    106         */ 
    107         DOMString selectorText() const; 
    108  
    109         // checks if the 2 selectors (including sub selectors) agree. 
    110         bool operator == ( const CSSSelector &other ); 
    111  
    112         // tag == -1 means apply to all elements (Selector = *) 
    113  
    114         unsigned int specificity(); 
    115  
    116         /* how the attribute value has to match.... Default is Exact */ 
    117         enum Match 
    118         { 
    119             None = 0, 
    120             Id, 
     101    /** 
     102    * Print debug output for this selector 
     103    */ 
     104    void print(); 
     105 
     106    /** 
     107    * Re-create selector text from selector's data 
     108    */ 
     109    DOMString selectorText() const; 
     110 
     111    // checks if the 2 selectors (including sub selectors) agree. 
     112    bool operator == ( const CSSSelector &other ); 
     113 
     114    // tag == -1 means apply to all elements (Selector = *) 
     115 
     116    unsigned int specificity(); 
     117 
     118    /* how the attribute value has to match.... Default is Exact */ 
     119    enum Match 
     120    { 
     121        None = 0, 
     122        Id, 
    121123            Class, 
    122             Exact, 
    123             Set, 
    124             List, 
    125             Hyphen, 
    126             Pseudo, 
    127             Contain,   // css3: E[foo*="bar"] 
    128             Begin,     // css3: E[foo^="bar"] 
    129             End        // css3: E[foo$="bar"] 
    130         }; 
    131  
    132         enum Relation 
    133         { 
    134             Descendant = 0, 
    135             Child, 
    136             Sibling, 
    137             SubSelector 
    138         }; 
    139  
    140         enum PseudoType 
    141         { 
    142             PseudoNotParsed = 0, 
    143             PseudoOther, 
    144             PseudoEmpty, 
    145             PseudoFirstChild, 
     124        Exact, 
     125        Set, 
     126        List, 
     127        Hyphen, 
     128        Pseudo, 
     129        Contain,   // css3: E[foo*="bar"] 
     130        Begin,     // css3: E[foo^="bar"] 
     131        End        // css3: E[foo$="bar"] 
     132    }; 
     133 
     134    enum Relation 
     135    { 
     136        Descendant = 0, 
     137        Child, 
     138        Sibling, 
     139        SubSelector 
     140    }; 
     141 
     142    enum PseudoType 
     143    { 
     144        PseudoNotParsed = 0, 
     145        PseudoOther, 
     146        PseudoEmpty, 
     147        PseudoFirstChild, 
    146148            PseudoLastChild, 
    147149            PseudoOnlyChild, 
    148             PseudoFirstLine, 
    149             PseudoFirstLetter, 
    150             PseudoLink, 
    151             PseudoVisited, 
     150        PseudoFirstLine, 
     151        PseudoFirstLetter, 
     152        PseudoLink, 
     153        PseudoVisited, 
    152154            PseudoAnyLink, 
    153             PseudoHover, 
    154             PseudoDrag, 
    155             PseudoFocus, 
    156             PseudoActive, 
     155        PseudoHover, 
     156        PseudoDrag, 
     157        PseudoFocus, 
     158        PseudoActive, 
    157159            PseudoTarget, 
    158             PseudoBefore, 
    159             PseudoAfter, 
     160        PseudoBefore, 
     161        PseudoAfter, 
    160162            PseudoLang, 
    161163            PseudoNot, 
    162164            PseudoRoot, 
    163165            PseudoSelection 
    164         }; 
    165  
    166         inline PseudoType pseudoType() const 
    167             { 
    168                 if (_pseudoType == PseudoNotParsed) 
    169                     extractPseudoType(); 
    170                 return _pseudoType; 
    171             } 
    172  
    173         mutable DOM::AtomicString value; 
    174         CSSSelector* tagHistory; 
     166    }; 
     167 
     168    inline PseudoType pseudoType() const 
     169        { 
     170        if (_pseudoType == PseudoNotParsed) 
     171            extractPseudoType(); 
     172        return _pseudoType; 
     173        } 
     174 
     175    mutable DOM::AtomicString value; 
     176    CSSSelector* tagHistory; 
    175177        CSSSelector* simpleSelector; // Used for :not. 
    176178        CSSSelector* nextSelector; // used for ,-chained selectors 
    177         Q_UINT32     attr; 
    178         Q_UINT32     tag; 
     179    Q_UINT32     attr; 
     180    Q_UINT32     tag; 
    179181 
    180182        Relation relation     : 2; 
    181         Match    match         : 4; 
    182         unsigned int pseudoId : 3; 
    183         mutable PseudoType _pseudoType : 5; 
     183    Match    match         : 4; 
     184    unsigned int pseudoId : 3; 
     185    mutable PseudoType _pseudoType : 5; 
    184186 
    185187    private: 
    186         void extractPseudoType() const; 
     188    void extractPseudoType() const; 
    187189    }; 
    188190 
     
    191193    { 
    192194    public: 
    193         StyleBaseImpl()  { m_parent = 0; strictParsing = true; multiLength = false; } 
    194         StyleBaseImpl(StyleBaseImpl *p) { 
    195             m_parent = p; 
    196             strictParsing = (m_parent ? m_parent->useStrictParsing() : true); 
    197             multiLength = false; 
    198         } 
    199  
    200         virtual ~StyleBaseImpl() {} 
     195    StyleBaseImpl()  { m_parent = 0; strictParsing = true; multiLength = false; } 
     196    StyleBaseImpl(StyleBaseImpl *p) { 
     197        m_parent = p; 
     198        strictParsing = (m_parent ? m_parent->useStrictParsing() : true); 
     199        multiLength = false; 
     200    } 
     201 
     202    virtual ~StyleBaseImpl() {} 
    201203 
    202204        MAIN_THREAD_ALLOCATED; 
    203205 
    204         // returns the url of the style sheet this object belongs to 
    205         DOMString baseURL(); 
    206  
    207         virtual bool isStyleSheet() const { return false; } 
    208         virtual bool isCSSStyleSheet() const { return false; } 
     206    // returns the url of the style sheet this object belongs to 
     207    DOMString baseURL(); 
     208 
     209    virtual bool isStyleSheet() const { return false; } 
     210    virtual bool isCSSStyleSheet() const { return false; } 
    209211        virtual bool isXSLStyleSheet() const { return false; } 
    210         virtual bool isStyleSheetList() const { return false; } 
    211         virtual bool isMediaList() { return false; } 
    212         virtual bool isRuleList() { return false; } 
    213         virtual bool isRule() { return false; } 
    214         virtual bool isStyleRule() { return false; } 
    215         virtual bool isCharetRule() { return false; } 
    216         virtual bool isImportRule() { return false; } 
    217         virtual bool isMediaRule() { return false; } 
    218         virtual bool isFontFaceRule() { return false; } 
    219         virtual bool isPageRule() { return false; } 
    220         virtual bool isUnknownRule() { return false; } 
    221         virtual bool isStyleDeclaration() { return false; } 
    222         virtual bool isValue() { return false; } 
    223         virtual bool isPrimitiveValue() const { return false; } 
    224         virtual bool isValueList() { return false; } 
    225         virtual bool isValueCustom() { return false; } 
    226  
    227         void setParent(StyleBaseImpl *parent) { m_parent = parent; } 
    228  
    229         virtual bool parseString(const DOMString &/*cssString*/, bool = false) { return false; } 
    230  
    231         virtual void checkLoaded(); 
    232  
    233         void setStrictParsing( bool b ) { strictParsing = b; } 
    234         bool useStrictParsing() const { return strictParsing; } 
    235  
    236         StyleSheetImpl* stylesheet(); 
     212    virtual bool isStyleSheetList() const { return false; } 
     213    virtual bool isMediaList() { return false; } 
     214    virtual bool isRuleList() { return false; } 
     215    virtual bool isRule() { return false; } 
     216    virtual bool isStyleRule() { return false; } 
     217    virtual bool isCharetRule() { return false; } 
     218    virtual bool isImportRule() { return false; } 
     219    virtual bool isMediaRule() { return false; } 
     220    virtual bool isFontFaceRule() { return false; } 
     221    virtual bool isPageRule() { return false; } 
     222    virtual bool isUnknownRule() { return false; } 
     223    virtual bool isStyleDeclaration() { return false; } 
     224    virtual bool isValue() { return false; } 
     225    virtual bool isPrimitiveValue() const { return false; } 
     226    virtual bool isValueList() { return false; } 
     227    virtual bool isValueCustom() { return false; } 
     228 
     229    void setParent(StyleBaseImpl *parent) { m_parent = parent; } 
     230 
     231    virtual bool parseString(const DOMString &/*cssString*/, bool = false) { return false; } 
     232 
     233    virtual void checkLoaded(); 
     234 
     235    void setStrictParsing( bool b ) { strictParsing = b; } 
     236    bool useStrictParsing() const { return strictParsing; } 
     237 
     238    StyleSheetImpl* stylesheet(); 
    237239 
    238240    protected: 
    239         bool strictParsing : 1; 
    240         bool multiLength : 1; 
     241    bool strictParsing : 1; 
     242    bool multiLength : 1; 
    241243    }; 
    242244 
     
    245247    { 
    246248    public: 
    247         StyleListImpl() : StyleBaseImpl() { m_lstChildren = 0; } 
    248         StyleListImpl(StyleBaseImpl *parent) : StyleBaseImpl(parent) { m_lstChildren = 0; } 
    249  
    250         virtual ~StyleListImpl(); 
    251  
    252         unsigned long length() { return m_lstChildren->count(); } 
    253         StyleBaseImpl *item(unsigned long num) { return m_lstChildren->at(num); } 
    254  
    255         void append(StyleBaseImpl *item) { m_lstChildren->append(item); } 
     249    StyleListImpl() : StyleBaseImpl() { m_lstChildren = 0; } 
     250    StyleListImpl(StyleBaseImpl *parent) : StyleBaseImpl(parent) { m_lstChildren = 0; } 
     251 
     252    virtual ~StyleListImpl(); 
     253 
     254    unsigned long length() { return m_lstChildren->count(); } 
     255    StyleBaseImpl *item(unsigned long num) { return m_lstChildren->at(num); } 
     256 
     257    void append(StyleBaseImpl *item) { m_lstChildren->append(item); } 
    256258 
    257259    protected: 
    258         QPtrList<StyleBaseImpl> *m_lstChildren; 
     260    QPtrList<StyleBaseImpl> *m_lstChildren; 
    259261    }; 
    260262 
  • S60/trunk/WebCore/khtml/css/cssparser.h

    r14062 r20657  
    4444 
    4545    struct ParseString { 
    46         unsigned short *string; 
    47         int length; 
     46    unsigned short *string; 
     47    int length; 
    4848         
    4949        void lower(); 
     
    5555     
    5656    struct Value { 
    57         int id; 
    58         union { 
    59             double fValue; 
    60             int iValue; 
    61             ParseString string; 
    62             Function *function; 
    63         }; 
    64         enum { 
    65             Operator = 0x100000, 
    66             Function = 0x100001, 
    67             Q_EMS     = 0x100002 
    68         }; 
     57    int id; 
     58    union { 
     59        double fValue; 
     60        int iValue; 
     61        ParseString string; 
     62        Function *function; 
     63    }; 
     64    enum { 
     65        Operator = 0x100000, 
     66        Function = 0x100001, 
     67        Q_EMS     = 0x100002 
     68    }; 
    6969 
    70         int unit; 
     70    int unit; 
    7171    }; 
    7272 
    7373    static inline QString qString( const ParseString &ps ) { 
    74         return QString( (QChar *)ps.string, ps.length ); 
     74    return QString( (QChar *)ps.string, ps.length ); 
    7575    } 
    7676    static inline DOMString domString( const ParseString &ps ) { 
    77         return DOMString( (QChar *)ps.string, ps.length ); 
     77    return DOMString( (QChar *)ps.string, ps.length ); 
    7878    } 
    7979    static inline AtomicString atomicString( const ParseString &ps ) { 
    80         return AtomicString( ps.string, ps.length ); 
     80    return AtomicString( ps.string, ps.length ); 
    8181    } 
    8282     
     
    8585    { 
    8686    public: 
    87         ValueList(); 
    88         ~ValueList(); 
    89         void addValue( const Value &val ); 
    90         Value *current() { return currentValue < numValues ? values + currentValue : 0; } 
    91         Value *next() { ++currentValue; return current(); } 
    92         Value *values; 
    93         int numValues; 
    94         int maxValues; 
    95         int currentValue; 
     87    ValueList(); 
     88    ~ValueList(); 
     89    void addValue( const Value &val ); 
     90    Value *current() { return currentValue < numValues ? values + currentValue : 0; } 
     91    Value *next() { ++currentValue; return current(); } 
     92    Value *values; 
     93    int numValues; 
     94    int maxValues; 
     95    int currentValue; 
    9696    }; 
    9797 
    98     struct Function { 
     98    struct Function  
     99    OOM_MODIFIED 
     100    { 
    99101        ParseString name; 
    100102        ValueList *args; 
     
    104106     
    105107    class CSSParser 
    106         OOM_MODIFIED     
     108    OOM_MODIFIED     
    107109    { 
    108110    public: 
    109         CSSParser( bool strictParsing = true ); 
    110         ~CSSParser(); 
     111    CSSParser( bool strictParsing = true ); 
     112    ~CSSParser(); 
    111113 
    112         void parseSheet( DOM::CSSStyleSheetImpl *sheet, const DOM::DOMString &string ); 
    113         DOM::CSSRuleImpl *parseRule( DOM::CSSStyleSheetImpl *sheet, const DOM::DOMString &string ); 
    114         bool parseValue( DOM::CSSMutableStyleDeclarationImpl *decls, int id, const DOM::DOMString &string, 
    115                         bool _important ); 
     114    void parseSheet( DOM::CSSStyleSheetImpl *sheet, const DOM::DOMString &string ); 
     115    DOM::CSSRuleImpl *parseRule( DOM::CSSStyleSheetImpl *sheet, const DOM::DOMString &string ); 
     116    bool parseValue( DOM::CSSMutableStyleDeclarationImpl *decls, int id, const DOM::DOMString &string, 
     117            bool _important ); 
    116118        static QRgb parseColor( const DOM::DOMString &string ); 
    117         bool parseColor( DOM::CSSMutableStyleDeclarationImpl *declaration, const DOM::DOMString &string ); 
    118         bool parseDeclaration( DOM::CSSMutableStyleDeclarationImpl *decls, const DOM::DOMString &string ); 
     119    bool parseColor( DOM::CSSMutableStyleDeclarationImpl *declaration, const DOM::DOMString &string ); 
     120    bool parseDeclaration( DOM::CSSMutableStyleDeclarationImpl *decls, const DOM::DOMString &string ); 
    119121 
    120         static CSSParser *current() { return currentParser; } 
     122    static CSSParser *current() { return currentParser; } 
    121123 
    122124 
    123         DOM::DocumentImpl *document() const; 
     125    DOM::DocumentImpl *document() const; 
    124126 
    125         void addProperty( int propId, CSSValueImpl *value, bool important ); 
    126         bool hasProperties() const { return numParsedProperties > 0; } 
    127         CSSMutableStyleDeclarationImpl *createStyleDeclaration( CSSStyleRuleImpl *rule ); 
    128         void clearProperties(); 
     127    void addProperty( int propId, CSSValueImpl *value, bool important ); 
     128    bool hasProperties() const { return numParsedProperties > 0; } 
     129    CSSMutableStyleDeclarationImpl *createStyleDeclaration( CSSStyleRuleImpl *rule ); 
     130    void clearProperties(); 
    129131 
    130         bool parseValue( int propId, bool important ); 
    131         bool parseShortHand( const int *properties, int numProperties, bool important ); 
    132         bool parse4Values( const int *properties, bool important ); 
    133         bool parseContent( int propId, bool important ); 
     132    bool parseValue( int propId, bool important ); 
     133    bool parseShortHand( const int *properties, int numProperties, bool important ); 
     134    bool parse4Values( const int *properties, bool important ); 
     135    bool parseContent( int propId, bool important ); 
    134136 
    135137        CSSValueImpl* parseBackgroundColor(); 
     
    143145        void addBackgroundValue(CSSValueImpl*& lval, CSSValueImpl* rval); 
    144146         
    145         bool parseDashboardRegions( int propId, bool important ); 
    146         bool parseShape( int propId, bool important ); 
    147         bool parseFont(bool important); 
    148         CSSValueListImpl *parseFontFamily(); 
     147    bool parseDashboardRegions( int propId, bool important ); 
     148    bool parseShape( int propId, bool important ); 
     149    bool parseFont(bool important); 
     150    CSSValueListImpl *parseFontFamily(); 
    149151        CSSPrimitiveValueImpl *parseColor(); 
    150         CSSPrimitiveValueImpl *parseColorFromValue(Value* val); 
     152    CSSPrimitiveValueImpl *parseColorFromValue(Value* val); 
    151153 
    152154        static bool parseColor(const QString &name, QRgb& rgb); 
     
    155157        bool parseShadow(int propId, bool important); 
    156158         
    157         int yyparse( void ); 
     159    int yyparse( void ); 
    158160    public: 
    159         bool strict; 
    160         bool important; 
    161         int id; 
    162         DOM::StyleListImpl *styleElement; 
    163         DOM::CSSRuleImpl *rule; 
    164         ValueList *valueList; 
    165         CSSProperty **parsedProperties; 
    166         int numParsedProperties; 
    167         int maxParsedProperties; 
    168         bool inParseShortHand; 
     161    bool strict; 
     162    bool important; 
     163    int id; 
     164    DOM::StyleListImpl *styleElement; 
     165    DOM::CSSRuleImpl *rule; 
     166    ValueList *valueList; 
     167    CSSProperty **parsedProperties; 
     168    int numParsedProperties; 
     169    int maxParsedProperties; 
     170    bool inParseShortHand; 
    169171 
    170172        Q_UINT16 defaultNamespace; 
    171173         
    172         static CSSParser *currentParser; 
     174    static CSSParser *currentParser; 
    173175 
    174         // tokenizer methods and data 
     176    // tokenizer methods and data 
    175177    public: 
    176         int lex( void *yylval ); 
    177         int token() { return yyTok; } 
    178         unsigned short *text( int *length); 
    179         int lex(); 
     178    int lex( void *yylval ); 
     179    int token() { return yyTok; } 
     180    unsigned short *text( int *length); 
     181    int lex(); 
    180182         
    181183    private: 
    182184        void setupParser(const char *prefix, const DOMString &string, const char *suffix); 
    183185         
    184         unsigned short *data; 
    185         unsigned short *yytext; 
    186         unsigned short *yy_c_buf_p; 
    187         unsigned short yy_hold_char; 
    188         int yy_last_accepting_state; 
    189         unsigned short *yy_last_accepting_cpos; 
    190         int yyleng; 
    191         int yyTok; 
    192         int yy_start; 
     186    unsigned short *data; 
     187    unsigned short *yytext; 
     188    unsigned short *yy_c_buf_p; 
     189    unsigned short yy_hold_char; 
     190    int yy_last_accepting_state; 
     191    unsigned short *yy_last_accepting_cpos; 
     192    int yyleng; 
     193    int yyTok; 
     194    int yy_start; 
    193195    }; 
    194196