Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: Source/core/css/PropertySetCSSStyleDeclaration.h

Issue 205033007: Revert of Oilpan: Move CSSStyleDeclaration and subclasses to the heap using transistion types. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSViewportRule.cpp ('k') | Source/core/css/PropertySetCSSStyleDeclaration.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 28 matching lines...) Expand all
39 class ExceptionState; 39 class ExceptionState;
40 class MutableStylePropertySet; 40 class MutableStylePropertySet;
41 class StyleSheetContents; 41 class StyleSheetContents;
42 42
43 class AbstractPropertySetCSSStyleDeclaration : public CSSStyleDeclaration { 43 class AbstractPropertySetCSSStyleDeclaration : public CSSStyleDeclaration {
44 public: 44 public:
45 virtual Element* parentElement() const { return 0; } 45 virtual Element* parentElement() const { return 0; }
46 virtual void clearParentElement() { ASSERT_NOT_REACHED(); } 46 virtual void clearParentElement() { ASSERT_NOT_REACHED(); }
47 StyleSheetContents* contextStyleSheet() const; 47 StyleSheetContents* contextStyleSheet() const;
48 48
49 virtual void trace(Visitor*) OVERRIDE;
50
51 private: 49 private:
52 virtual CSSRule* parentRule() const OVERRIDE { return 0; } 50 virtual CSSRule* parentRule() const OVERRIDE { return 0; }
53 virtual unsigned length() const OVERRIDE FINAL; 51 virtual unsigned length() const OVERRIDE FINAL;
54 virtual String item(unsigned index) const OVERRIDE FINAL; 52 virtual String item(unsigned index) const OVERRIDE FINAL;
55 virtual PassRefPtrWillBeRawPtr<CSSValue> getPropertyCSSValue(const String& p ropertyName) OVERRIDE FINAL; 53 virtual PassRefPtrWillBeRawPtr<CSSValue> getPropertyCSSValue(const String& p ropertyName) OVERRIDE FINAL;
56 virtual String getPropertyValue(const String& propertyName) OVERRIDE FINAL; 54 virtual String getPropertyValue(const String& propertyName) OVERRIDE FINAL;
57 virtual String getPropertyPriority(const String& propertyName) OVERRIDE FINA L; 55 virtual String getPropertyPriority(const String& propertyName) OVERRIDE FINA L;
58 virtual String getPropertyShorthand(const String& propertyName) OVERRIDE FIN AL; 56 virtual String getPropertyShorthand(const String& propertyName) OVERRIDE FIN AL;
59 virtual bool isPropertyImplicit(const String& propertyName) OVERRIDE FINAL; 57 virtual bool isPropertyImplicit(const String& propertyName) OVERRIDE FINAL;
60 virtual void setProperty(const String& propertyName, const String& value, co nst String& priority, ExceptionState&) OVERRIDE FINAL; 58 virtual void setProperty(const String& propertyName, const String& value, co nst String& priority, ExceptionState&) OVERRIDE FINAL;
61 virtual String removeProperty(const String& propertyName, ExceptionState&) O VERRIDE FINAL; 59 virtual String removeProperty(const String& propertyName, ExceptionState&) O VERRIDE FINAL;
62 virtual String cssText() const OVERRIDE FINAL; 60 virtual String cssText() const OVERRIDE FINAL;
63 virtual void setCSSText(const String&, ExceptionState&) OVERRIDE FINAL; 61 virtual void setCSSText(const String&, ExceptionState&) OVERRIDE FINAL;
64 virtual PassRefPtrWillBeRawPtr<CSSValue> getPropertyCSSValueInternal(CSSProp ertyID) OVERRIDE FINAL; 62 virtual PassRefPtrWillBeRawPtr<CSSValue> getPropertyCSSValueInternal(CSSProp ertyID) OVERRIDE FINAL;
65 virtual String getPropertyValueInternal(CSSPropertyID) OVERRIDE FINAL; 63 virtual String getPropertyValueInternal(CSSPropertyID) OVERRIDE FINAL;
66 virtual void setPropertyInternal(CSSPropertyID, const String& value, bool im portant, ExceptionState&) OVERRIDE FINAL; 64 virtual void setPropertyInternal(CSSPropertyID, const String& value, bool im portant, ExceptionState&) OVERRIDE FINAL;
67 65
68 virtual bool cssPropertyMatches(CSSPropertyID, const CSSValue*) const OVERRI DE FINAL; 66 virtual bool cssPropertyMatches(CSSPropertyID, const CSSValue*) const OVERRI DE FINAL;
69 virtual PassRefPtrWillBeRawPtr<MutableStylePropertySet> copyProperties() con st OVERRIDE FINAL; 67 virtual PassRefPtrWillBeRawPtr<MutableStylePropertySet> copyProperties() con st OVERRIDE FINAL;
70 68
71 CSSValue* cloneAndCacheForCSSOM(CSSValue*); 69 CSSValue* cloneAndCacheForCSSOM(CSSValue*);
72 70
73 protected: 71 protected:
74 enum MutationType { NoChanges, PropertyChanged }; 72 enum MutationType { NoChanges, PropertyChanged };
75 virtual void willMutate() { } 73 virtual void willMutate() { }
76 virtual void didMutate(MutationType) { } 74 virtual void didMutate(MutationType) { }
77 virtual MutableStylePropertySet& propertySet() const = 0; 75 virtual MutableStylePropertySet& propertySet() const = 0;
78 76
79 OwnPtrWillBeMember<WillBeHeapHashMap<RawPtrWillBeMember<CSSValue>, RefPtrWil lBeMember<CSSValue> > > m_cssomCSSValueClones; 77 OwnPtrWillBePersistent<WillBeHeapHashMap<CSSValue*, RefPtrWillBeMember<CSSVa lue> > > m_cssomCSSValueClones;
80 }; 78 };
81 79
82 class PropertySetCSSStyleDeclaration : public AbstractPropertySetCSSStyleDeclara tion { 80 class PropertySetCSSStyleDeclaration : public AbstractPropertySetCSSStyleDeclara tion {
83 public: 81 public:
84 PropertySetCSSStyleDeclaration(MutableStylePropertySet& propertySet) : m_pro pertySet(&propertySet) { } 82 PropertySetCSSStyleDeclaration(MutableStylePropertySet& propertySet) : m_pro pertySet(&propertySet) { }
85 83
86 #if !ENABLE(OILPAN)
87 virtual void ref() OVERRIDE; 84 virtual void ref() OVERRIDE;
88 virtual void deref() OVERRIDE; 85 virtual void deref() OVERRIDE;
89 #endif
90
91 virtual void trace(Visitor*) OVERRIDE;
92 86
93 protected: 87 protected:
94 virtual MutableStylePropertySet& propertySet() const OVERRIDE FINAL { ASSERT (m_propertySet); return *m_propertySet; } 88 virtual MutableStylePropertySet& propertySet() const OVERRIDE FINAL { ASSERT (m_propertySet); return *m_propertySet; }
95 89
96 RawPtrWillBeMember<MutableStylePropertySet> m_propertySet; // Cannot be null 90 MutableStylePropertySet* m_propertySet; // Cannot be null
97 }; 91 };
98 92
99 class StyleRuleCSSStyleDeclaration FINAL : public PropertySetCSSStyleDeclaration 93 class StyleRuleCSSStyleDeclaration FINAL : public PropertySetCSSStyleDeclaration
100 { 94 {
101 public: 95 public:
102 static PassRefPtrWillBeRawPtr<StyleRuleCSSStyleDeclaration> create(MutableSt ylePropertySet& propertySet, CSSRule* parentRule) 96 static PassRefPtr<StyleRuleCSSStyleDeclaration> create(MutableStylePropertyS et& propertySet, CSSRule* parentRule)
103 { 97 {
104 return adoptRefWillBeNoop(new StyleRuleCSSStyleDeclaration(propertySet, parentRule)); 98 return adoptRef(new StyleRuleCSSStyleDeclaration(propertySet, parentRule ));
105 } 99 }
106 100
107 #if !ENABLE(OILPAN) 101 void clearParentRule() { m_parentRule = 0; }
108 void clearParentRule() { m_parentRule = nullptr; }
109 102
110 virtual void ref() OVERRIDE; 103 virtual void ref() OVERRIDE;
111 virtual void deref() OVERRIDE; 104 virtual void deref() OVERRIDE;
112 #endif
113 105
114 void reattach(MutableStylePropertySet&); 106 void reattach(MutableStylePropertySet&);
115 107
116 virtual void trace(Visitor*) OVERRIDE;
117
118 private: 108 private:
119 StyleRuleCSSStyleDeclaration(MutableStylePropertySet&, CSSRule*); 109 StyleRuleCSSStyleDeclaration(MutableStylePropertySet&, CSSRule*);
120 virtual ~StyleRuleCSSStyleDeclaration(); 110 virtual ~StyleRuleCSSStyleDeclaration();
121 111
122 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; 112 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE;
123 113
124 virtual CSSRule* parentRule() const OVERRIDE { return m_parentRule; } 114 virtual CSSRule* parentRule() const OVERRIDE { return m_parentRule; }
125 115
126 virtual void willMutate() OVERRIDE; 116 virtual void willMutate() OVERRIDE;
127 virtual void didMutate(MutationType) OVERRIDE; 117 virtual void didMutate(MutationType) OVERRIDE;
128 118
129 #if !ENABLE(OILPAN)
130 unsigned m_refCount; 119 unsigned m_refCount;
131 #endif 120 CSSRule* m_parentRule;
132 RawPtrWillBeMember<CSSRule> m_parentRule;
133 }; 121 };
134 122
135 class InlineCSSStyleDeclaration FINAL : public AbstractPropertySetCSSStyleDeclar ation 123 class InlineCSSStyleDeclaration FINAL : public AbstractPropertySetCSSStyleDeclar ation
136 { 124 {
137 public: 125 public:
138 explicit InlineCSSStyleDeclaration(Element* parentElement) 126 explicit InlineCSSStyleDeclaration(Element* parentElement)
139 : m_parentElement(parentElement) 127 : m_parentElement(parentElement)
140 { 128 {
141 } 129 }
142 130
143 virtual void trace(Visitor*) OVERRIDE;
144
145 private: 131 private:
146 virtual MutableStylePropertySet& propertySet() const OVERRIDE; 132 virtual MutableStylePropertySet& propertySet() const OVERRIDE;
147 #if !ENABLE(OILPAN)
148 virtual void ref() OVERRIDE; 133 virtual void ref() OVERRIDE;
149 virtual void deref() OVERRIDE; 134 virtual void deref() OVERRIDE;
150 #endif
151 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; 135 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE;
152 virtual Element* parentElement() const OVERRIDE { return m_parentElement; } 136 virtual Element* parentElement() const OVERRIDE { return m_parentElement; }
153 virtual void clearParentElement() OVERRIDE { m_parentElement = 0; } 137 virtual void clearParentElement() OVERRIDE { m_parentElement = 0; }
154 138
155 virtual void didMutate(MutationType) OVERRIDE; 139 virtual void didMutate(MutationType) OVERRIDE;
156 140
157 Element* m_parentElement; 141 Element* m_parentElement;
158 }; 142 };
159 143
160 } // namespace WebCore 144 } // namespace WebCore
161 145
162 #endif 146 #endif
OLDNEW
« no previous file with comments | « Source/core/css/CSSViewportRule.cpp ('k') | Source/core/css/PropertySetCSSStyleDeclaration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698