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 |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef PropertySetCSSStyleDeclaration_h | 26 #ifndef PropertySetCSSStyleDeclaration_h |
27 #define PropertySetCSSStyleDeclaration_h | 27 #define PropertySetCSSStyleDeclaration_h |
28 | 28 |
29 #include "CSSStyleDeclaration.h" | 29 #include "CSSStyleDeclaration.h" |
| 30 #include <wtf/OwnPtr.h> |
30 #include <wtf/HashMap.h> | 31 #include <wtf/HashMap.h> |
31 | 32 |
32 namespace WebCore { | 33 namespace WebCore { |
33 | 34 |
34 class CSSRule; | 35 class CSSRule; |
35 class CSSProperty; | 36 class CSSProperty; |
36 class CSSValue; | 37 class CSSValue; |
37 class StylePropertySet; | 38 class StylePropertySet; |
38 class StyleSheetContents; | 39 class StyleSheetContents; |
39 class StyledElement; | 40 class StyledElement; |
40 | 41 |
41 class PropertySetCSSStyleDeclaration : public CSSStyleDeclaration { | 42 class PropertySetCSSStyleDeclaration : public CSSStyleDeclaration { |
42 public: | 43 public: |
43 PropertySetCSSStyleDeclaration(StylePropertySet* propertySet) : m_propertySe
t(propertySet) { } | 44 PropertySetCSSStyleDeclaration(StylePropertySet* propertySet) : m_propertySe
t(propertySet) { } |
44 | 45 |
45 virtual StyledElement* parentElement() const { return 0; } | 46 virtual StyledElement* parentElement() const { return 0; } |
46 virtual void clearParentElement() { ASSERT_NOT_REACHED(); } | 47 virtual void clearParentElement() { ASSERT_NOT_REACHED(); } |
47 StyleSheetContents* contextStyleSheet() const; | 48 StyleSheetContents* contextStyleSheet() const; |
48 | 49 |
49 virtual void ref() OVERRIDE; | 50 virtual void ref() OVERRIDE; |
50 virtual void deref() OVERRIDE; | 51 virtual void deref() OVERRIDE; |
51 | 52 |
52 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; | |
53 | |
54 private: | 53 private: |
55 virtual CSSRule* parentRule() const OVERRIDE { return 0; }; | 54 virtual CSSRule* parentRule() const OVERRIDE { return 0; }; |
56 virtual unsigned length() const OVERRIDE; | 55 virtual unsigned length() const OVERRIDE; |
57 virtual String item(unsigned index) const OVERRIDE; | 56 virtual String item(unsigned index) const OVERRIDE; |
58 virtual PassRefPtr<CSSValue> getPropertyCSSValue(const String& propertyName)
OVERRIDE; | 57 virtual PassRefPtr<CSSValue> getPropertyCSSValue(const String& propertyName)
OVERRIDE; |
59 virtual String getPropertyValue(const String& propertyName) OVERRIDE; | 58 virtual String getPropertyValue(const String& propertyName) OVERRIDE; |
60 virtual String getPropertyPriority(const String& propertyName) OVERRIDE; | 59 virtual String getPropertyPriority(const String& propertyName) OVERRIDE; |
61 virtual String getPropertyShorthand(const String& propertyName) OVERRIDE; | 60 virtual String getPropertyShorthand(const String& propertyName) OVERRIDE; |
62 virtual bool isPropertyImplicit(const String& propertyName) OVERRIDE; | 61 virtual bool isPropertyImplicit(const String& propertyName) OVERRIDE; |
63 virtual void setProperty(const String& propertyName, const String& value, co
nst String& priority, ExceptionCode&) OVERRIDE; | 62 virtual void setProperty(const String& propertyName, const String& value, co
nst String& priority, ExceptionCode&) OVERRIDE; |
(...skipping 27 matching lines...) Expand all Loading... |
91 return adoptRef(new StyleRuleCSSStyleDeclaration(propertySet, parentRule
)); | 90 return adoptRef(new StyleRuleCSSStyleDeclaration(propertySet, parentRule
)); |
92 } | 91 } |
93 | 92 |
94 void clearParentRule() { m_parentRule = 0; } | 93 void clearParentRule() { m_parentRule = 0; } |
95 | 94 |
96 virtual void ref() OVERRIDE; | 95 virtual void ref() OVERRIDE; |
97 virtual void deref() OVERRIDE; | 96 virtual void deref() OVERRIDE; |
98 | 97 |
99 void reattach(StylePropertySet*); | 98 void reattach(StylePropertySet*); |
100 | 99 |
101 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; | |
102 | |
103 private: | 100 private: |
104 StyleRuleCSSStyleDeclaration(StylePropertySet*, CSSRule*); | 101 StyleRuleCSSStyleDeclaration(StylePropertySet*, CSSRule*); |
105 virtual ~StyleRuleCSSStyleDeclaration(); | 102 virtual ~StyleRuleCSSStyleDeclaration(); |
106 | 103 |
107 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; | 104 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; |
108 | 105 |
109 virtual CSSRule* parentRule() const OVERRIDE { return m_parentRule; } | 106 virtual CSSRule* parentRule() const OVERRIDE { return m_parentRule; } |
110 | 107 |
111 virtual void willMutate() OVERRIDE; | 108 virtual void willMutate() OVERRIDE; |
112 virtual void didMutate(MutationType) OVERRIDE; | 109 virtual void didMutate(MutationType) OVERRIDE; |
113 | 110 |
114 unsigned m_refCount; | 111 unsigned m_refCount; |
115 CSSRule* m_parentRule; | 112 CSSRule* m_parentRule; |
116 }; | 113 }; |
117 | 114 |
118 class InlineCSSStyleDeclaration : public PropertySetCSSStyleDeclaration | 115 class InlineCSSStyleDeclaration : public PropertySetCSSStyleDeclaration |
119 { | 116 { |
120 public: | 117 public: |
121 InlineCSSStyleDeclaration(StylePropertySet* propertySet, StyledElement* pare
ntElement) | 118 InlineCSSStyleDeclaration(StylePropertySet* propertySet, StyledElement* pare
ntElement) |
122 : PropertySetCSSStyleDeclaration(propertySet) | 119 : PropertySetCSSStyleDeclaration(propertySet) |
123 , m_parentElement(parentElement) | 120 , m_parentElement(parentElement) |
124 { | 121 { |
125 } | 122 } |
126 | |
127 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; | |
128 | 123 |
129 private: | 124 private: |
130 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; | 125 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; |
131 virtual StyledElement* parentElement() const OVERRIDE { return m_parentEleme
nt; } | 126 virtual StyledElement* parentElement() const OVERRIDE { return m_parentEleme
nt; } |
132 virtual void clearParentElement() OVERRIDE { m_parentElement = 0; } | 127 virtual void clearParentElement() OVERRIDE { m_parentElement = 0; } |
133 | 128 |
134 virtual void didMutate(MutationType) OVERRIDE; | 129 virtual void didMutate(MutationType) OVERRIDE; |
135 | 130 |
136 StyledElement* m_parentElement; | 131 StyledElement* m_parentElement; |
137 }; | 132 }; |
138 | 133 |
139 } // namespace WebCore | 134 } // namespace WebCore |
140 | 135 |
141 #endif | 136 #endif |
OLD | NEW |