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, 2010 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2014 Samsung Electronics. All rights reserved. | 4 * Copyright (C) 2014 Samsung Electronics. 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 parseError = ParsingAttributeFailedError; | 59 parseError = ParsingAttributeFailedError; |
60 return; | 60 return; |
61 } | 61 } |
62 | 62 |
63 if (baseValue()->width() < 0 || baseValue()->height() < 0) { | 63 if (baseValue()->width() < 0 || baseValue()->height() < 0) { |
64 parseError = NegativeValueForbiddenError; | 64 parseError = NegativeValueForbiddenError; |
65 baseValue()->setInvalid(); | 65 baseValue()->setInvalid(); |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 SVGFitToViewBox::SVGFitToViewBox(SVGElement* element, PropertyMapPolicy property
MapPolicy) | 69 SVGFitToViewBox::SVGFitToViewBox() |
70 : m_viewBox(SVGAnimatedViewBoxRect::create(element)) | |
71 , m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create(element, SVGN
ames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create())) | |
72 { | 70 { |
| 71 } |
| 72 |
| 73 void SVGFitToViewBox::initialize(SVGElement* element, PropertyMapPolicy property
MapPolicy) |
| 74 { |
| 75 ASSERT(!m_viewBox); |
| 76 ASSERT(!m_preserveAspectRatio); |
73 ASSERT(element); | 77 ASSERT(element); |
| 78 |
| 79 m_viewBox = SVGAnimatedViewBoxRect::create(element); |
| 80 m_preserveAspectRatio = SVGAnimatedPreserveAspectRatio::create(element, SVGN
ames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create()); |
| 81 |
74 if (propertyMapPolicy == PropertyMapPolicyAdd) { | 82 if (propertyMapPolicy == PropertyMapPolicyAdd) { |
75 element->addToPropertyMap(m_viewBox); | 83 element->addToPropertyMap(m_viewBox); |
76 element->addToPropertyMap(m_preserveAspectRatio); | 84 element->addToPropertyMap(m_preserveAspectRatio); |
77 } | 85 } |
78 } | 86 } |
79 | 87 |
80 void SVGFitToViewBox::trace(Visitor* visitor) | 88 void SVGFitToViewBox::trace(Visitor* visitor) |
81 { | 89 { |
82 visitor->trace(m_viewBox); | 90 visitor->trace(m_viewBox); |
83 visitor->trace(m_preserveAspectRatio); | 91 visitor->trace(m_preserveAspectRatio); |
(...skipping 18 matching lines...) Expand all Loading... |
102 supportedAttributes.add(SVGNames::preserveAspectRatioAttr); | 110 supportedAttributes.add(SVGNames::preserveAspectRatioAttr); |
103 } | 111 } |
104 | 112 |
105 void SVGFitToViewBox::updateViewBox(const FloatRect& rect) | 113 void SVGFitToViewBox::updateViewBox(const FloatRect& rect) |
106 { | 114 { |
107 ASSERT(m_viewBox); | 115 ASSERT(m_viewBox); |
108 m_viewBox->baseValue()->setValue(rect); | 116 m_viewBox->baseValue()->setValue(rect); |
109 } | 117 } |
110 | 118 |
111 } | 119 } |
OLD | NEW |