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

Side by Side Diff: sky/engine/core/css/StyleRuleKeyframes.cpp

Issue 758573005: Remove CSSOM mutability in StyleRule. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « sky/engine/core/css/StyleRuleKeyframes.h ('k') | sky/engine/core/css/StyleSheetContents.h » ('j') | no next file with comments »
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 17 matching lines...) Expand all
28 28
29 #include "sky/engine/core/css/StyleKeyframe.h" 29 #include "sky/engine/core/css/StyleKeyframe.h"
30 30
31 namespace blink { 31 namespace blink {
32 32
33 StyleRuleKeyframes::StyleRuleKeyframes() 33 StyleRuleKeyframes::StyleRuleKeyframes()
34 : StyleRuleBase(Keyframes) 34 : StyleRuleBase(Keyframes)
35 { 35 {
36 } 36 }
37 37
38 StyleRuleKeyframes::StyleRuleKeyframes(const StyleRuleKeyframes& o)
39 : StyleRuleBase(o)
40 , m_keyframes(o.m_keyframes)
41 , m_name(o.m_name)
42 , m_isPrefixed(o.m_isPrefixed)
43 {
44 }
45
46 StyleRuleKeyframes::~StyleRuleKeyframes() 38 StyleRuleKeyframes::~StyleRuleKeyframes()
47 { 39 {
48 } 40 }
49 41
50 void StyleRuleKeyframes::parserAppendKeyframe(PassRefPtr<StyleKeyframe> keyframe ) 42 void StyleRuleKeyframes::parserAppendKeyframe(PassRefPtr<StyleKeyframe> keyframe )
51 { 43 {
52 if (!keyframe) 44 if (!keyframe)
53 return; 45 return;
54 m_keyframes.append(keyframe); 46 m_keyframes.append(keyframe);
55 } 47 }
56 48
57 void StyleRuleKeyframes::wrapperAppendKeyframe(PassRefPtr<StyleKeyframe> keyfram e)
58 {
59 m_keyframes.append(keyframe);
60 }
61
62 void StyleRuleKeyframes::wrapperRemoveKeyframe(unsigned index)
63 {
64 m_keyframes.remove(index);
65 }
66
67 int StyleRuleKeyframes::findKeyframeIndex(const String& key) const
68 {
69 String percentageString;
70 if (equalIgnoringCase(key, "from"))
71 percentageString = "0%";
72 else if (equalIgnoringCase(key, "to"))
73 percentageString = "100%";
74 else
75 percentageString = key;
76
77 for (unsigned i = 0; i < m_keyframes.size(); ++i) {
78 if (m_keyframes[i]->keyText() == percentageString)
79 return i;
80 }
81 return -1;
82 }
83
84 } // namespace blink 49 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/css/StyleRuleKeyframes.h ('k') | sky/engine/core/css/StyleSheetContents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698