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

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

Issue 103393002: Use DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION to generate toSVGSMILElement() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years 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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 type = Condition::EventBase; 453 type = Condition::EventBase;
454 454
455 m_conditions.append(Condition(type, beginOrEnd, baseID, nameString, offset, repeat)); 455 m_conditions.append(Condition(type, beginOrEnd, baseID, nameString, offset, repeat));
456 456
457 if (type == Condition::EventBase && beginOrEnd == End) 457 if (type == Condition::EventBase && beginOrEnd == End)
458 m_hasEndEventConditions = true; 458 m_hasEndEventConditions = true;
459 459
460 return true; 460 return true;
461 } 461 }
462 462
463 bool SVGSMILElement::isSMILElement(Node* node)
464 {
465 if (!node)
466 return false;
467 return node->hasTagName(SVGNames::setTag) || node->hasTagName(SVGNames::anim ateTag) || node->hasTagName(SVGNames::animateMotionTag)
468 || node->hasTagName(SVGNames::animateTransformTag) || node->hasTagNa me(SVGNames::animateColorTag);
469 }
470
471 void SVGSMILElement::parseBeginOrEnd(const String& parseString, BeginOrEnd begin OrEnd) 463 void SVGSMILElement::parseBeginOrEnd(const String& parseString, BeginOrEnd begin OrEnd)
472 { 464 {
473 Vector<SMILTimeWithOrigin>& timeList = beginOrEnd == Begin ? m_beginTimes : m_endTimes; 465 Vector<SMILTimeWithOrigin>& timeList = beginOrEnd == Begin ? m_beginTimes : m_endTimes;
474 if (beginOrEnd == End) 466 if (beginOrEnd == End)
475 m_hasEndEventConditions = false; 467 m_hasEndEventConditions = false;
476 HashSet<double> existing; 468 HashSet<double> existing;
477 for (unsigned n = 0; n < timeList.size(); ++n) 469 for (unsigned n = 0; n < timeList.size(); ++n)
478 existing.add(timeList[n].time().value()); 470 existing.add(timeList[n].time().value());
479 Vector<String> splitString; 471 Vector<String> splitString;
480 parseString.split(';', splitString); 472 parseString.split(';', splitString);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 ASSERT(!condition.m_syncbase); 571 ASSERT(!condition.m_syncbase);
580 Element* eventBase = eventBaseFor(condition); 572 Element* eventBase = eventBaseFor(condition);
581 if (!eventBase) 573 if (!eventBase)
582 continue; 574 continue;
583 ASSERT(!condition.m_eventListener); 575 ASSERT(!condition.m_eventListener);
584 condition.m_eventListener = ConditionEventListener::create(this, &co ndition); 576 condition.m_eventListener = ConditionEventListener::create(this, &co ndition);
585 eventBase->addEventListener(condition.m_name, condition.m_eventListe ner, false); 577 eventBase->addEventListener(condition.m_name, condition.m_eventListe ner, false);
586 } else if (condition.m_type == Condition::Syncbase) { 578 } else if (condition.m_type == Condition::Syncbase) {
587 ASSERT(!condition.m_baseID.isEmpty()); 579 ASSERT(!condition.m_baseID.isEmpty());
588 condition.m_syncbase = treeScope().getElementById(condition.m_baseID ); 580 condition.m_syncbase = treeScope().getElementById(condition.m_baseID );
589 if (!isSMILElement(condition.m_syncbase.get())) { 581 if (!condition.m_syncbase || !isSVGSMILElement(*condition.m_syncbase )) {
590 condition.m_syncbase = 0; 582 condition.m_syncbase = 0;
591 continue; 583 continue;
592 } 584 }
593 toSVGSMILElement(condition.m_syncbase.get())->addTimeDependent(this) ; 585 toSVGSMILElement(condition.m_syncbase.get())->addTimeDependent(this) ;
594 } 586 }
595 } 587 }
596 } 588 }
597 589
598 void SVGSMILElement::disconnectConditions() 590 void SVGSMILElement::disconnectConditions()
599 { 591 {
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 if (eventType == "repeatn") { 1279 if (eventType == "repeatn") {
1288 unsigned repeatEventCount = m_repeatEventCountList.first(); 1280 unsigned repeatEventCount = m_repeatEventCountList.first();
1289 m_repeatEventCountList.remove(0); 1281 m_repeatEventCountList.remove(0);
1290 dispatchEvent(RepeatEvent::create(eventType, repeatEventCount)); 1282 dispatchEvent(RepeatEvent::create(eventType, repeatEventCount));
1291 } else { 1283 } else {
1292 dispatchEvent(Event::create(eventType)); 1284 dispatchEvent(Event::create(eventType));
1293 } 1285 }
1294 } 1286 }
1295 1287
1296 } 1288 }
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