OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 virtual bool cssPropertyMatches(CSSPropertyID, const CSSValue*) const OVERRI
DE FINAL; | 66 virtual bool cssPropertyMatches(CSSPropertyID, const CSSValue*) const OVERRI
DE FINAL; |
67 virtual PassRefPtr<MutableStylePropertySet> copyProperties() const OVERRIDE
FINAL; | 67 virtual PassRefPtr<MutableStylePropertySet> copyProperties() const OVERRIDE
FINAL; |
68 | 68 |
69 CSSValue* cloneAndCacheForCSSOM(CSSValue*); | 69 CSSValue* cloneAndCacheForCSSOM(CSSValue*); |
70 | 70 |
71 protected: | 71 protected: |
72 enum MutationType { NoChanges, PropertyChanged }; | 72 enum MutationType { NoChanges, PropertyChanged }; |
73 virtual void willMutate() { } | 73 virtual void willMutate() { } |
74 virtual void didMutate(MutationType) { } | 74 virtual void didMutate(MutationType) { } |
75 virtual MutableStylePropertySet* propertySet() const = 0; | 75 virtual MutableStylePropertySet& propertySet() const = 0; |
76 | 76 |
77 OwnPtrWillBePersistent<WillBeHeapHashMap<CSSValue*, RefPtrWillBeMember<CSSVa
lue> > > m_cssomCSSValueClones; | 77 OwnPtrWillBePersistent<WillBeHeapHashMap<CSSValue*, RefPtrWillBeMember<CSSVa
lue> > > m_cssomCSSValueClones; |
78 }; | 78 }; |
79 | 79 |
80 class PropertySetCSSStyleDeclaration : public AbstractPropertySetCSSStyleDeclara
tion { | 80 class PropertySetCSSStyleDeclaration : public AbstractPropertySetCSSStyleDeclara
tion { |
81 public: | 81 public: |
82 PropertySetCSSStyleDeclaration(MutableStylePropertySet* propertySet) : m_pro
pertySet(propertySet) { } | 82 PropertySetCSSStyleDeclaration(MutableStylePropertySet& propertySet) : m_pro
pertySet(&propertySet) { } |
83 | 83 |
84 virtual void ref() OVERRIDE; | 84 virtual void ref() OVERRIDE; |
85 virtual void deref() OVERRIDE; | 85 virtual void deref() OVERRIDE; |
86 | 86 |
87 protected: | 87 protected: |
88 virtual MutableStylePropertySet* propertySet() const OVERRIDE FINAL { return
m_propertySet; } | 88 virtual MutableStylePropertySet& propertySet() const OVERRIDE FINAL { ASSERT
(m_propertySet); return *m_propertySet; } |
89 | 89 |
90 MutableStylePropertySet* m_propertySet; | 90 MutableStylePropertySet* m_propertySet; // Cannot be null |
91 }; | 91 }; |
92 | 92 |
93 class StyleRuleCSSStyleDeclaration FINAL : public PropertySetCSSStyleDeclaration | 93 class StyleRuleCSSStyleDeclaration FINAL : public PropertySetCSSStyleDeclaration |
94 { | 94 { |
95 public: | 95 public: |
96 static PassRefPtr<StyleRuleCSSStyleDeclaration> create(MutableStylePropertyS
et* propertySet, CSSRule* parentRule) | 96 static PassRefPtr<StyleRuleCSSStyleDeclaration> create(MutableStylePropertyS
et& propertySet, CSSRule* parentRule) |
97 { | 97 { |
98 return adoptRef(new StyleRuleCSSStyleDeclaration(propertySet, parentRule
)); | 98 return adoptRef(new StyleRuleCSSStyleDeclaration(propertySet, parentRule
)); |
99 } | 99 } |
100 | 100 |
101 void clearParentRule() { m_parentRule = 0; } | 101 void clearParentRule() { m_parentRule = 0; } |
102 | 102 |
103 virtual void ref() OVERRIDE; | 103 virtual void ref() OVERRIDE; |
104 virtual void deref() OVERRIDE; | 104 virtual void deref() OVERRIDE; |
105 | 105 |
106 void reattach(MutableStylePropertySet*); | 106 void reattach(MutableStylePropertySet&); |
107 | 107 |
108 private: | 108 private: |
109 StyleRuleCSSStyleDeclaration(MutableStylePropertySet*, CSSRule*); | 109 StyleRuleCSSStyleDeclaration(MutableStylePropertySet&, CSSRule*); |
110 virtual ~StyleRuleCSSStyleDeclaration(); | 110 virtual ~StyleRuleCSSStyleDeclaration(); |
111 | 111 |
112 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; | 112 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; |
113 | 113 |
114 virtual CSSRule* parentRule() const OVERRIDE { return m_parentRule; } | 114 virtual CSSRule* parentRule() const OVERRIDE { return m_parentRule; } |
115 | 115 |
116 virtual void willMutate() OVERRIDE; | 116 virtual void willMutate() OVERRIDE; |
117 virtual void didMutate(MutationType) OVERRIDE; | 117 virtual void didMutate(MutationType) OVERRIDE; |
118 | 118 |
119 unsigned m_refCount; | 119 unsigned m_refCount; |
120 CSSRule* m_parentRule; | 120 CSSRule* m_parentRule; |
121 }; | 121 }; |
122 | 122 |
123 class InlineCSSStyleDeclaration FINAL : public AbstractPropertySetCSSStyleDeclar
ation | 123 class InlineCSSStyleDeclaration FINAL : public AbstractPropertySetCSSStyleDeclar
ation |
124 { | 124 { |
125 public: | 125 public: |
126 explicit InlineCSSStyleDeclaration(Element* parentElement) | 126 explicit InlineCSSStyleDeclaration(Element* parentElement) |
127 : m_parentElement(parentElement) | 127 : m_parentElement(parentElement) |
128 { | 128 { |
129 } | 129 } |
130 | 130 |
131 private: | 131 private: |
132 virtual MutableStylePropertySet* propertySet() const OVERRIDE; | 132 virtual MutableStylePropertySet& propertySet() const OVERRIDE; |
133 virtual void ref() OVERRIDE; | 133 virtual void ref() OVERRIDE; |
134 virtual void deref() OVERRIDE; | 134 virtual void deref() OVERRIDE; |
135 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; | 135 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; |
136 virtual Element* parentElement() const OVERRIDE { return m_parentElement; } | 136 virtual Element* parentElement() const OVERRIDE { return m_parentElement; } |
137 virtual void clearParentElement() OVERRIDE { m_parentElement = 0; } | 137 virtual void clearParentElement() OVERRIDE { m_parentElement = 0; } |
138 | 138 |
139 virtual void didMutate(MutationType) OVERRIDE; | 139 virtual void didMutate(MutationType) OVERRIDE; |
140 | 140 |
141 Element* m_parentElement; | 141 Element* m_parentElement; |
142 }; | 142 }; |
143 | 143 |
144 } // namespace WebCore | 144 } // namespace WebCore |
145 | 145 |
146 #endif | 146 #endif |
OLD | NEW |