| 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 28 matching lines...) Expand all Loading... |
| 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 |
| 49 private: | 51 private: |
| 50 virtual CSSRule* parentRule() const OVERRIDE { return 0; } | 52 virtual CSSRule* parentRule() const OVERRIDE { return 0; } |
| 51 virtual unsigned length() const OVERRIDE FINAL; | 53 virtual unsigned length() const OVERRIDE FINAL; |
| 52 virtual String item(unsigned index) const OVERRIDE FINAL; | 54 virtual String item(unsigned index) const OVERRIDE FINAL; |
| 53 virtual PassRefPtrWillBeRawPtr<CSSValue> getPropertyCSSValue(const String& p
ropertyName) OVERRIDE FINAL; | 55 virtual PassRefPtrWillBeRawPtr<CSSValue> getPropertyCSSValue(const String& p
ropertyName) OVERRIDE FINAL; |
| 54 virtual String getPropertyValue(const String& propertyName) OVERRIDE FINAL; | 56 virtual String getPropertyValue(const String& propertyName) OVERRIDE FINAL; |
| 55 virtual String getPropertyPriority(const String& propertyName) OVERRIDE FINA
L; | 57 virtual String getPropertyPriority(const String& propertyName) OVERRIDE FINA
L; |
| 56 virtual String getPropertyShorthand(const String& propertyName) OVERRIDE FIN
AL; | 58 virtual String getPropertyShorthand(const String& propertyName) OVERRIDE FIN
AL; |
| 57 virtual bool isPropertyImplicit(const String& propertyName) OVERRIDE FINAL; | 59 virtual bool isPropertyImplicit(const String& propertyName) OVERRIDE FINAL; |
| 58 virtual void setProperty(const String& propertyName, const String& value, co
nst String& priority, ExceptionState&) OVERRIDE FINAL; | 60 virtual void setProperty(const String& propertyName, const String& value, co
nst String& priority, ExceptionState&) OVERRIDE FINAL; |
| 59 virtual String removeProperty(const String& propertyName, ExceptionState&) O
VERRIDE FINAL; | 61 virtual String removeProperty(const String& propertyName, ExceptionState&) O
VERRIDE FINAL; |
| 60 virtual String cssText() const OVERRIDE FINAL; | 62 virtual String cssText() const OVERRIDE FINAL; |
| 61 virtual void setCSSText(const String&, ExceptionState&) OVERRIDE FINAL; | 63 virtual void setCSSText(const String&, ExceptionState&) OVERRIDE FINAL; |
| 62 virtual PassRefPtrWillBeRawPtr<CSSValue> getPropertyCSSValueInternal(CSSProp
ertyID) OVERRIDE FINAL; | 64 virtual PassRefPtrWillBeRawPtr<CSSValue> getPropertyCSSValueInternal(CSSProp
ertyID) OVERRIDE FINAL; |
| 63 virtual String getPropertyValueInternal(CSSPropertyID) OVERRIDE FINAL; | 65 virtual String getPropertyValueInternal(CSSPropertyID) OVERRIDE FINAL; |
| 64 virtual void setPropertyInternal(CSSPropertyID, const String& value, bool im
portant, ExceptionState&) OVERRIDE FINAL; | 66 virtual void setPropertyInternal(CSSPropertyID, const String& value, bool im
portant, ExceptionState&) OVERRIDE FINAL; |
| 65 | 67 |
| 66 virtual bool cssPropertyMatches(CSSPropertyID, const CSSValue*) const OVERRI
DE FINAL; | 68 virtual bool cssPropertyMatches(CSSPropertyID, const CSSValue*) const OVERRI
DE FINAL; |
| 67 virtual PassRefPtrWillBeRawPtr<MutableStylePropertySet> copyProperties() con
st OVERRIDE FINAL; | 69 virtual PassRefPtrWillBeRawPtr<MutableStylePropertySet> copyProperties() con
st OVERRIDE FINAL; |
| 68 | 70 |
| 69 CSSValue* cloneAndCacheForCSSOM(CSSValue*); | 71 CSSValue* cloneAndCacheForCSSOM(CSSValue*); |
| 70 | 72 |
| 71 protected: | 73 protected: |
| 72 enum MutationType { NoChanges, PropertyChanged }; | 74 enum MutationType { NoChanges, PropertyChanged }; |
| 73 virtual void willMutate() { } | 75 virtual void willMutate() { } |
| 74 virtual void didMutate(MutationType) { } | 76 virtual void didMutate(MutationType) { } |
| 75 virtual MutableStylePropertySet& propertySet() const = 0; | 77 virtual MutableStylePropertySet& propertySet() const = 0; |
| 76 | 78 |
| 77 OwnPtrWillBePersistent<WillBeHeapHashMap<CSSValue*, RefPtrWillBeMember<CSSVa
lue> > > m_cssomCSSValueClones; | 79 OwnPtrWillBeMember<WillBeHeapHashMap<RawPtrWillBeMember<CSSValue>, RefPtrWil
lBeMember<CSSValue> > > m_cssomCSSValueClones; |
| 78 }; | 80 }; |
| 79 | 81 |
| 80 class PropertySetCSSStyleDeclaration : public AbstractPropertySetCSSStyleDeclara
tion { | 82 class PropertySetCSSStyleDeclaration : public AbstractPropertySetCSSStyleDeclara
tion { |
| 81 public: | 83 public: |
| 82 PropertySetCSSStyleDeclaration(MutableStylePropertySet& propertySet) : m_pro
pertySet(&propertySet) { } | 84 PropertySetCSSStyleDeclaration(MutableStylePropertySet& propertySet) : m_pro
pertySet(&propertySet) { } |
| 83 | 85 |
| 86 #if !ENABLE(OILPAN) |
| 84 virtual void ref() OVERRIDE; | 87 virtual void ref() OVERRIDE; |
| 85 virtual void deref() OVERRIDE; | 88 virtual void deref() OVERRIDE; |
| 89 #endif |
| 90 |
| 91 virtual void trace(Visitor*) OVERRIDE; |
| 86 | 92 |
| 87 protected: | 93 protected: |
| 88 virtual MutableStylePropertySet& propertySet() const OVERRIDE FINAL { ASSERT
(m_propertySet); return *m_propertySet; } | 94 virtual MutableStylePropertySet& propertySet() const OVERRIDE FINAL { ASSERT
(m_propertySet); return *m_propertySet; } |
| 89 | 95 |
| 90 MutableStylePropertySet* m_propertySet; // Cannot be null | 96 RawPtrWillBeMember<MutableStylePropertySet> m_propertySet; // Cannot be null |
| 91 }; | 97 }; |
| 92 | 98 |
| 93 class StyleRuleCSSStyleDeclaration FINAL : public PropertySetCSSStyleDeclaration | 99 class StyleRuleCSSStyleDeclaration FINAL : public PropertySetCSSStyleDeclaration |
| 94 { | 100 { |
| 95 public: | 101 public: |
| 96 static PassRefPtr<StyleRuleCSSStyleDeclaration> create(MutableStylePropertyS
et& propertySet, CSSRule* parentRule) | 102 static PassRefPtrWillBeRawPtr<StyleRuleCSSStyleDeclaration> create(MutableSt
ylePropertySet& propertySet, CSSRule* parentRule) |
| 97 { | 103 { |
| 98 return adoptRef(new StyleRuleCSSStyleDeclaration(propertySet, parentRule
)); | 104 return adoptRefWillBeNoop(new StyleRuleCSSStyleDeclaration(propertySet,
parentRule)); |
| 99 } | 105 } |
| 100 | 106 |
| 101 void clearParentRule() { m_parentRule = 0; } | 107 #if !ENABLE(OILPAN) |
| 108 void clearParentRule() { m_parentRule = nullptr; } |
| 102 | 109 |
| 103 virtual void ref() OVERRIDE; | 110 virtual void ref() OVERRIDE; |
| 104 virtual void deref() OVERRIDE; | 111 virtual void deref() OVERRIDE; |
| 112 #endif |
| 105 | 113 |
| 106 void reattach(MutableStylePropertySet&); | 114 void reattach(MutableStylePropertySet&); |
| 107 | 115 |
| 116 virtual void trace(Visitor*) OVERRIDE; |
| 117 |
| 108 private: | 118 private: |
| 109 StyleRuleCSSStyleDeclaration(MutableStylePropertySet&, CSSRule*); | 119 StyleRuleCSSStyleDeclaration(MutableStylePropertySet&, CSSRule*); |
| 110 virtual ~StyleRuleCSSStyleDeclaration(); | 120 virtual ~StyleRuleCSSStyleDeclaration(); |
| 111 | 121 |
| 112 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; | 122 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; |
| 113 | 123 |
| 114 virtual CSSRule* parentRule() const OVERRIDE { return m_parentRule; } | 124 virtual CSSRule* parentRule() const OVERRIDE { return m_parentRule; } |
| 115 | 125 |
| 116 virtual void willMutate() OVERRIDE; | 126 virtual void willMutate() OVERRIDE; |
| 117 virtual void didMutate(MutationType) OVERRIDE; | 127 virtual void didMutate(MutationType) OVERRIDE; |
| 118 | 128 |
| 129 #if !ENABLE(OILPAN) |
| 119 unsigned m_refCount; | 130 unsigned m_refCount; |
| 120 CSSRule* m_parentRule; | 131 #endif |
| 132 RawPtrWillBeMember<CSSRule> m_parentRule; |
| 121 }; | 133 }; |
| 122 | 134 |
| 123 class InlineCSSStyleDeclaration FINAL : public AbstractPropertySetCSSStyleDeclar
ation | 135 class InlineCSSStyleDeclaration FINAL : public AbstractPropertySetCSSStyleDeclar
ation |
| 124 { | 136 { |
| 125 public: | 137 public: |
| 126 explicit InlineCSSStyleDeclaration(Element* parentElement) | 138 explicit InlineCSSStyleDeclaration(Element* parentElement) |
| 127 : m_parentElement(parentElement) | 139 : m_parentElement(parentElement) |
| 128 { | 140 { |
| 129 } | 141 } |
| 130 | 142 |
| 143 virtual void trace(Visitor*) OVERRIDE; |
| 144 |
| 131 private: | 145 private: |
| 132 virtual MutableStylePropertySet& propertySet() const OVERRIDE; | 146 virtual MutableStylePropertySet& propertySet() const OVERRIDE; |
| 147 #if !ENABLE(OILPAN) |
| 133 virtual void ref() OVERRIDE; | 148 virtual void ref() OVERRIDE; |
| 134 virtual void deref() OVERRIDE; | 149 virtual void deref() OVERRIDE; |
| 150 #endif |
| 135 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; | 151 virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; |
| 136 virtual Element* parentElement() const OVERRIDE { return m_parentElement; } | 152 virtual Element* parentElement() const OVERRIDE { return m_parentElement; } |
| 137 virtual void clearParentElement() OVERRIDE { m_parentElement = 0; } | 153 virtual void clearParentElement() OVERRIDE { m_parentElement = 0; } |
| 138 | 154 |
| 139 virtual void didMutate(MutationType) OVERRIDE; | 155 virtual void didMutate(MutationType) OVERRIDE; |
| 140 | 156 |
| 141 Element* m_parentElement; | 157 Element* m_parentElement; |
| 142 }; | 158 }; |
| 143 | 159 |
| 144 } // namespace WebCore | 160 } // namespace WebCore |
| 145 | 161 |
| 146 #endif | 162 #endif |
| OLD | NEW |