OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 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) 2009 Google, Inc. | 5 * Copyright (C) 2009 Google, Inc. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 void RenderSVGViewportContainer::calcViewport() | 57 void RenderSVGViewportContainer::calcViewport() |
58 { | 58 { |
59 SVGElement* element = toSVGElement(node()); | 59 SVGElement* element = toSVGElement(node()); |
60 if (!element->hasTagName(SVGNames::svgTag)) | 60 if (!element->hasTagName(SVGNames::svgTag)) |
61 return; | 61 return; |
62 SVGSVGElement* svg = toSVGSVGElement(element); | 62 SVGSVGElement* svg = toSVGSVGElement(element); |
63 FloatRect oldViewport = m_viewport; | 63 FloatRect oldViewport = m_viewport; |
64 | 64 |
65 SVGLengthContext lengthContext(element); | 65 SVGLengthContext lengthContext(element); |
66 m_viewport = FloatRect(svg->x().value(lengthContext), svg->y().value(lengthC
ontext), svg->width().value(lengthContext), svg->height().value(lengthContext)); | 66 m_viewport = FloatRect(svg->xCurrentValue().value(lengthContext), svg->yCurr
entValue().value(lengthContext), svg->widthCurrentValue().value(lengthContext),
svg->heightCurrentValue().value(lengthContext)); |
67 | 67 |
68 SVGElement* correspondingElement = svg->correspondingElement(); | 68 SVGElement* correspondingElement = svg->correspondingElement(); |
69 if (correspondingElement && svg->isInShadowTree()) { | 69 if (correspondingElement && svg->isInShadowTree()) { |
70 const HashSet<SVGElementInstance*>& instances = correspondingElement->in
stancesForElement(); | 70 const HashSet<SVGElementInstance*>& instances = correspondingElement->in
stancesForElement(); |
71 ASSERT(!instances.isEmpty()); | 71 ASSERT(!instances.isEmpty()); |
72 | 72 |
73 SVGUseElement* useElement = 0; | 73 SVGUseElement* useElement = 0; |
74 const HashSet<SVGElementInstance*>::const_iterator end = instances.end()
; | 74 const HashSet<SVGElementInstance*>::const_iterator end = instances.end()
; |
75 for (HashSet<SVGElementInstance*>::const_iterator it = instances.begin()
; it != end; ++it) { | 75 for (HashSet<SVGElementInstance*>::const_iterator it = instances.begin()
; it != end; ++it) { |
76 const SVGElementInstance* instance = (*it); | 76 const SVGElementInstance* instance = (*it); |
(...skipping 13 matching lines...) Expand all Loading... |
90 // Spec (<use> on <symbol>): This generated 'svg' will always have expli
cit values for attributes width and height. | 90 // Spec (<use> on <symbol>): This generated 'svg' will always have expli
cit values for attributes width and height. |
91 // If attributes width and/or height are provided on the 'use' element,
then these attributes | 91 // If attributes width and/or height are provided on the 'use' element,
then these attributes |
92 // will be transferred to the generated 'svg'. If attributes width and/o
r height are not specified, | 92 // will be transferred to the generated 'svg'. If attributes width and/o
r height are not specified, |
93 // the generated 'svg' element will use values of 100% for these attribu
tes. | 93 // the generated 'svg' element will use values of 100% for these attribu
tes. |
94 | 94 |
95 // Spec (<use> on <svg>): If attributes width and/or height are provided
on the 'use' element, then these | 95 // Spec (<use> on <svg>): If attributes width and/or height are provided
on the 'use' element, then these |
96 // values will override the corresponding attributes on the 'svg' in the
generated tree. | 96 // values will override the corresponding attributes on the 'svg' in the
generated tree. |
97 | 97 |
98 SVGLengthContext lengthContext(element); | 98 SVGLengthContext lengthContext(element); |
99 if (useElement->hasAttribute(SVGNames::widthAttr)) | 99 if (useElement->hasAttribute(SVGNames::widthAttr)) |
100 m_viewport.setWidth(useElement->width().value(lengthContext)); | 100 m_viewport.setWidth(useElement->widthCurrentValue().value(lengthCont
ext)); |
101 else if (isSymbolElement && svg->hasAttribute(SVGNames::widthAttr)) { | 101 else if (isSymbolElement && svg->hasAttribute(SVGNames::widthAttr)) { |
102 SVGLength containerWidth(LengthModeWidth, "100%"); | 102 SVGLength containerWidth(LengthModeWidth, "100%"); |
103 m_viewport.setWidth(containerWidth.value(lengthContext)); | 103 m_viewport.setWidth(containerWidth.value(lengthContext)); |
104 } | 104 } |
105 | 105 |
106 if (useElement->hasAttribute(SVGNames::heightAttr)) | 106 if (useElement->hasAttribute(SVGNames::heightAttr)) |
107 m_viewport.setHeight(useElement->height().value(lengthContext)); | 107 m_viewport.setHeight(useElement->heightCurrentValue().value(lengthCo
ntext)); |
108 else if (isSymbolElement && svg->hasAttribute(SVGNames::heightAttr)) { | 108 else if (isSymbolElement && svg->hasAttribute(SVGNames::heightAttr)) { |
109 SVGLength containerHeight(LengthModeHeight, "100%"); | 109 SVGLength containerHeight(LengthModeHeight, "100%"); |
110 m_viewport.setHeight(containerHeight.value(lengthContext)); | 110 m_viewport.setHeight(containerHeight.value(lengthContext)); |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 if (oldViewport != m_viewport) { | 114 if (oldViewport != m_viewport) { |
115 setNeedsBoundariesUpdate(); | 115 setNeedsBoundariesUpdate(); |
116 setNeedsTransformUpdate(); | 116 setNeedsTransformUpdate(); |
117 } | 117 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // An empty viewBox disables rendering. | 152 // An empty viewBox disables rendering. |
153 if (node()->hasTagName(SVGNames::svgTag)) { | 153 if (node()->hasTagName(SVGNames::svgTag)) { |
154 if (toSVGSVGElement(node())->hasEmptyViewBox()) | 154 if (toSVGSVGElement(node())->hasEmptyViewBox()) |
155 return; | 155 return; |
156 } | 156 } |
157 | 157 |
158 RenderSVGContainer::paint(paintInfo, paintOffset); | 158 RenderSVGContainer::paint(paintInfo, paintOffset); |
159 } | 159 } |
160 | 160 |
161 } | 161 } |
OLD | NEW |