| 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, 2006, 2008, 2012, 2013 Apple Inc. All rights reserved. | 4 * Copyright (C) 2002, 2006, 2008, 2012, 2013 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 unsigned m_type : 5; | 92 unsigned m_type : 5; |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 class CORE_EXPORT StyleRule : public StyleRuleBase { | 95 class CORE_EXPORT StyleRule : public StyleRuleBase { |
| 96 public: | 96 public: |
| 97 // Adopts the selector list | 97 // Adopts the selector list |
| 98 static StyleRule* create(CSSSelectorList selectorList, | 98 static StyleRule* create(CSSSelectorList selectorList, |
| 99 StylePropertySet* properties) { | 99 StylePropertySet* properties) { |
| 100 return new StyleRule(std::move(selectorList), properties); | 100 return new StyleRule(std::move(selectorList), properties); |
| 101 } | 101 } |
| 102 static StyleRule* createLazy( |
| 103 CSSSelectorList selectorList, |
| 104 std::unique_ptr<DeferredPropertiesClosure> deferredProperties) { |
| 105 return new StyleRule(std::move(selectorList), |
| 106 std::move(deferredProperties)); |
| 107 } |
| 102 | 108 |
| 103 ~StyleRule(); | 109 ~StyleRule(); |
| 104 | 110 |
| 105 const CSSSelectorList& selectorList() const { return m_selectorList; } | 111 const CSSSelectorList& selectorList() const { return m_selectorList; } |
| 106 const StylePropertySet& properties() const { return *m_properties; } | 112 const StylePropertySet& properties() const; |
| 107 MutableStylePropertySet& mutableProperties(); | 113 MutableStylePropertySet& mutableProperties(); |
| 108 | 114 |
| 109 void wrapperAdoptSelectorList(CSSSelectorList selectors) { | 115 void wrapperAdoptSelectorList(CSSSelectorList selectors) { |
| 110 m_selectorList = std::move(selectors); | 116 m_selectorList = std::move(selectors); |
| 111 } | 117 } |
| 112 | 118 |
| 113 StyleRule* copy() const { return new StyleRule(*this); } | 119 StyleRule* copy() const { return new StyleRule(*this); } |
| 114 | 120 |
| 115 static unsigned averageSizeInBytes(); | 121 static unsigned averageSizeInBytes(); |
| 116 | 122 |
| 123 // Helper methods to avoid parsing lazy properties when not needed. |
| 124 bool propertiesHaveFailedOrCanceledSubresources() const; |
| 125 bool shouldConsiderForMatchingRules(bool includeEmptyRules) const; |
| 126 |
| 117 DECLARE_TRACE_AFTER_DISPATCH(); | 127 DECLARE_TRACE_AFTER_DISPATCH(); |
| 118 | 128 |
| 119 private: | 129 private: |
| 120 StyleRule(CSSSelectorList, StylePropertySet*); | 130 StyleRule(CSSSelectorList, StylePropertySet*); |
| 131 StyleRule(CSSSelectorList, std::unique_ptr<DeferredPropertiesClosure>); |
| 121 StyleRule(const StyleRule&); | 132 StyleRule(const StyleRule&); |
| 122 | 133 |
| 123 Member<StylePropertySet> m_properties; // Cannot be null. | |
| 124 CSSSelectorList m_selectorList; | 134 CSSSelectorList m_selectorList; |
| 135 mutable Member<StylePropertySet> m_properties; |
| 136 mutable std::unique_ptr<DeferredPropertiesClosure> m_deferred; |
| 125 }; | 137 }; |
| 126 | 138 |
| 127 class StyleRuleFontFace : public StyleRuleBase { | 139 class StyleRuleFontFace : public StyleRuleBase { |
| 128 public: | 140 public: |
| 129 static StyleRuleFontFace* create(StylePropertySet* properties) { | 141 static StyleRuleFontFace* create(StylePropertySet* properties) { |
| 130 return new StyleRuleFontFace(properties); | 142 return new StyleRuleFontFace(properties); |
| 131 } | 143 } |
| 132 | 144 |
| 133 ~StyleRuleFontFace(); | 145 ~StyleRuleFontFace(); |
| 134 | 146 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 DEFINE_STYLE_RULE_TYPE_CASTS(FontFace); | 301 DEFINE_STYLE_RULE_TYPE_CASTS(FontFace); |
| 290 DEFINE_STYLE_RULE_TYPE_CASTS(Page); | 302 DEFINE_STYLE_RULE_TYPE_CASTS(Page); |
| 291 DEFINE_STYLE_RULE_TYPE_CASTS(Media); | 303 DEFINE_STYLE_RULE_TYPE_CASTS(Media); |
| 292 DEFINE_STYLE_RULE_TYPE_CASTS(Supports); | 304 DEFINE_STYLE_RULE_TYPE_CASTS(Supports); |
| 293 DEFINE_STYLE_RULE_TYPE_CASTS(Viewport); | 305 DEFINE_STYLE_RULE_TYPE_CASTS(Viewport); |
| 294 DEFINE_STYLE_RULE_TYPE_CASTS(Charset); | 306 DEFINE_STYLE_RULE_TYPE_CASTS(Charset); |
| 295 | 307 |
| 296 } // namespace blink | 308 } // namespace blink |
| 297 | 309 |
| 298 #endif // StyleRule_h | 310 #endif // StyleRule_h |
| OLD | NEW |