| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 5 * Copyright (C) 2014 Google, Inc. | 5 * Copyright (C) 2014 Google, Inc. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 #include "wtf/MathExtras.h" | 60 #include "wtf/MathExtras.h" |
| 61 #include "wtf/StdLibExtras.h" | 61 #include "wtf/StdLibExtras.h" |
| 62 | 62 |
| 63 namespace blink { | 63 namespace blink { |
| 64 | 64 |
| 65 inline SVGSVGElement::SVGSVGElement(Document& doc) | 65 inline SVGSVGElement::SVGSVGElement(Document& doc) |
| 66 : SVGGraphicsElement(SVGNames::svgTag, doc), | 66 : SVGGraphicsElement(SVGNames::svgTag, doc), |
| 67 SVGFitToViewBox(this), | 67 SVGFitToViewBox(this), |
| 68 m_x(SVGAnimatedLength::create(this, | 68 m_x(SVGAnimatedLength::create(this, |
| 69 SVGNames::xAttr, | 69 SVGNames::xAttr, |
| 70 SVGLength::create(SVGLengthMode::Width))), | 70 SVGLength::create(SVGLengthMode::Width), |
| 71 CSSPropertyX)), |
| 71 m_y(SVGAnimatedLength::create(this, | 72 m_y(SVGAnimatedLength::create(this, |
| 72 SVGNames::yAttr, | 73 SVGNames::yAttr, |
| 73 SVGLength::create(SVGLengthMode::Height))), | 74 SVGLength::create(SVGLengthMode::Height), |
| 74 m_width( | 75 CSSPropertyY)), |
| 75 SVGAnimatedLength::create(this, | 76 m_width(SVGAnimatedLength::create(this, |
| 76 SVGNames::widthAttr, | 77 SVGNames::widthAttr, |
| 77 SVGLength::create(SVGLengthMode::Width))), | 78 SVGLength::create(SVGLengthMode::Width), |
| 79 CSSPropertyWidth)), |
| 78 m_height( | 80 m_height( |
| 79 SVGAnimatedLength::create(this, | 81 SVGAnimatedLength::create(this, |
| 80 SVGNames::heightAttr, | 82 SVGNames::heightAttr, |
| 81 SVGLength::create(SVGLengthMode::Height))), | 83 SVGLength::create(SVGLengthMode::Height), |
| 84 CSSPropertyHeight)), |
| 82 m_useCurrentView(false), | 85 m_useCurrentView(false), |
| 83 m_timeContainer(SMILTimeContainer::create(*this)), | 86 m_timeContainer(SMILTimeContainer::create(*this)), |
| 84 m_translation(SVGPoint::create()), | 87 m_translation(SVGPoint::create()), |
| 85 m_currentScale(1) { | 88 m_currentScale(1) { |
| 86 m_width->setDefaultValueAsString("100%"); | 89 m_width->setDefaultValueAsString("100%"); |
| 87 m_height->setDefaultValueAsString("100%"); | 90 m_height->setDefaultValueAsString("100%"); |
| 88 | 91 |
| 89 addToPropertyMap(m_x); | 92 addToPropertyMap(m_x); |
| 90 addToPropertyMap(m_y); | 93 addToPropertyMap(m_y); |
| 91 addToPropertyMap(m_width); | 94 addToPropertyMap(m_width); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 parseError = property->setBaseValueAsString(value); | 213 parseError = property->setBaseValueAsString(value); |
| 211 if (parseError != SVGParseStatus::NoError || value.isNull()) | 214 if (parseError != SVGParseStatus::NoError || value.isNull()) |
| 212 property->setDefaultValueAsString("100%"); | 215 property->setDefaultValueAsString("100%"); |
| 213 reportAttributeParsingError(parseError, name, value); | 216 reportAttributeParsingError(parseError, name, value); |
| 214 } else { | 217 } else { |
| 215 SVGElement::parseAttribute(name, oldValue, value); | 218 SVGElement::parseAttribute(name, oldValue, value); |
| 216 } | 219 } |
| 217 } | 220 } |
| 218 | 221 |
| 219 bool SVGSVGElement::isPresentationAttribute(const QualifiedName& name) const { | 222 bool SVGSVGElement::isPresentationAttribute(const QualifiedName& name) const { |
| 220 if (isOutermostSVGSVGElement() && | 223 if ((name == SVGNames::widthAttr || name == SVGNames::heightAttr) && |
| 221 (name == SVGNames::widthAttr || name == SVGNames::heightAttr)) | 224 !isOutermostSVGSVGElement()) |
| 222 return true; | 225 return false; |
| 223 else if (name == SVGNames::xAttr || name == SVGNames::yAttr) | |
| 224 return true; | |
| 225 | |
| 226 return SVGGraphicsElement::isPresentationAttribute(name); | 226 return SVGGraphicsElement::isPresentationAttribute(name); |
| 227 } | 227 } |
| 228 | 228 |
| 229 bool SVGSVGElement::isPresentationAttributeWithSVGDOM( | 229 bool SVGSVGElement::isPresentationAttributeWithSVGDOM( |
| 230 const QualifiedName& attrName) const { | 230 const QualifiedName& attrName) const { |
| 231 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) | 231 if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) |
| 232 return true; | 232 return false; |
| 233 return SVGGraphicsElement::isPresentationAttributeWithSVGDOM(attrName); | 233 return SVGGraphicsElement::isPresentationAttributeWithSVGDOM(attrName); |
| 234 } | 234 } |
| 235 | 235 |
| 236 void SVGSVGElement::collectStyleForPresentationAttribute( | 236 void SVGSVGElement::collectStyleForPresentationAttribute( |
| 237 const QualifiedName& name, | 237 const QualifiedName& name, |
| 238 const AtomicString& value, | 238 const AtomicString& value, |
| 239 MutableStylePropertySet* style) { | 239 MutableStylePropertySet* style) { |
| 240 SVGAnimatedPropertyBase* property = propertyFromAttribute(name); | 240 SVGAnimatedPropertyBase* property = propertyFromAttribute(name); |
| 241 if (property == m_x) { | 241 if (property == m_x) { |
| 242 addPropertyToPresentationAttributeStyle( | 242 addPropertyToPresentationAttributeStyle( |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 visitor->trace(m_width); | 792 visitor->trace(m_width); |
| 793 visitor->trace(m_height); | 793 visitor->trace(m_height); |
| 794 visitor->trace(m_translation); | 794 visitor->trace(m_translation); |
| 795 visitor->trace(m_timeContainer); | 795 visitor->trace(m_timeContainer); |
| 796 visitor->trace(m_viewSpec); | 796 visitor->trace(m_viewSpec); |
| 797 SVGGraphicsElement::trace(visitor); | 797 SVGGraphicsElement::trace(visitor); |
| 798 SVGFitToViewBox::trace(visitor); | 798 SVGFitToViewBox::trace(visitor); |
| 799 } | 799 } |
| 800 | 800 |
| 801 } // namespace blink | 801 } // namespace blink |
| OLD | NEW |