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

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

Issue 19798009: Introduce toSVGSMILElement, and use it (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 5 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/animation/SVGSMILElement.h ('k') | no next file » | 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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 ASSERT(!condition.m_eventListener); 529 ASSERT(!condition.m_eventListener);
530 condition.m_eventListener = ConditionEventListener::create(this, &co ndition); 530 condition.m_eventListener = ConditionEventListener::create(this, &co ndition);
531 eventBase->addEventListener(condition.m_name, condition.m_eventListe ner, false); 531 eventBase->addEventListener(condition.m_name, condition.m_eventListe ner, false);
532 } else if (condition.m_type == Condition::Syncbase) { 532 } else if (condition.m_type == Condition::Syncbase) {
533 ASSERT(!condition.m_baseID.isEmpty()); 533 ASSERT(!condition.m_baseID.isEmpty());
534 condition.m_syncbase = treeScope()->getElementById(condition.m_baseI D); 534 condition.m_syncbase = treeScope()->getElementById(condition.m_baseI D);
535 if (!isSMILElement(condition.m_syncbase.get())) { 535 if (!isSMILElement(condition.m_syncbase.get())) {
536 condition.m_syncbase = 0; 536 condition.m_syncbase = 0;
537 continue; 537 continue;
538 } 538 }
539 SVGSMILElement* syncbase = static_cast<SVGSMILElement*>(condition.m_ syncbase.get()); 539 SVGSMILElement* syncbase = toSVGSMILElement(condition.m_syncbase.get ());
tkent 2013/07/24 05:19:26 We can remove the local variable |syncbase|.
540 syncbase->addTimeDependent(this); 540 syncbase->addTimeDependent(this);
541 } 541 }
542 } 542 }
543 } 543 }
544 544
545 void SVGSMILElement::disconnectConditions() 545 void SVGSMILElement::disconnectConditions()
546 { 546 {
547 if (!m_conditionsConnected) 547 if (!m_conditionsConnected)
548 return; 548 return;
549 m_conditionsConnected = false; 549 m_conditionsConnected = false;
550 for (unsigned n = 0; n < m_conditions.size(); ++n) { 550 for (unsigned n = 0; n < m_conditions.size(); ++n) {
551 Condition& condition = m_conditions[n]; 551 Condition& condition = m_conditions[n];
552 if (condition.m_type == Condition::EventBase) { 552 if (condition.m_type == Condition::EventBase) {
553 ASSERT(!condition.m_syncbase); 553 ASSERT(!condition.m_syncbase);
554 if (!condition.m_eventListener) 554 if (!condition.m_eventListener)
555 continue; 555 continue;
556 // Note: It's a memory optimization to try to remove our condition 556 // Note: It's a memory optimization to try to remove our condition
557 // event listener, but it's not guaranteed to work, since we have 557 // event listener, but it's not guaranteed to work, since we have
558 // no guarantee that eventBaseFor() will be able to find our conditi on's 558 // no guarantee that eventBaseFor() will be able to find our conditi on's
559 // original eventBase. So, we also have to disconnect ourselves from 559 // original eventBase. So, we also have to disconnect ourselves from
560 // our condition event listener, in case it later fires. 560 // our condition event listener, in case it later fires.
561 Element* eventBase = eventBaseFor(condition); 561 Element* eventBase = eventBaseFor(condition);
562 if (eventBase) 562 if (eventBase)
563 eventBase->removeEventListener(condition.m_name, condition.m_eve ntListener.get(), false); 563 eventBase->removeEventListener(condition.m_name, condition.m_eve ntListener.get(), false);
564 condition.m_eventListener->disconnectAnimation(); 564 condition.m_eventListener->disconnectAnimation();
565 condition.m_eventListener = 0; 565 condition.m_eventListener = 0;
566 } else if (condition.m_type == Condition::Syncbase) { 566 } else if (condition.m_type == Condition::Syncbase) {
567 if (condition.m_syncbase) { 567 if (condition.m_syncbase) {
568 ASSERT(isSMILElement(condition.m_syncbase.get())); 568 ASSERT(isSMILElement(condition.m_syncbase.get()));
tkent 2013/07/24 05:19:26 This assertion is redundant. toSVgSMILElement() c
569 static_cast<SVGSMILElement*>(condition.m_syncbase.get())->remove TimeDependent(this); 569 toSVGSMILElement(condition.m_syncbase.get())->removeTimeDependen t(this);
570 } 570 }
571 } 571 }
572 condition.m_syncbase = 0; 572 condition.m_syncbase = 0;
573 } 573 }
574 } 574 }
575 575
576 void SVGSMILElement::setAttributeName(const QualifiedName& attributeName) 576 void SVGSMILElement::setAttributeName(const QualifiedName& attributeName)
577 { 577 {
578 if (m_timeContainer && m_targetElement && m_attributeName != attributeName) { 578 if (m_timeContainer && m_targetElement && m_attributeName != attributeName) {
579 if (hasValidAttributeName()) 579 if (hasValidAttributeName())
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 addBeginTime(elapsed, elapsed); 1188 addBeginTime(elapsed, elapsed);
1189 } 1189 }
1190 1190
1191 void SVGSMILElement::endedActiveInterval() 1191 void SVGSMILElement::endedActiveInterval()
1192 { 1192 {
1193 clearTimesWithDynamicOrigins(m_beginTimes); 1193 clearTimesWithDynamicOrigins(m_beginTimes);
1194 clearTimesWithDynamicOrigins(m_endTimes); 1194 clearTimesWithDynamicOrigins(m_endTimes);
1195 } 1195 }
1196 1196
1197 } 1197 }
OLDNEW
« no previous file with comments | « Source/core/svg/animation/SVGSMILElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698