| 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 * Copyright (C) 2005 Alexander Kellett <lypanov@kde.org> | 4 * Copyright (C) 2005 Alexander Kellett <lypanov@kde.org> |
| 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
| 6 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "core/dom/StyleChangeReason.h" | 26 #include "core/dom/StyleChangeReason.h" |
| 27 #include "core/layout/svg/LayoutSVGResourceMasker.h" | 27 #include "core/layout/svg/LayoutSVGResourceMasker.h" |
| 28 | 28 |
| 29 namespace blink { | 29 namespace blink { |
| 30 | 30 |
| 31 inline SVGMaskElement::SVGMaskElement(Document& document) | 31 inline SVGMaskElement::SVGMaskElement(Document& document) |
| 32 : SVGElement(SVGNames::maskTag, document), | 32 : SVGElement(SVGNames::maskTag, document), |
| 33 SVGTests(this), | 33 SVGTests(this), |
| 34 m_x(SVGAnimatedLength::create(this, | 34 m_x(SVGAnimatedLength::create(this, |
| 35 SVGNames::xAttr, | 35 SVGNames::xAttr, |
| 36 SVGLength::create(SVGLengthMode::Width))), | 36 SVGLength::create(SVGLengthMode::Width), |
| 37 CSSPropertyX)), |
| 37 m_y(SVGAnimatedLength::create(this, | 38 m_y(SVGAnimatedLength::create(this, |
| 38 SVGNames::yAttr, | 39 SVGNames::yAttr, |
| 39 SVGLength::create(SVGLengthMode::Height))), | 40 SVGLength::create(SVGLengthMode::Height), |
| 40 m_width( | 41 CSSPropertyY)), |
| 41 SVGAnimatedLength::create(this, | 42 m_width(SVGAnimatedLength::create(this, |
| 42 SVGNames::widthAttr, | 43 SVGNames::widthAttr, |
| 43 SVGLength::create(SVGLengthMode::Width))), | 44 SVGLength::create(SVGLengthMode::Width), |
| 45 CSSPropertyWidth)), |
| 44 m_height( | 46 m_height( |
| 45 SVGAnimatedLength::create(this, | 47 SVGAnimatedLength::create(this, |
| 46 SVGNames::heightAttr, | 48 SVGNames::heightAttr, |
| 47 SVGLength::create(SVGLengthMode::Height))), | 49 SVGLength::create(SVGLengthMode::Height), |
| 50 CSSPropertyHeight)), |
| 48 m_maskUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::create( | 51 m_maskUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::create( |
| 49 this, | 52 this, |
| 50 SVGNames::maskUnitsAttr, | 53 SVGNames::maskUnitsAttr, |
| 51 SVGUnitTypes::kSvgUnitTypeObjectboundingbox)), | 54 SVGUnitTypes::kSvgUnitTypeObjectboundingbox)), |
| 52 m_maskContentUnits( | 55 m_maskContentUnits( |
| 53 SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::create( | 56 SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::create( |
| 54 this, | 57 this, |
| 55 SVGNames::maskContentUnitsAttr, | 58 SVGNames::maskContentUnitsAttr, |
| 56 SVGUnitTypes::kSvgUnitTypeUserspaceonuse)) { | 59 SVGUnitTypes::kSvgUnitTypeUserspaceonuse)) { |
| 57 // Spec: If the x/y attribute is not specified, the effect is as if a value of | 60 // Spec: If the x/y attribute is not specified, the effect is as if a value of |
| (...skipping 20 matching lines...) Expand all Loading... |
| 78 visitor->trace(m_width); | 81 visitor->trace(m_width); |
| 79 visitor->trace(m_height); | 82 visitor->trace(m_height); |
| 80 visitor->trace(m_maskUnits); | 83 visitor->trace(m_maskUnits); |
| 81 visitor->trace(m_maskContentUnits); | 84 visitor->trace(m_maskContentUnits); |
| 82 SVGElement::trace(visitor); | 85 SVGElement::trace(visitor); |
| 83 SVGTests::trace(visitor); | 86 SVGTests::trace(visitor); |
| 84 } | 87 } |
| 85 | 88 |
| 86 DEFINE_NODE_FACTORY(SVGMaskElement) | 89 DEFINE_NODE_FACTORY(SVGMaskElement) |
| 87 | 90 |
| 88 bool SVGMaskElement::isPresentationAttribute( | |
| 89 const QualifiedName& attrName) const { | |
| 90 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || | |
| 91 attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) | |
| 92 return true; | |
| 93 return SVGElement::isPresentationAttribute(attrName); | |
| 94 } | |
| 95 | |
| 96 bool SVGMaskElement::isPresentationAttributeWithSVGDOM( | |
| 97 const QualifiedName& attrName) const { | |
| 98 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || | |
| 99 attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) | |
| 100 return true; | |
| 101 return SVGElement::isPresentationAttributeWithSVGDOM(attrName); | |
| 102 } | |
| 103 | |
| 104 void SVGMaskElement::collectStyleForPresentationAttribute( | 91 void SVGMaskElement::collectStyleForPresentationAttribute( |
| 105 const QualifiedName& name, | 92 const QualifiedName& name, |
| 106 const AtomicString& value, | 93 const AtomicString& value, |
| 107 MutableStylePropertySet* style) { | 94 MutableStylePropertySet* style) { |
| 108 SVGAnimatedPropertyBase* property = propertyFromAttribute(name); | 95 SVGAnimatedPropertyBase* property = propertyFromAttribute(name); |
| 109 if (property == m_x) | 96 if (property == m_x) |
| 110 addPropertyToPresentationAttributeStyle( | 97 addPropertyToPresentationAttributeStyle( |
| 111 style, CSSPropertyX, m_x->currentValue()->asCSSPrimitiveValue()); | 98 style, CSSPropertyX, m_x->currentValue()->asCSSPrimitiveValue()); |
| 112 else if (property == m_y) | 99 else if (property == m_y) |
| 113 addPropertyToPresentationAttributeStyle( | 100 addPropertyToPresentationAttributeStyle( |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } | 155 } |
| 169 | 156 |
| 170 bool SVGMaskElement::selfHasRelativeLengths() const { | 157 bool SVGMaskElement::selfHasRelativeLengths() const { |
| 171 return m_x->currentValue()->isRelative() || | 158 return m_x->currentValue()->isRelative() || |
| 172 m_y->currentValue()->isRelative() || | 159 m_y->currentValue()->isRelative() || |
| 173 m_width->currentValue()->isRelative() || | 160 m_width->currentValue()->isRelative() || |
| 174 m_height->currentValue()->isRelative(); | 161 m_height->currentValue()->isRelative(); |
| 175 } | 162 } |
| 176 | 163 |
| 177 } // namespace blink | 164 } // namespace blink |
| OLD | NEW |