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

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

Issue 1074813002: Remove isSupportedAttribute in svg (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: invalidation guard tweaks Created 5 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 | Annotate | Revision Log
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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 for (unsigned n = 0; n < splitString.size(); ++n) { 500 for (unsigned n = 0; n < splitString.size(); ++n) {
501 SMILTime value = parseClockValue(splitString[n]); 501 SMILTime value = parseClockValue(splitString[n]);
502 if (value.isUnresolved()) 502 if (value.isUnresolved())
503 parseCondition(splitString[n], beginOrEnd); 503 parseCondition(splitString[n], beginOrEnd);
504 else if (!existing.contains(value.value())) 504 else if (!existing.contains(value.value()))
505 timeList.append(SMILTimeWithOrigin(value, SMILTimeWithOrigin::Parser Origin)); 505 timeList.append(SMILTimeWithOrigin(value, SMILTimeWithOrigin::Parser Origin));
506 } 506 }
507 sortTimeList(timeList); 507 sortTimeList(timeList);
508 } 508 }
509 509
510 bool SVGSMILElement::isSupportedAttribute(const QualifiedName& attrName)
511 {
512 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
513 if (supportedAttributes.isEmpty()) {
514 SVGTests::addSupportedAttributes(supportedAttributes);
515 supportedAttributes.add(SVGNames::beginAttr);
516 supportedAttributes.add(SVGNames::endAttr);
517 supportedAttributes.add(SVGNames::durAttr);
518 supportedAttributes.add(SVGNames::repeatDurAttr);
519 supportedAttributes.add(SVGNames::repeatCountAttr);
520 supportedAttributes.add(SVGNames::minAttr);
521 supportedAttributes.add(SVGNames::maxAttr);
522 supportedAttributes.add(SVGNames::attributeNameAttr);
523 supportedAttributes.add(XLinkNames::hrefAttr);
524 }
525 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
526 }
527
528 void SVGSMILElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value) 510 void SVGSMILElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value)
529 { 511 {
530 if (name == SVGNames::beginAttr) { 512 if (name == SVGNames::beginAttr) {
531 if (!m_conditions.isEmpty()) { 513 if (!m_conditions.isEmpty()) {
532 clearConditions(); 514 clearConditions();
533 parseBeginOrEnd(fastGetAttribute(SVGNames::endAttr), End); 515 parseBeginOrEnd(fastGetAttribute(SVGNames::endAttr), End);
534 } 516 }
535 parseBeginOrEnd(value.string(), Begin); 517 parseBeginOrEnd(value.string(), Begin);
536 if (inDocument()) 518 if (inDocument())
537 connectSyncBaseConditions(); 519 connectSyncBaseConditions();
(...skipping 11 matching lines...) Expand all
549 setAttributeEventListener(EventTypeNames::endEvent, createAttributeEvent Listener(this, name, value, eventParameterName())); 531 setAttributeEventListener(EventTypeNames::endEvent, createAttributeEvent Listener(this, name, value, eventParameterName()));
550 } else if (name == SVGNames::onrepeatAttr) { 532 } else if (name == SVGNames::onrepeatAttr) {
551 setAttributeEventListener(EventTypeNames::repeatEvent, createAttributeEv entListener(this, name, value, eventParameterName())); 533 setAttributeEventListener(EventTypeNames::repeatEvent, createAttributeEv entListener(this, name, value, eventParameterName()));
552 } else { 534 } else {
553 SVGElement::parseAttribute(name, value); 535 SVGElement::parseAttribute(name, value);
554 } 536 }
555 } 537 }
556 538
557 void SVGSMILElement::svgAttributeChanged(const QualifiedName& attrName) 539 void SVGSMILElement::svgAttributeChanged(const QualifiedName& attrName)
558 { 540 {
559 if (!isSupportedAttribute(attrName)) {
560 SVGElement::svgAttributeChanged(attrName);
561 return;
562 }
563
564 if (attrName == SVGNames::durAttr) 541 if (attrName == SVGNames::durAttr)
565 m_cachedDur = invalidCachedTime; 542 m_cachedDur = invalidCachedTime;
566 else if (attrName == SVGNames::repeatDurAttr) 543 else if (attrName == SVGNames::repeatDurAttr)
567 m_cachedRepeatDur = invalidCachedTime; 544 m_cachedRepeatDur = invalidCachedTime;
568 else if (attrName == SVGNames::repeatCountAttr) 545 else if (attrName == SVGNames::repeatCountAttr)
569 m_cachedRepeatCount = invalidCachedTime; 546 m_cachedRepeatCount = invalidCachedTime;
570 else if (attrName == SVGNames::minAttr) 547 else if (attrName == SVGNames::minAttr)
571 m_cachedMin = invalidCachedTime; 548 m_cachedMin = invalidCachedTime;
572 else if (attrName == SVGNames::maxAttr) 549 else if (attrName == SVGNames::maxAttr)
573 m_cachedMax = invalidCachedTime; 550 m_cachedMax = invalidCachedTime;
574 else if (attrName == SVGNames::attributeNameAttr) 551 else if (attrName == SVGNames::attributeNameAttr)
575 setAttributeName(constructQualifiedName(this, fastGetAttribute(SVGNames: :attributeNameAttr))); 552 setAttributeName(constructQualifiedName(this, fastGetAttribute(SVGNames: :attributeNameAttr)));
576 else if (attrName.matches(XLinkNames::hrefAttr)) { 553 else if (attrName.matches(XLinkNames::hrefAttr)) {
577 SVGElement::InvalidationGuard invalidationGuard(this); 554 SVGElement::InvalidationGuard invalidationGuard(this);
578 buildPendingResource(); 555 buildPendingResource();
579 if (m_targetElement) 556 if (m_targetElement)
580 clearAnimatedType(); 557 clearAnimatedType();
581 } else if (inDocument()) { 558 } else if (attrName == SVGNames::beginAttr || attrName == SVGNames::endAttr) {
582 if (attrName == SVGNames::beginAttr) 559 if (inDocument()) {
583 beginListChanged(elapsed()); 560 if (attrName == SVGNames::beginAttr)
584 else if (attrName == SVGNames::endAttr) 561 beginListChanged(elapsed());
585 endListChanged(elapsed()); 562 else if (attrName == SVGNames::endAttr)
563 endListChanged(elapsed());
564 }
565 } else {
566 SVGElement::svgAttributeChanged(attrName);
567 return;
586 } 568 }
587 569
588 animationAttributeChanged(); 570 animationAttributeChanged();
589 } 571 }
590 572
591 inline SVGElement* SVGSMILElement::eventBaseFor(const Condition& condition) 573 inline SVGElement* SVGSMILElement::eventBaseFor(const Condition& condition)
592 { 574 {
593 Element* eventBase = condition.baseID().isEmpty() ? targetElement() : treeSc ope().getElementById(AtomicString(condition.baseID())); 575 Element* eventBase = condition.baseID().isEmpty() ? targetElement() : treeSc ope().getElementById(AtomicString(condition.baseID()));
594 if (eventBase && eventBase->isSVGElement()) 576 if (eventBase && eventBase->isSVGElement())
595 return toSVGElement(eventBase); 577 return toSVGElement(eventBase);
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 visitor->trace(m_targetElement); 1353 visitor->trace(m_targetElement);
1372 visitor->trace(m_timeContainer); 1354 visitor->trace(m_timeContainer);
1373 visitor->trace(m_conditions); 1355 visitor->trace(m_conditions);
1374 visitor->trace(m_syncBaseDependents); 1356 visitor->trace(m_syncBaseDependents);
1375 #endif 1357 #endif
1376 SVGElement::trace(visitor); 1358 SVGElement::trace(visitor);
1377 SVGTests::trace(visitor); 1359 SVGTests::trace(visitor);
1378 } 1360 }
1379 1361
1380 } // namespace blink 1362 } // namespace blink
OLDNEW
« Source/core/svg/SVGSVGElement.cpp ('K') | « Source/core/svg/animation/SVGSMILElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698