| 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 15 matching lines...) Expand all Loading... |
| 26 #include "XLinkNames.h" | 26 #include "XLinkNames.h" |
| 27 #include "core/dom/Document.h" | 27 #include "core/dom/Document.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_LENGTH(SVGCursorElement, SVGNames::xAttr, X, x) | 33 DEFINE_ANIMATED_LENGTH(SVGCursorElement, SVGNames::xAttr, X, x) |
| 34 DEFINE_ANIMATED_LENGTH(SVGCursorElement, SVGNames::yAttr, Y, y) | 34 DEFINE_ANIMATED_LENGTH(SVGCursorElement, SVGNames::yAttr, Y, y) |
| 35 DEFINE_ANIMATED_STRING(SVGCursorElement, XLinkNames::hrefAttr, Href, href) | 35 DEFINE_ANIMATED_STRING(SVGCursorElement, XLinkNames::hrefAttr, Href, href) |
| 36 DEFINE_ANIMATED_BOOLEAN(SVGCursorElement, SVGNames::externalResourcesRequiredAtt
r, ExternalResourcesRequired, externalResourcesRequired) | |
| 37 | 36 |
| 38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGCursorElement) | 37 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGCursorElement) |
| 39 REGISTER_LOCAL_ANIMATED_PROPERTY(x) | 38 REGISTER_LOCAL_ANIMATED_PROPERTY(x) |
| 40 REGISTER_LOCAL_ANIMATED_PROPERTY(y) | 39 REGISTER_LOCAL_ANIMATED_PROPERTY(y) |
| 41 REGISTER_LOCAL_ANIMATED_PROPERTY(href) | 40 REGISTER_LOCAL_ANIMATED_PROPERTY(href) |
| 42 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | |
| 43 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) | 41 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) |
| 44 END_REGISTER_ANIMATED_PROPERTIES | 42 END_REGISTER_ANIMATED_PROPERTIES |
| 45 | 43 |
| 46 inline SVGCursorElement::SVGCursorElement(Document& document) | 44 inline SVGCursorElement::SVGCursorElement(Document& document) |
| 47 : SVGElement(SVGNames::cursorTag, document) | 45 : SVGElement(SVGNames::cursorTag, document) |
| 48 , m_x(LengthModeWidth) | 46 , m_x(LengthModeWidth) |
| 49 , m_y(LengthModeHeight) | 47 , m_y(LengthModeHeight) |
| 50 { | 48 { |
| 51 ScriptWrappable::init(this); | 49 ScriptWrappable::init(this); |
| 52 registerAnimatedPropertiesForSVGCursorElement(); | 50 registerAnimatedPropertiesForSVGCursorElement(); |
| 53 } | 51 } |
| 54 | 52 |
| 55 PassRefPtr<SVGCursorElement> SVGCursorElement::create(Document& document) | 53 PassRefPtr<SVGCursorElement> SVGCursorElement::create(Document& document) |
| 56 { | 54 { |
| 57 return adoptRef(new SVGCursorElement(document)); | 55 return adoptRef(new SVGCursorElement(document)); |
| 58 } | 56 } |
| 59 | 57 |
| 60 SVGCursorElement::~SVGCursorElement() | 58 SVGCursorElement::~SVGCursorElement() |
| 61 { | 59 { |
| 62 HashSet<SVGElement*>::iterator end = m_clients.end(); | 60 HashSet<SVGElement*>::iterator end = m_clients.end(); |
| 63 for (HashSet<SVGElement*>::iterator it = m_clients.begin(); it != end; ++it) | 61 for (HashSet<SVGElement*>::iterator it = m_clients.begin(); it != end; ++it) |
| 64 (*it)->cursorElementRemoved(); | 62 (*it)->cursorElementRemoved(); |
| 65 } | 63 } |
| 66 | 64 |
| 67 bool SVGCursorElement::isSupportedAttribute(const QualifiedName& attrName) | 65 bool SVGCursorElement::isSupportedAttribute(const QualifiedName& attrName) |
| 68 { | 66 { |
| 69 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 67 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 70 if (supportedAttributes.isEmpty()) { | 68 if (supportedAttributes.isEmpty()) { |
| 71 SVGTests::addSupportedAttributes(supportedAttributes); | 69 SVGTests::addSupportedAttributes(supportedAttributes); |
| 72 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | |
| 73 SVGURIReference::addSupportedAttributes(supportedAttributes); | 70 SVGURIReference::addSupportedAttributes(supportedAttributes); |
| 74 supportedAttributes.add(SVGNames::xAttr); | 71 supportedAttributes.add(SVGNames::xAttr); |
| 75 supportedAttributes.add(SVGNames::yAttr); | 72 supportedAttributes.add(SVGNames::yAttr); |
| 76 } | 73 } |
| 77 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 74 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| 78 } | 75 } |
| 79 | 76 |
| 80 void SVGCursorElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) | 77 void SVGCursorElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) |
| 81 { | 78 { |
| 82 SVGParsingError parseError = NoError; | 79 SVGParsingError parseError = NoError; |
| 83 | 80 |
| 84 if (!isSupportedAttribute(name)) | 81 if (!isSupportedAttribute(name)) |
| 85 SVGElement::parseAttribute(name, value); | 82 SVGElement::parseAttribute(name, value); |
| 86 else if (name == SVGNames::xAttr) | 83 else if (name == SVGNames::xAttr) |
| 87 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); | 84 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); |
| 88 else if (name == SVGNames::yAttr) | 85 else if (name == SVGNames::yAttr) |
| 89 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError))
; | 86 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError))
; |
| 90 else if (SVGTests::parseAttribute(name, value) | 87 else if (SVGTests::parseAttribute(name, value) |
| 91 || SVGExternalResourcesRequired::parseAttribute(name, value) | |
| 92 || SVGURIReference::parseAttribute(name, value)) { | 88 || SVGURIReference::parseAttribute(name, value)) { |
| 93 } else | 89 } else |
| 94 ASSERT_NOT_REACHED(); | 90 ASSERT_NOT_REACHED(); |
| 95 | 91 |
| 96 reportAttributeParsingError(parseError, name, value); | 92 reportAttributeParsingError(parseError, name, value); |
| 97 } | 93 } |
| 98 | 94 |
| 99 void SVGCursorElement::addClient(SVGElement* element) | 95 void SVGCursorElement::addClient(SVGElement* element) |
| 100 { | 96 { |
| 101 m_clients.add(element); | 97 m_clients.add(element); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 127 | 123 |
| 128 // Any change of a cursor specific attribute triggers this recalc. | 124 // Any change of a cursor specific attribute triggers this recalc. |
| 129 HashSet<SVGElement*>::const_iterator it = m_clients.begin(); | 125 HashSet<SVGElement*>::const_iterator it = m_clients.begin(); |
| 130 HashSet<SVGElement*>::const_iterator end = m_clients.end(); | 126 HashSet<SVGElement*>::const_iterator end = m_clients.end(); |
| 131 | 127 |
| 132 for (; it != end; ++it) | 128 for (; it != end; ++it) |
| 133 (*it)->setNeedsStyleRecalc(); | 129 (*it)->setNeedsStyleRecalc(); |
| 134 } | 130 } |
| 135 | 131 |
| 136 } | 132 } |
| OLD | NEW |