| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 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 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "core/dom/StyleChangeReason.h" | 23 #include "core/dom/StyleChangeReason.h" |
| 24 #include "core/layout/svg/LayoutSVGEllipse.h" | 24 #include "core/layout/svg/LayoutSVGEllipse.h" |
| 25 #include "core/svg/SVGLength.h" | 25 #include "core/svg/SVGLength.h" |
| 26 | 26 |
| 27 namespace blink { | 27 namespace blink { |
| 28 | 28 |
| 29 inline SVGEllipseElement::SVGEllipseElement(Document& document) | 29 inline SVGEllipseElement::SVGEllipseElement(Document& document) |
| 30 : SVGGeometryElement(SVGNames::ellipseTag, document), | 30 : SVGGeometryElement(SVGNames::ellipseTag, document), |
| 31 m_cx(SVGAnimatedLength::create(this, | 31 m_cx(SVGAnimatedLength::create(this, |
| 32 SVGNames::cxAttr, | 32 SVGNames::cxAttr, |
| 33 SVGLength::create(SVGLengthMode::Width))), | 33 SVGLength::create(SVGLengthMode::Width), |
| 34 CSSPropertyCx)), |
| 34 m_cy(SVGAnimatedLength::create(this, | 35 m_cy(SVGAnimatedLength::create(this, |
| 35 SVGNames::cyAttr, | 36 SVGNames::cyAttr, |
| 36 SVGLength::create(SVGLengthMode::Height))), | 37 SVGLength::create(SVGLengthMode::Height), |
| 38 CSSPropertyCy)), |
| 37 m_rx(SVGAnimatedLength::create(this, | 39 m_rx(SVGAnimatedLength::create(this, |
| 38 SVGNames::rxAttr, | 40 SVGNames::rxAttr, |
| 39 SVGLength::create(SVGLengthMode::Width))), | 41 SVGLength::create(SVGLengthMode::Width), |
| 40 m_ry( | 42 CSSPropertyRx)), |
| 41 SVGAnimatedLength::create(this, | 43 m_ry(SVGAnimatedLength::create(this, |
| 42 SVGNames::ryAttr, | 44 SVGNames::ryAttr, |
| 43 SVGLength::create(SVGLengthMode::Height))) { | 45 SVGLength::create(SVGLengthMode::Height), |
| 46 CSSPropertyRy)) { |
| 44 addToPropertyMap(m_cx); | 47 addToPropertyMap(m_cx); |
| 45 addToPropertyMap(m_cy); | 48 addToPropertyMap(m_cy); |
| 46 addToPropertyMap(m_rx); | 49 addToPropertyMap(m_rx); |
| 47 addToPropertyMap(m_ry); | 50 addToPropertyMap(m_ry); |
| 48 } | 51 } |
| 49 | 52 |
| 50 DEFINE_TRACE(SVGEllipseElement) { | 53 DEFINE_TRACE(SVGEllipseElement) { |
| 51 visitor->trace(m_cx); | 54 visitor->trace(m_cx); |
| 52 visitor->trace(m_cy); | 55 visitor->trace(m_cy); |
| 53 visitor->trace(m_rx); | 56 visitor->trace(m_rx); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 80 lengthContext.valueForLength(svgStyle.cx(), style, SVGLengthMode::Width) - | 83 lengthContext.valueForLength(svgStyle.cx(), style, SVGLengthMode::Width) - |
| 81 rx, | 84 rx, |
| 82 lengthContext.valueForLength(svgStyle.cy(), style, | 85 lengthContext.valueForLength(svgStyle.cy(), style, |
| 83 SVGLengthMode::Height) - | 86 SVGLengthMode::Height) - |
| 84 ry, | 87 ry, |
| 85 rx * 2, ry * 2)); | 88 rx * 2, ry * 2)); |
| 86 | 89 |
| 87 return path; | 90 return path; |
| 88 } | 91 } |
| 89 | 92 |
| 90 bool SVGEllipseElement::isPresentationAttribute( | |
| 91 const QualifiedName& attrName) const { | |
| 92 if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr || | |
| 93 attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) | |
| 94 return true; | |
| 95 return SVGGeometryElement::isPresentationAttribute(attrName); | |
| 96 } | |
| 97 | |
| 98 bool SVGEllipseElement::isPresentationAttributeWithSVGDOM( | |
| 99 const QualifiedName& attrName) const { | |
| 100 if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr || | |
| 101 attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) | |
| 102 return true; | |
| 103 return SVGGeometryElement::isPresentationAttributeWithSVGDOM(attrName); | |
| 104 } | |
| 105 | |
| 106 void SVGEllipseElement::collectStyleForPresentationAttribute( | 93 void SVGEllipseElement::collectStyleForPresentationAttribute( |
| 107 const QualifiedName& name, | 94 const QualifiedName& name, |
| 108 const AtomicString& value, | 95 const AtomicString& value, |
| 109 MutableStylePropertySet* style) { | 96 MutableStylePropertySet* style) { |
| 110 SVGAnimatedPropertyBase* property = propertyFromAttribute(name); | 97 SVGAnimatedPropertyBase* property = propertyFromAttribute(name); |
| 111 if (property == m_cx) | 98 if (property == m_cx) |
| 112 addPropertyToPresentationAttributeStyle( | 99 addPropertyToPresentationAttributeStyle( |
| 113 style, CSSPropertyCx, m_cx->currentValue()->asCSSPrimitiveValue()); | 100 style, CSSPropertyCx, m_cx->currentValue()->asCSSPrimitiveValue()); |
| 114 else if (property == m_cy) | 101 else if (property == m_cy) |
| 115 addPropertyToPresentationAttributeStyle( | 102 addPropertyToPresentationAttributeStyle( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 m_cy->currentValue()->isRelative() || | 139 m_cy->currentValue()->isRelative() || |
| 153 m_rx->currentValue()->isRelative() || | 140 m_rx->currentValue()->isRelative() || |
| 154 m_ry->currentValue()->isRelative(); | 141 m_ry->currentValue()->isRelative(); |
| 155 } | 142 } |
| 156 | 143 |
| 157 LayoutObject* SVGEllipseElement::createLayoutObject(const ComputedStyle&) { | 144 LayoutObject* SVGEllipseElement::createLayoutObject(const ComputedStyle&) { |
| 158 return new LayoutSVGEllipse(this); | 145 return new LayoutSVGEllipse(this); |
| 159 } | 146 } |
| 160 | 147 |
| 161 } // namespace blink | 148 } // namespace blink |
| OLD | NEW |