| 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 * | 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 22 matching lines...) Expand all Loading... |
| 33 { | 33 { |
| 34 DEFINE_STATIC_LOCAL(SVGEnumerationStringEntries, entries, ()); | 34 DEFINE_STATIC_LOCAL(SVGEnumerationStringEntries, entries, ()); |
| 35 if (entries.isEmpty()) { | 35 if (entries.isEmpty()) { |
| 36 entries.append(std::make_pair(SVGMarkerUnitsUserSpaceOnUse, "userSpaceOn
Use")); | 36 entries.append(std::make_pair(SVGMarkerUnitsUserSpaceOnUse, "userSpaceOn
Use")); |
| 37 entries.append(std::make_pair(SVGMarkerUnitsStrokeWidth, "strokeWidth"))
; | 37 entries.append(std::make_pair(SVGMarkerUnitsStrokeWidth, "strokeWidth"))
; |
| 38 } | 38 } |
| 39 return entries; | 39 return entries; |
| 40 } | 40 } |
| 41 | 41 |
| 42 | 42 |
| 43 SVGMarkerElement::SVGMarkerElement(Document& document) | 43 inline SVGMarkerElement::SVGMarkerElement(Document& document) |
| 44 : SVGElement(SVGNames::markerTag, document) | 44 : SVGElement(SVGNames::markerTag, document) |
| 45 , SVGFitToViewBox(this) | 45 , SVGFitToViewBox(this) |
| 46 , m_refX(SVGAnimatedLength::create(this, SVGNames::refXAttr, SVGLength::crea
te(LengthModeWidth), AllowNegativeLengths)) | 46 , m_refX(SVGAnimatedLength::create(this, SVGNames::refXAttr, SVGLength::crea
te(LengthModeWidth), AllowNegativeLengths)) |
| 47 , m_refY(SVGAnimatedLength::create(this, SVGNames::refXAttr, SVGLength::crea
te(LengthModeWidth), AllowNegativeLengths)) | 47 , m_refY(SVGAnimatedLength::create(this, SVGNames::refXAttr, SVGLength::crea
te(LengthModeWidth), AllowNegativeLengths)) |
| 48 , m_markerWidth(SVGAnimatedLength::create(this, SVGNames::markerWidthAttr, S
VGLength::create(LengthModeWidth), ForbidNegativeLengths)) | 48 , m_markerWidth(SVGAnimatedLength::create(this, SVGNames::markerWidthAttr, S
VGLength::create(LengthModeWidth), ForbidNegativeLengths)) |
| 49 , m_markerHeight(SVGAnimatedLength::create(this, SVGNames::markerHeightAttr,
SVGLength::create(LengthModeHeight), ForbidNegativeLengths)) | 49 , m_markerHeight(SVGAnimatedLength::create(this, SVGNames::markerHeightAttr,
SVGLength::create(LengthModeHeight), ForbidNegativeLengths)) |
| 50 , m_orientAngle(SVGAnimatedAngle::create(this)) | 50 , m_orientAngle(SVGAnimatedAngle::create(this)) |
| 51 , m_markerUnits(SVGAnimatedEnumeration<SVGMarkerUnitsType>::create(this, SVG
Names::markerUnitsAttr, SVGMarkerUnitsStrokeWidth)) | 51 , m_markerUnits(SVGAnimatedEnumeration<SVGMarkerUnitsType>::create(this, SVG
Names::markerUnitsAttr, SVGMarkerUnitsStrokeWidth)) |
| 52 { | 52 { |
| 53 ScriptWrappable::init(this); | 53 ScriptWrappable::init(this); |
| 54 | 54 |
| 55 // Spec: If the markerWidth/markerHeight attribute is not specified, the eff
ect is as if a value of "3" were specified. | 55 // Spec: If the markerWidth/markerHeight attribute is not specified, the eff
ect is as if a value of "3" were specified. |
| 56 m_markerWidth->setDefaultValueAsString("3"); | 56 m_markerWidth->setDefaultValueAsString("3"); |
| 57 m_markerHeight->setDefaultValueAsString("3"); | 57 m_markerHeight->setDefaultValueAsString("3"); |
| 58 | 58 |
| 59 addToPropertyMap(m_refX); | 59 addToPropertyMap(m_refX); |
| 60 addToPropertyMap(m_refY); | 60 addToPropertyMap(m_refY); |
| 61 addToPropertyMap(m_markerWidth); | 61 addToPropertyMap(m_markerWidth); |
| 62 addToPropertyMap(m_markerHeight); | 62 addToPropertyMap(m_markerHeight); |
| 63 addToPropertyMap(m_orientAngle); | 63 addToPropertyMap(m_orientAngle); |
| 64 addToPropertyMap(m_markerUnits); | 64 addToPropertyMap(m_markerUnits); |
| 65 } | 65 } |
| 66 | 66 |
| 67 DEFINE_NODE_FACTORY(SVGMarkerElement) |
| 68 |
| 67 AffineTransform SVGMarkerElement::viewBoxToViewTransform(float viewWidth, float
viewHeight) const | 69 AffineTransform SVGMarkerElement::viewBoxToViewTransform(float viewWidth, float
viewHeight) const |
| 68 { | 70 { |
| 69 return SVGFitToViewBox::viewBoxToViewTransform(viewBox()->currentValue()->va
lue(), preserveAspectRatio()->currentValue(), viewWidth, viewHeight); | 71 return SVGFitToViewBox::viewBoxToViewTransform(viewBox()->currentValue()->va
lue(), preserveAspectRatio()->currentValue(), viewWidth, viewHeight); |
| 70 } | 72 } |
| 71 | 73 |
| 72 bool SVGMarkerElement::isSupportedAttribute(const QualifiedName& attrName) | 74 bool SVGMarkerElement::isSupportedAttribute(const QualifiedName& attrName) |
| 73 { | 75 { |
| 74 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 76 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 75 if (supportedAttributes.isEmpty()) { | 77 if (supportedAttributes.isEmpty()) { |
| 76 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); | 78 SVGFitToViewBox::addSupportedAttributes(supportedAttributes); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 165 |
| 164 bool SVGMarkerElement::selfHasRelativeLengths() const | 166 bool SVGMarkerElement::selfHasRelativeLengths() const |
| 165 { | 167 { |
| 166 return m_refX->currentValue()->isRelative() | 168 return m_refX->currentValue()->isRelative() |
| 167 || m_refY->currentValue()->isRelative() | 169 || m_refY->currentValue()->isRelative() |
| 168 || m_markerWidth->currentValue()->isRelative() | 170 || m_markerWidth->currentValue()->isRelative() |
| 169 || m_markerHeight->currentValue()->isRelative(); | 171 || m_markerHeight->currentValue()->isRelative(); |
| 170 } | 172 } |
| 171 | 173 |
| 172 } | 174 } |
| OLD | NEW |