1 // Copyright 2019 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PROPERTY_RULE_H_
6 #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PROPERTY_RULE_H_
7 
8 #include "third_party/blink/renderer/core/css/css_rule.h"
9 #include "third_party/blink/renderer/platform/heap/handle.h"
10 #include "third_party/blink/renderer/platform/wtf/casting.h"
11 
12 namespace blink {
13 
14 class CSSStyleDeclaration;
15 class StyleRuleProperty;
16 class StyleRuleCSSStyleDeclaration;
17 
18 class CSSPropertyRule final : public CSSRule {
19   DEFINE_WRAPPERTYPEINFO();
20 
21  public:
22   CSSPropertyRule(StyleRuleProperty*, CSSStyleSheet*);
23   ~CSSPropertyRule() override;
24 
25   String cssText() const override;
26   void Reattach(StyleRuleBase*) override;
27 
28   CSSStyleDeclaration* style() const;
29 
30   void Trace(Visitor*) override;
31 
32  private:
type()33   CSSRule::Type type() const override { return kPropertyRule; }
34 
35   Member<StyleRuleProperty> property_rule_;
36   mutable Member<StyleRuleCSSStyleDeclaration> properties_cssom_wrapper_;
37 };
38 
39 template <>
40 struct DowncastTraits<CSSPropertyRule> {
41   static bool AllowFrom(const CSSRule& rule) {
42     return rule.type() == CSSRule::kPropertyRule;
43   }
44 };
45 
46 }  // namespace blink
47 
48 #endif  // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_PROPERTY_RULE_H_
49