| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) | 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) |
| 4 * Copyright (C) 2002, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved. | 4 * Copyright (C) 2002, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 PassRefPtr<CSSRule> StyleRuleBase::createCSSOMWrapper(CSSStyleSheet* parentSheet
) const | 41 PassRefPtr<CSSRule> StyleRuleBase::createCSSOMWrapper(CSSStyleSheet* parentSheet
) const |
| 42 { | 42 { |
| 43 return createCSSOMWrapper(parentSheet, 0); | 43 return createCSSOMWrapper(parentSheet, 0); |
| 44 } | 44 } |
| 45 | 45 |
| 46 PassRefPtr<CSSRule> StyleRuleBase::createCSSOMWrapper(CSSRule* parentRule) const | 46 PassRefPtr<CSSRule> StyleRuleBase::createCSSOMWrapper(CSSRule* parentRule) const |
| 47 { | 47 { |
| 48 return createCSSOMWrapper(0, parentRule); | 48 return createCSSOMWrapper(0, parentRule); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void StyleRuleBase::trace(Visitor* visitor) | |
| 52 { | |
| 53 switch (type()) { | |
| 54 case Style: | |
| 55 toStyleRule(this)->traceAfterDispatch(visitor); | |
| 56 return; | |
| 57 case FontFace: | |
| 58 toStyleRuleFontFace(this)->traceAfterDispatch(visitor); | |
| 59 return; | |
| 60 case Media: | |
| 61 toStyleRuleMedia(this)->traceAfterDispatch(visitor); | |
| 62 return; | |
| 63 case Supports: | |
| 64 toStyleRuleSupports(this)->traceAfterDispatch(visitor); | |
| 65 return; | |
| 66 case Keyframes: | |
| 67 toStyleRuleKeyframes(this)->traceAfterDispatch(visitor); | |
| 68 return; | |
| 69 case Filter: | |
| 70 toStyleRuleFilter(this)->traceAfterDispatch(visitor); | |
| 71 return; | |
| 72 case Unknown: | |
| 73 case Keyframe: | |
| 74 ASSERT_NOT_REACHED(); | |
| 75 return; | |
| 76 } | |
| 77 ASSERT_NOT_REACHED(); | |
| 78 } | |
| 79 | |
| 80 void StyleRuleBase::finalizeGarbageCollectedObject() | |
| 81 { | |
| 82 switch (type()) { | |
| 83 case Style: | |
| 84 toStyleRule(this)->~StyleRule(); | |
| 85 return; | |
| 86 case FontFace: | |
| 87 toStyleRuleFontFace(this)->~StyleRuleFontFace(); | |
| 88 return; | |
| 89 case Media: | |
| 90 toStyleRuleMedia(this)->~StyleRuleMedia(); | |
| 91 return; | |
| 92 case Supports: | |
| 93 toStyleRuleSupports(this)->~StyleRuleSupports(); | |
| 94 return; | |
| 95 case Keyframes: | |
| 96 toStyleRuleKeyframes(this)->~StyleRuleKeyframes(); | |
| 97 return; | |
| 98 case Filter: | |
| 99 toStyleRuleFilter(this)->~StyleRuleFilter(); | |
| 100 return; | |
| 101 case Unknown: | |
| 102 case Keyframe: | |
| 103 ASSERT_NOT_REACHED(); | |
| 104 return; | |
| 105 } | |
| 106 ASSERT_NOT_REACHED(); | |
| 107 } | |
| 108 | |
| 109 void StyleRuleBase::destroy() | 51 void StyleRuleBase::destroy() |
| 110 { | 52 { |
| 111 switch (type()) { | 53 switch (type()) { |
| 112 case Style: | 54 case Style: |
| 113 delete toStyleRule(this); | 55 delete toStyleRule(this); |
| 114 return; | 56 return; |
| 115 case FontFace: | 57 case FontFace: |
| 116 delete toStyleRuleFontFace(this); | 58 delete toStyleRuleFontFace(this); |
| 117 return; | 59 return; |
| 118 case Media: | 60 case Media: |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 if (!m_properties->isMutable()) | 160 if (!m_properties->isMutable()) |
| 219 m_properties = m_properties->mutableCopy(); | 161 m_properties = m_properties->mutableCopy(); |
| 220 return *toMutableStylePropertySet(m_properties.get()); | 162 return *toMutableStylePropertySet(m_properties.get()); |
| 221 } | 163 } |
| 222 | 164 |
| 223 void StyleRule::setProperties(PassRefPtr<StylePropertySet> properties) | 165 void StyleRule::setProperties(PassRefPtr<StylePropertySet> properties) |
| 224 { | 166 { |
| 225 m_properties = properties; | 167 m_properties = properties; |
| 226 } | 168 } |
| 227 | 169 |
| 228 void StyleRule::traceAfterDispatch(Visitor* visitor) | |
| 229 { | |
| 230 visitor->trace(m_properties); | |
| 231 StyleRuleBase::traceAfterDispatch(visitor); | |
| 232 } | |
| 233 | |
| 234 StyleRuleFontFace::StyleRuleFontFace() | 170 StyleRuleFontFace::StyleRuleFontFace() |
| 235 : StyleRuleBase(FontFace) | 171 : StyleRuleBase(FontFace) |
| 236 { | 172 { |
| 237 } | 173 } |
| 238 | 174 |
| 239 StyleRuleFontFace::StyleRuleFontFace(const StyleRuleFontFace& o) | 175 StyleRuleFontFace::StyleRuleFontFace(const StyleRuleFontFace& o) |
| 240 : StyleRuleBase(o) | 176 : StyleRuleBase(o) |
| 241 , m_properties(o.m_properties->mutableCopy()) | 177 , m_properties(o.m_properties->mutableCopy()) |
| 242 { | 178 { |
| 243 } | 179 } |
| 244 | 180 |
| 245 StyleRuleFontFace::~StyleRuleFontFace() | 181 StyleRuleFontFace::~StyleRuleFontFace() |
| 246 { | 182 { |
| 247 } | 183 } |
| 248 | 184 |
| 249 MutableStylePropertySet& StyleRuleFontFace::mutableProperties() | 185 MutableStylePropertySet& StyleRuleFontFace::mutableProperties() |
| 250 { | 186 { |
| 251 if (!m_properties->isMutable()) | 187 if (!m_properties->isMutable()) |
| 252 m_properties = m_properties->mutableCopy(); | 188 m_properties = m_properties->mutableCopy(); |
| 253 return *toMutableStylePropertySet(m_properties); | 189 return *toMutableStylePropertySet(m_properties); |
| 254 } | 190 } |
| 255 | 191 |
| 256 void StyleRuleFontFace::setProperties(PassRefPtr<StylePropertySet> properties) | 192 void StyleRuleFontFace::setProperties(PassRefPtr<StylePropertySet> properties) |
| 257 { | 193 { |
| 258 m_properties = properties; | 194 m_properties = properties; |
| 259 } | 195 } |
| 260 | 196 |
| 261 void StyleRuleFontFace::traceAfterDispatch(Visitor* visitor) | |
| 262 { | |
| 263 visitor->trace(m_properties); | |
| 264 StyleRuleBase::traceAfterDispatch(visitor); | |
| 265 } | |
| 266 | |
| 267 StyleRuleGroup::StyleRuleGroup(Type type, Vector<RefPtr<StyleRuleBase> >& adoptR
ule) | 197 StyleRuleGroup::StyleRuleGroup(Type type, Vector<RefPtr<StyleRuleBase> >& adoptR
ule) |
| 268 : StyleRuleBase(type) | 198 : StyleRuleBase(type) |
| 269 { | 199 { |
| 270 m_childRules.swap(adoptRule); | 200 m_childRules.swap(adoptRule); |
| 271 } | 201 } |
| 272 | 202 |
| 273 StyleRuleGroup::StyleRuleGroup(const StyleRuleGroup& o) | 203 StyleRuleGroup::StyleRuleGroup(const StyleRuleGroup& o) |
| 274 : StyleRuleBase(o) | 204 : StyleRuleBase(o) |
| 275 , m_childRules(o.m_childRules.size()) | 205 , m_childRules(o.m_childRules.size()) |
| 276 { | 206 { |
| 277 for (unsigned i = 0; i < m_childRules.size(); ++i) | 207 for (unsigned i = 0; i < m_childRules.size(); ++i) |
| 278 m_childRules[i] = o.m_childRules[i]->copy(); | 208 m_childRules[i] = o.m_childRules[i]->copy(); |
| 279 } | 209 } |
| 280 | 210 |
| 281 void StyleRuleGroup::wrapperInsertRule(unsigned index, PassRefPtr<StyleRuleBase>
rule) | 211 void StyleRuleGroup::wrapperInsertRule(unsigned index, PassRefPtr<StyleRuleBase>
rule) |
| 282 { | 212 { |
| 283 m_childRules.insert(index, rule); | 213 m_childRules.insert(index, rule); |
| 284 } | 214 } |
| 285 | 215 |
| 286 void StyleRuleGroup::wrapperRemoveRule(unsigned index) | 216 void StyleRuleGroup::wrapperRemoveRule(unsigned index) |
| 287 { | 217 { |
| 288 m_childRules.remove(index); | 218 m_childRules.remove(index); |
| 289 } | 219 } |
| 290 | 220 |
| 291 void StyleRuleGroup::traceAfterDispatch(Visitor* visitor) | |
| 292 { | |
| 293 visitor->trace(m_childRules); | |
| 294 StyleRuleBase::traceAfterDispatch(visitor); | |
| 295 } | |
| 296 | |
| 297 StyleRuleMedia::StyleRuleMedia(PassRefPtr<MediaQuerySet> media, Vector<RefPtr<St
yleRuleBase> >& adoptRules) | 221 StyleRuleMedia::StyleRuleMedia(PassRefPtr<MediaQuerySet> media, Vector<RefPtr<St
yleRuleBase> >& adoptRules) |
| 298 : StyleRuleGroup(Media, adoptRules) | 222 : StyleRuleGroup(Media, adoptRules) |
| 299 , m_mediaQueries(media) | 223 , m_mediaQueries(media) |
| 300 { | 224 { |
| 301 } | 225 } |
| 302 | 226 |
| 303 StyleRuleMedia::StyleRuleMedia(const StyleRuleMedia& o) | 227 StyleRuleMedia::StyleRuleMedia(const StyleRuleMedia& o) |
| 304 : StyleRuleGroup(o) | 228 : StyleRuleGroup(o) |
| 305 { | 229 { |
| 306 if (o.m_mediaQueries) | 230 if (o.m_mediaQueries) |
| 307 m_mediaQueries = o.m_mediaQueries->copy(); | 231 m_mediaQueries = o.m_mediaQueries->copy(); |
| 308 } | 232 } |
| 309 | 233 |
| 310 void StyleRuleMedia::traceAfterDispatch(Visitor* visitor) | |
| 311 { | |
| 312 visitor->trace(m_mediaQueries); | |
| 313 StyleRuleGroup::traceAfterDispatch(visitor); | |
| 314 } | |
| 315 | |
| 316 StyleRuleSupports::StyleRuleSupports(const String& conditionText, bool condition
IsSupported, Vector<RefPtr<StyleRuleBase> >& adoptRules) | 234 StyleRuleSupports::StyleRuleSupports(const String& conditionText, bool condition
IsSupported, Vector<RefPtr<StyleRuleBase> >& adoptRules) |
| 317 : StyleRuleGroup(Supports, adoptRules) | 235 : StyleRuleGroup(Supports, adoptRules) |
| 318 , m_conditionText(conditionText) | 236 , m_conditionText(conditionText) |
| 319 , m_conditionIsSupported(conditionIsSupported) | 237 , m_conditionIsSupported(conditionIsSupported) |
| 320 { | 238 { |
| 321 } | 239 } |
| 322 | 240 |
| 323 StyleRuleSupports::StyleRuleSupports(const StyleRuleSupports& o) | 241 StyleRuleSupports::StyleRuleSupports(const StyleRuleSupports& o) |
| 324 : StyleRuleGroup(o) | 242 : StyleRuleGroup(o) |
| 325 , m_conditionText(o.m_conditionText) | 243 , m_conditionText(o.m_conditionText) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 349 if (!m_properties->isMutable()) | 267 if (!m_properties->isMutable()) |
| 350 m_properties = m_properties->mutableCopy(); | 268 m_properties = m_properties->mutableCopy(); |
| 351 return *toMutableStylePropertySet(m_properties); | 269 return *toMutableStylePropertySet(m_properties); |
| 352 } | 270 } |
| 353 | 271 |
| 354 void StyleRuleFilter::setProperties(PassRefPtr<StylePropertySet> properties) | 272 void StyleRuleFilter::setProperties(PassRefPtr<StylePropertySet> properties) |
| 355 { | 273 { |
| 356 m_properties = properties; | 274 m_properties = properties; |
| 357 } | 275 } |
| 358 | 276 |
| 359 void StyleRuleFilter::traceAfterDispatch(Visitor* visitor) | |
| 360 { | |
| 361 visitor->trace(m_properties); | |
| 362 StyleRuleBase::traceAfterDispatch(visitor); | |
| 363 } | |
| 364 | |
| 365 } // namespace blink | 277 } // namespace blink |
| OLD | NEW |