| 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 16 matching lines...) Expand all Loading... |
| 27 #define PropertySetCSSStyleDeclaration_h | 27 #define PropertySetCSSStyleDeclaration_h |
| 28 | 28 |
| 29 #include "core/css/CSSStyleDeclaration.h" | 29 #include "core/css/CSSStyleDeclaration.h" |
| 30 #include <wtf/HashMap.h> | 30 #include <wtf/HashMap.h> |
| 31 | 31 |
| 32 namespace WebCore { | 32 namespace WebCore { |
| 33 | 33 |
| 34 class CSSRule; | 34 class CSSRule; |
| 35 class CSSProperty; | 35 class CSSProperty; |
| 36 class CSSValue; | 36 class CSSValue; |
| 37 class StylePropertySet; | 37 class MutableStylePropertySet; |
| 38 class StyleSheetContents; | 38 class StyleSheetContents; |
| 39 class StyledElement; | 39 class StyledElement; |
| 40 | 40 |
| 41 class PropertySetCSSStyleDeclaration : public CSSStyleDeclaration { | 41 class PropertySetCSSStyleDeclaration : public CSSStyleDeclaration { |
| 42 public: | 42 public: |
| 43 PropertySetCSSStyleDeclaration(StylePropertySet* propertySet) : m_propertySe
t(propertySet) { } | 43 PropertySetCSSStyleDeclaration(MutableStylePropertySet* propertySet) : m_pro
pertySet(propertySet) { } |
| 44 | 44 |
| 45 virtual StyledElement* parentElement() const { return 0; } | 45 virtual StyledElement* 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 ref() OVERRIDE; | 49 virtual void ref() OVERRIDE; |
| 50 virtual void deref() OVERRIDE; | 50 virtual void deref() OVERRIDE; |
| 51 | 51 |
| 52 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; | 52 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; |
| 53 | 53 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 71 virtual bool cssPropertyMatches(CSSPropertyID, const CSSValue*) const OVERRI
DE; | 71 virtual bool cssPropertyMatches(CSSPropertyID, const CSSValue*) const OVERRI
DE; |
| 72 virtual PassRefPtr<MutableStylePropertySet> copyProperties() const OVERRIDE; | 72 virtual PassRefPtr<MutableStylePropertySet> copyProperties() const OVERRIDE; |
| 73 | 73 |
| 74 CSSValue* cloneAndCacheForCSSOM(CSSValue*); | 74 CSSValue* cloneAndCacheForCSSOM(CSSValue*); |
| 75 | 75 |
| 76 protected: | 76 protected: |
| 77 enum MutationType { NoChanges, PropertyChanged }; | 77 enum MutationType { NoChanges, PropertyChanged }; |
| 78 virtual void willMutate() { } | 78 virtual void willMutate() { } |
| 79 virtual void didMutate(MutationType) { } | 79 virtual void didMutate(MutationType) { } |
| 80 | 80 |
| 81 StylePropertySet* m_propertySet; | 81 MutableStylePropertySet* m_propertySet; |
| 82 OwnPtr<HashMap<CSSValue*, RefPtr<CSSValue> > > m_cssomCSSValueClones; | 82 OwnPtr<HashMap<CSSValue*, RefPtr<CSSValue> > > m_cssomCSSValueClones; |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 class StyleRuleCSSStyleDeclaration : public PropertySetCSSStyleDeclaration | 85 class StyleRuleCSSStyleDeclaration : public PropertySetCSSStyleDeclaration |
| 86 { | 86 { |
| 87 public: | 87 public: |
| 88 static PassRefPtr<StyleRuleCSSStyleDeclaration> create(StylePropertySet* pro
pertySet, CSSRule* parentRule) | 88 static PassRefPtr<StyleRuleCSSStyleDeclaration> create(MutableStylePropertyS
et* propertySet, CSSRule* parentRule) |
| 89 { | 89 { |
| 90 return adoptRef(new StyleRuleCSSStyleDeclaration(propertySet, parentRule
)); | 90 return adoptRef(new StyleRuleCSSStyleDeclaration(propertySet, parentRule
)); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void clearParentRule() { m_parentRule = 0; } | 93 void clearParentRule() { m_parentRule = 0; } |
| 94 | 94 |
| 95 virtual void ref() OVERRIDE; | 95 virtual void ref() OVERRIDE; |
| 96 virtual void deref() OVERRIDE; | 96 virtual void deref() OVERRIDE; |
| 97 | 97 |
| 98 void reattach(StylePropertySet*); | 98 void reattach(MutableStylePropertySet*); |
| 99 | 99 |
| 100 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; | 100 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; |
| 101 | 101 |
| 102 private: | 102 private: |
| 103 StyleRuleCSSStyleDeclaration(StylePropertySet*, CSSRule*); | 103 StyleRuleCSSStyleDeclaration(MutableStylePropertySet*, CSSRule*); |
| 104 virtual ~StyleRuleCSSStyleDeclaration(); | 104 virtual ~StyleRuleCSSStyleDeclaration(); |
| 105 | 105 |
| 106 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; | 106 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; |
| 107 | 107 |
| 108 virtual CSSRule* parentRule() const OVERRIDE { return m_parentRule; } | 108 virtual CSSRule* parentRule() const OVERRIDE { return m_parentRule; } |
| 109 | 109 |
| 110 virtual void willMutate() OVERRIDE; | 110 virtual void willMutate() OVERRIDE; |
| 111 virtual void didMutate(MutationType) OVERRIDE; | 111 virtual void didMutate(MutationType) OVERRIDE; |
| 112 | 112 |
| 113 unsigned m_refCount; | 113 unsigned m_refCount; |
| 114 CSSRule* m_parentRule; | 114 CSSRule* m_parentRule; |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 class InlineCSSStyleDeclaration : public PropertySetCSSStyleDeclaration | 117 class InlineCSSStyleDeclaration : public PropertySetCSSStyleDeclaration |
| 118 { | 118 { |
| 119 public: | 119 public: |
| 120 InlineCSSStyleDeclaration(StylePropertySet* propertySet, StyledElement* pare
ntElement) | 120 InlineCSSStyleDeclaration(MutableStylePropertySet* propertySet, StyledElemen
t* parentElement) |
| 121 : PropertySetCSSStyleDeclaration(propertySet) | 121 : PropertySetCSSStyleDeclaration(propertySet) |
| 122 , m_parentElement(parentElement) | 122 , m_parentElement(parentElement) |
| 123 { | 123 { |
| 124 } | 124 } |
| 125 | 125 |
| 126 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; | 126 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; |
| 127 | 127 |
| 128 private: | 128 private: |
| 129 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; | 129 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; |
| 130 virtual StyledElement* parentElement() const OVERRIDE { return m_parentEleme
nt; } | 130 virtual StyledElement* parentElement() const OVERRIDE { return m_parentEleme
nt; } |
| 131 virtual void clearParentElement() OVERRIDE { m_parentElement = 0; } | 131 virtual void clearParentElement() OVERRIDE { m_parentElement = 0; } |
| 132 | 132 |
| 133 virtual void didMutate(MutationType) OVERRIDE; | 133 virtual void didMutate(MutationType) OVERRIDE; |
| 134 | 134 |
| 135 StyledElement* m_parentElement; | 135 StyledElement* m_parentElement; |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 } // namespace WebCore | 138 } // namespace WebCore |
| 139 | 139 |
| 140 #endif | 140 #endif |
| OLD | NEW |