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

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

Issue 121173004: Make calls to AtomicString(const String&) explicit in svg/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Take feedback into consideration Created 6 years, 11 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
« no previous file with comments | « Source/core/svg/SVGViewSpec.cpp ('k') | Source/platform/graphics/filters/FilterOperation.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 void SVGSMILElement::buildPendingResource() 201 void SVGSMILElement::buildPendingResource()
202 { 202 {
203 clearResourceReferences(); 203 clearResourceReferences();
204 204
205 if (!inDocument()) { 205 if (!inDocument()) {
206 // Reset the target element if we are no longer in the document. 206 // Reset the target element if we are no longer in the document.
207 setTargetElement(0); 207 setTargetElement(0);
208 return; 208 return;
209 } 209 }
210 210
211 String id; 211 AtomicString id;
212 String href = getAttribute(XLinkNames::hrefAttr); 212 AtomicString href = getAttribute(XLinkNames::hrefAttr);
213 Element* target; 213 Element* target;
214 if (href.isEmpty()) 214 if (href.isEmpty())
215 target = parentNode() && parentNode()->isElementNode() ? toElement(paren tNode()) : 0; 215 target = parentNode() && parentNode()->isElementNode() ? toElement(paren tNode()) : 0;
216 else 216 else
217 target = SVGURIReference::targetElementFromIRIString(href, document(), & id); 217 target = SVGURIReference::targetElementFromIRIString(href, document(), & id);
218 SVGElement* svgTarget = target && target->isSVGElement() ? toSVGElement(targ et) : 0; 218 SVGElement* svgTarget = target && target->isSVGElement() ? toSVGElement(targ et) : 0;
219 219
220 if (svgTarget && !svgTarget->inDocument()) 220 if (svgTarget && !svgTarget->inDocument())
221 svgTarget = 0; 221 svgTarget = 0;
222 222
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 beginListChanged(elapsed()); 550 beginListChanged(elapsed());
551 else if (attrName == SVGNames::endAttr) 551 else if (attrName == SVGNames::endAttr)
552 endListChanged(elapsed()); 552 endListChanged(elapsed());
553 } 553 }
554 554
555 animationAttributeChanged(); 555 animationAttributeChanged();
556 } 556 }
557 557
558 inline Element* SVGSMILElement::eventBaseFor(const Condition& condition) 558 inline Element* SVGSMILElement::eventBaseFor(const Condition& condition)
559 { 559 {
560 return condition.m_baseID.isEmpty() ? targetElement() : treeScope().getEleme ntById(condition.m_baseID); 560 return condition.m_baseID.isEmpty() ? targetElement() : treeScope().getEleme ntById(AtomicString(condition.m_baseID));
561 } 561 }
562 562
563 void SVGSMILElement::connectConditions() 563 void SVGSMILElement::connectConditions()
564 { 564 {
565 if (m_conditionsConnected) 565 if (m_conditionsConnected)
566 disconnectConditions(); 566 disconnectConditions();
567 m_conditionsConnected = true; 567 m_conditionsConnected = true;
568 for (unsigned n = 0; n < m_conditions.size(); ++n) { 568 for (unsigned n = 0; n < m_conditions.size(); ++n) {
569 Condition& condition = m_conditions[n]; 569 Condition& condition = m_conditions[n];
570 if (condition.m_type == Condition::EventBase) { 570 if (condition.m_type == Condition::EventBase) {
571 ASSERT(!condition.m_syncbase); 571 ASSERT(!condition.m_syncbase);
572 Element* eventBase = eventBaseFor(condition); 572 Element* eventBase = eventBaseFor(condition);
573 if (!eventBase) 573 if (!eventBase)
574 continue; 574 continue;
575 ASSERT(!condition.m_eventListener); 575 ASSERT(!condition.m_eventListener);
576 condition.m_eventListener = ConditionEventListener::create(this, &co ndition); 576 condition.m_eventListener = ConditionEventListener::create(this, &co ndition);
577 eventBase->addEventListener(condition.m_name, condition.m_eventListe ner, false); 577 eventBase->addEventListener(AtomicString(condition.m_name), conditio n.m_eventListener, false);
578 } else if (condition.m_type == Condition::Syncbase) { 578 } else if (condition.m_type == Condition::Syncbase) {
579 ASSERT(!condition.m_baseID.isEmpty()); 579 ASSERT(!condition.m_baseID.isEmpty());
580 condition.m_syncbase = treeScope().getElementById(condition.m_baseID ); 580 condition.m_syncbase = treeScope().getElementById(AtomicString(condi tion.m_baseID));
581 if (!condition.m_syncbase || !isSVGSMILElement(*condition.m_syncbase )) { 581 if (!condition.m_syncbase || !isSVGSMILElement(*condition.m_syncbase )) {
582 condition.m_syncbase = 0; 582 condition.m_syncbase = 0;
583 continue; 583 continue;
584 } 584 }
585 toSVGSMILElement(condition.m_syncbase.get())->addTimeDependent(this) ; 585 toSVGSMILElement(condition.m_syncbase.get())->addTimeDependent(this) ;
586 } 586 }
587 } 587 }
588 } 588 }
589 589
590 void SVGSMILElement::disconnectConditions() 590 void SVGSMILElement::disconnectConditions()
591 { 591 {
592 if (!m_conditionsConnected) 592 if (!m_conditionsConnected)
593 return; 593 return;
594 m_conditionsConnected = false; 594 m_conditionsConnected = false;
595 for (unsigned n = 0; n < m_conditions.size(); ++n) { 595 for (unsigned n = 0; n < m_conditions.size(); ++n) {
596 Condition& condition = m_conditions[n]; 596 Condition& condition = m_conditions[n];
597 if (condition.m_type == Condition::EventBase) { 597 if (condition.m_type == Condition::EventBase) {
598 ASSERT(!condition.m_syncbase); 598 ASSERT(!condition.m_syncbase);
599 if (!condition.m_eventListener) 599 if (!condition.m_eventListener)
600 continue; 600 continue;
601 // Note: It's a memory optimization to try to remove our condition 601 // Note: It's a memory optimization to try to remove our condition
602 // event listener, but it's not guaranteed to work, since we have 602 // event listener, but it's not guaranteed to work, since we have
603 // no guarantee that eventBaseFor() will be able to find our conditi on's 603 // no guarantee that eventBaseFor() will be able to find our conditi on's
604 // original eventBase. So, we also have to disconnect ourselves from 604 // original eventBase. So, we also have to disconnect ourselves from
605 // our condition event listener, in case it later fires. 605 // our condition event listener, in case it later fires.
606 Element* eventBase = eventBaseFor(condition); 606 Element* eventBase = eventBaseFor(condition);
607 if (eventBase) 607 if (eventBase)
608 eventBase->removeEventListener(condition.m_name, condition.m_eve ntListener.get(), false); 608 eventBase->removeEventListener(AtomicString(condition.m_name), c ondition.m_eventListener.get(), false);
609 condition.m_eventListener->disconnectAnimation(); 609 condition.m_eventListener->disconnectAnimation();
610 condition.m_eventListener = 0; 610 condition.m_eventListener = 0;
611 } else if (condition.m_type == Condition::Syncbase) { 611 } else if (condition.m_type == Condition::Syncbase) {
612 if (condition.m_syncbase) 612 if (condition.m_syncbase)
613 toSVGSMILElement(condition.m_syncbase.get())->removeTimeDependen t(this); 613 toSVGSMILElement(condition.m_syncbase.get())->removeTimeDependen t(this);
614 } 614 }
615 condition.m_syncbase = 0; 615 condition.m_syncbase = 0;
616 } 616 }
617 } 617 }
618 618
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 if (eventType == "repeatn") { 1274 if (eventType == "repeatn") {
1275 unsigned repeatEventCount = m_repeatEventCountList.first(); 1275 unsigned repeatEventCount = m_repeatEventCountList.first();
1276 m_repeatEventCountList.remove(0); 1276 m_repeatEventCountList.remove(0);
1277 dispatchEvent(RepeatEvent::create(eventType, repeatEventCount)); 1277 dispatchEvent(RepeatEvent::create(eventType, repeatEventCount));
1278 } else { 1278 } else {
1279 dispatchEvent(Event::create(eventType)); 1279 dispatchEvent(Event::create(eventType));
1280 } 1280 }
1281 } 1281 }
1282 1282
1283 } 1283 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGViewSpec.cpp ('k') | Source/platform/graphics/filters/FilterOperation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698