| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 } | 204 } |
| 205 | 205 |
| 206 unsigned StyleRule::AverageSizeInBytes() { | 206 unsigned StyleRule::AverageSizeInBytes() { |
| 207 return sizeof(StyleRule) + sizeof(CSSSelector) + | 207 return sizeof(StyleRule) + sizeof(CSSSelector) + |
| 208 StylePropertySet::AverageSizeInBytes(); | 208 StylePropertySet::AverageSizeInBytes(); |
| 209 } | 209 } |
| 210 | 210 |
| 211 StyleRule::StyleRule(CSSSelectorList selector_list, | 211 StyleRule::StyleRule(CSSSelectorList selector_list, |
| 212 StylePropertySet* properties) | 212 StylePropertySet* properties) |
| 213 : StyleRuleBase(kStyle), | 213 : StyleRuleBase(kStyle), |
| 214 should_consider_for_matching_rules_(kConsiderIfNonEmpty), |
| 214 selector_list_(std::move(selector_list)), | 215 selector_list_(std::move(selector_list)), |
| 215 properties_(properties), | 216 properties_(properties) {} |
| 216 should_consider_for_matching_rules_(kConsiderIfNonEmpty) {} | |
| 217 | 217 |
| 218 StyleRule::StyleRule(CSSSelectorList selector_list, | 218 StyleRule::StyleRule(CSSSelectorList selector_list, |
| 219 CSSLazyPropertyParser* lazy_property_parser) | 219 CSSLazyPropertyParser* lazy_property_parser) |
| 220 : StyleRuleBase(kStyle), | 220 : StyleRuleBase(kStyle), |
| 221 should_consider_for_matching_rules_(kAlwaysConsider), |
| 221 selector_list_(std::move(selector_list)), | 222 selector_list_(std::move(selector_list)), |
| 222 lazy_property_parser_(lazy_property_parser), | 223 lazy_property_parser_(lazy_property_parser) {} |
| 223 should_consider_for_matching_rules_(kAlwaysConsider) {} | |
| 224 | 224 |
| 225 const StylePropertySet& StyleRule::Properties() const { | 225 const StylePropertySet& StyleRule::Properties() const { |
| 226 if (!properties_) { | 226 if (!properties_) { |
| 227 properties_ = lazy_property_parser_->ParseProperties(); | 227 properties_ = lazy_property_parser_->ParseProperties(); |
| 228 lazy_property_parser_.Clear(); | 228 lazy_property_parser_.Clear(); |
| 229 } | 229 } |
| 230 return *properties_; | 230 return *properties_; |
| 231 } | 231 } |
| 232 | 232 |
| 233 StyleRule::StyleRule(const StyleRule& o) | 233 StyleRule::StyleRule(const StyleRule& o) |
| 234 : StyleRuleBase(o), | 234 : StyleRuleBase(o), |
| 235 should_consider_for_matching_rules_(kConsiderIfNonEmpty), |
| 235 selector_list_(o.selector_list_.Copy()), | 236 selector_list_(o.selector_list_.Copy()), |
| 236 properties_(o.Properties().MutableCopy()), | 237 properties_(o.Properties().MutableCopy()) {} |
| 237 should_consider_for_matching_rules_(kConsiderIfNonEmpty) {} | |
| 238 | 238 |
| 239 StyleRule::~StyleRule() {} | 239 StyleRule::~StyleRule() {} |
| 240 | 240 |
| 241 MutableStylePropertySet& StyleRule::MutableProperties() { | 241 MutableStylePropertySet& StyleRule::MutableProperties() { |
| 242 // Ensure properties_ is initialized. | 242 // Ensure properties_ is initialized. |
| 243 if (!Properties().IsMutable()) | 243 if (!Properties().IsMutable()) |
| 244 properties_ = properties_->MutableCopy(); | 244 properties_ = properties_->MutableCopy(); |
| 245 return *ToMutableStylePropertySet(properties_.Get()); | 245 return *ToMutableStylePropertySet(properties_.Get()); |
| 246 } | 246 } |
| 247 | 247 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 properties_ = properties_->MutableCopy(); | 393 properties_ = properties_->MutableCopy(); |
| 394 return *ToMutableStylePropertySet(properties_); | 394 return *ToMutableStylePropertySet(properties_); |
| 395 } | 395 } |
| 396 | 396 |
| 397 DEFINE_TRACE_AFTER_DISPATCH(StyleRuleViewport) { | 397 DEFINE_TRACE_AFTER_DISPATCH(StyleRuleViewport) { |
| 398 visitor->Trace(properties_); | 398 visitor->Trace(properties_); |
| 399 StyleRuleBase::TraceAfterDispatch(visitor); | 399 StyleRuleBase::TraceAfterDispatch(visitor); |
| 400 } | 400 } |
| 401 | 401 |
| 402 } // namespace blink | 402 } // namespace blink |
| OLD | NEW |