Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp

Issue 1858163002: Rename inDocument() to inShadowIncludingDocument() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 { 225 {
226 disconnectSyncBaseConditions(); 226 disconnectSyncBaseConditions();
227 disconnectEventBaseConditions(); 227 disconnectEventBaseConditions();
228 m_conditions.clear(); 228 m_conditions.clear();
229 } 229 }
230 230
231 void SVGSMILElement::buildPendingResource() 231 void SVGSMILElement::buildPendingResource()
232 { 232 {
233 clearResourceAndEventBaseReferences(); 233 clearResourceAndEventBaseReferences();
234 234
235 if (!inDocument()) { 235 if (!inShadowIncludingDocument()) {
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 const AtomicString& href = SVGURIReference::legacyHrefString(*this);
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->inShadowIncludingDocument())
251 svgTarget = nullptr; 251 svgTarget = nullptr;
252 252
253 if (svgTarget != targetElement()) 253 if (svgTarget != targetElement())
254 setTargetElement(svgTarget); 254 setTargetElement(svgTarget);
255 255
256 if (!svgTarget) { 256 if (!svgTarget) {
257 // Do not register as pending if we are already pending this resource. 257 // Do not register as pending if we are already pending this resource.
258 if (document().accessSVGExtensions().isElementPendingResource(this, id)) 258 if (document().accessSVGExtensions().isElementPendingResource(this, id))
259 return; 259 return;
260 260
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 m_lastPercent = 0; 316 m_lastPercent = 0;
317 m_lastRepeat = 0; 317 m_lastRepeat = 0;
318 m_nextProgressTime = 0; 318 m_nextProgressTime = 0;
319 resolveFirstInterval(); 319 resolveFirstInterval();
320 } 320 }
321 321
322 Node::InsertionNotificationRequest SVGSMILElement::insertedInto(ContainerNode* r ootParent) 322 Node::InsertionNotificationRequest SVGSMILElement::insertedInto(ContainerNode* r ootParent)
323 { 323 {
324 SVGElement::insertedInto(rootParent); 324 SVGElement::insertedInto(rootParent);
325 325
326 if (!rootParent->inDocument()) 326 if (!rootParent->inShadowIncludingDocument())
327 return InsertionDone; 327 return InsertionDone;
328 328
329 Deprecation::countDeprecation(document(), UseCounter::SVGSMILElementInDocume nt); 329 Deprecation::countDeprecation(document(), UseCounter::SVGSMILElementInDocume nt);
330 330
331 setAttributeName(constructQualifiedName(this, fastGetAttribute(SVGNames::att ributeNameAttr))); 331 setAttributeName(constructQualifiedName(this, fastGetAttribute(SVGNames::att ributeNameAttr)));
332 SVGSVGElement* owner = ownerSVGElement(); 332 SVGSVGElement* owner = ownerSVGElement();
333 if (!owner) 333 if (!owner)
334 return InsertionDone; 334 return InsertionDone;
335 335
336 m_timeContainer = owner->timeContainer(); 336 m_timeContainer = owner->timeContainer();
(...skipping 10 matching lines...) Expand all
347 if (m_timeContainer) 347 if (m_timeContainer)
348 m_timeContainer->notifyIntervalsChanged(); 348 m_timeContainer->notifyIntervalsChanged();
349 349
350 buildPendingResource(); 350 buildPendingResource();
351 351
352 return InsertionDone; 352 return InsertionDone;
353 } 353 }
354 354
355 void SVGSMILElement::removedFrom(ContainerNode* rootParent) 355 void SVGSMILElement::removedFrom(ContainerNode* rootParent)
356 { 356 {
357 if (rootParent->inDocument()) { 357 if (rootParent->inShadowIncludingDocument()) {
358 clearResourceAndEventBaseReferences(); 358 clearResourceAndEventBaseReferences();
359 clearConditions(); 359 clearConditions();
360 setTargetElement(nullptr); 360 setTargetElement(nullptr);
361 setAttributeName(anyQName()); 361 setAttributeName(anyQName());
362 animationAttributeChanged(); 362 animationAttributeChanged();
363 m_timeContainer = nullptr; 363 m_timeContainer = nullptr;
364 } 364 }
365 365
366 SVGElement::removedFrom(rootParent); 366 SVGElement::removedFrom(rootParent);
367 } 367 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 } 520 }
521 521
522 void SVGSMILElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& oldValue, const AtomicString& value) 522 void SVGSMILElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& oldValue, const AtomicString& value)
523 { 523 {
524 if (name == SVGNames::beginAttr) { 524 if (name == SVGNames::beginAttr) {
525 if (!m_conditions.isEmpty()) { 525 if (!m_conditions.isEmpty()) {
526 clearConditions(); 526 clearConditions();
527 parseBeginOrEnd(fastGetAttribute(SVGNames::endAttr), End); 527 parseBeginOrEnd(fastGetAttribute(SVGNames::endAttr), End);
528 } 528 }
529 parseBeginOrEnd(value.getString(), Begin); 529 parseBeginOrEnd(value.getString(), Begin);
530 if (inDocument()) 530 if (inShadowIncludingDocument())
531 connectSyncBaseConditions(); 531 connectSyncBaseConditions();
532 } else if (name == SVGNames::endAttr) { 532 } else if (name == SVGNames::endAttr) {
533 if (!m_conditions.isEmpty()) { 533 if (!m_conditions.isEmpty()) {
534 clearConditions(); 534 clearConditions();
535 parseBeginOrEnd(fastGetAttribute(SVGNames::beginAttr), Begin); 535 parseBeginOrEnd(fastGetAttribute(SVGNames::beginAttr), Begin);
536 } 536 }
537 parseBeginOrEnd(value.getString(), End); 537 parseBeginOrEnd(value.getString(), End);
538 if (inDocument()) 538 if (inShadowIncludingDocument())
539 connectSyncBaseConditions(); 539 connectSyncBaseConditions();
540 } else if (name == SVGNames::onbeginAttr) { 540 } else if (name == SVGNames::onbeginAttr) {
541 setAttributeEventListener(EventTypeNames::beginEvent, createAttributeEve ntListener(this, name, value, eventParameterName())); 541 setAttributeEventListener(EventTypeNames::beginEvent, createAttributeEve ntListener(this, name, value, eventParameterName()));
542 } else if (name == SVGNames::onendAttr) { 542 } else if (name == SVGNames::onendAttr) {
543 setAttributeEventListener(EventTypeNames::endEvent, createAttributeEvent Listener(this, name, value, eventParameterName())); 543 setAttributeEventListener(EventTypeNames::endEvent, createAttributeEvent Listener(this, name, value, eventParameterName()));
544 } else if (name == SVGNames::onrepeatAttr) { 544 } else if (name == SVGNames::onrepeatAttr) {
545 setAttributeEventListener(EventTypeNames::repeatEvent, createAttributeEv entListener(this, name, value, eventParameterName())); 545 setAttributeEventListener(EventTypeNames::repeatEvent, createAttributeEv entListener(this, name, value, eventParameterName()));
546 } else { 546 } else {
547 SVGElement::parseAttribute(name, oldValue, value); 547 SVGElement::parseAttribute(name, oldValue, value);
548 } 548 }
(...skipping 13 matching lines...) Expand all
562 m_cachedMax = invalidCachedTime; 562 m_cachedMax = invalidCachedTime;
563 } else if (attrName == SVGNames::attributeNameAttr) { 563 } else if (attrName == SVGNames::attributeNameAttr) {
564 setAttributeName(constructQualifiedName(this, fastGetAttribute(SVGNames: :attributeNameAttr))); 564 setAttributeName(constructQualifiedName(this, fastGetAttribute(SVGNames: :attributeNameAttr)));
565 } else if (attrName.matches(SVGNames::hrefAttr) || attrName.matches(XLinkNam es::hrefAttr)) { 565 } else if (attrName.matches(SVGNames::hrefAttr) || attrName.matches(XLinkNam es::hrefAttr)) {
566 // TODO(fs): Could be smarter here when 'href' is specified and 'xlink:h ref' is changed. 566 // TODO(fs): Could be smarter here when 'href' is specified and 'xlink:h ref' is changed.
567 SVGElement::InvalidationGuard invalidationGuard(this); 567 SVGElement::InvalidationGuard invalidationGuard(this);
568 buildPendingResource(); 568 buildPendingResource();
569 if (m_targetElement) 569 if (m_targetElement)
570 clearAnimatedType(); 570 clearAnimatedType();
571 } else if (attrName == SVGNames::beginAttr || attrName == SVGNames::endAttr) { 571 } else if (attrName == SVGNames::beginAttr || attrName == SVGNames::endAttr) {
572 if (inDocument()) { 572 if (inShadowIncludingDocument()) {
573 connectEventBaseConditions(); 573 connectEventBaseConditions();
574 if (attrName == SVGNames::beginAttr) 574 if (attrName == SVGNames::beginAttr)
575 beginListChanged(elapsed()); 575 beginListChanged(elapsed());
576 else if (attrName == SVGNames::endAttr) 576 else if (attrName == SVGNames::endAttr)
577 endListChanged(elapsed()); 577 endListChanged(elapsed());
578 } 578 }
579 } else { 579 } else {
580 SVGElement::svgAttributeChanged(attrName); 580 SVGElement::svgAttributeChanged(attrName);
581 return; 581 return;
582 } 582 }
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 { 1366 {
1367 visitor->trace(m_targetElement); 1367 visitor->trace(m_targetElement);
1368 visitor->trace(m_timeContainer); 1368 visitor->trace(m_timeContainer);
1369 visitor->trace(m_conditions); 1369 visitor->trace(m_conditions);
1370 visitor->trace(m_syncBaseDependents); 1370 visitor->trace(m_syncBaseDependents);
1371 SVGElement::trace(visitor); 1371 SVGElement::trace(visitor);
1372 SVGTests::trace(visitor); 1372 SVGTests::trace(visitor);
1373 } 1373 }
1374 1374
1375 } // namespace blink 1375 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698