| 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 17 matching lines...) Expand all Loading... |
| 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 |
| OLD | NEW |