OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2008 Apple Inc. All rights reserved. |
6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 else if (!toValue().isEmpty()) | 294 else if (!toValue().isEmpty()) |
295 setAnimationMode(fromValue().isEmpty() ? ToAnimation : FromToAnimation); | 295 setAnimationMode(fromValue().isEmpty() ? ToAnimation : FromToAnimation); |
296 else if (!byValue().isEmpty()) | 296 else if (!byValue().isEmpty()) |
297 setAnimationMode(fromValue().isEmpty() ? ByAnimation : FromByAnimation); | 297 setAnimationMode(fromValue().isEmpty() ? ByAnimation : FromByAnimation); |
298 else | 298 else |
299 setAnimationMode(NoAnimation); | 299 setAnimationMode(NoAnimation); |
300 } | 300 } |
301 | 301 |
302 void SVGAnimationElement::setCalcMode(const AtomicString& calcMode) | 302 void SVGAnimationElement::setCalcMode(const AtomicString& calcMode) |
303 { | 303 { |
304 DEFINE_STATIC_LOCAL(const AtomicString, discrete, ("discrete", AtomicString:
:ConstructFromLiteral)); | 304 DEFINE_STATIC_LOCAL(const AtomicString, discrete, ("discrete")); |
305 DEFINE_STATIC_LOCAL(const AtomicString, linear, ("linear", AtomicString::Con
structFromLiteral)); | 305 DEFINE_STATIC_LOCAL(const AtomicString, linear, ("linear")); |
306 DEFINE_STATIC_LOCAL(const AtomicString, paced, ("paced", AtomicString::Const
ructFromLiteral)); | 306 DEFINE_STATIC_LOCAL(const AtomicString, paced, ("paced")); |
307 DEFINE_STATIC_LOCAL(const AtomicString, spline, ("spline", AtomicString::Con
structFromLiteral)); | 307 DEFINE_STATIC_LOCAL(const AtomicString, spline, ("spline")); |
308 if (calcMode == discrete) | 308 if (calcMode == discrete) |
309 setCalcMode(CalcModeDiscrete); | 309 setCalcMode(CalcModeDiscrete); |
310 else if (calcMode == linear) | 310 else if (calcMode == linear) |
311 setCalcMode(CalcModeLinear); | 311 setCalcMode(CalcModeLinear); |
312 else if (calcMode == paced) | 312 else if (calcMode == paced) |
313 setCalcMode(CalcModePaced); | 313 setCalcMode(CalcModePaced); |
314 else if (calcMode == spline) | 314 else if (calcMode == spline) |
315 setCalcMode(CalcModeSpline); | 315 setCalcMode(CalcModeSpline); |
316 else | 316 else |
317 setCalcMode(isSVGAnimateMotionElement(*this) ? CalcModePaced : CalcModeL
inear); | 317 setCalcMode(isSVGAnimateMotionElement(*this) ? CalcModePaced : CalcModeL
inear); |
318 } | 318 } |
319 | 319 |
320 void SVGAnimationElement::setAttributeType(const AtomicString& attributeType) | 320 void SVGAnimationElement::setAttributeType(const AtomicString& attributeType) |
321 { | 321 { |
322 DEFINE_STATIC_LOCAL(const AtomicString, css, ("CSS", AtomicString::Construct
FromLiteral)); | 322 DEFINE_STATIC_LOCAL(const AtomicString, css, ("CSS")); |
323 DEFINE_STATIC_LOCAL(const AtomicString, xml, ("XML", AtomicString::Construct
FromLiteral)); | 323 DEFINE_STATIC_LOCAL(const AtomicString, xml, ("XML")); |
324 if (attributeType == css) | 324 if (attributeType == css) |
325 m_attributeType = AttributeTypeCSS; | 325 m_attributeType = AttributeTypeCSS; |
326 else if (attributeType == xml) | 326 else if (attributeType == xml) |
327 m_attributeType = AttributeTypeXML; | 327 m_attributeType = AttributeTypeXML; |
328 else | 328 else |
329 m_attributeType = AttributeTypeAuto; | 329 m_attributeType = AttributeTypeAuto; |
330 checkInvalidCSSAttributeType(); | 330 checkInvalidCSSAttributeType(); |
331 } | 331 } |
332 | 332 |
333 String SVGAnimationElement::toValue() const | 333 String SVGAnimationElement::toValue() const |
334 { | 334 { |
335 return fastGetAttribute(SVGNames::toAttr); | 335 return fastGetAttribute(SVGNames::toAttr); |
336 } | 336 } |
337 | 337 |
338 String SVGAnimationElement::byValue() const | 338 String SVGAnimationElement::byValue() const |
339 { | 339 { |
340 return fastGetAttribute(SVGNames::byAttr); | 340 return fastGetAttribute(SVGNames::byAttr); |
341 } | 341 } |
342 | 342 |
343 String SVGAnimationElement::fromValue() const | 343 String SVGAnimationElement::fromValue() const |
344 { | 344 { |
345 return fastGetAttribute(SVGNames::fromAttr); | 345 return fastGetAttribute(SVGNames::fromAttr); |
346 } | 346 } |
347 | 347 |
348 bool SVGAnimationElement::isAdditive() | 348 bool SVGAnimationElement::isAdditive() |
349 { | 349 { |
350 DEFINE_STATIC_LOCAL(const AtomicString, sum, ("sum", AtomicString::Construct
FromLiteral)); | 350 DEFINE_STATIC_LOCAL(const AtomicString, sum, ("sum")); |
351 const AtomicString& value = fastGetAttribute(SVGNames::additiveAttr); | 351 const AtomicString& value = fastGetAttribute(SVGNames::additiveAttr); |
352 return value == sum || getAnimationMode() == ByAnimation; | 352 return value == sum || getAnimationMode() == ByAnimation; |
353 } | 353 } |
354 | 354 |
355 bool SVGAnimationElement::isAccumulated() const | 355 bool SVGAnimationElement::isAccumulated() const |
356 { | 356 { |
357 DEFINE_STATIC_LOCAL(const AtomicString, sum, ("sum", AtomicString::Construct
FromLiteral)); | 357 DEFINE_STATIC_LOCAL(const AtomicString, sum, ("sum")); |
358 const AtomicString& value = fastGetAttribute(SVGNames::accumulateAttr); | 358 const AtomicString& value = fastGetAttribute(SVGNames::accumulateAttr); |
359 return value == sum && getAnimationMode() != ToAnimation; | 359 return value == sum && getAnimationMode() != ToAnimation; |
360 } | 360 } |
361 | 361 |
362 bool SVGAnimationElement::isTargetAttributeCSSProperty(SVGElement* targetElement
, const QualifiedName& attributeName) | 362 bool SVGAnimationElement::isTargetAttributeCSSProperty(SVGElement* targetElement
, const QualifiedName& attributeName) |
363 { | 363 { |
364 ASSERT(targetElement); | 364 ASSERT(targetElement); |
365 | 365 |
366 return SVGElement::isAnimatableCSSProperty(attributeName) || targetElement->
isPresentationAttribute(attributeName); | 366 return SVGElement::isAnimatableCSSProperty(attributeName) || targetElement->
isPresentationAttribute(attributeName); |
367 } | 367 } |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 if (!parent || !parent->isSVGElement()) | 673 if (!parent || !parent->isSVGElement()) |
674 return; | 674 return; |
675 | 675 |
676 SVGElement* svgParent = toSVGElement(parent); | 676 SVGElement* svgParent = toSVGElement(parent); |
677 computeCSSPropertyValue(svgParent, cssPropertyID(attributeName.localName()),
value); | 677 computeCSSPropertyValue(svgParent, cssPropertyID(attributeName.localName()),
value); |
678 } | 678 } |
679 | 679 |
680 static bool inheritsFromProperty(SVGElement* targetElement, const QualifiedName&
attributeName, const String& value) | 680 static bool inheritsFromProperty(SVGElement* targetElement, const QualifiedName&
attributeName, const String& value) |
681 { | 681 { |
682 ASSERT(targetElement); | 682 ASSERT(targetElement); |
683 DEFINE_STATIC_LOCAL(const AtomicString, inherit, ("inherit", AtomicString::C
onstructFromLiteral)); | 683 DEFINE_STATIC_LOCAL(const AtomicString, inherit, ("inherit")); |
684 | 684 |
685 if (value.isEmpty() || value != inherit) | 685 if (value.isEmpty() || value != inherit) |
686 return false; | 686 return false; |
687 return SVGElement::isAnimatableCSSProperty(attributeName); | 687 return SVGElement::isAnimatableCSSProperty(attributeName); |
688 } | 688 } |
689 | 689 |
690 void SVGAnimationElement::determinePropertyValueTypes(const String& from, const
String& to) | 690 void SVGAnimationElement::determinePropertyValueTypes(const String& from, const
String& to) |
691 { | 691 { |
692 SVGElement* targetElement = this->targetElement(); | 692 SVGElement* targetElement = this->targetElement(); |
693 ASSERT(targetElement); | 693 ASSERT(targetElement); |
(...skipping 30 matching lines...) Expand all Loading... |
724 if (!hasInvalidCSSAttributeType) | 724 if (!hasInvalidCSSAttributeType) |
725 schedule(); | 725 schedule(); |
726 } | 726 } |
727 | 727 |
728 // Clear values that may depend on the previous target. | 728 // Clear values that may depend on the previous target. |
729 if (targetElement()) | 729 if (targetElement()) |
730 clearAnimatedType(); | 730 clearAnimatedType(); |
731 } | 731 } |
732 | 732 |
733 } // namespace blink | 733 } // namespace blink |
OLD | NEW |