| 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 15 matching lines...) Expand all Loading... |
| 26 #ifndef SKY_ENGINE_CORE_CSS_PROPERTYSETCSSSTYLEDECLARATION_H_ | 26 #ifndef SKY_ENGINE_CORE_CSS_PROPERTYSETCSSSTYLEDECLARATION_H_ |
| 27 #define SKY_ENGINE_CORE_CSS_PROPERTYSETCSSSTYLEDECLARATION_H_ | 27 #define SKY_ENGINE_CORE_CSS_PROPERTYSETCSSSTYLEDECLARATION_H_ |
| 28 | 28 |
| 29 #include "sky/engine/core/css/CSSStyleDeclaration.h" | 29 #include "sky/engine/core/css/CSSStyleDeclaration.h" |
| 30 #include "sky/engine/wtf/HashMap.h" | 30 #include "sky/engine/wtf/HashMap.h" |
| 31 #include "sky/engine/wtf/OwnPtr.h" | 31 #include "sky/engine/wtf/OwnPtr.h" |
| 32 | 32 |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 class CSSProperty; | 35 class CSSProperty; |
| 36 class CSSRule; | |
| 37 class CSSValue; | 36 class CSSValue; |
| 38 class Element; | 37 class Element; |
| 39 class ExceptionState; | 38 class ExceptionState; |
| 40 class MutableStylePropertySet; | 39 class MutableStylePropertySet; |
| 41 class StyleSheetContents; | 40 class StyleSheetContents; |
| 42 | 41 |
| 43 class AbstractPropertySetCSSStyleDeclaration : public CSSStyleDeclaration { | 42 class AbstractPropertySetCSSStyleDeclaration : public CSSStyleDeclaration { |
| 44 public: | 43 public: |
| 45 virtual Element* parentElement() const { return 0; } | 44 virtual Element* parentElement() const { return 0; } |
| 46 StyleSheetContents* contextStyleSheet() const; | 45 StyleSheetContents* contextStyleSheet() const; |
| 47 | 46 |
| 48 private: | 47 private: |
| 49 virtual CSSRule* parentRule() const override { return 0; } | |
| 50 virtual unsigned length() const override final; | 48 virtual unsigned length() const override final; |
| 51 virtual String item(unsigned index) const override final; | 49 virtual String item(unsigned index) const override final; |
| 52 virtual PassRefPtr<CSSValue> getPropertyCSSValue(const String& propertyName)
override final; | 50 virtual PassRefPtr<CSSValue> getPropertyCSSValue(const String& propertyName)
override final; |
| 53 virtual String getPropertyValue(const String& propertyName) override final; | 51 virtual String getPropertyValue(const String& propertyName) override final; |
| 54 virtual String getPropertyPriority(const String& propertyName) override fina
l; | 52 virtual String getPropertyPriority(const String& propertyName) override fina
l; |
| 55 virtual String getPropertyShorthand(const String& propertyName) override fin
al; | 53 virtual String getPropertyShorthand(const String& propertyName) override fin
al; |
| 56 virtual bool isPropertyImplicit(const String& propertyName) override final; | 54 virtual bool isPropertyImplicit(const String& propertyName) override final; |
| 57 virtual void setProperty(const String& propertyName, const String& value, co
nst String& priority, ExceptionState&) override final; | 55 virtual void setProperty(const String& propertyName, const String& value, co
nst String& priority, ExceptionState&) override final; |
| 58 virtual String removeProperty(const String& propertyName, ExceptionState&) o
verride final; | 56 virtual String removeProperty(const String& propertyName, ExceptionState&) o
verride final; |
| 59 virtual String cssText() const override final; | 57 virtual String cssText() const override final; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 84 virtual void ref() override; | 82 virtual void ref() override; |
| 85 virtual void deref() override; | 83 virtual void deref() override; |
| 86 #endif | 84 #endif |
| 87 | 85 |
| 88 protected: | 86 protected: |
| 89 virtual MutableStylePropertySet& propertySet() const override final { ASSERT
(m_propertySet); return *m_propertySet; } | 87 virtual MutableStylePropertySet& propertySet() const override final { ASSERT
(m_propertySet); return *m_propertySet; } |
| 90 | 88 |
| 91 RawPtr<MutableStylePropertySet> m_propertySet; // Cannot be null | 89 RawPtr<MutableStylePropertySet> m_propertySet; // Cannot be null |
| 92 }; | 90 }; |
| 93 | 91 |
| 94 class StyleRuleCSSStyleDeclaration final : public PropertySetCSSStyleDeclaration | |
| 95 { | |
| 96 public: | |
| 97 static PassRefPtr<StyleRuleCSSStyleDeclaration> create(MutableStylePropertyS
et& propertySet, CSSRule* parentRule) | |
| 98 { | |
| 99 return adoptRef(new StyleRuleCSSStyleDeclaration(propertySet, parentRule
)); | |
| 100 } | |
| 101 | |
| 102 #if !ENABLE(OILPAN) | |
| 103 void clearParentRule() { m_parentRule = nullptr; } | |
| 104 | |
| 105 virtual void ref() override; | |
| 106 virtual void deref() override; | |
| 107 #endif | |
| 108 | |
| 109 void reattach(MutableStylePropertySet&); | |
| 110 | |
| 111 private: | |
| 112 StyleRuleCSSStyleDeclaration(MutableStylePropertySet&, CSSRule*); | |
| 113 virtual ~StyleRuleCSSStyleDeclaration(); | |
| 114 | |
| 115 virtual CSSStyleSheet* parentStyleSheet() const override; | |
| 116 | |
| 117 virtual CSSRule* parentRule() const override { return m_parentRule; } | |
| 118 | |
| 119 virtual void willMutate() override; | |
| 120 virtual void didMutate(MutationType) override; | |
| 121 | |
| 122 #if !ENABLE(OILPAN) | |
| 123 unsigned m_refCount; | |
| 124 #endif | |
| 125 RawPtr<CSSRule> m_parentRule; | |
| 126 }; | |
| 127 | |
| 128 class InlineCSSStyleDeclaration final : public AbstractPropertySetCSSStyleDeclar
ation | 92 class InlineCSSStyleDeclaration final : public AbstractPropertySetCSSStyleDeclar
ation |
| 129 { | 93 { |
| 130 public: | 94 public: |
| 131 explicit InlineCSSStyleDeclaration(Element* parentElement) | 95 explicit InlineCSSStyleDeclaration(Element* parentElement) |
| 132 : m_parentElement(parentElement) | 96 : m_parentElement(parentElement) |
| 133 { | 97 { |
| 134 } | 98 } |
| 135 | 99 |
| 136 private: | 100 private: |
| 137 virtual MutableStylePropertySet& propertySet() const override; | 101 virtual MutableStylePropertySet& propertySet() const override; |
| 138 #if !ENABLE(OILPAN) | 102 #if !ENABLE(OILPAN) |
| 139 virtual void ref() override; | 103 virtual void ref() override; |
| 140 virtual void deref() override; | 104 virtual void deref() override; |
| 141 #endif | 105 #endif |
| 142 virtual CSSStyleSheet* parentStyleSheet() const override; | 106 virtual CSSStyleSheet* parentStyleSheet() const override; |
| 143 virtual Element* parentElement() const override { return m_parentElement; } | 107 virtual Element* parentElement() const override { return m_parentElement; } |
| 144 | 108 |
| 145 virtual void didMutate(MutationType) override; | 109 virtual void didMutate(MutationType) override; |
| 146 | 110 |
| 147 RawPtr<Element> m_parentElement; | 111 RawPtr<Element> m_parentElement; |
| 148 }; | 112 }; |
| 149 | 113 |
| 150 } // namespace blink | 114 } // namespace blink |
| 151 | 115 |
| 152 #endif // SKY_ENGINE_CORE_CSS_PROPERTYSETCSSSTYLEDECLARATION_H_ | 116 #endif // SKY_ENGINE_CORE_CSS_PROPERTYSETCSSSTYLEDECLARATION_H_ |
| OLD | NEW |