OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> |
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 case kSvgAngletypeTurn: | 327 case kSvgAngletypeTurn: |
328 m_valueInSpecifiedUnits = grad2turn(m_valueInSpecifiedUnits); | 328 m_valueInSpecifiedUnits = grad2turn(m_valueInSpecifiedUnits); |
329 break; | 329 break; |
330 case kSvgAngletypeGrad: | 330 case kSvgAngletypeGrad: |
331 case kSvgAngletypeUnknown: | 331 case kSvgAngletypeUnknown: |
332 ASSERT_NOT_REACHED(); | 332 ASSERT_NOT_REACHED(); |
333 break; | 333 break; |
334 } | 334 } |
335 break; | 335 break; |
336 case kSvgAngletypeUnspecified: | 336 case kSvgAngletypeUnspecified: |
337 // Spec: For angles, a unitless value is treated the same as if degrees were
specified. | 337 // Spec: For angles, a unitless value is treated the same as if degrees were |
| 338 // specified. |
338 case kSvgAngletypeDeg: | 339 case kSvgAngletypeDeg: |
339 switch (unitType) { | 340 switch (unitType) { |
340 case kSvgAngletypeRad: | 341 case kSvgAngletypeRad: |
341 m_valueInSpecifiedUnits = deg2rad(m_valueInSpecifiedUnits); | 342 m_valueInSpecifiedUnits = deg2rad(m_valueInSpecifiedUnits); |
342 break; | 343 break; |
343 case kSvgAngletypeGrad: | 344 case kSvgAngletypeGrad: |
344 m_valueInSpecifiedUnits = deg2grad(m_valueInSpecifiedUnits); | 345 m_valueInSpecifiedUnits = deg2grad(m_valueInSpecifiedUnits); |
345 break; | 346 break; |
346 case kSvgAngletypeTurn: | 347 case kSvgAngletypeTurn: |
347 m_valueInSpecifiedUnits = deg2turn(m_valueInSpecifiedUnits); | 348 m_valueInSpecifiedUnits = deg2turn(m_valueInSpecifiedUnits); |
(...skipping 11 matching lines...) Expand all Loading... |
359 break; | 360 break; |
360 } | 361 } |
361 | 362 |
362 m_unitType = unitType; | 363 m_unitType = unitType; |
363 m_orientType->setEnumValue(SVGMarkerOrientAngle); | 364 m_orientType->setEnumValue(SVGMarkerOrientAngle); |
364 } | 365 } |
365 | 366 |
366 void SVGAngle::add(SVGPropertyBase* other, SVGElement*) { | 367 void SVGAngle::add(SVGPropertyBase* other, SVGElement*) { |
367 SVGAngle* otherAngle = toSVGAngle(other); | 368 SVGAngle* otherAngle = toSVGAngle(other); |
368 | 369 |
369 // Only respect by animations, if from and by are both specified in angles (an
d not eg. 'auto'). | 370 // Only respect by animations, if from and by are both specified in angles |
| 371 // (and not, for example, 'auto'). |
370 if (orientType()->enumValue() != SVGMarkerOrientAngle || | 372 if (orientType()->enumValue() != SVGMarkerOrientAngle || |
371 otherAngle->orientType()->enumValue() != SVGMarkerOrientAngle) | 373 otherAngle->orientType()->enumValue() != SVGMarkerOrientAngle) |
372 return; | 374 return; |
373 | 375 |
374 setValue(value() + otherAngle->value()); | 376 setValue(value() + otherAngle->value()); |
375 } | 377 } |
376 | 378 |
377 void SVGAngle::assign(const SVGAngle& other) { | 379 void SVGAngle::assign(const SVGAngle& other) { |
378 SVGMarkerOrientType otherOrientType = other.orientType()->enumValue(); | 380 SVGMarkerOrientType otherOrientType = other.orientType()->enumValue(); |
379 if (otherOrientType == SVGMarkerOrientAngle) | 381 if (otherOrientType == SVGMarkerOrientAngle) |
(...skipping 23 matching lines...) Expand all Loading... |
403 return; | 405 return; |
404 } | 406 } |
405 | 407 |
406 switch (fromOrientType) { | 408 switch (fromOrientType) { |
407 // From 'auto' to 'auto', or 'auto-start-reverse' to 'auto-start-reverse' | 409 // From 'auto' to 'auto', or 'auto-start-reverse' to 'auto-start-reverse' |
408 case SVGMarkerOrientAuto: | 410 case SVGMarkerOrientAuto: |
409 case SVGMarkerOrientAutoStartReverse: | 411 case SVGMarkerOrientAutoStartReverse: |
410 orientType()->setEnumValue(fromOrientType); | 412 orientType()->setEnumValue(fromOrientType); |
411 return; | 413 return; |
412 | 414 |
413 // Regular from angle to angle animation, with all features like additive et
c. | 415 // Regular from angle to angle animation, with all features like additive |
| 416 // etc. |
414 case SVGMarkerOrientAngle: { | 417 case SVGMarkerOrientAngle: { |
415 float animatedValue = value(); | 418 float animatedValue = value(); |
416 SVGAngle* toAtEndOfDurationAngle = toSVGAngle(toAtEndOfDuration); | 419 SVGAngle* toAtEndOfDurationAngle = toSVGAngle(toAtEndOfDuration); |
417 | 420 |
418 animationElement->animateAdditiveNumber( | 421 animationElement->animateAdditiveNumber( |
419 percentage, repeatCount, fromAngle->value(), toAngle->value(), | 422 percentage, repeatCount, fromAngle->value(), toAngle->value(), |
420 toAtEndOfDurationAngle->value(), animatedValue); | 423 toAtEndOfDurationAngle->value(), animatedValue); |
421 orientType()->setEnumValue(SVGMarkerOrientAngle); | 424 orientType()->setEnumValue(SVGMarkerOrientAngle); |
422 setValue(animatedValue); | 425 setValue(animatedValue); |
423 } | 426 } |
(...skipping 13 matching lines...) Expand all Loading... |
437 | 440 |
438 void SVGAngle::orientTypeChanged() { | 441 void SVGAngle::orientTypeChanged() { |
439 if (orientType()->enumValue() == SVGMarkerOrientAuto || | 442 if (orientType()->enumValue() == SVGMarkerOrientAuto || |
440 orientType()->enumValue() == SVGMarkerOrientAutoStartReverse) { | 443 orientType()->enumValue() == SVGMarkerOrientAutoStartReverse) { |
441 m_unitType = kSvgAngletypeUnspecified; | 444 m_unitType = kSvgAngletypeUnspecified; |
442 m_valueInSpecifiedUnits = 0; | 445 m_valueInSpecifiedUnits = 0; |
443 } | 446 } |
444 } | 447 } |
445 | 448 |
446 } // namespace blink | 449 } // namespace blink |
OLD | NEW |