| 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 10 matching lines...) Expand all Loading... |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "core/css/CSSKeyframeRule.h" | 27 #include "core/css/CSSKeyframeRule.h" |
| 28 | 28 |
| 29 #include "bindings/core/v8/ExceptionState.h" | 29 #include "bindings/core/v8/ExceptionState.h" |
| 30 #include "core/css/CSSKeyframesRule.h" | 30 #include "core/css/CSSKeyframesRule.h" |
| 31 #include "core/css/PropertySetCSSStyleDeclaration.h" | 31 #include "core/css/CSSStyleSheet.h" |
| 32 #include "core/css/KeyframeStyleRuleCSSStyleDeclaration.h" |
| 32 #include "core/dom/ExceptionCode.h" | 33 #include "core/dom/ExceptionCode.h" |
| 33 | 34 |
| 34 namespace blink { | 35 namespace blink { |
| 35 | 36 |
| 36 CSSKeyframeRule::CSSKeyframeRule(StyleRuleKeyframe* keyframe, CSSKeyframesRule*
parent) | 37 CSSKeyframeRule::CSSKeyframeRule(StyleRuleKeyframe* keyframe, CSSKeyframesRule*
parent) |
| 37 : CSSRule(0) | 38 : CSSRule(0) |
| 38 , m_keyframe(keyframe) | 39 , m_keyframe(keyframe) |
| 39 { | 40 { |
| 40 setParentRule(parent); | 41 setParentRule(parent); |
| 41 } | 42 } |
| 42 | 43 |
| 43 CSSKeyframeRule::~CSSKeyframeRule() | 44 CSSKeyframeRule::~CSSKeyframeRule() |
| 44 { | 45 { |
| 45 #if !ENABLE(OILPAN) | 46 #if !ENABLE(OILPAN) |
| 46 if (m_propertiesCSSOMWrapper) | 47 if (m_propertiesCSSOMWrapper) |
| 47 m_propertiesCSSOMWrapper->clearParentRule(); | 48 m_propertiesCSSOMWrapper->clearParentRule(); |
| 48 #endif | 49 #endif |
| 49 } | 50 } |
| 50 | 51 |
| 51 void CSSKeyframeRule::setKeyText(const String& keyText, ExceptionState& exceptio
nState) | 52 void CSSKeyframeRule::setKeyText(const String& keyText, ExceptionState& exceptio
nState) |
| 52 { | 53 { |
| 53 if (!m_keyframe->setKeyText(keyText)) | 54 if (!m_keyframe->setKeyText(keyText)) |
| 54 exceptionState.throwDOMException(SyntaxError, "The key '" + keyText + "'
is invalid and cannot be parsed"); | 55 exceptionState.throwDOMException(SyntaxError, "The key '" + keyText + "'
is invalid and cannot be parsed"); |
| 56 |
| 57 toCSSKeyframesRule(parentRule())->styleChanged(); |
| 55 } | 58 } |
| 56 | 59 |
| 57 CSSStyleDeclaration* CSSKeyframeRule::style() const | 60 CSSStyleDeclaration* CSSKeyframeRule::style() const |
| 58 { | 61 { |
| 59 if (!m_propertiesCSSOMWrapper) | 62 if (!m_propertiesCSSOMWrapper) |
| 60 m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_keyfra
me->mutableProperties(), const_cast<CSSKeyframeRule*>(this)); | 63 m_propertiesCSSOMWrapper = KeyframeStyleRuleCSSStyleDeclaration::create(
m_keyframe->mutableProperties(), const_cast<CSSKeyframeRule*>(this)); |
| 61 return m_propertiesCSSOMWrapper.get(); | 64 return m_propertiesCSSOMWrapper.get(); |
| 62 } | 65 } |
| 63 | 66 |
| 64 void CSSKeyframeRule::reattach(StyleRuleBase*) | 67 void CSSKeyframeRule::reattach(StyleRuleBase*) |
| 65 { | 68 { |
| 66 // No need to reattach, the underlying data is shareable on mutation. | 69 // No need to reattach, the underlying data is shareable on mutation. |
| 67 ASSERT_NOT_REACHED(); | 70 ASSERT_NOT_REACHED(); |
| 68 } | 71 } |
| 69 | 72 |
| 70 void CSSKeyframeRule::trace(Visitor* visitor) | 73 void CSSKeyframeRule::trace(Visitor* visitor) |
| 71 { | 74 { |
| 72 visitor->trace(m_keyframe); | 75 visitor->trace(m_keyframe); |
| 73 visitor->trace(m_propertiesCSSOMWrapper); | 76 visitor->trace(m_propertiesCSSOMWrapper); |
| 74 CSSRule::trace(visitor); | 77 CSSRule::trace(visitor); |
| 75 } | 78 } |
| 76 | 79 |
| 77 } // namespace blink | 80 } // namespace blink |
| OLD | NEW |