Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(705)

Side by Side Diff: Source/core/css/CSSKeyframeRule.h

Issue 13943004: Avoid reparsing keyframe selectors (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/css/CSSKeyframeRule.cpp » ('j') | Source/core/css/CSSParser.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 String keyText() const;
49 void setKeyText(const String& s) { m_key = s; } 49 void setKeyText(const String&);
50 void setKeys(const Vector<float>&);
50 51
51 void getKeys(Vector<float>& keys) const { parseKeyString(m_key, keys); } 52 Vector<float> getKeys() const { return m_keys; }
apavlov 2013/06/26 10:45:40 This should also be const Vector<float>& getKeys()
52 53
53 const StylePropertySet* properties() const { return m_properties.get(); } 54 const StylePropertySet* properties() const { return m_properties.get(); }
54 MutableStylePropertySet* mutableProperties(); 55 MutableStylePropertySet* mutableProperties();
55 void setProperties(PassRefPtr<StylePropertySet>); 56 void setProperties(PassRefPtr<StylePropertySet>);
56 57
57 String cssText() const; 58 String cssText() const;
58 59
59 void reportMemoryUsage(MemoryObjectInfo*) const; 60 void reportMemoryUsage(MemoryObjectInfo*) const;
60 61
61 private: 62 private:
62 StyleKeyframe(); 63 StyleKeyframe();
63 64
64 static void parseKeyString(const String&, Vector<float>& keys); 65 static void parseKeyString(const String&, Vector<float>&);
65 66
66 RefPtr<StylePropertySet> m_properties; 67 RefPtr<StylePropertySet> m_properties;
67 // FIXME: This should be a parsed vector of floats. 68 mutable String m_keyText;
68 // comma separated list of keys 69 Vector<float> m_keys;
69 String m_key;
70 }; 70 };
71 71
72 class CSSKeyframeRule : public CSSRule { 72 class CSSKeyframeRule : public CSSRule {
73 public: 73 public:
74 virtual ~CSSKeyframeRule(); 74 virtual ~CSSKeyframeRule();
75 75
76 virtual CSSRule::Type type() const OVERRIDE { return WEBKIT_KEYFRAME_RULE; } 76 virtual CSSRule::Type type() const OVERRIDE { return WEBKIT_KEYFRAME_RULE; }
77 virtual String cssText() const OVERRIDE { return m_keyframe->cssText(); } 77 virtual String cssText() const OVERRIDE { return m_keyframe->cssText(); }
78 virtual void reattach(StyleRuleBase*) OVERRIDE; 78 virtual void reattach(StyleRuleBase*) OVERRIDE;
79 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; 79 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
80 80
81 String keyText() const { return m_keyframe->keyText(); } 81 String keyText() const { return m_keyframe->keyText(); }
82 void setKeyText(const String& s) { m_keyframe->setKeyText(s); } 82 void setKeyText(const String& s) { m_keyframe->setKeyText(s); }
83 83
84 CSSStyleDeclaration* style() const; 84 CSSStyleDeclaration* style() const;
85 85
86 private: 86 private:
87 CSSKeyframeRule(StyleKeyframe*, CSSKeyframesRule* parent); 87 CSSKeyframeRule(StyleKeyframe*, CSSKeyframesRule* parent);
88 88
89 RefPtr<StyleKeyframe> m_keyframe; 89 RefPtr<StyleKeyframe> m_keyframe;
90 mutable RefPtr<StyleRuleCSSStyleDeclaration> m_propertiesCSSOMWrapper; 90 mutable RefPtr<StyleRuleCSSStyleDeclaration> m_propertiesCSSOMWrapper;
91 91
92 friend class CSSKeyframesRule; 92 friend class CSSKeyframesRule;
93 }; 93 };
94 94
95 } // namespace WebCore 95 } // namespace WebCore
96 96
97 #endif // CSSKeyframeRule_h 97 #endif // CSSKeyframeRule_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/css/CSSKeyframeRule.cpp » ('j') | Source/core/css/CSSParser.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698