| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann |
| 3 * <zimmermann@kde.org> | 3 * <zimmermann@kde.org> |
| 4 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> | 4 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> |
| 5 * Copyright (C) 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 6 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 6 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
| 7 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 7 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 } | 654 } |
| 655 | 655 |
| 656 void SVGElement::setCorrespondingElement(SVGElement* correspondingElement) { | 656 void SVGElement::setCorrespondingElement(SVGElement* correspondingElement) { |
| 657 ensureSVGRareData()->setCorrespondingElement(correspondingElement); | 657 ensureSVGRareData()->setCorrespondingElement(correspondingElement); |
| 658 } | 658 } |
| 659 | 659 |
| 660 bool SVGElement::inUseShadowTree() const { | 660 bool SVGElement::inUseShadowTree() const { |
| 661 return correspondingUseElement(); | 661 return correspondingUseElement(); |
| 662 } | 662 } |
| 663 | 663 |
| 664 void SVGElement::parseAttribute(const QualifiedName& name, | 664 void SVGElement::parseAttribute(const AttributeModificationParams& params) { |
| 665 const AtomicString& oldValue, | 665 if (SVGAnimatedPropertyBase* property = propertyFromAttribute(params.name)) { |
| 666 const AtomicString& value) { | 666 SVGParsingError parseError = |
| 667 if (SVGAnimatedPropertyBase* property = propertyFromAttribute(name)) { | 667 property->setBaseValueAsString(params.newValue); |
| 668 SVGParsingError parseError = property->setBaseValueAsString(value); | 668 reportAttributeParsingError(parseError, params.name, params.newValue); |
| 669 reportAttributeParsingError(parseError, name, value); | |
| 670 return; | 669 return; |
| 671 } | 670 } |
| 672 | 671 |
| 673 if (name == HTMLNames::classAttr) { | 672 if (params.name == HTMLNames::classAttr) { |
| 674 // SVG animation has currently requires special storage of values so we set | 673 // SVG animation has currently requires special storage of values so we set |
| 675 // the className here. svgAttributeChanged actually causes the resulting | 674 // the className here. svgAttributeChanged actually causes the resulting |
| 676 // style updates (instead of Element::parseAttribute). We don't | 675 // style updates (instead of Element::parseAttribute). We don't |
| 677 // tell Element about the change to avoid parsing the class list twice | 676 // tell Element about the change to avoid parsing the class list twice |
| 678 SVGParsingError parseError = m_className->setBaseValueAsString(value); | 677 SVGParsingError parseError = |
| 679 reportAttributeParsingError(parseError, name, value); | 678 m_className->setBaseValueAsString(params.newValue); |
| 680 } else if (name == tabindexAttr) { | 679 reportAttributeParsingError(parseError, params.name, params.newValue); |
| 681 Element::parseAttribute(name, oldValue, value); | 680 } else if (params.name == tabindexAttr) { |
| 681 Element::parseAttribute(params); |
| 682 } else { | 682 } else { |
| 683 // standard events | 683 // standard events |
| 684 const AtomicString& eventName = | 684 const AtomicString& eventName = |
| 685 HTMLElement::eventNameForAttributeName(name); | 685 HTMLElement::eventNameForAttributeName(params.name); |
| 686 if (!eventName.isNull()) | 686 if (!eventName.isNull()) { |
| 687 setAttributeEventListener( | 687 setAttributeEventListener( |
| 688 eventName, createAttributeEventListener(this, name, value, | 688 eventName, |
| 689 eventParameterName())); | 689 createAttributeEventListener(this, params.name, params.newValue, |
| 690 else | 690 eventParameterName())); |
| 691 Element::parseAttribute(name, oldValue, value); | 691 } else { |
| 692 Element::parseAttribute(params); |
| 693 } |
| 692 } | 694 } |
| 693 } | 695 } |
| 694 | 696 |
| 695 typedef HashMap<QualifiedName, AnimatedPropertyType> AttributeToPropertyTypeMap; | 697 typedef HashMap<QualifiedName, AnimatedPropertyType> AttributeToPropertyTypeMap; |
| 696 AnimatedPropertyType SVGElement::animatedPropertyTypeForCSSAttribute( | 698 AnimatedPropertyType SVGElement::animatedPropertyTypeForCSSAttribute( |
| 697 const QualifiedName& attributeName) { | 699 const QualifiedName& attributeName) { |
| 698 DEFINE_STATIC_LOCAL(AttributeToPropertyTypeMap, cssPropertyMap, ()); | 700 DEFINE_STATIC_LOCAL(AttributeToPropertyTypeMap, cssPropertyMap, ()); |
| 699 | 701 |
| 700 if (cssPropertyMap.isEmpty()) { | 702 if (cssPropertyMap.isEmpty()) { |
| 701 // Fill the map for the first use. | 703 // Fill the map for the first use. |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 // the element in question. | 909 // the element in question. |
| 908 if (document().loadEventFinished()) | 910 if (document().loadEventFinished()) |
| 909 return; | 911 return; |
| 910 | 912 |
| 911 if (!parent || !parent->isSVGElement()) | 913 if (!parent || !parent->isSVGElement()) |
| 912 return; | 914 return; |
| 913 | 915 |
| 914 toSVGElement(parent)->sendSVGLoadEventToSelfAndAncestorChainIfPossible(); | 916 toSVGElement(parent)->sendSVGLoadEventToSelfAndAncestorChainIfPossible(); |
| 915 } | 917 } |
| 916 | 918 |
| 917 void SVGElement::attributeChanged(const QualifiedName& name, | 919 void SVGElement::attributeChanged(const AttributeModificationParams& params) { |
| 918 const AtomicString& oldValue, | 920 Element::attributeChanged( |
| 919 const AtomicString& newValue, | 921 AttributeModificationParams(params.name, params.oldValue, params.newValue, |
| 920 AttributeModificationReason) { | 922 AttributeModificationReason::kDirectly)); |
| 921 Element::attributeChanged(name, oldValue, newValue, | |
| 922 AttributeModificationReason::kDirectly); | |
| 923 | 923 |
| 924 if (name == HTMLNames::idAttr) | 924 if (params.name == HTMLNames::idAttr) |
| 925 rebuildAllIncomingReferences(); | 925 rebuildAllIncomingReferences(); |
| 926 | 926 |
| 927 // Changes to the style attribute are processed lazily (see | 927 // Changes to the style attribute are processed lazily (see |
| 928 // Element::getAttribute() and related methods), so we don't want changes to | 928 // Element::getAttribute() and related methods), so we don't want changes to |
| 929 // the style attribute to result in extra work here. | 929 // the style attribute to result in extra work here. |
| 930 if (name == HTMLNames::styleAttr) | 930 if (params.name == HTMLNames::styleAttr) |
| 931 return; | 931 return; |
| 932 | 932 |
| 933 svgAttributeBaseValChanged(name); | 933 svgAttributeBaseValChanged(params.name); |
| 934 } | 934 } |
| 935 | 935 |
| 936 void SVGElement::svgAttributeChanged(const QualifiedName& attrName) { | 936 void SVGElement::svgAttributeChanged(const QualifiedName& attrName) { |
| 937 CSSPropertyID propId = SVGElement::cssPropertyIdForSVGAttributeName(attrName); | 937 CSSPropertyID propId = SVGElement::cssPropertyIdForSVGAttributeName(attrName); |
| 938 if (propId > 0) { | 938 if (propId > 0) { |
| 939 invalidateInstances(); | 939 invalidateInstances(); |
| 940 return; | 940 return; |
| 941 } | 941 } |
| 942 | 942 |
| 943 if (attrName == HTMLNames::classAttr) { | 943 if (attrName == HTMLNames::classAttr) { |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 visitor->trace(m_className); | 1287 visitor->trace(m_className); |
| 1288 Element::trace(visitor); | 1288 Element::trace(visitor); |
| 1289 } | 1289 } |
| 1290 | 1290 |
| 1291 const AtomicString& SVGElement::eventParameterName() { | 1291 const AtomicString& SVGElement::eventParameterName() { |
| 1292 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); | 1292 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); |
| 1293 return evtString; | 1293 return evtString; |
| 1294 } | 1294 } |
| 1295 | 1295 |
| 1296 } // namespace blink | 1296 } // namespace blink |
| OLD | NEW |