| 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/LayoutSVGRect.h" | 24 #include "core/layout/svg/LayoutSVGRect.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 SVGRectElement::SVGRectElement(Document& document) | 29 inline SVGRectElement::SVGRectElement(Document& document) |
| 30 : SVGGeometryElement(SVGNames::rectTag, document), | 30 : SVGGeometryElement(SVGNames::rectTag, document), |
| 31 m_x(SVGAnimatedLength::create(this, | 31 m_x(SVGAnimatedLength::create(this, |
| 32 SVGNames::xAttr, | 32 SVGNames::xAttr, |
| 33 SVGLength::create(SVGLengthMode::Width))), | 33 SVGLength::create(SVGLengthMode::Width), |
| 34 CSSPropertyX)), |
| 34 m_y(SVGAnimatedLength::create(this, | 35 m_y(SVGAnimatedLength::create(this, |
| 35 SVGNames::yAttr, | 36 SVGNames::yAttr, |
| 36 SVGLength::create(SVGLengthMode::Height))), | 37 SVGLength::create(SVGLengthMode::Height), |
| 37 m_width( | 38 CSSPropertyY)), |
| 38 SVGAnimatedLength::create(this, | 39 m_width(SVGAnimatedLength::create(this, |
| 39 SVGNames::widthAttr, | 40 SVGNames::widthAttr, |
| 40 SVGLength::create(SVGLengthMode::Width))), | 41 SVGLength::create(SVGLengthMode::Width), |
| 42 CSSPropertyWidth)), |
| 41 m_height( | 43 m_height( |
| 42 SVGAnimatedLength::create(this, | 44 SVGAnimatedLength::create(this, |
| 43 SVGNames::heightAttr, | 45 SVGNames::heightAttr, |
| 44 SVGLength::create(SVGLengthMode::Height))), | 46 SVGLength::create(SVGLengthMode::Height), |
| 47 CSSPropertyHeight)), |
| 45 m_rx(SVGAnimatedLength::create(this, | 48 m_rx(SVGAnimatedLength::create(this, |
| 46 SVGNames::rxAttr, | 49 SVGNames::rxAttr, |
| 47 SVGLength::create(SVGLengthMode::Width))), | 50 SVGLength::create(SVGLengthMode::Width), |
| 48 m_ry( | 51 CSSPropertyRx)), |
| 49 SVGAnimatedLength::create(this, | 52 m_ry(SVGAnimatedLength::create(this, |
| 50 SVGNames::ryAttr, | 53 SVGNames::ryAttr, |
| 51 SVGLength::create(SVGLengthMode::Height))) { | 54 SVGLength::create(SVGLengthMode::Height), |
| 55 CSSPropertyRy)) { |
| 52 addToPropertyMap(m_x); | 56 addToPropertyMap(m_x); |
| 53 addToPropertyMap(m_y); | 57 addToPropertyMap(m_y); |
| 54 addToPropertyMap(m_width); | 58 addToPropertyMap(m_width); |
| 55 addToPropertyMap(m_height); | 59 addToPropertyMap(m_height); |
| 56 addToPropertyMap(m_rx); | 60 addToPropertyMap(m_rx); |
| 57 addToPropertyMap(m_ry); | 61 addToPropertyMap(m_ry); |
| 58 } | 62 } |
| 59 | 63 |
| 60 DEFINE_TRACE(SVGRectElement) { | 64 DEFINE_TRACE(SVGRectElement) { |
| 61 visitor->trace(m_x); | 65 visitor->trace(m_x); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 ry = rx; | 109 ry = rx; |
| 106 | 110 |
| 107 path.addRoundedRect(FloatRect(x, y, width, height), FloatSize(rx, ry)); | 111 path.addRoundedRect(FloatRect(x, y, width, height), FloatSize(rx, ry)); |
| 108 return path; | 112 return path; |
| 109 } | 113 } |
| 110 | 114 |
| 111 path.addRect(FloatRect(x, y, width, height)); | 115 path.addRect(FloatRect(x, y, width, height)); |
| 112 return path; | 116 return path; |
| 113 } | 117 } |
| 114 | 118 |
| 115 bool SVGRectElement::isPresentationAttribute( | |
| 116 const QualifiedName& attrName) const { | |
| 117 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || | |
| 118 attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr || | |
| 119 attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) | |
| 120 return true; | |
| 121 return SVGGeometryElement::isPresentationAttribute(attrName); | |
| 122 } | |
| 123 | |
| 124 bool SVGRectElement::isPresentationAttributeWithSVGDOM( | |
| 125 const QualifiedName& attrName) const { | |
| 126 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || | |
| 127 attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr || | |
| 128 attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) | |
| 129 return true; | |
| 130 return SVGGeometryElement::isPresentationAttributeWithSVGDOM(attrName); | |
| 131 } | |
| 132 | |
| 133 void SVGRectElement::collectStyleForPresentationAttribute( | 119 void SVGRectElement::collectStyleForPresentationAttribute( |
| 134 const QualifiedName& name, | 120 const QualifiedName& name, |
| 135 const AtomicString& value, | 121 const AtomicString& value, |
| 136 MutableStylePropertySet* style) { | 122 MutableStylePropertySet* style) { |
| 137 SVGAnimatedPropertyBase* property = propertyFromAttribute(name); | 123 SVGAnimatedPropertyBase* property = propertyFromAttribute(name); |
| 138 if (property == m_x) | 124 if (property == m_x) |
| 139 addPropertyToPresentationAttributeStyle( | 125 addPropertyToPresentationAttributeStyle( |
| 140 style, CSSPropertyX, m_x->currentValue()->asCSSPrimitiveValue()); | 126 style, CSSPropertyX, m_x->currentValue()->asCSSPrimitiveValue()); |
| 141 else if (property == m_y) | 127 else if (property == m_y) |
| 142 addPropertyToPresentationAttributeStyle( | 128 addPropertyToPresentationAttributeStyle( |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 m_height->currentValue()->isRelative() || | 177 m_height->currentValue()->isRelative() || |
| 192 m_rx->currentValue()->isRelative() || | 178 m_rx->currentValue()->isRelative() || |
| 193 m_ry->currentValue()->isRelative(); | 179 m_ry->currentValue()->isRelative(); |
| 194 } | 180 } |
| 195 | 181 |
| 196 LayoutObject* SVGRectElement::createLayoutObject(const ComputedStyle&) { | 182 LayoutObject* SVGRectElement::createLayoutObject(const ComputedStyle&) { |
| 197 return new LayoutSVGRect(this); | 183 return new LayoutSVGRect(this); |
| 198 } | 184 } |
| 199 | 185 |
| 200 } // namespace blink | 186 } // namespace blink |
| OLD | NEW |