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

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

Issue 13943004: Avoid reparsing keyframe selectors (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 8 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
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 26 matching lines...) Expand all
37 37
38 class StyleKeyframe : public RefCounted<StyleKeyframe> { 38 class StyleKeyframe : public RefCounted<StyleKeyframe> {
39 WTF_MAKE_FAST_ALLOCATED; 39 WTF_MAKE_FAST_ALLOCATED;
40 public: 40 public:
41 static PassRefPtr<StyleKeyframe> create() 41 static PassRefPtr<StyleKeyframe> create()
42 { 42 {
43 return adoptRef(new StyleKeyframe()); 43 return adoptRef(new StyleKeyframe());
44 } 44 }
45 ~StyleKeyframe(); 45 ~StyleKeyframe();
46 46
47 String keyText() const { return m_key; } 47 String keyText() const;
48 void setKeyText(const String& s) { m_key = s; } 48 void setKeyText(const String&);
49 void setKeys(const Vector<float>&);
50 bool isValid() const { return m_keys.size() > 0 || !m_keyText.isEmpty(); }
49 51
50 void getKeys(Vector<float>& keys) const { parseKeyString(m_key, keys); } 52 Vector<float> getKeys() const { return m_keys; }
51 53
52 const StylePropertySet* properties() const { return m_properties.get(); } 54 const StylePropertySet* properties() const { return m_properties.get(); }
53 StylePropertySet* mutableProperties(); 55 StylePropertySet* mutableProperties();
54 void setProperties(PassRefPtr<StylePropertySet>); 56 void setProperties(PassRefPtr<StylePropertySet>);
55 57
56 String cssText() const; 58 String cssText() const;
57 59
58 void reportMemoryUsage(MemoryObjectInfo*) const; 60 void reportMemoryUsage(MemoryObjectInfo*) const;
59 61
60 private: 62 private:
61 StyleKeyframe(); 63 StyleKeyframe();
62 64
63 static void parseKeyString(const String&, Vector<float>& keys); 65 static Vector<float> parseKeyString(const String&);
64 66
65 RefPtr<StylePropertySet> m_properties; 67 RefPtr<StylePropertySet> m_properties;
66 // FIXME: This should be a parsed vector of floats. 68 mutable String m_keyText;
67 // comma separated list of keys 69 Vector<float> m_keys;
68 String m_key;
69 }; 70 };
70 71
71 class WebKitCSSKeyframeRule : public CSSRule { 72 class WebKitCSSKeyframeRule : public CSSRule {
72 public: 73 public:
73 virtual ~WebKitCSSKeyframeRule(); 74 virtual ~WebKitCSSKeyframeRule();
74 75
75 virtual CSSRule::Type type() const OVERRIDE { return WEBKIT_KEYFRAME_RULE; } 76 virtual CSSRule::Type type() const OVERRIDE { return WEBKIT_KEYFRAME_RULE; }
76 virtual String cssText() const OVERRIDE { return m_keyframe->cssText(); } 77 virtual String cssText() const OVERRIDE { return m_keyframe->cssText(); }
77 virtual void reattach(StyleRuleBase*) OVERRIDE; 78 virtual void reattach(StyleRuleBase*) OVERRIDE;
78 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; 79 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
79 80
80 String keyText() const { return m_keyframe->keyText(); } 81 String keyText() const { return m_keyframe->keyText(); }
81 void setKeyText(const String& s) { m_keyframe->setKeyText(s); } 82 void setKeyText(const String& s) { m_keyframe->setKeyText(s); }
82 83
83 CSSStyleDeclaration* style() const; 84 CSSStyleDeclaration* style() const;
84 85
85 private: 86 private:
86 WebKitCSSKeyframeRule(StyleKeyframe*, WebKitCSSKeyframesRule* parent); 87 WebKitCSSKeyframeRule(StyleKeyframe*, WebKitCSSKeyframesRule* parent);
87 88
88 RefPtr<StyleKeyframe> m_keyframe; 89 RefPtr<StyleKeyframe> m_keyframe;
89 mutable RefPtr<StyleRuleCSSStyleDeclaration> m_propertiesCSSOMWrapper; 90 mutable RefPtr<StyleRuleCSSStyleDeclaration> m_propertiesCSSOMWrapper;
90 91
91 friend class WebKitCSSKeyframesRule; 92 friend class WebKitCSSKeyframesRule;
92 }; 93 };
93 94
94 } // namespace WebCore 95 } // namespace WebCore
95 96
96 #endif // WebKitCSSKeyframeRule_h 97 #endif // WebKitCSSKeyframeRule_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698