| 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 = this->element(); | 59 SVGElement* element = this->element(); |
| 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->xCurrentValue().value(lengthContext), svg->yCurr
entValue().value(lengthContext), svg->widthCurrentValue().value(lengthContext),
svg->heightCurrentValue().value(lengthContext)); | 66 m_viewport = FloatRect(svg->x()->currentValue()->value(lengthContext), svg->
y()->currentValue()->value(lengthContext), svg->width()->currentValue()->value(l
engthContext), svg->height()->currentValue()->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->widthCurrentValue().value(lengthCont
ext)); | 100 m_viewport.setWidth(useElement->width()->currentValue()->value(lengt
hContext)); |
| 101 else if (isSymbolElement && svg->hasAttribute(SVGNames::widthAttr)) { | 101 else if (isSymbolElement && svg->hasAttribute(SVGNames::widthAttr)) { |
| 102 SVGLength containerWidth(LengthModeWidth, "100%"); | 102 RefPtr<SVGLength> containerWidth = SVGLength::create(LengthModeWidth
); |
| 103 m_viewport.setWidth(containerWidth.value(lengthContext)); | 103 containerWidth->setValueAsString("100%", ASSERT_NO_EXCEPTION); |
| 104 m_viewport.setWidth(containerWidth->value(lengthContext)); |
| 104 } | 105 } |
| 105 | 106 |
| 106 if (useElement->hasAttribute(SVGNames::heightAttr)) | 107 if (useElement->hasAttribute(SVGNames::heightAttr)) |
| 107 m_viewport.setHeight(useElement->heightCurrentValue().value(lengthCo
ntext)); | 108 m_viewport.setHeight(useElement->height()->currentValue()->value(len
gthContext)); |
| 108 else if (isSymbolElement && svg->hasAttribute(SVGNames::heightAttr)) { | 109 else if (isSymbolElement && svg->hasAttribute(SVGNames::heightAttr)) { |
| 109 SVGLength containerHeight(LengthModeHeight, "100%"); | 110 RefPtr<SVGLength> containerHeight = SVGLength::create(LengthModeHeig
ht); |
| 110 m_viewport.setHeight(containerHeight.value(lengthContext)); | 111 containerHeight->setValueAsString("100%", ASSERT_NO_EXCEPTION); |
| 112 m_viewport.setHeight(containerHeight->value(lengthContext)); |
| 111 } | 113 } |
| 112 } | 114 } |
| 113 | 115 |
| 114 if (oldViewport != m_viewport) { | 116 if (oldViewport != m_viewport) { |
| 115 setNeedsBoundariesUpdate(); | 117 setNeedsBoundariesUpdate(); |
| 116 setNeedsTransformUpdate(); | 118 setNeedsTransformUpdate(); |
| 117 } | 119 } |
| 118 } | 120 } |
| 119 | 121 |
| 120 bool RenderSVGViewportContainer::calculateLocalTransform() | 122 bool RenderSVGViewportContainer::calculateLocalTransform() |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // An empty viewBox disables rendering. | 154 // An empty viewBox disables rendering. |
| 153 if (element()->hasTagName(SVGNames::svgTag)) { | 155 if (element()->hasTagName(SVGNames::svgTag)) { |
| 154 if (toSVGSVGElement(element())->hasEmptyViewBox()) | 156 if (toSVGSVGElement(element())->hasEmptyViewBox()) |
| 155 return; | 157 return; |
| 156 } | 158 } |
| 157 | 159 |
| 158 RenderSVGContainer::paint(paintInfo, paintOffset); | 160 RenderSVGContainer::paint(paintInfo, paintOffset); |
| 159 } | 161 } |
| 160 | 162 |
| 161 } | 163 } |
| OLD | NEW |