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() | 69 SVGFitToViewBox::SVGFitToViewBox(SVGElement* element, PropertyMapPolicy property
MapPolicy) |
| 70 : m_viewBox(SVGAnimatedViewBoxRect::create(element)) |
| 71 , m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create(element, SVGN
ames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create())) |
70 { | 72 { |
71 } | |
72 | |
73 void SVGFitToViewBox::initialize(SVGElement* element, PropertyMapPolicy property
MapPolicy) | |
74 { | |
75 ASSERT(!m_viewBox); | |
76 ASSERT(!m_preserveAspectRatio); | |
77 ASSERT(element); | 73 ASSERT(element); |
78 | |
79 m_viewBox = SVGAnimatedViewBoxRect::create(element); | |
80 m_preserveAspectRatio = SVGAnimatedPreserveAspectRatio::create(element, SVGN
ames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create()); | |
81 | |
82 if (propertyMapPolicy == PropertyMapPolicyAdd) { | 74 if (propertyMapPolicy == PropertyMapPolicyAdd) { |
83 element->addToPropertyMap(m_viewBox); | 75 element->addToPropertyMap(m_viewBox); |
84 element->addToPropertyMap(m_preserveAspectRatio); | 76 element->addToPropertyMap(m_preserveAspectRatio); |
85 } | 77 } |
86 } | 78 } |
87 | 79 |
88 DEFINE_TRACE(SVGFitToViewBox) | 80 DEFINE_TRACE(SVGFitToViewBox) |
89 { | 81 { |
90 visitor->trace(m_viewBox); | 82 visitor->trace(m_viewBox); |
91 visitor->trace(m_preserveAspectRatio); | 83 visitor->trace(m_preserveAspectRatio); |
(...skipping 18 matching lines...) Expand all Loading... |
110 supportedAttributes.add(SVGNames::preserveAspectRatioAttr); | 102 supportedAttributes.add(SVGNames::preserveAspectRatioAttr); |
111 } | 103 } |
112 | 104 |
113 void SVGFitToViewBox::updateViewBox(const FloatRect& rect) | 105 void SVGFitToViewBox::updateViewBox(const FloatRect& rect) |
114 { | 106 { |
115 ASSERT(m_viewBox); | 107 ASSERT(m_viewBox); |
116 m_viewBox->baseValue()->setValue(rect); | 108 m_viewBox->baseValue()->setValue(rect); |
117 } | 109 } |
118 | 110 |
119 } | 111 } |
OLD | NEW |