| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 { | 215 { |
| 216 disconnectSyncBaseConditions(); | 216 disconnectSyncBaseConditions(); |
| 217 disconnectEventBaseConditions(); | 217 disconnectEventBaseConditions(); |
| 218 m_conditions.clear(); | 218 m_conditions.clear(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void SVGSMILElement::buildPendingResource() | 221 void SVGSMILElement::buildPendingResource() |
| 222 { | 222 { |
| 223 clearResourceAndEventBaseReferences(); | 223 clearResourceAndEventBaseReferences(); |
| 224 | 224 |
| 225 if (!inShadowIncludingDocument()) { | 225 if (!isConnected()) { |
| 226 // Reset the target element if we are no longer in the document. | 226 // Reset the target element if we are no longer in the document. |
| 227 setTargetElement(nullptr); | 227 setTargetElement(nullptr); |
| 228 return; | 228 return; |
| 229 } | 229 } |
| 230 | 230 |
| 231 AtomicString id; | 231 AtomicString id; |
| 232 const AtomicString& href = SVGURIReference::legacyHrefString(*this); | 232 const AtomicString& href = SVGURIReference::legacyHrefString(*this); |
| 233 Element* target; | 233 Element* target; |
| 234 if (href.isEmpty()) | 234 if (href.isEmpty()) |
| 235 target = parentNode() && parentNode()->isElementNode() ? toElement(paren
tNode()) : nullptr; | 235 target = parentNode() && parentNode()->isElementNode() ? toElement(paren
tNode()) : nullptr; |
| 236 else | 236 else |
| 237 target = SVGURIReference::targetElementFromIRIString(href, treeScope(),
&id); | 237 target = SVGURIReference::targetElementFromIRIString(href, treeScope(),
&id); |
| 238 SVGElement* svgTarget = target && target->isSVGElement() ? toSVGElement(targ
et) : nullptr; | 238 SVGElement* svgTarget = target && target->isSVGElement() ? toSVGElement(targ
et) : nullptr; |
| 239 | 239 |
| 240 if (svgTarget && !svgTarget->inShadowIncludingDocument()) | 240 if (svgTarget && !svgTarget->isConnected()) |
| 241 svgTarget = nullptr; | 241 svgTarget = nullptr; |
| 242 | 242 |
| 243 if (svgTarget != targetElement()) | 243 if (svgTarget != targetElement()) |
| 244 setTargetElement(svgTarget); | 244 setTargetElement(svgTarget); |
| 245 | 245 |
| 246 if (!svgTarget) { | 246 if (!svgTarget) { |
| 247 // Do not register as pending if we are already pending this resource. | 247 // Do not register as pending if we are already pending this resource. |
| 248 if (document().accessSVGExtensions().isElementPendingResource(this, id)) | 248 if (document().accessSVGExtensions().isElementPendingResource(this, id)) |
| 249 return; | 249 return; |
| 250 | 250 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 m_lastPercent = 0; | 306 m_lastPercent = 0; |
| 307 m_lastRepeat = 0; | 307 m_lastRepeat = 0; |
| 308 m_nextProgressTime = 0; | 308 m_nextProgressTime = 0; |
| 309 resolveFirstInterval(); | 309 resolveFirstInterval(); |
| 310 } | 310 } |
| 311 | 311 |
| 312 Node::InsertionNotificationRequest SVGSMILElement::insertedInto(ContainerNode* r
ootParent) | 312 Node::InsertionNotificationRequest SVGSMILElement::insertedInto(ContainerNode* r
ootParent) |
| 313 { | 313 { |
| 314 SVGElement::insertedInto(rootParent); | 314 SVGElement::insertedInto(rootParent); |
| 315 | 315 |
| 316 if (!rootParent->inShadowIncludingDocument()) | 316 if (!rootParent->isConnected()) |
| 317 return InsertionDone; | 317 return InsertionDone; |
| 318 | 318 |
| 319 Deprecation::countDeprecation(document(), UseCounter::SVGSMILElementInDocume
nt); | 319 Deprecation::countDeprecation(document(), UseCounter::SVGSMILElementInDocume
nt); |
| 320 | 320 |
| 321 setAttributeName(constructQualifiedName(this, fastGetAttribute(SVGNames::att
ributeNameAttr))); | 321 setAttributeName(constructQualifiedName(this, fastGetAttribute(SVGNames::att
ributeNameAttr))); |
| 322 SVGSVGElement* owner = ownerSVGElement(); | 322 SVGSVGElement* owner = ownerSVGElement(); |
| 323 if (!owner) | 323 if (!owner) |
| 324 return InsertionDone; | 324 return InsertionDone; |
| 325 | 325 |
| 326 m_timeContainer = owner->timeContainer(); | 326 m_timeContainer = owner->timeContainer(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 337 if (m_timeContainer) | 337 if (m_timeContainer) |
| 338 m_timeContainer->notifyIntervalsChanged(); | 338 m_timeContainer->notifyIntervalsChanged(); |
| 339 | 339 |
| 340 buildPendingResource(); | 340 buildPendingResource(); |
| 341 | 341 |
| 342 return InsertionDone; | 342 return InsertionDone; |
| 343 } | 343 } |
| 344 | 344 |
| 345 void SVGSMILElement::removedFrom(ContainerNode* rootParent) | 345 void SVGSMILElement::removedFrom(ContainerNode* rootParent) |
| 346 { | 346 { |
| 347 if (rootParent->inShadowIncludingDocument()) { | 347 if (rootParent->isConnected()) { |
| 348 clearResourceAndEventBaseReferences(); | 348 clearResourceAndEventBaseReferences(); |
| 349 clearConditions(); | 349 clearConditions(); |
| 350 setTargetElement(nullptr); | 350 setTargetElement(nullptr); |
| 351 setAttributeName(anyQName()); | 351 setAttributeName(anyQName()); |
| 352 animationAttributeChanged(); | 352 animationAttributeChanged(); |
| 353 m_timeContainer = nullptr; | 353 m_timeContainer = nullptr; |
| 354 } | 354 } |
| 355 | 355 |
| 356 SVGElement::removedFrom(rootParent); | 356 SVGElement::removedFrom(rootParent); |
| 357 } | 357 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 } | 510 } |
| 511 | 511 |
| 512 void SVGSMILElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& oldValue, const AtomicString& value) | 512 void SVGSMILElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& oldValue, const AtomicString& value) |
| 513 { | 513 { |
| 514 if (name == SVGNames::beginAttr) { | 514 if (name == SVGNames::beginAttr) { |
| 515 if (!m_conditions.isEmpty()) { | 515 if (!m_conditions.isEmpty()) { |
| 516 clearConditions(); | 516 clearConditions(); |
| 517 parseBeginOrEnd(fastGetAttribute(SVGNames::endAttr), End); | 517 parseBeginOrEnd(fastGetAttribute(SVGNames::endAttr), End); |
| 518 } | 518 } |
| 519 parseBeginOrEnd(value.getString(), Begin); | 519 parseBeginOrEnd(value.getString(), Begin); |
| 520 if (inShadowIncludingDocument()) | 520 if (isConnected()) |
| 521 connectSyncBaseConditions(); | 521 connectSyncBaseConditions(); |
| 522 } else if (name == SVGNames::endAttr) { | 522 } else if (name == SVGNames::endAttr) { |
| 523 if (!m_conditions.isEmpty()) { | 523 if (!m_conditions.isEmpty()) { |
| 524 clearConditions(); | 524 clearConditions(); |
| 525 parseBeginOrEnd(fastGetAttribute(SVGNames::beginAttr), Begin); | 525 parseBeginOrEnd(fastGetAttribute(SVGNames::beginAttr), Begin); |
| 526 } | 526 } |
| 527 parseBeginOrEnd(value.getString(), End); | 527 parseBeginOrEnd(value.getString(), End); |
| 528 if (inShadowIncludingDocument()) | 528 if (isConnected()) |
| 529 connectSyncBaseConditions(); | 529 connectSyncBaseConditions(); |
| 530 } else if (name == SVGNames::onbeginAttr) { | 530 } else if (name == SVGNames::onbeginAttr) { |
| 531 setAttributeEventListener(EventTypeNames::beginEvent, createAttributeEve
ntListener(this, name, value, eventParameterName())); | 531 setAttributeEventListener(EventTypeNames::beginEvent, createAttributeEve
ntListener(this, name, value, eventParameterName())); |
| 532 } else if (name == SVGNames::onendAttr) { | 532 } else if (name == SVGNames::onendAttr) { |
| 533 setAttributeEventListener(EventTypeNames::endEvent, createAttributeEvent
Listener(this, name, value, eventParameterName())); | 533 setAttributeEventListener(EventTypeNames::endEvent, createAttributeEvent
Listener(this, name, value, eventParameterName())); |
| 534 } else if (name == SVGNames::onrepeatAttr) { | 534 } else if (name == SVGNames::onrepeatAttr) { |
| 535 setAttributeEventListener(EventTypeNames::repeatEvent, createAttributeEv
entListener(this, name, value, eventParameterName())); | 535 setAttributeEventListener(EventTypeNames::repeatEvent, createAttributeEv
entListener(this, name, value, eventParameterName())); |
| 536 } else { | 536 } else { |
| 537 SVGElement::parseAttribute(name, oldValue, value); | 537 SVGElement::parseAttribute(name, oldValue, value); |
| 538 } | 538 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 552 m_cachedMax = invalidCachedTime; | 552 m_cachedMax = invalidCachedTime; |
| 553 } else if (attrName == SVGNames::attributeNameAttr) { | 553 } else if (attrName == SVGNames::attributeNameAttr) { |
| 554 setAttributeName(constructQualifiedName(this, fastGetAttribute(SVGNames:
:attributeNameAttr))); | 554 setAttributeName(constructQualifiedName(this, fastGetAttribute(SVGNames:
:attributeNameAttr))); |
| 555 } else if (attrName.matches(SVGNames::hrefAttr) || attrName.matches(XLinkNam
es::hrefAttr)) { | 555 } else if (attrName.matches(SVGNames::hrefAttr) || attrName.matches(XLinkNam
es::hrefAttr)) { |
| 556 // TODO(fs): Could be smarter here when 'href' is specified and 'xlink:h
ref' is changed. | 556 // TODO(fs): Could be smarter here when 'href' is specified and 'xlink:h
ref' is changed. |
| 557 SVGElement::InvalidationGuard invalidationGuard(this); | 557 SVGElement::InvalidationGuard invalidationGuard(this); |
| 558 buildPendingResource(); | 558 buildPendingResource(); |
| 559 if (m_targetElement) | 559 if (m_targetElement) |
| 560 clearAnimatedType(); | 560 clearAnimatedType(); |
| 561 } else if (attrName == SVGNames::beginAttr || attrName == SVGNames::endAttr)
{ | 561 } else if (attrName == SVGNames::beginAttr || attrName == SVGNames::endAttr)
{ |
| 562 if (inShadowIncludingDocument()) { | 562 if (isConnected()) { |
| 563 connectEventBaseConditions(); | 563 connectEventBaseConditions(); |
| 564 if (attrName == SVGNames::beginAttr) | 564 if (attrName == SVGNames::beginAttr) |
| 565 beginListChanged(elapsed()); | 565 beginListChanged(elapsed()); |
| 566 else if (attrName == SVGNames::endAttr) | 566 else if (attrName == SVGNames::endAttr) |
| 567 endListChanged(elapsed()); | 567 endListChanged(elapsed()); |
| 568 } | 568 } |
| 569 } else { | 569 } else { |
| 570 SVGElement::svgAttributeChanged(attrName); | 570 SVGElement::svgAttributeChanged(attrName); |
| 571 return; | 571 return; |
| 572 } | 572 } |
| (...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1357 { | 1357 { |
| 1358 visitor->trace(m_targetElement); | 1358 visitor->trace(m_targetElement); |
| 1359 visitor->trace(m_timeContainer); | 1359 visitor->trace(m_timeContainer); |
| 1360 visitor->trace(m_conditions); | 1360 visitor->trace(m_conditions); |
| 1361 visitor->trace(m_syncBaseDependents); | 1361 visitor->trace(m_syncBaseDependents); |
| 1362 SVGElement::trace(visitor); | 1362 SVGElement::trace(visitor); |
| 1363 SVGTests::trace(visitor); | 1363 SVGTests::trace(visitor); |
| 1364 } | 1364 } |
| 1365 | 1365 |
| 1366 } // namespace blink | 1366 } // namespace blink |
| OLD | NEW |