OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> |
3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2008 Apple Inc. All rights reserved. | 4 * Copyright (C) 2008 Apple Inc. All rights reserved. |
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 propertyId = CSSPropertyWebkitTransformOrigin; // cssPropertyID("-webkit
-transform-origin") | 67 propertyId = CSSPropertyWebkitTransformOrigin; // cssPropertyID("-webkit
-transform-origin") |
68 ASSERT(propertyId > 0); | 68 ASSERT(propertyId > 0); |
69 propertyNameToIdMap->set(attrName.localName().impl(), propertyId); | 69 propertyNameToIdMap->set(attrName.localName().impl(), propertyId); |
70 } | 70 } |
71 | 71 |
72 SVGElement::SVGElement(const QualifiedName& tagName, Document& document, Constru
ctionType constructionType) | 72 SVGElement::SVGElement(const QualifiedName& tagName, Document& document, Constru
ctionType constructionType) |
73 : Element(tagName, &document, constructionType) | 73 : Element(tagName, &document, constructionType) |
74 #if !ASSERT_DISABLED | 74 #if !ASSERT_DISABLED |
75 , m_inRelativeLengthClientsInvalidation(false) | 75 , m_inRelativeLengthClientsInvalidation(false) |
76 #endif | 76 #endif |
77 , m_animatedPropertiesDestructed(false) | |
78 // |m_isContextElement| must be initialized before |m_className|, as SVGAnim
atedString tear-off c-tor currently set this to true. | 77 // |m_isContextElement| must be initialized before |m_className|, as SVGAnim
atedString tear-off c-tor currently set this to true. |
79 , m_isContextElement(false) | 78 , m_isContextElement(false) |
80 , m_hasSVGRareData(false) | 79 , m_hasSVGRareData(false) |
81 , m_className(SVGAnimatedString::create(this, HTMLNames::classAttr, SVGStrin
g::create())) | 80 , m_className(SVGAnimatedString::create(this, HTMLNames::classAttr, SVGStrin
g::create())) |
82 { | 81 { |
83 ScriptWrappable::init(this); | 82 ScriptWrappable::init(this); |
84 addToPropertyMap(m_className); | 83 addToPropertyMap(m_className); |
85 registerAnimatedPropertiesForSVGElement(); | |
86 setHasCustomStyleCallbacks(); | 84 setHasCustomStyleCallbacks(); |
87 } | 85 } |
88 | 86 |
89 SVGElement::~SVGElement() | 87 SVGElement::~SVGElement() |
90 { | 88 { |
91 ASSERT(inDocument() || !hasRelativeLengths()); | 89 ASSERT(inDocument() || !hasRelativeLengths()); |
92 } | |
93 | |
94 void | |
95 SVGElement::cleanupAnimatedProperties() | |
96 { | |
97 if (m_animatedPropertiesDestructed) | |
98 return; | |
99 m_animatedPropertiesDestructed = true; | |
100 | 90 |
101 if (!hasSVGRareData()) | 91 if (!hasSVGRareData()) |
102 ASSERT(!SVGElementRareData::rareDataMap().contains(this)); | 92 ASSERT(!SVGElementRareData::rareDataMap().contains(this)); |
103 else { | 93 else { |
104 SVGElementRareData::SVGElementRareDataMap& rareDataMap = SVGElementRareD
ata::rareDataMap(); | 94 SVGElementRareData::SVGElementRareDataMap& rareDataMap = SVGElementRareD
ata::rareDataMap(); |
105 SVGElementRareData::SVGElementRareDataMap::iterator it = rareDataMap.fin
d(this); | 95 SVGElementRareData::SVGElementRareDataMap::iterator it = rareDataMap.fin
d(this); |
106 ASSERT_WITH_SECURITY_IMPLICATION(it != rareDataMap.end()); | 96 ASSERT_WITH_SECURITY_IMPLICATION(it != rareDataMap.end()); |
107 | 97 |
108 SVGElementRareData* rareData = it->value; | 98 SVGElementRareData* rareData = it->value; |
109 rareData->destroyAnimatedSMILStyleProperties(); | 99 rareData->destroyAnimatedSMILStyleProperties(); |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 s_cssPropertyMap.set(text_decorationAttr, AnimatedString); | 724 s_cssPropertyMap.set(text_decorationAttr, AnimatedString); |
735 s_cssPropertyMap.set(text_renderingAttr, AnimatedString); | 725 s_cssPropertyMap.set(text_renderingAttr, AnimatedString); |
736 s_cssPropertyMap.set(vector_effectAttr, AnimatedString); | 726 s_cssPropertyMap.set(vector_effectAttr, AnimatedString); |
737 s_cssPropertyMap.set(visibilityAttr, AnimatedString); | 727 s_cssPropertyMap.set(visibilityAttr, AnimatedString); |
738 s_cssPropertyMap.set(word_spacingAttr, AnimatedLength); | 728 s_cssPropertyMap.set(word_spacingAttr, AnimatedLength); |
739 return s_cssPropertyMap; | 729 return s_cssPropertyMap; |
740 } | 730 } |
741 | 731 |
742 void SVGElement::animatedPropertyTypeForAttribute(const QualifiedName& attribute
Name, Vector<AnimatedPropertyType>& propertyTypes) | 732 void SVGElement::animatedPropertyTypeForAttribute(const QualifiedName& attribute
Name, Vector<AnimatedPropertyType>& propertyTypes) |
743 { | 733 { |
744 localAttributeToPropertyMap().animatedPropertyTypeForAttribute(attributeName
, propertyTypes); | |
745 if (!propertyTypes.isEmpty()) | |
746 return; | |
747 | |
748 RefPtr<NewSVGAnimatedPropertyBase> animatedProperty = m_newAttributeToProper
tyMap.get(attributeName); | 734 RefPtr<NewSVGAnimatedPropertyBase> animatedProperty = m_newAttributeToProper
tyMap.get(attributeName); |
749 if (animatedProperty) { | 735 if (animatedProperty) { |
750 propertyTypes.append(animatedProperty->type()); | 736 propertyTypes.append(animatedProperty->type()); |
751 return; | 737 return; |
752 } | 738 } |
753 | 739 |
754 AttributeToPropertyTypeMap& cssPropertyTypeMap = cssPropertyToTypeMap(); | 740 AttributeToPropertyTypeMap& cssPropertyTypeMap = cssPropertyToTypeMap(); |
755 if (cssPropertyTypeMap.contains(attributeName)) | 741 if (cssPropertyTypeMap.contains(attributeName)) |
756 propertyTypes.append(cssPropertyTypeMap.get(attributeName)); | 742 propertyTypes.append(cssPropertyTypeMap.get(attributeName)); |
757 } | 743 } |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 SVGElementInstance::invalidateAllInstancesOfElement(this); | 974 SVGElementInstance::invalidateAllInstancesOfElement(this); |
989 return; | 975 return; |
990 } | 976 } |
991 } | 977 } |
992 | 978 |
993 void SVGElement::synchronizeAnimatedSVGAttribute(const QualifiedName& name) cons
t | 979 void SVGElement::synchronizeAnimatedSVGAttribute(const QualifiedName& name) cons
t |
994 { | 980 { |
995 if (!elementData() || !elementData()->m_animatedSVGAttributesAreDirty) | 981 if (!elementData() || !elementData()->m_animatedSVGAttributesAreDirty) |
996 return; | 982 return; |
997 | 983 |
998 SVGElement* nonConstThis = const_cast<SVGElement*>(this); | |
999 if (name == anyQName()) { | 984 if (name == anyQName()) { |
1000 nonConstThis->localAttributeToPropertyMap().synchronizeProperties(nonCon
stThis); | |
1001 | |
1002 AttributeToPropertyMap::const_iterator::Values it = m_newAttributeToProp
ertyMap.values().begin(); | 985 AttributeToPropertyMap::const_iterator::Values it = m_newAttributeToProp
ertyMap.values().begin(); |
1003 AttributeToPropertyMap::const_iterator::Values end = m_newAttributeToPro
pertyMap.values().end(); | 986 AttributeToPropertyMap::const_iterator::Values end = m_newAttributeToPro
pertyMap.values().end(); |
1004 for (; it != end; ++it) { | 987 for (; it != end; ++it) { |
1005 if ((*it)->needsSynchronizeAttribute()) | 988 if ((*it)->needsSynchronizeAttribute()) |
1006 (*it)->synchronizeAttribute(); | 989 (*it)->synchronizeAttribute(); |
1007 } | 990 } |
1008 | 991 |
1009 elementData()->m_animatedSVGAttributesAreDirty = false; | 992 elementData()->m_animatedSVGAttributesAreDirty = false; |
1010 } else { | 993 } else { |
1011 nonConstThis->localAttributeToPropertyMap().synchronizeProperty(nonConst
This, name); | |
1012 | |
1013 RefPtr<NewSVGAnimatedPropertyBase> property = m_newAttributeToPropertyMa
p.get(name); | 994 RefPtr<NewSVGAnimatedPropertyBase> property = m_newAttributeToPropertyMa
p.get(name); |
1014 if (property && property->needsSynchronizeAttribute()) | 995 if (property && property->needsSynchronizeAttribute()) |
1015 property->synchronizeAttribute(); | 996 property->synchronizeAttribute(); |
1016 } | 997 } |
1017 } | 998 } |
1018 | 999 |
1019 PassRefPtr<RenderStyle> SVGElement::customStyleForRenderer() | 1000 PassRefPtr<RenderStyle> SVGElement::customStyleForRenderer() |
1020 { | 1001 { |
1021 if (!correspondingElement()) | 1002 if (!correspondingElement()) |
1022 return document().ensureStyleResolver().styleForElement(this); | 1003 return document().ensureStyleResolver().styleForElement(this); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 animatableAttributes.add(SVGNames::zAttr); | 1153 animatableAttributes.add(SVGNames::zAttr); |
1173 } | 1154 } |
1174 | 1155 |
1175 if (name == classAttr) | 1156 if (name == classAttr) |
1176 return true; | 1157 return true; |
1177 | 1158 |
1178 return animatableAttributes.contains(name); | 1159 return animatableAttributes.contains(name); |
1179 } | 1160 } |
1180 #endif | 1161 #endif |
1181 } | 1162 } |
OLD | NEW |