Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 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 13 matching lines...) Expand all Loading... | |
| 24 #include "core/svg/SVGClipPathElement.h" | 24 #include "core/svg/SVGClipPathElement.h" |
| 25 | 25 |
| 26 #include "SVGNames.h" | 26 #include "SVGNames.h" |
| 27 #include "core/rendering/svg/RenderSVGResourceClipper.h" | 27 #include "core/rendering/svg/RenderSVGResourceClipper.h" |
| 28 #include "core/svg/SVGElementInstance.h" | 28 #include "core/svg/SVGElementInstance.h" |
| 29 | 29 |
| 30 namespace WebCore { | 30 namespace WebCore { |
| 31 | 31 |
| 32 // Animated property definitions | 32 // Animated property definitions |
| 33 DEFINE_ANIMATED_ENUMERATION(SVGClipPathElement, SVGNames::clipPathUnitsAttr, Cli pPathUnits, clipPathUnits, SVGUnitTypes::SVGUnitType) | 33 DEFINE_ANIMATED_ENUMERATION(SVGClipPathElement, SVGNames::clipPathUnitsAttr, Cli pPathUnits, clipPathUnits, SVGUnitTypes::SVGUnitType) |
| 34 DEFINE_ANIMATED_BOOLEAN(SVGClipPathElement, SVGNames::externalResourcesRequiredA ttr, ExternalResourcesRequired, externalResourcesRequired) | |
| 35 | 34 |
| 36 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGClipPathElement) | 35 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGClipPathElement) |
| 37 REGISTER_LOCAL_ANIMATED_PROPERTY(clipPathUnits) | 36 REGISTER_LOCAL_ANIMATED_PROPERTY(clipPathUnits) |
| 38 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | |
| 39 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) | 37 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) |
| 40 END_REGISTER_ANIMATED_PROPERTIES | 38 END_REGISTER_ANIMATED_PROPERTIES |
| 41 | 39 |
| 42 inline SVGClipPathElement::SVGClipPathElement(const QualifiedName& tagName, Docu ment& document) | 40 inline SVGClipPathElement::SVGClipPathElement(const QualifiedName& tagName, Docu ment& document) |
| 43 : SVGGraphicsElement(tagName, document) | 41 : SVGGraphicsElement(tagName, document) |
| 44 , m_clipPathUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) | 42 , m_clipPathUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) |
| 45 { | 43 { |
| 46 ASSERT(hasTagName(SVGNames::clipPathTag)); | 44 ASSERT(hasTagName(SVGNames::clipPathTag)); |
| 47 ScriptWrappable::init(this); | 45 ScriptWrappable::init(this); |
| 48 registerAnimatedPropertiesForSVGClipPathElement(); | 46 registerAnimatedPropertiesForSVGClipPathElement(); |
| 49 } | 47 } |
| 50 | 48 |
| 51 PassRefPtr<SVGClipPathElement> SVGClipPathElement::create(const QualifiedName& t agName, Document& document) | 49 PassRefPtr<SVGClipPathElement> SVGClipPathElement::create(const QualifiedName& t agName, Document& document) |
| 52 { | 50 { |
| 53 return adoptRef(new SVGClipPathElement(tagName, document)); | 51 return adoptRef(new SVGClipPathElement(tagName, document)); |
| 54 } | 52 } |
| 55 | 53 |
| 56 bool SVGClipPathElement::isSupportedAttribute(const QualifiedName& attrName) | 54 bool SVGClipPathElement::isSupportedAttribute(const QualifiedName& attrName) |
| 57 { | 55 { |
| 58 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 56 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 59 if (supportedAttributes.isEmpty()) { | 57 if (supportedAttributes.isEmpty()) { |
|
Stephen Chennney
2013/11/06 16:45:43
Remove braces.
Erik Dahlström (inactive)
2013/11/07 09:38:04
Done.
| |
| 60 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes ); | |
| 61 supportedAttributes.add(SVGNames::clipPathUnitsAttr); | 58 supportedAttributes.add(SVGNames::clipPathUnitsAttr); |
| 62 } | 59 } |
| 63 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 60 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| 64 } | 61 } |
| 65 | 62 |
| 66 void SVGClipPathElement::parseAttribute(const QualifiedName& name, const AtomicS tring& value) | 63 void SVGClipPathElement::parseAttribute(const QualifiedName& name, const AtomicS tring& value) |
| 67 { | 64 { |
| 68 if (!isSupportedAttribute(name)) { | 65 if (!isSupportedAttribute(name)) { |
| 69 SVGGraphicsElement::parseAttribute(name, value); | 66 SVGGraphicsElement::parseAttribute(name, value); |
| 70 return; | 67 return; |
| 71 } | 68 } |
| 72 | 69 |
| 73 if (name == SVGNames::clipPathUnitsAttr) { | 70 if (name == SVGNames::clipPathUnitsAttr) { |
| 74 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes ::SVGUnitType>::fromString(value); | 71 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes ::SVGUnitType>::fromString(value); |
| 75 if (propertyValue > 0) | 72 if (propertyValue > 0) |
| 76 setClipPathUnitsBaseValue(propertyValue); | 73 setClipPathUnitsBaseValue(propertyValue); |
| 77 return; | 74 return; |
| 78 } | 75 } |
| 79 | 76 |
| 80 if (SVGExternalResourcesRequired::parseAttribute(name, value)) | |
| 81 return; | |
| 82 | |
| 83 ASSERT_NOT_REACHED(); | 77 ASSERT_NOT_REACHED(); |
| 84 } | 78 } |
| 85 | 79 |
| 86 void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName) | 80 void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName) |
| 87 { | 81 { |
| 88 if (!isSupportedAttribute(attrName)) { | 82 if (!isSupportedAttribute(attrName)) { |
| 89 SVGGraphicsElement::svgAttributeChanged(attrName); | 83 SVGGraphicsElement::svgAttributeChanged(attrName); |
| 90 return; | 84 return; |
| 91 } | 85 } |
| 92 | 86 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 106 if (RenderObject* object = renderer()) | 100 if (RenderObject* object = renderer()) |
| 107 object->setNeedsLayout(); | 101 object->setNeedsLayout(); |
| 108 } | 102 } |
| 109 | 103 |
| 110 RenderObject* SVGClipPathElement::createRenderer(RenderStyle*) | 104 RenderObject* SVGClipPathElement::createRenderer(RenderStyle*) |
| 111 { | 105 { |
| 112 return new RenderSVGResourceClipper(this); | 106 return new RenderSVGResourceClipper(this); |
| 113 } | 107 } |
| 114 | 108 |
| 115 } | 109 } |
| OLD | NEW |