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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
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->width().value(lengthContext) > 0) |
100 m_viewport.setWidth(useElement->width().value(lengthContext)); | 100 m_viewport.setWidth(useElement->width().value(lengthContext)); |
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->height().value(lengthContext) > 0) |
107 m_viewport.setHeight(useElement->height().value(lengthContext)); | 107 m_viewport.setHeight(useElement->height().value(lengthContext)); |
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(); |
(...skipping 35 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 |