OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
6 * Copyright (C) 2012 University of Szeged | 6 * Copyright (C) 2012 University of Szeged |
7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> | 7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 if (m_resource->errorOccurred()) | 141 if (m_resource->errorOccurred()) |
142 return 0; | 142 return 0; |
143 ASSERT(m_resource->document()); | 143 ASSERT(m_resource->document()); |
144 return m_resource->document(); | 144 return m_resource->document(); |
145 } | 145 } |
146 return 0; | 146 return 0; |
147 } | 147 } |
148 | 148 |
149 void transferUseWidthAndHeightIfNeeded(const SVGUseElement& use, SVGElement* sha
dowElement, const SVGElement& originalElement) | 149 void transferUseWidthAndHeightIfNeeded(const SVGUseElement& use, SVGElement* sha
dowElement, const SVGElement& originalElement) |
150 { | 150 { |
| 151 DEFINE_STATIC_LOCAL(const AtomicString, hundredPercentString, ("100%", Atomi
cString::ConstructFromLiteral)); |
151 ASSERT(shadowElement); | 152 ASSERT(shadowElement); |
152 if (isSVGSymbolElement(*shadowElement)) { | 153 if (isSVGSymbolElement(*shadowElement)) { |
153 // Spec (<use> on <symbol>): This generated 'svg' will always have expli
cit values for attributes width and height. | 154 // Spec (<use> on <symbol>): This generated 'svg' will always have expli
cit values for attributes width and height. |
154 // If attributes width and/or height are provided on the 'use' element,
then these attributes | 155 // If attributes width and/or height are provided on the 'use' element,
then these attributes |
155 // will be transferred to the generated 'svg'. If attributes width and/o
r height are not specified, | 156 // will be transferred to the generated 'svg'. If attributes width and/o
r height are not specified, |
156 // the generated 'svg' element will use values of 100% for these attribu
tes. | 157 // the generated 'svg' element will use values of 100% for these attribu
tes. |
157 shadowElement->setAttribute(SVGNames::widthAttr, use.width()->isSpecifie
d() ? AtomicString(use.width()->currentValue()->valueAsString()) : "100%"); | 158 shadowElement->setAttribute(SVGNames::widthAttr, use.width()->isSpecifie
d() ? AtomicString(use.width()->currentValue()->valueAsString()) : hundredPercen
tString); |
158 shadowElement->setAttribute(SVGNames::heightAttr, use.height()->isSpecif
ied() ? AtomicString(use.height()->currentValue()->valueAsString()) : "100%"); | 159 shadowElement->setAttribute(SVGNames::heightAttr, use.height()->isSpecif
ied() ? AtomicString(use.height()->currentValue()->valueAsString()) : hundredPer
centString); |
159 } else if (isSVGSVGElement(*shadowElement)) { | 160 } else if (isSVGSVGElement(*shadowElement)) { |
160 // Spec (<use> on <svg>): If attributes width and/or height are provided
on the 'use' element, then these | 161 // Spec (<use> on <svg>): If attributes width and/or height are provided
on the 'use' element, then these |
161 // values will override the corresponding attributes on the 'svg' in the
generated tree. | 162 // values will override the corresponding attributes on the 'svg' in the
generated tree. |
162 if (use.width()->isSpecified()) | 163 if (use.width()->isSpecified()) |
163 shadowElement->setAttribute(SVGNames::widthAttr, AtomicString(use.wi
dth()->currentValue()->valueAsString())); | 164 shadowElement->setAttribute(SVGNames::widthAttr, AtomicString(use.wi
dth()->currentValue()->valueAsString())); |
164 else | 165 else |
165 shadowElement->setAttribute(SVGNames::widthAttr, originalElement.get
Attribute(SVGNames::widthAttr)); | 166 shadowElement->setAttribute(SVGNames::widthAttr, originalElement.get
Attribute(SVGNames::widthAttr)); |
166 if (use.height()->isSpecified()) | 167 if (use.height()->isSpecified()) |
167 shadowElement->setAttribute(SVGNames::heightAttr, AtomicString(use.h
eight()->currentValue()->valueAsString())); | 168 shadowElement->setAttribute(SVGNames::heightAttr, AtomicString(use.h
eight()->currentValue()->valueAsString())); |
168 else | 169 else |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 m_resource->addClient(this); | 751 m_resource->addClient(this); |
751 } | 752 } |
752 | 753 |
753 void SVGUseElement::trace(Visitor* visitor) | 754 void SVGUseElement::trace(Visitor* visitor) |
754 { | 755 { |
755 visitor->trace(m_targetElementInstance); | 756 visitor->trace(m_targetElementInstance); |
756 SVGGraphicsElement::trace(visitor); | 757 SVGGraphicsElement::trace(visitor); |
757 } | 758 } |
758 | 759 |
759 } | 760 } |
OLD | NEW |