| 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(CSSSelectorList selectorList, |
| 103 CSSLazyPropertyParser* lazyPropertyParser) { |
| 104 return new StyleRule(std::move(selectorList), lazyPropertyParser); |
| 105 } |
| 102 | 106 |
| 103 ~StyleRule(); | 107 ~StyleRule(); |
| 104 | 108 |
| 105 const CSSSelectorList& selectorList() const { return m_selectorList; } | 109 const CSSSelectorList& selectorList() const { return m_selectorList; } |
| 106 const StylePropertySet& properties() const { return *m_properties; } | 110 const StylePropertySet& properties() const; |
| 107 MutableStylePropertySet& mutableProperties(); | 111 MutableStylePropertySet& mutableProperties(); |
| 108 | 112 |
| 109 void wrapperAdoptSelectorList(CSSSelectorList selectors) { | 113 void wrapperAdoptSelectorList(CSSSelectorList selectors) { |
| 110 m_selectorList = std::move(selectors); | 114 m_selectorList = std::move(selectors); |
| 111 } | 115 } |
| 112 | 116 |
| 113 StyleRule* copy() const { return new StyleRule(*this); } | 117 StyleRule* copy() const { return new StyleRule(*this); } |
| 114 | 118 |
| 115 static unsigned averageSizeInBytes(); | 119 static unsigned averageSizeInBytes(); |
| 116 | 120 |
| 121 // Helper methods to avoid parsing lazy properties when not needed. |
| 122 bool propertiesHaveFailedOrCanceledSubresources() const; |
| 123 bool shouldConsiderForMatchingRules(bool includeEmptyRules) const; |
| 124 |
| 117 DECLARE_TRACE_AFTER_DISPATCH(); | 125 DECLARE_TRACE_AFTER_DISPATCH(); |
| 118 | 126 |
| 119 private: | 127 private: |
| 120 StyleRule(CSSSelectorList, StylePropertySet*); | 128 StyleRule(CSSSelectorList, StylePropertySet*); |
| 129 StyleRule(CSSSelectorList, CSSLazyPropertyParser*); |
| 121 StyleRule(const StyleRule&); | 130 StyleRule(const StyleRule&); |
| 122 | 131 |
| 123 Member<StylePropertySet> m_properties; // Cannot be null. | |
| 124 CSSSelectorList m_selectorList; | 132 CSSSelectorList m_selectorList; |
| 133 mutable Member<StylePropertySet> m_properties; |
| 134 mutable Member<CSSLazyPropertyParser> m_lazyPropertyParser; |
| 125 }; | 135 }; |
| 126 | 136 |
| 127 class StyleRuleFontFace : public StyleRuleBase { | 137 class StyleRuleFontFace : public StyleRuleBase { |
| 128 public: | 138 public: |
| 129 static StyleRuleFontFace* create(StylePropertySet* properties) { | 139 static StyleRuleFontFace* create(StylePropertySet* properties) { |
| 130 return new StyleRuleFontFace(properties); | 140 return new StyleRuleFontFace(properties); |
| 131 } | 141 } |
| 132 | 142 |
| 133 ~StyleRuleFontFace(); | 143 ~StyleRuleFontFace(); |
| 134 | 144 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 DEFINE_STYLE_RULE_TYPE_CASTS(FontFace); | 315 DEFINE_STYLE_RULE_TYPE_CASTS(FontFace); |
| 306 DEFINE_STYLE_RULE_TYPE_CASTS(Page); | 316 DEFINE_STYLE_RULE_TYPE_CASTS(Page); |
| 307 DEFINE_STYLE_RULE_TYPE_CASTS(Media); | 317 DEFINE_STYLE_RULE_TYPE_CASTS(Media); |
| 308 DEFINE_STYLE_RULE_TYPE_CASTS(Supports); | 318 DEFINE_STYLE_RULE_TYPE_CASTS(Supports); |
| 309 DEFINE_STYLE_RULE_TYPE_CASTS(Viewport); | 319 DEFINE_STYLE_RULE_TYPE_CASTS(Viewport); |
| 310 DEFINE_STYLE_RULE_TYPE_CASTS(Charset); | 320 DEFINE_STYLE_RULE_TYPE_CASTS(Charset); |
| 311 | 321 |
| 312 } // namespace blink | 322 } // namespace blink |
| 313 | 323 |
| 314 #endif // StyleRule_h | 324 #endif // StyleRule_h |
| OLD | NEW |