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

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

Issue 1885453002: Rename Node::treeScope() to Node::treeScopeOrDocument() Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, treeScopeOrDo cument(), &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->inShadowIncludingDocument())
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.
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 } else { 569 } else {
570 SVGElement::svgAttributeChanged(attrName); 570 SVGElement::svgAttributeChanged(attrName);
571 return; 571 return;
572 } 572 }
573 573
574 animationAttributeChanged(); 574 animationAttributeChanged();
575 } 575 }
576 576
577 inline SVGElement* SVGSMILElement::eventBaseFor(const Condition& condition) 577 inline SVGElement* SVGSMILElement::eventBaseFor(const Condition& condition)
578 { 578 {
579 Element* eventBase = condition.baseID().isEmpty() ? targetElement() : treeSc ope().getElementById(AtomicString(condition.baseID())); 579 Element* eventBase = condition.baseID().isEmpty() ? targetElement() : treeSc opeOrDocument().getElementById(AtomicString(condition.baseID()));
580 if (eventBase && eventBase->isSVGElement()) 580 if (eventBase && eventBase->isSVGElement())
581 return toSVGElement(eventBase); 581 return toSVGElement(eventBase);
582 return nullptr; 582 return nullptr;
583 } 583 }
584 584
585 void SVGSMILElement::connectSyncBaseConditions() 585 void SVGSMILElement::connectSyncBaseConditions()
586 { 586 {
587 if (m_syncBaseConditionsConnected) 587 if (m_syncBaseConditionsConnected)
588 disconnectSyncBaseConditions(); 588 disconnectSyncBaseConditions();
589 m_syncBaseConditionsConnected = true; 589 m_syncBaseConditionsConnected = true;
590 for (unsigned n = 0; n < m_conditions.size(); ++n) { 590 for (unsigned n = 0; n < m_conditions.size(); ++n) {
591 Condition* condition = m_conditions[n].get(); 591 Condition* condition = m_conditions[n].get();
592 if (condition->getType() == Condition::Syncbase) { 592 if (condition->getType() == Condition::Syncbase) {
593 ASSERT(!condition->baseID().isEmpty()); 593 ASSERT(!condition->baseID().isEmpty());
594 Element* element = treeScope().getElementById(AtomicString(condition ->baseID())); 594 Element* element = treeScopeOrDocument().getElementById(AtomicString (condition->baseID()));
595 if (!element || !isSVGSMILElement(*element)) { 595 if (!element || !isSVGSMILElement(*element)) {
596 condition->setSyncBase(0); 596 condition->setSyncBase(0);
597 continue; 597 continue;
598 } 598 }
599 SVGSMILElement* svgSMILElement = toSVGSMILElement(element); 599 SVGSMILElement* svgSMILElement = toSVGSMILElement(element);
600 condition->setSyncBase(svgSMILElement); 600 condition->setSyncBase(svgSMILElement);
601 svgSMILElement->addSyncBaseDependent(this); 601 svgSMILElement->addSyncBaseDependent(this);
602 } 602 }
603 } 603 }
604 } 604 }
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 { 1356 {
1357 visitor->trace(m_targetElement); 1357 visitor->trace(m_targetElement);
1358 visitor->trace(m_timeContainer); 1358 visitor->trace(m_timeContainer);
1359 visitor->trace(m_conditions); 1359 visitor->trace(m_conditions);
1360 visitor->trace(m_syncBaseDependents); 1360 visitor->trace(m_syncBaseDependents);
1361 SVGElement::trace(visitor); 1361 SVGElement::trace(visitor);
1362 SVGTests::trace(visitor); 1362 SVGTests::trace(visitor);
1363 } 1363 }
1364 1364
1365 } // namespace blink 1365 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGViewSpec.cpp ('k') | third_party/WebKit/Source/core/testing/Internals.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698