| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 Google Inc. All rights reserved. | 2 * Copyright (c) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 class StyleRuleBase; | 42 class StyleRuleBase; |
| 43 | 43 |
| 44 struct SourceRange { | 44 struct SourceRange { |
| 45 ALLOW_ONLY_INLINE_ALLOCATION(); | 45 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 46 public: | 46 public: |
| 47 SourceRange(); | 47 SourceRange(); |
| 48 SourceRange(unsigned start, unsigned end); | 48 SourceRange(unsigned start, unsigned end); |
| 49 unsigned length() const; | 49 unsigned length() const; |
| 50 | 50 |
| 51 void trace(Visitor*) { } | |
| 52 | |
| 53 unsigned start; | 51 unsigned start; |
| 54 unsigned end; | 52 unsigned end; |
| 55 }; | 53 }; |
| 56 | 54 |
| 57 struct CSSPropertySourceData { | 55 struct CSSPropertySourceData { |
| 58 ALLOW_ONLY_INLINE_ALLOCATION(); | 56 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 59 public: | 57 public: |
| 60 CSSPropertySourceData(const String& name, const String& value, bool importan
t, bool disabled, bool parsedOk, const SourceRange& range); | 58 CSSPropertySourceData(const String& name, const String& value, bool importan
t, bool disabled, bool parsedOk, const SourceRange& range); |
| 61 CSSPropertySourceData(const CSSPropertySourceData& other); | 59 CSSPropertySourceData(const CSSPropertySourceData& other); |
| 62 CSSPropertySourceData(); | 60 CSSPropertySourceData(); |
| 63 | 61 |
| 64 String toString() const; | 62 String toString() const; |
| 65 unsigned hash() const; | 63 unsigned hash() const; |
| 66 | 64 |
| 67 void trace(Visitor* visitor) { visitor->trace(range); } | |
| 68 | |
| 69 String name; | 65 String name; |
| 70 String value; | 66 String value; |
| 71 bool important; | 67 bool important; |
| 72 bool disabled; | 68 bool disabled; |
| 73 bool parsedOk; | 69 bool parsedOk; |
| 74 SourceRange range; | 70 SourceRange range; |
| 75 }; | 71 }; |
| 76 | 72 |
| 77 struct CSSStyleSourceData : public RefCounted<CSSStyleSourceData> { | 73 struct CSSStyleSourceData : public RefCounted<CSSStyleSourceData> { |
| 78 static PassRefPtr<CSSStyleSourceData> create() | 74 static PassRefPtr<CSSStyleSourceData> create() |
| 79 { | 75 { |
| 80 return adoptRef(new CSSStyleSourceData()); | 76 return adoptRef(new CSSStyleSourceData()); |
| 81 } | 77 } |
| 82 | 78 |
| 83 void trace(Visitor* visitor) { visitor->trace(propertyData); } | |
| 84 | |
| 85 Vector<CSSPropertySourceData> propertyData; | 79 Vector<CSSPropertySourceData> propertyData; |
| 86 }; | 80 }; |
| 87 | 81 |
| 88 struct CSSRuleSourceData; | 82 struct CSSRuleSourceData; |
| 89 typedef Vector<RefPtr<CSSRuleSourceData> > RuleSourceDataList; | 83 typedef Vector<RefPtr<CSSRuleSourceData> > RuleSourceDataList; |
| 90 typedef Vector<SourceRange> SelectorRangeList; | 84 typedef Vector<SourceRange> SelectorRangeList; |
| 91 | 85 |
| 92 struct CSSRuleSourceData : public RefCounted<CSSRuleSourceData> { | 86 struct CSSRuleSourceData : public RefCounted<CSSRuleSourceData> { |
| 93 enum Type { | 87 enum Type { |
| 94 UNKNOWN_RULE = 0, | 88 UNKNOWN_RULE = 0, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 110 return adoptRef(new CSSRuleSourceData(UNKNOWN_RULE)); | 104 return adoptRef(new CSSRuleSourceData(UNKNOWN_RULE)); |
| 111 } | 105 } |
| 112 | 106 |
| 113 CSSRuleSourceData(Type type) | 107 CSSRuleSourceData(Type type) |
| 114 : type(type) | 108 : type(type) |
| 115 { | 109 { |
| 116 if (type == STYLE_RULE || type == FONT_FACE_RULE) | 110 if (type == STYLE_RULE || type == FONT_FACE_RULE) |
| 117 styleSourceData = CSSStyleSourceData::create(); | 111 styleSourceData = CSSStyleSourceData::create(); |
| 118 } | 112 } |
| 119 | 113 |
| 120 void trace(Visitor*); | |
| 121 | |
| 122 Type type; | 114 Type type; |
| 123 | 115 |
| 124 // Range of the selector list in the enclosing source. | 116 // Range of the selector list in the enclosing source. |
| 125 SourceRange ruleHeaderRange; | 117 SourceRange ruleHeaderRange; |
| 126 | 118 |
| 127 // Range of the rule body (e.g. style text for style rules) in the enclosing
source. | 119 // Range of the rule body (e.g. style text for style rules) in the enclosing
source. |
| 128 SourceRange ruleBodyRange; | 120 SourceRange ruleBodyRange; |
| 129 | 121 |
| 130 // Only for CSSStyleRules. | 122 // Only for CSSStyleRules. |
| 131 SelectorRangeList selectorRanges; | 123 SelectorRangeList selectorRanges; |
| 132 | 124 |
| 133 // Only for CSSStyleRules, CSSFontFaceRules. | 125 // Only for CSSStyleRules, CSSFontFaceRules. |
| 134 RefPtr<CSSStyleSourceData> styleSourceData; | 126 RefPtr<CSSStyleSourceData> styleSourceData; |
| 135 | 127 |
| 136 // Only for CSSMediaRules. | 128 // Only for CSSMediaRules. |
| 137 RuleSourceDataList childRules; | 129 RuleSourceDataList childRules; |
| 138 }; | 130 }; |
| 139 | 131 |
| 140 } // namespace blink | 132 } // namespace blink |
| 141 | 133 |
| 142 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::SourceRange); | 134 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::SourceRange); |
| 143 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::CSSPropertySourceData); | 135 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::CSSPropertySourceData); |
| 144 | 136 |
| 145 #endif // CSSPropertySourceData_h | 137 #endif // CSSPropertySourceData_h |
| OLD | NEW |