Changeset 20657 for S60/trunk/WebCore
- Timestamp:
- 04/02/07 10:39:53 (22 months ago)
- Location:
- S60/trunk/WebCore
- Files:
-
- 3 modified
-
ChangeLog (modified) (1 diff)
-
khtml/css/css_base.h (modified) (5 diffs)
-
khtml/css/cssparser.h (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
S60/trunk/WebCore/ChangeLog
r20587 r20657 1 2007-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 1 16 yongjzha <yongjun.zhang@nokia.com> 2 17 -
S60/trunk/WebCore/khtml/css/css_base.h
r14549 r20657 50 50 class DocumentImpl; 51 51 52 struct CSSNamespace { 52 struct CSSNamespace 53 OOM_MODIFIED 54 { 53 55 DOMString m_prefix; 54 56 DOMString m_uri; … … 78 80 { 79 81 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), 82 84 relation( Descendant ), match( None ), 83 85 pseudoId( 0 ), _pseudoType(PseudoNotParsed) 84 86 {} 85 87 86 ~CSSSelector() {87 delete tagHistory;88 ~CSSSelector() { 89 delete tagHistory; 88 90 delete simpleSelector; 89 91 delete nextSelector; 90 }92 } 91 93 92 94 MAIN_THREAD_ALLOCATED; … … 97 99 CSSSelector* next() { return nextSelector; } 98 100 99 /**100 * Print debug output for this selector101 */102 void print();103 104 /**105 * Re-create selector text from selector's data106 */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 Match118 {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, 121 123 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 Relation133 {134 Descendant = 0,135 Child,136 Sibling,137 SubSelector138 };139 140 enum PseudoType141 {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, 146 148 PseudoLastChild, 147 149 PseudoOnlyChild, 148 PseudoFirstLine,149 PseudoFirstLetter,150 PseudoLink,151 PseudoVisited,150 PseudoFirstLine, 151 PseudoFirstLetter, 152 PseudoLink, 153 PseudoVisited, 152 154 PseudoAnyLink, 153 PseudoHover,154 PseudoDrag,155 PseudoFocus,156 PseudoActive,155 PseudoHover, 156 PseudoDrag, 157 PseudoFocus, 158 PseudoActive, 157 159 PseudoTarget, 158 PseudoBefore,159 PseudoAfter,160 PseudoBefore, 161 PseudoAfter, 160 162 PseudoLang, 161 163 PseudoNot, 162 164 PseudoRoot, 163 165 PseudoSelection 164 };165 166 inline PseudoType pseudoType() const167 {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; 175 177 CSSSelector* simpleSelector; // Used for :not. 176 178 CSSSelector* nextSelector; // used for ,-chained selectors 177 Q_UINT32 attr;178 Q_UINT32 tag;179 Q_UINT32 attr; 180 Q_UINT32 tag; 179 181 180 182 Relation relation : 2; 181 Matchmatch : 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; 184 186 185 187 private: 186 void extractPseudoType() const;188 void extractPseudoType() const; 187 189 }; 188 190 … … 191 193 { 192 194 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() {} 201 203 202 204 MAIN_THREAD_ALLOCATED; 203 205 204 // returns the url of the style sheet this object belongs to205 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; } 209 211 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(); 237 239 238 240 protected: 239 bool strictParsing : 1;240 bool multiLength : 1;241 bool strictParsing : 1; 242 bool multiLength : 1; 241 243 }; 242 244 … … 245 247 { 246 248 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); } 256 258 257 259 protected: 258 QPtrList<StyleBaseImpl> *m_lstChildren;260 QPtrList<StyleBaseImpl> *m_lstChildren; 259 261 }; 260 262 -
S60/trunk/WebCore/khtml/css/cssparser.h
r14062 r20657 44 44 45 45 struct ParseString { 46 unsigned short *string;47 int length;46 unsigned short *string; 47 int length; 48 48 49 49 void lower(); … … 55 55 56 56 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 = 0x10000268 };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 }; 69 69 70 int unit;70 int unit; 71 71 }; 72 72 73 73 static inline QString qString( const ParseString &ps ) { 74 return QString( (QChar *)ps.string, ps.length );74 return QString( (QChar *)ps.string, ps.length ); 75 75 } 76 76 static inline DOMString domString( const ParseString &ps ) { 77 return DOMString( (QChar *)ps.string, ps.length );77 return DOMString( (QChar *)ps.string, ps.length ); 78 78 } 79 79 static inline AtomicString atomicString( const ParseString &ps ) { 80 return AtomicString( ps.string, ps.length );80 return AtomicString( ps.string, ps.length ); 81 81 } 82 82 … … 85 85 { 86 86 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; 96 96 }; 97 97 98 struct Function { 98 struct Function 99 OOM_MODIFIED 100 { 99 101 ParseString name; 100 102 ValueList *args; … … 104 106 105 107 class CSSParser 106 OOM_MODIFIED108 OOM_MODIFIED 107 109 { 108 110 public: 109 CSSParser( bool strictParsing = true );110 ~CSSParser();111 CSSParser( bool strictParsing = true ); 112 ~CSSParser(); 111 113 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 ); 116 118 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 ); 119 121 120 static CSSParser *current() { return currentParser; }122 static CSSParser *current() { return currentParser; } 121 123 122 124 123 DOM::DocumentImpl *document() const;125 DOM::DocumentImpl *document() const; 124 126 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(); 129 131 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 ); 134 136 135 137 CSSValueImpl* parseBackgroundColor(); … … 143 145 void addBackgroundValue(CSSValueImpl*& lval, CSSValueImpl* rval); 144 146 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(); 149 151 CSSPrimitiveValueImpl *parseColor(); 150 CSSPrimitiveValueImpl *parseColorFromValue(Value* val);152 CSSPrimitiveValueImpl *parseColorFromValue(Value* val); 151 153 152 154 static bool parseColor(const QString &name, QRgb& rgb); … … 155 157 bool parseShadow(int propId, bool important); 156 158 157 int yyparse( void );159 int yyparse( void ); 158 160 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; 169 171 170 172 Q_UINT16 defaultNamespace; 171 173 172 static CSSParser *currentParser;174 static CSSParser *currentParser; 173 175 174 // tokenizer methods and data176 // tokenizer methods and data 175 177 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(); 180 182 181 183 private: 182 184 void setupParser(const char *prefix, const DOMString &string, const char *suffix); 183 185 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; 193 195 }; 194 196