| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 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 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 class StyleKeyframe : public RefCounted<StyleKeyframe> { | 39 class StyleKeyframe : public RefCounted<StyleKeyframe> { |
| 40 WTF_MAKE_FAST_ALLOCATED; | 40 WTF_MAKE_FAST_ALLOCATED; |
| 41 public: | 41 public: |
| 42 static PassRefPtr<StyleKeyframe> create() | 42 static PassRefPtr<StyleKeyframe> create() |
| 43 { | 43 { |
| 44 return adoptRef(new StyleKeyframe()); | 44 return adoptRef(new StyleKeyframe()); |
| 45 } | 45 } |
| 46 ~StyleKeyframe(); | 46 ~StyleKeyframe(); |
| 47 | 47 |
| 48 String keyText() const { return m_key; } | 48 // Exposed to JavaScript. |
| 49 // FIXME: Should we trim whitespace? | 49 String keyText() const; |
| 50 // FIXME: Should we leave keyText unchanged when attempting to set to an | 50 void setKeyText(const String&); |
| 51 // invalid string? | |
| 52 void setKeyText(const String& s) { m_key = s; } | |
| 53 | 51 |
| 54 void getKeys(Vector<float>& keys) const { parseKeyString(m_key, keys); } | 52 // Used by StyleResolver. |
| 53 const Vector<float>& keys() const; |
| 54 // Used by CSSParser when constructing a new StyleKeyframe. |
| 55 void setKeys(PassOwnPtr<Vector<float> >); |
| 55 | 56 |
| 56 const StylePropertySet* properties() const { return m_properties.get(); } | 57 const StylePropertySet* properties() const { return m_properties.get(); } |
| 57 MutableStylePropertySet* mutableProperties(); | 58 MutableStylePropertySet* mutableProperties(); |
| 58 void setProperties(PassRefPtr<StylePropertySet>); | 59 void setProperties(PassRefPtr<StylePropertySet>); |
| 59 | 60 |
| 60 String cssText() const; | 61 String cssText() const; |
| 61 | 62 |
| 62 void reportMemoryUsage(MemoryObjectInfo*) const; | 63 void reportMemoryUsage(MemoryObjectInfo*) const; |
| 63 | 64 |
| 64 private: | 65 private: |
| 65 StyleKeyframe(); | 66 StyleKeyframe(); |
| 66 | 67 |
| 67 static void parseKeyString(const String&, Vector<float>& keys); | |
| 68 | |
| 69 RefPtr<StylePropertySet> m_properties; | 68 RefPtr<StylePropertySet> m_properties; |
| 70 // FIXME: This should be a parsed vector of floats. | 69 // These are both calculated lazily. Either one can be set, which invalidate
s the other. |
| 71 // comma separated list of keys | 70 mutable String m_keyText; |
| 72 String m_key; | 71 mutable OwnPtr<Vector<float> > m_keys; |
| 73 }; | 72 }; |
| 74 | 73 |
| 75 class CSSKeyframeRule : public CSSRule { | 74 class CSSKeyframeRule : public CSSRule { |
| 76 public: | 75 public: |
| 77 virtual ~CSSKeyframeRule(); | 76 virtual ~CSSKeyframeRule(); |
| 78 | 77 |
| 79 virtual CSSRule::Type type() const OVERRIDE { return WEBKIT_KEYFRAME_RULE; } | 78 virtual CSSRule::Type type() const OVERRIDE { return WEBKIT_KEYFRAME_RULE; } |
| 80 virtual String cssText() const OVERRIDE { return m_keyframe->cssText(); } | 79 virtual String cssText() const OVERRIDE { return m_keyframe->cssText(); } |
| 81 virtual void reattach(StyleRuleBase*) OVERRIDE; | 80 virtual void reattach(StyleRuleBase*) OVERRIDE; |
| 82 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; | 81 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; |
| 83 | 82 |
| 84 String keyText() const { return m_keyframe->keyText(); } | 83 String keyText() const { return m_keyframe->keyText(); } |
| 85 void setKeyText(const String& s) { m_keyframe->setKeyText(s); } | 84 void setKeyText(const String& s) { m_keyframe->setKeyText(s); } |
| 86 | 85 |
| 87 CSSStyleDeclaration* style() const; | 86 CSSStyleDeclaration* style() const; |
| 88 | 87 |
| 89 private: | 88 private: |
| 90 CSSKeyframeRule(StyleKeyframe*, CSSKeyframesRule* parent); | 89 CSSKeyframeRule(StyleKeyframe*, CSSKeyframesRule* parent); |
| 91 | 90 |
| 92 RefPtr<StyleKeyframe> m_keyframe; | 91 RefPtr<StyleKeyframe> m_keyframe; |
| 93 mutable RefPtr<StyleRuleCSSStyleDeclaration> m_propertiesCSSOMWrapper; | 92 mutable RefPtr<StyleRuleCSSStyleDeclaration> m_propertiesCSSOMWrapper; |
| 94 | 93 |
| 95 friend class CSSKeyframesRule; | 94 friend class CSSKeyframesRule; |
| 96 }; | 95 }; |
| 97 | 96 |
| 98 } // namespace WebCore | 97 } // namespace WebCore |
| 99 | 98 |
| 100 #endif // CSSKeyframeRule_h | 99 #endif // CSSKeyframeRule_h |
| OLD | NEW |