OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2008 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) 2010 Dirk Schulze <krit@webkit.org> | 4 * Copyright (C) 2010 Dirk Schulze <krit@webkit.org> |
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 16 matching lines...) Expand all Loading... |
27 #include "core/dom/ExceptionCode.h" | 27 #include "core/dom/ExceptionCode.h" |
28 #include "core/svg/SVGAnimationElement.h" | 28 #include "core/svg/SVGAnimationElement.h" |
29 #include "core/svg/SVGParserUtilities.h" | 29 #include "core/svg/SVGParserUtilities.h" |
30 #include "platform/geometry/FloatRect.h" | 30 #include "platform/geometry/FloatRect.h" |
31 #include "platform/transforms/AffineTransform.h" | 31 #include "platform/transforms/AffineTransform.h" |
32 #include "wtf/text/WTFString.h" | 32 #include "wtf/text/WTFString.h" |
33 | 33 |
34 namespace WebCore { | 34 namespace WebCore { |
35 | 35 |
36 SVGPreserveAspectRatio::SVGPreserveAspectRatio() | 36 SVGPreserveAspectRatio::SVGPreserveAspectRatio() |
37 : NewSVGPropertyBase(classType()) | 37 : SVGPropertyBase(classType()) |
38 { | 38 { |
39 setDefault(); | 39 setDefault(); |
40 } | 40 } |
41 | 41 |
42 void SVGPreserveAspectRatio::setDefault() | 42 void SVGPreserveAspectRatio::setDefault() |
43 { | 43 { |
44 m_align = SVG_PRESERVEASPECTRATIO_XMIDYMID; | 44 m_align = SVG_PRESERVEASPECTRATIO_XMIDYMID; |
45 m_meetOrSlice = SVG_MEETORSLICE_MEET; | 45 m_meetOrSlice = SVG_MEETORSLICE_MEET; |
46 } | 46 } |
47 | 47 |
48 PassRefPtr<SVGPreserveAspectRatio> SVGPreserveAspectRatio::clone() const | 48 PassRefPtr<SVGPreserveAspectRatio> SVGPreserveAspectRatio::clone() const |
49 { | 49 { |
50 RefPtr<SVGPreserveAspectRatio> preserveAspectRatio = create(); | 50 RefPtr<SVGPreserveAspectRatio> preserveAspectRatio = create(); |
51 | 51 |
52 preserveAspectRatio->m_align = m_align; | 52 preserveAspectRatio->m_align = m_align; |
53 preserveAspectRatio->m_meetOrSlice = m_meetOrSlice; | 53 preserveAspectRatio->m_meetOrSlice = m_meetOrSlice; |
54 | 54 |
55 return preserveAspectRatio.release(); | 55 return preserveAspectRatio.release(); |
56 } | 56 } |
57 | 57 |
58 PassRefPtr<NewSVGPropertyBase> SVGPreserveAspectRatio::cloneForAnimation(const S
tring& value) const | 58 PassRefPtr<SVGPropertyBase> SVGPreserveAspectRatio::cloneForAnimation(const Stri
ng& value) const |
59 { | 59 { |
60 RefPtr<SVGPreserveAspectRatio> preserveAspectRatio = create(); | 60 RefPtr<SVGPreserveAspectRatio> preserveAspectRatio = create(); |
61 | 61 |
62 preserveAspectRatio->setValueAsString(value, IGNORE_EXCEPTION); | 62 preserveAspectRatio->setValueAsString(value, IGNORE_EXCEPTION); |
63 | 63 |
64 return preserveAspectRatio.release(); | 64 return preserveAspectRatio.release(); |
65 } | 65 } |
66 | 66 |
67 template<typename CharType> | 67 template<typename CharType> |
68 bool SVGPreserveAspectRatio::parseInternal(const CharType*& ptr, const CharType*
end, bool validate) | 68 bool SVGPreserveAspectRatio::parseInternal(const CharType*& ptr, const CharType*
end, bool validate) |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 default: | 390 default: |
391 case SVG_MEETORSLICE_UNKNOWN: | 391 case SVG_MEETORSLICE_UNKNOWN: |
392 return alignType; | 392 return alignType; |
393 case SVG_MEETORSLICE_MEET: | 393 case SVG_MEETORSLICE_MEET: |
394 return alignType + " meet"; | 394 return alignType + " meet"; |
395 case SVG_MEETORSLICE_SLICE: | 395 case SVG_MEETORSLICE_SLICE: |
396 return alignType + " slice"; | 396 return alignType + " slice"; |
397 } | 397 } |
398 } | 398 } |
399 | 399 |
400 void SVGPreserveAspectRatio::add(PassRefPtr<NewSVGPropertyBase> other, SVGElemen
t*) | 400 void SVGPreserveAspectRatio::add(PassRefPtr<SVGPropertyBase> other, SVGElement*) |
401 { | 401 { |
402 ASSERT_NOT_REACHED(); | 402 ASSERT_NOT_REACHED(); |
403 } | 403 } |
404 | 404 |
405 void SVGPreserveAspectRatio::calculateAnimatedValue(SVGAnimationElement* animati
onElement, float percentage, unsigned repeatCount, PassRefPtr<NewSVGPropertyBase
> fromValue, PassRefPtr<NewSVGPropertyBase> toValue, PassRefPtr<NewSVGPropertyBa
se>, SVGElement*) | 405 void SVGPreserveAspectRatio::calculateAnimatedValue(SVGAnimationElement* animati
onElement, float percentage, unsigned repeatCount, PassRefPtr<SVGPropertyBase> f
romValue, PassRefPtr<SVGPropertyBase> toValue, PassRefPtr<SVGPropertyBase>, SVGE
lement*) |
406 { | 406 { |
407 ASSERT(animationElement); | 407 ASSERT(animationElement); |
408 | 408 |
409 bool useToValue; | 409 bool useToValue; |
410 animationElement->animateDiscreteType(percentage, false, true, useToValue); | 410 animationElement->animateDiscreteType(percentage, false, true, useToValue); |
411 | 411 |
412 RefPtr<SVGPreserveAspectRatio> preserveAspectRatioToUse = useToValue ? toSVG
PreserveAspectRatio(toValue) : toSVGPreserveAspectRatio(fromValue); | 412 RefPtr<SVGPreserveAspectRatio> preserveAspectRatioToUse = useToValue ? toSVG
PreserveAspectRatio(toValue) : toSVGPreserveAspectRatio(fromValue); |
413 | 413 |
414 m_align = preserveAspectRatioToUse->m_align; | 414 m_align = preserveAspectRatioToUse->m_align; |
415 m_meetOrSlice = preserveAspectRatioToUse->m_meetOrSlice; | 415 m_meetOrSlice = preserveAspectRatioToUse->m_meetOrSlice; |
416 } | 416 } |
417 | 417 |
418 float SVGPreserveAspectRatio::calculateDistance(PassRefPtr<NewSVGPropertyBase> t
oValue, SVGElement* contextElement) | 418 float SVGPreserveAspectRatio::calculateDistance(PassRefPtr<SVGPropertyBase> toVa
lue, SVGElement* contextElement) |
419 { | 419 { |
420 // No paced animations for SVGPreserveAspectRatio. | 420 // No paced animations for SVGPreserveAspectRatio. |
421 return -1; | 421 return -1; |
422 } | 422 } |
423 | 423 |
424 } | 424 } |
OLD | NEW |