| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 { | 232 { |
| 233 clearResourceAndEventBaseReferences(); | 233 clearResourceAndEventBaseReferences(); |
| 234 | 234 |
| 235 if (!inDocument()) { | 235 if (!inDocument()) { |
| 236 // Reset the target element if we are no longer in the document. | 236 // Reset the target element if we are no longer in the document. |
| 237 setTargetElement(nullptr); | 237 setTargetElement(nullptr); |
| 238 return; | 238 return; |
| 239 } | 239 } |
| 240 | 240 |
| 241 AtomicString id; | 241 AtomicString id; |
| 242 const AtomicString& href = SVGURIReference::legacyHrefString(*this); | 242 AtomicString href = getAttribute(XLinkNames::hrefAttr); |
| 243 Element* target; | 243 Element* target; |
| 244 if (href.isEmpty()) | 244 if (href.isEmpty()) |
| 245 target = parentNode() && parentNode()->isElementNode() ? toElement(paren
tNode()) : nullptr; | 245 target = parentNode() && parentNode()->isElementNode() ? toElement(paren
tNode()) : nullptr; |
| 246 else | 246 else |
| 247 target = SVGURIReference::targetElementFromIRIString(href, treeScope(),
&id); | 247 target = SVGURIReference::targetElementFromIRIString(href, treeScope(),
&id); |
| 248 SVGElement* svgTarget = target && target->isSVGElement() ? toSVGElement(targ
et) : nullptr; | 248 SVGElement* svgTarget = target && target->isSVGElement() ? toSVGElement(targ
et) : nullptr; |
| 249 | 249 |
| 250 if (svgTarget && !svgTarget->inDocument()) | 250 if (svgTarget && !svgTarget->inDocument()) |
| 251 svgTarget = nullptr; | 251 svgTarget = nullptr; |
| 252 | 252 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 280 | 280 |
| 281 AtomicString prefix; | 281 AtomicString prefix; |
| 282 AtomicString localName; | 282 AtomicString localName; |
| 283 if (!Document::parseQualifiedName(attributeName, prefix, localName, IGNORE_E
XCEPTION)) | 283 if (!Document::parseQualifiedName(attributeName, prefix, localName, IGNORE_E
XCEPTION)) |
| 284 return anyQName(); | 284 return anyQName(); |
| 285 | 285 |
| 286 const AtomicString& namespaceURI = svgElement->lookupNamespaceURI(prefix); | 286 const AtomicString& namespaceURI = svgElement->lookupNamespaceURI(prefix); |
| 287 if (namespaceURI.isEmpty()) | 287 if (namespaceURI.isEmpty()) |
| 288 return anyQName(); | 288 return anyQName(); |
| 289 | 289 |
| 290 QualifiedName resolvedAttrName(nullAtom, localName, namespaceURI); | 290 return QualifiedName(nullAtom, localName, namespaceURI); |
| 291 // "Animation elements treat attributeName='xlink:href' as being an alias | |
| 292 // for targetting the 'href' attribute." | |
| 293 // https://svgwg.org/svg2-draft/types.html#__svg__SVGURIReference__href | |
| 294 if (resolvedAttrName == XLinkNames::hrefAttr) | |
| 295 return SVGNames::hrefAttr; | |
| 296 return resolvedAttrName; | |
| 297 } | 291 } |
| 298 | 292 |
| 299 static inline void clearTimesWithDynamicOrigins(Vector<SMILTimeWithOrigin>& time
List) | 293 static inline void clearTimesWithDynamicOrigins(Vector<SMILTimeWithOrigin>& time
List) |
| 300 { | 294 { |
| 301 for (int i = timeList.size() - 1; i >= 0; --i) { | 295 for (int i = timeList.size() - 1; i >= 0; --i) { |
| 302 if (timeList[i].originIsScript()) | 296 if (timeList[i].originIsScript()) |
| 303 timeList.remove(i); | 297 timeList.remove(i); |
| 304 } | 298 } |
| 305 } | 299 } |
| 306 | 300 |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 setAttributeEventListener(EventTypeNames::endEvent, createAttributeEvent
Listener(this, name, value, eventParameterName())); | 537 setAttributeEventListener(EventTypeNames::endEvent, createAttributeEvent
Listener(this, name, value, eventParameterName())); |
| 544 } else if (name == SVGNames::onrepeatAttr) { | 538 } else if (name == SVGNames::onrepeatAttr) { |
| 545 setAttributeEventListener(EventTypeNames::repeatEvent, createAttributeEv
entListener(this, name, value, eventParameterName())); | 539 setAttributeEventListener(EventTypeNames::repeatEvent, createAttributeEv
entListener(this, name, value, eventParameterName())); |
| 546 } else { | 540 } else { |
| 547 SVGElement::parseAttribute(name, oldValue, value); | 541 SVGElement::parseAttribute(name, oldValue, value); |
| 548 } | 542 } |
| 549 } | 543 } |
| 550 | 544 |
| 551 void SVGSMILElement::svgAttributeChanged(const QualifiedName& attrName) | 545 void SVGSMILElement::svgAttributeChanged(const QualifiedName& attrName) |
| 552 { | 546 { |
| 553 if (attrName == SVGNames::durAttr) { | 547 if (attrName == SVGNames::durAttr) |
| 554 m_cachedDur = invalidCachedTime; | 548 m_cachedDur = invalidCachedTime; |
| 555 } else if (attrName == SVGNames::repeatDurAttr) { | 549 else if (attrName == SVGNames::repeatDurAttr) |
| 556 m_cachedRepeatDur = invalidCachedTime; | 550 m_cachedRepeatDur = invalidCachedTime; |
| 557 } else if (attrName == SVGNames::repeatCountAttr) { | 551 else if (attrName == SVGNames::repeatCountAttr) |
| 558 m_cachedRepeatCount = invalidCachedTime; | 552 m_cachedRepeatCount = invalidCachedTime; |
| 559 } else if (attrName == SVGNames::minAttr) { | 553 else if (attrName == SVGNames::minAttr) |
| 560 m_cachedMin = invalidCachedTime; | 554 m_cachedMin = invalidCachedTime; |
| 561 } else if (attrName == SVGNames::maxAttr) { | 555 else if (attrName == SVGNames::maxAttr) |
| 562 m_cachedMax = invalidCachedTime; | 556 m_cachedMax = invalidCachedTime; |
| 563 } else if (attrName == SVGNames::attributeNameAttr) { | 557 else if (attrName == SVGNames::attributeNameAttr) |
| 564 setAttributeName(constructQualifiedName(this, fastGetAttribute(SVGNames:
:attributeNameAttr))); | 558 setAttributeName(constructQualifiedName(this, fastGetAttribute(SVGNames:
:attributeNameAttr))); |
| 565 } else if (attrName.matches(SVGNames::hrefAttr) || attrName.matches(XLinkNam
es::hrefAttr)) { | 559 else if (attrName.matches(XLinkNames::hrefAttr)) { |
| 566 // TODO(fs): Could be smarter here when 'href' is specified and 'xlink:h
ref' is changed. | |
| 567 SVGElement::InvalidationGuard invalidationGuard(this); | 560 SVGElement::InvalidationGuard invalidationGuard(this); |
| 568 buildPendingResource(); | 561 buildPendingResource(); |
| 569 if (m_targetElement) | 562 if (m_targetElement) |
| 570 clearAnimatedType(); | 563 clearAnimatedType(); |
| 571 } else if (attrName == SVGNames::beginAttr || attrName == SVGNames::endAttr)
{ | 564 } else if (attrName == SVGNames::beginAttr || attrName == SVGNames::endAttr)
{ |
| 572 if (inDocument()) { | 565 if (inDocument()) { |
| 573 connectEventBaseConditions(); | 566 connectEventBaseConditions(); |
| 574 if (attrName == SVGNames::beginAttr) | 567 if (attrName == SVGNames::beginAttr) |
| 575 beginListChanged(elapsed()); | 568 beginListChanged(elapsed()); |
| 576 else if (attrName == SVGNames::endAttr) | 569 else if (attrName == SVGNames::endAttr) |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1368 visitor->trace(m_targetElement); | 1361 visitor->trace(m_targetElement); |
| 1369 visitor->trace(m_timeContainer); | 1362 visitor->trace(m_timeContainer); |
| 1370 visitor->trace(m_conditions); | 1363 visitor->trace(m_conditions); |
| 1371 visitor->trace(m_syncBaseDependents); | 1364 visitor->trace(m_syncBaseDependents); |
| 1372 #endif | 1365 #endif |
| 1373 SVGElement::trace(visitor); | 1366 SVGElement::trace(visitor); |
| 1374 SVGTests::trace(visitor); | 1367 SVGTests::trace(visitor); |
| 1375 } | 1368 } |
| 1376 | 1369 |
| 1377 } // namespace blink | 1370 } // namespace blink |
| OLD | NEW |